@lumx/react 3.8.1 → 3.8.2-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 +63 -1
- package/index.js +1293 -542
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/image-lightbox/ImageLightbox.stories.tsx +165 -0
- package/src/components/image-lightbox/ImageLightbox.test.tsx +253 -0
- package/src/components/image-lightbox/ImageLightbox.tsx +85 -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 +107 -0
- package/src/components/image-lightbox/internal/ImageSlideshow.tsx +173 -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 +50 -0
- package/src/components/image-lightbox/useImageLightbox.tsx +130 -0
- 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/stories/generated/ImageLightbox/Demos.stories.tsx +6 -0
- package/src/utils/DOM/findImage.tsx +3 -0
- package/src/utils/DOM/startViewTransition.ts +56 -0
- package/src/utils/browser/getPrefersReducedMotion.ts +6 -0
- package/src/utils/object/isEqual.test.ts +25 -0
- package/src/utils/object/isEqual.ts +11 -0
- package/src/utils/react/unref.ts +7 -0
- package/src/utils/type.ts +15 -0
- package/src/utils/unref.ts +0 -0
package/index.d.ts
CHANGED
|
@@ -1383,6 +1383,68 @@ interface ImageBlockProps extends GenericProps, HasTheme, ImageCaptionMetadata {
|
|
|
1383
1383
|
*/
|
|
1384
1384
|
declare const ImageBlock: Comp<ImageBlockProps, HTMLDivElement>;
|
|
1385
1385
|
|
|
1386
|
+
type InheritedSlideShowProps = Pick<SlideshowProps, 'slideshowControlsProps' | 'slideGroupLabel'>;
|
|
1387
|
+
interface ZoomButtonProps {
|
|
1388
|
+
/** Zoom in button props */
|
|
1389
|
+
zoomInButtonProps?: IconButtonProps;
|
|
1390
|
+
/** Zoom out button props */
|
|
1391
|
+
zoomOutButtonProps?: IconButtonProps;
|
|
1392
|
+
}
|
|
1393
|
+
type InheritedThumbnailProps = Pick<ThumbnailProps, 'image' | 'alt' | 'imgProps' | 'imgRef' | 'loadingPlaceholderImageRef'>;
|
|
1394
|
+
type InheritedImageMetadata = Pick<ImageCaptionMetadata, 'title' | 'description' | 'tags'>;
|
|
1395
|
+
type ImageProps = InheritedThumbnailProps & InheritedImageMetadata;
|
|
1396
|
+
interface ImagesProps {
|
|
1397
|
+
/** Index of the active image to show on open */
|
|
1398
|
+
activeImageIndex?: number;
|
|
1399
|
+
/** List of images to display */
|
|
1400
|
+
images: Array<ImageProps>;
|
|
1401
|
+
/** Ref of the active image when the lightbox is open */
|
|
1402
|
+
activeImageRef?: React.Ref<HTMLImageElement>;
|
|
1403
|
+
}
|
|
1404
|
+
type InheritedLightboxProps = Pick<LightboxProps, 'isOpen' | 'parentElement' | 'onClose' | 'closeButtonProps' | 'aria-label' | 'aria-labelledby'>;
|
|
1405
|
+
type ForwardedProps = React.ComponentPropsWithoutRef<'div'>;
|
|
1406
|
+
/**
|
|
1407
|
+
* ImageLightbox component props
|
|
1408
|
+
*/
|
|
1409
|
+
interface ImageLightboxProps extends HasClassName, ZoomButtonProps, ImagesProps, InheritedSlideShowProps, InheritedLightboxProps, ForwardedProps {
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/** Subset of the ImageLightboxProps managed by the useImageLightbox hook */
|
|
1413
|
+
type ManagedProps = Pick<ImageLightboxProps, 'isOpen' | 'images' | 'parentElement' | 'activeImageRef' | 'onClose' | 'activeImageIndex'>;
|
|
1414
|
+
type TriggerOptions = Pick<ImageLightboxProps, 'activeImageIndex'>;
|
|
1415
|
+
/**
|
|
1416
|
+
* Set up an ImageLightbox with images and triggers.
|
|
1417
|
+
*
|
|
1418
|
+
* - Associate a trigger with the lightbox to properly focus the trigger on close
|
|
1419
|
+
* - Associate a trigger with an image to display on open
|
|
1420
|
+
* - Automatically provide a view transition between an image trigger and the displayed image on open & close
|
|
1421
|
+
*
|
|
1422
|
+
* @param initialProps Images to display in the image lightbox
|
|
1423
|
+
*/
|
|
1424
|
+
declare function useImageLightbox<P extends Partial<ImageLightboxProps>>(initialProps: P): {
|
|
1425
|
+
/**
|
|
1426
|
+
* Generates trigger props
|
|
1427
|
+
* @param index Provide an index to choose which image to display when the image lightbox opens.
|
|
1428
|
+
* */
|
|
1429
|
+
getTriggerProps: (options?: TriggerOptions) => {
|
|
1430
|
+
onClick: React.MouseEventHandler;
|
|
1431
|
+
ref: React.Ref<any>;
|
|
1432
|
+
};
|
|
1433
|
+
/** Props to forward to the ImageLightbox */
|
|
1434
|
+
imageLightboxProps: ManagedProps & P;
|
|
1435
|
+
};
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* ImageLightbox component.
|
|
1439
|
+
*
|
|
1440
|
+
* @param props Component props.
|
|
1441
|
+
* @param ref Component ref.
|
|
1442
|
+
* @return React element.
|
|
1443
|
+
*/
|
|
1444
|
+
declare const ImageLightbox: Comp<ImageLightboxProps, HTMLDivElement> & {
|
|
1445
|
+
useImageLightbox: typeof useImageLightbox;
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1386
1448
|
/**
|
|
1387
1449
|
* Defines the props of the component.
|
|
1388
1450
|
*/
|
|
@@ -2922,4 +2984,4 @@ interface UserBlockProps extends GenericProps, HasTheme {
|
|
|
2922
2984
|
*/
|
|
2923
2985
|
declare const UserBlock: Comp<UserBlockProps, HTMLDivElement>;
|
|
2924
2986
|
|
|
2925
|
-
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 };
|
|
2987
|
+
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 };
|