@lumx/react 3.7.5 → 3.7.6-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +76 -12
- package/index.js +1466 -718
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/image-block/ImageBlock.tsx +13 -42
- package/src/components/image-block/ImageCaption.tsx +73 -0
- package/src/components/image-block/constants.ts +11 -0
- package/src/components/image-lightbox/ImageLightbox.stories.tsx +163 -0
- package/src/components/image-lightbox/ImageLightbox.test.tsx +252 -0
- package/src/components/image-lightbox/ImageLightbox.tsx +72 -0
- package/src/components/image-lightbox/constants.ts +11 -0
- package/src/components/image-lightbox/index.ts +2 -0
- package/src/components/image-lightbox/internal/ImageSlide.tsx +99 -0
- package/src/components/image-lightbox/internal/ImageSlideshow.tsx +158 -0
- package/src/components/image-lightbox/internal/useAnimateScroll.ts +55 -0
- package/src/components/image-lightbox/internal/usePointerZoom.ts +148 -0
- package/src/components/image-lightbox/types.ts +49 -0
- package/src/components/image-lightbox/useImageLightbox.tsx +122 -0
- package/src/components/lightbox/Lightbox.tsx +13 -12
- package/src/components/thumbnail/useFocusPointStyle.tsx +3 -4
- package/src/hooks/useElementSizeDependentOfWindowSize.ts +32 -0
- package/src/hooks/useImageSize.ts +17 -0
- package/src/index.ts +1 -0
- package/src/utils/findImage.tsx +3 -0
- package/src/utils/getPrefersReducedMotion.ts +6 -0
- package/src/utils/startViewTransition.ts +54 -0
- package/src/utils/type.ts +15 -0
- package/src/utils/unref.ts +6 -0
- package/src/hooks/useOnResize.ts +0 -41
package/index.d.ts
CHANGED
|
@@ -1321,6 +1321,19 @@ interface ThumbnailProps extends GenericProps, HasTheme {
|
|
|
1321
1321
|
*/
|
|
1322
1322
|
declare const Thumbnail: Comp<ThumbnailProps>;
|
|
1323
1323
|
|
|
1324
|
+
type ImageCaptionMetadata = {
|
|
1325
|
+
/** Image title to display in the caption. */
|
|
1326
|
+
title?: string;
|
|
1327
|
+
/** Image description. Can be either a string, or sanitized html. */
|
|
1328
|
+
description?: string | {
|
|
1329
|
+
__html: string;
|
|
1330
|
+
};
|
|
1331
|
+
/** Tag content. */
|
|
1332
|
+
tags?: ReactNode;
|
|
1333
|
+
/** Caption custom CSS style. */
|
|
1334
|
+
captionStyle?: CSSProperties;
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1324
1337
|
/**
|
|
1325
1338
|
* Image block variants.
|
|
1326
1339
|
*/
|
|
@@ -1336,7 +1349,7 @@ type ImageBlockSize = Extract<Size, 'xl' | 'xxl'>;
|
|
|
1336
1349
|
/**
|
|
1337
1350
|
* Defines the props of the component.
|
|
1338
1351
|
*/
|
|
1339
|
-
interface ImageBlockProps extends GenericProps, HasTheme {
|
|
1352
|
+
interface ImageBlockProps extends GenericProps, HasTheme, ImageCaptionMetadata {
|
|
1340
1353
|
/** Action toolbar content. */
|
|
1341
1354
|
actions?: ReactNode;
|
|
1342
1355
|
/** Alignment. */
|
|
@@ -1345,24 +1358,14 @@ interface ImageBlockProps extends GenericProps, HasTheme {
|
|
|
1345
1358
|
alt: string;
|
|
1346
1359
|
/** Caption position. */
|
|
1347
1360
|
captionPosition?: ImageBlockCaptionPosition;
|
|
1348
|
-
/** Caption custom CSS style. */
|
|
1349
|
-
captionStyle?: CSSProperties;
|
|
1350
|
-
/** Image description. Can be either a string, or sanitized html. */
|
|
1351
|
-
description?: string | {
|
|
1352
|
-
__html: string;
|
|
1353
|
-
};
|
|
1354
1361
|
/** Whether the image has to fill its container height or not. */
|
|
1355
1362
|
fillHeight?: boolean;
|
|
1356
1363
|
/** Image URL. */
|
|
1357
1364
|
image: string;
|
|
1358
1365
|
/** Size variant. */
|
|
1359
1366
|
size?: ImageBlockSize;
|
|
1360
|
-
/** Tag content. */
|
|
1361
|
-
tags?: ReactNode;
|
|
1362
1367
|
/** Props to pass to the thumbnail (minus those already set by the ImageBlock props). */
|
|
1363
1368
|
thumbnailProps?: Omit<ThumbnailProps, 'image' | 'size' | 'theme' | 'align' | 'fillHeight'>;
|
|
1364
|
-
/** Image title to display in the caption. */
|
|
1365
|
-
title?: string;
|
|
1366
1369
|
}
|
|
1367
1370
|
/**
|
|
1368
1371
|
* ImageBlock component.
|
|
@@ -1373,6 +1376,67 @@ interface ImageBlockProps extends GenericProps, HasTheme {
|
|
|
1373
1376
|
*/
|
|
1374
1377
|
declare const ImageBlock: Comp<ImageBlockProps, HTMLDivElement>;
|
|
1375
1378
|
|
|
1379
|
+
type InheritedSlideShowProps = Pick<SlideshowProps, 'activeIndex' | 'slideshowControlsProps' | 'slideGroupLabel'>;
|
|
1380
|
+
interface ZoomProps {
|
|
1381
|
+
/** */
|
|
1382
|
+
zoomInButtonProps?: IconButtonProps;
|
|
1383
|
+
zoomOutButtonProps?: IconButtonProps;
|
|
1384
|
+
}
|
|
1385
|
+
type InheritedThumbnailProps = Pick<ThumbnailProps, 'image' | 'alt' | 'imgProps' | 'imgRef'>;
|
|
1386
|
+
type InheritedImageMetadata = Pick<ImageCaptionMetadata, 'title' | 'description' | 'tags'>;
|
|
1387
|
+
type ImageProps = InheritedThumbnailProps & InheritedImageMetadata;
|
|
1388
|
+
interface ImagesProps {
|
|
1389
|
+
/** Index of the active thumbnail to show on open */
|
|
1390
|
+
activeImageIndex?: number;
|
|
1391
|
+
/** List of images to display */
|
|
1392
|
+
images: Array<ImageProps>;
|
|
1393
|
+
/** Ref of the active image when the lightbox is open */
|
|
1394
|
+
activeImageRef?: React.Ref<HTMLImageElement>;
|
|
1395
|
+
}
|
|
1396
|
+
type InheritedLightboxProps = Pick<LightboxProps, 'isOpen' | 'parentElement' | 'onClose' | 'closeButtonProps'>;
|
|
1397
|
+
type InheritedAriaAttributes = Pick<React.AriaAttributes, 'aria-label' | 'aria-labelledby'>;
|
|
1398
|
+
type ForwardedProps = React.ComponentPropsWithoutRef<'div'>;
|
|
1399
|
+
/**
|
|
1400
|
+
* ImageLightbox component props
|
|
1401
|
+
*/
|
|
1402
|
+
interface ImageLightboxProps extends HasClassName, ZoomProps, ImagesProps, InheritedSlideShowProps, InheritedLightboxProps, InheritedAriaAttributes, ForwardedProps {
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/** Subset of the ImageLightboxProps managed by the useImageLightbox hook */
|
|
1406
|
+
type ManagedProps = Pick<ImageLightboxProps, 'isOpen' | 'images' | 'parentElement' | 'activeImageRef' | 'onClose' | 'activeImageIndex'>;
|
|
1407
|
+
/**
|
|
1408
|
+
* Set up an ImageLightbox with images and triggers.
|
|
1409
|
+
*
|
|
1410
|
+
* - Associate a trigger with the lightbox to properly focus the trigger on close
|
|
1411
|
+
* - Associate a trigger with an image to display on open
|
|
1412
|
+
* - Automatically provide a view transition between an image trigger and the displayed image on open & close
|
|
1413
|
+
*
|
|
1414
|
+
* @param images Images to display in the image lightbox
|
|
1415
|
+
*/
|
|
1416
|
+
declare function useImageLightbox(images?: ImageLightboxProps['images']): {
|
|
1417
|
+
/**
|
|
1418
|
+
* Generates trigger props
|
|
1419
|
+
* @param index Provide an index to choose which image to display when the image lightbox opens.
|
|
1420
|
+
* */
|
|
1421
|
+
getTriggerProps: (index?: number) => {
|
|
1422
|
+
onClick: React.MouseEventHandler;
|
|
1423
|
+
ref: React.Ref<any>;
|
|
1424
|
+
};
|
|
1425
|
+
/** Props to forward to the ImageLightbox */
|
|
1426
|
+
imageLightboxProps: ManagedProps;
|
|
1427
|
+
};
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* ImageLightbox component.
|
|
1431
|
+
*
|
|
1432
|
+
* @param props Component props.
|
|
1433
|
+
* @param ref Component ref.
|
|
1434
|
+
* @return React element.
|
|
1435
|
+
*/
|
|
1436
|
+
declare const ImageLightbox: Comp<ImageLightboxProps, HTMLDivElement> & {
|
|
1437
|
+
useImageLightbox: typeof useImageLightbox;
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1376
1440
|
/**
|
|
1377
1441
|
* Defines the props of the component.
|
|
1378
1442
|
*/
|
|
@@ -2912,4 +2976,4 @@ interface UserBlockProps extends GenericProps, HasTheme {
|
|
|
2912
2976
|
*/
|
|
2913
2977
|
declare const UserBlock: Comp<UserBlockProps, HTMLDivElement>;
|
|
2914
2978
|
|
|
2915
|
-
export { AlertDialog, AlertDialogProps, Autocomplete, AutocompleteMultiple, AutocompleteMultipleProps, AutocompleteProps, Avatar, AvatarProps, AvatarSize, Badge, BadgeProps, BaseButtonProps, Button, ButtonEmphasis, ButtonGroup, ButtonGroupProps, ButtonProps, ButtonSize, Checkbox, CheckboxProps, Chip, ChipGroup, ChipGroupProps, ChipProps, CommentBlock, CommentBlockProps, CommentBlockVariant, DatePicker, DatePickerControlled, DatePickerControlledProps, DatePickerField, DatePickerFieldProps, DatePickerProps, Dialog, DialogProps, DialogSizes, Divider, DividerProps, DragHandle, DragHandleProps, Dropdown, DropdownProps, Elevation, ExpansionPanel, ExpansionPanelProps, Flag, FlagProps, FlexBox, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, GapSize, GenericBlock, GenericBlockGapSize, GenericBlockProps, Grid, GridColumn, GridColumnGapSize, GridColumnProps, GridItem, GridItemProps, GridProps, Heading, HeadingLevelProvider, HeadingLevelProviderProps, HeadingProps, Icon, IconButton, IconButtonProps, IconProps, IconSizes, ImageBlock, ImageBlockCaptionPosition, ImageBlockProps, ImageBlockSize, InlineList, InlineListProps, InputHelper, InputHelperProps, InputLabel, InputLabelProps, Lightbox, LightboxProps, Link, LinkPreview, LinkPreviewProps, LinkProps, List, ListDivider, ListDividerProps, ListItem, ListItemProps, ListItemSize, ListProps, ListSubheader, ListSubheaderProps, MarginAutoAlignment, Message, MessageProps, Mosaic, MosaicProps, Navigation, NavigationProps, Notification, NotificationProps, Offset, Placement, Popover, PopoverDialog, PopoverDialogProps, PopoverProps, PostBlock, PostBlockProps, Progress, ProgressCircular, ProgressCircularProps, ProgressCircularSize, ProgressLinear, ProgressLinearProps, ProgressProps, ProgressTracker, ProgressTrackerProps, ProgressTrackerProvider, ProgressTrackerProviderProps, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, ProgressVariant, RadioButton, RadioButtonProps, RadioGroup, RadioGroupProps, Select, SelectMultiple, SelectMultipleField, SelectMultipleProps, SelectProps, SelectVariant, SideNavigation, SideNavigationItem, SideNavigationItemProps, SideNavigationProps, SkeletonCircle, SkeletonCircleProps, SkeletonRectangle, SkeletonRectangleProps, SkeletonRectangleVariant, SkeletonTypography, SkeletonTypographyProps, Slider, SliderProps, Slides, SlidesProps, Slideshow, SlideshowControls, SlideshowControlsProps, SlideshowItem, SlideshowItemProps, SlideshowProps, Switch, SwitchProps, Tab, TabList, TabListLayout, TabListProps, TabPanel, TabPanelProps, TabProps, TabProvider, TabProviderProps, Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableCellVariant, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, Text, TextField, TextFieldProps, TextProps, ThOrder, Thumbnail, ThumbnailProps, Toolbar, ToolbarProps, Tooltip, TooltipPlacement, TooltipProps, Uploader, UploaderProps, UploaderSize, UploaderVariant, UserBlock, UserBlockProps, UserBlockSize, clamp, isClickable, useFocusPointStyle, useHeadingLevel };
|
|
2979
|
+
export { AlertDialog, AlertDialogProps, Autocomplete, AutocompleteMultiple, AutocompleteMultipleProps, AutocompleteProps, Avatar, AvatarProps, AvatarSize, Badge, BadgeProps, BaseButtonProps, Button, ButtonEmphasis, ButtonGroup, ButtonGroupProps, ButtonProps, ButtonSize, Checkbox, CheckboxProps, Chip, ChipGroup, ChipGroupProps, ChipProps, CommentBlock, CommentBlockProps, CommentBlockVariant, DatePicker, DatePickerControlled, DatePickerControlledProps, DatePickerField, DatePickerFieldProps, DatePickerProps, Dialog, DialogProps, DialogSizes, Divider, DividerProps, DragHandle, DragHandleProps, Dropdown, DropdownProps, Elevation, ExpansionPanel, ExpansionPanelProps, Flag, FlagProps, FlexBox, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, GapSize, GenericBlock, GenericBlockGapSize, GenericBlockProps, Grid, GridColumn, GridColumnGapSize, GridColumnProps, GridItem, GridItemProps, GridProps, Heading, HeadingLevelProvider, HeadingLevelProviderProps, HeadingProps, Icon, IconButton, IconButtonProps, IconProps, IconSizes, ImageBlock, ImageBlockCaptionPosition, ImageBlockProps, ImageBlockSize, ImageLightbox, ImageLightboxProps, InlineList, InlineListProps, InputHelper, InputHelperProps, InputLabel, InputLabelProps, Lightbox, LightboxProps, Link, LinkPreview, LinkPreviewProps, LinkProps, List, ListDivider, ListDividerProps, ListItem, ListItemProps, ListItemSize, ListProps, ListSubheader, ListSubheaderProps, MarginAutoAlignment, Message, MessageProps, Mosaic, MosaicProps, Navigation, NavigationProps, Notification, NotificationProps, Offset, Placement, Popover, PopoverDialog, PopoverDialogProps, PopoverProps, PostBlock, PostBlockProps, Progress, ProgressCircular, ProgressCircularProps, ProgressCircularSize, ProgressLinear, ProgressLinearProps, ProgressProps, ProgressTracker, ProgressTrackerProps, ProgressTrackerProvider, ProgressTrackerProviderProps, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, ProgressVariant, RadioButton, RadioButtonProps, RadioGroup, RadioGroupProps, Select, SelectMultiple, SelectMultipleField, SelectMultipleProps, SelectProps, SelectVariant, SideNavigation, SideNavigationItem, SideNavigationItemProps, SideNavigationProps, SkeletonCircle, SkeletonCircleProps, SkeletonRectangle, SkeletonRectangleProps, SkeletonRectangleVariant, SkeletonTypography, SkeletonTypographyProps, Slider, SliderProps, Slides, SlidesProps, Slideshow, SlideshowControls, SlideshowControlsProps, SlideshowItem, SlideshowItemProps, SlideshowProps, Switch, SwitchProps, Tab, TabList, TabListLayout, TabListProps, TabPanel, TabPanelProps, TabProps, TabProvider, TabProviderProps, Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableCellVariant, TableHeader, TableHeaderProps, TableProps, TableRow, TableRowProps, Text, TextField, TextFieldProps, TextProps, ThOrder, Thumbnail, ThumbnailProps, Toolbar, ToolbarProps, Tooltip, TooltipPlacement, TooltipProps, Uploader, UploaderProps, UploaderSize, UploaderVariant, UserBlock, UserBlockProps, UserBlockSize, clamp, isClickable, useFocusPointStyle, useHeadingLevel };
|