@lumx/react 3.7.6-test.1 → 3.8.1-alpha.0

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.
Files changed (34) hide show
  1. package/index.d.ts +69 -5
  2. package/index.js +1322 -549
  3. package/index.js.map +1 -1
  4. package/package.json +3 -4
  5. package/src/components/checkbox/Checkbox.stories.tsx +9 -0
  6. package/src/components/checkbox/Checkbox.test.tsx +12 -0
  7. package/src/components/checkbox/Checkbox.tsx +25 -9
  8. package/src/components/image-lightbox/ImageLightbox.stories.tsx +165 -0
  9. package/src/components/image-lightbox/ImageLightbox.test.tsx +253 -0
  10. package/src/components/image-lightbox/ImageLightbox.tsx +72 -0
  11. package/src/components/image-lightbox/constants.ts +11 -0
  12. package/src/components/image-lightbox/index.ts +2 -0
  13. package/src/components/image-lightbox/internal/ImageSlide.tsx +107 -0
  14. package/src/components/image-lightbox/internal/ImageSlideshow.tsx +173 -0
  15. package/src/components/image-lightbox/internal/useAnimateScroll.ts +55 -0
  16. package/src/components/image-lightbox/internal/usePointerZoom.ts +148 -0
  17. package/src/components/image-lightbox/types.ts +50 -0
  18. package/src/components/image-lightbox/useImageLightbox.tsx +130 -0
  19. package/src/components/thumbnail/Thumbnail.stories.tsx +35 -0
  20. package/src/components/thumbnail/Thumbnail.tsx +21 -2
  21. package/src/components/thumbnail/useFocusPointStyle.tsx +3 -4
  22. package/src/hooks/useElementSizeDependentOfWindowSize.ts +32 -0
  23. package/src/hooks/useImageSize.ts +17 -0
  24. package/src/index.ts +1 -0
  25. package/src/stories/generated/ImageLightbox/Demos.stories.tsx +6 -0
  26. package/src/utils/DOM/findImage.tsx +3 -0
  27. package/src/utils/DOM/startViewTransition.ts +56 -0
  28. package/src/utils/browser/getPrefersReducedMotion.ts +6 -0
  29. package/src/utils/object/isEqual.test.ts +25 -0
  30. package/src/utils/object/isEqual.ts +11 -0
  31. package/src/utils/react/unref.ts +7 -0
  32. package/src/utils/type.ts +15 -0
  33. package/src/utils/unref.ts +0 -0
  34. package/src/hooks/useOnResize.ts +0 -41
package/index.d.ts CHANGED
@@ -394,8 +394,8 @@ interface CheckboxProps extends GenericProps, HasTheme {
394
394
  id?: string;
395
395
  /** Native input ref. */
396
396
  inputRef?: React.Ref<HTMLInputElement>;
397
- /** Whether it is checked or not. */
398
- isChecked?: boolean;
397
+ /** Whether it is checked or not or intermediate. */
398
+ isChecked?: boolean | 'intermediate';
399
399
  /** Whether the component is disabled or not. */
400
400
  isDisabled?: boolean;
401
401
  /** Label text. */
@@ -404,10 +404,10 @@ interface CheckboxProps extends GenericProps, HasTheme {
404
404
  name?: string;
405
405
  /** Native input value property. */
406
406
  value?: string;
407
- /** On change callback. */
408
- onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;
409
407
  /** optional props for input */
410
408
  inputProps?: InputHTMLAttributes<HTMLInputElement>;
409
+ /** On change callback. */
410
+ onChange?(isChecked: boolean, value?: string, name?: string, event?: SyntheticEvent): void;
411
411
  }
412
412
  /**
413
413
  * Checkbox component.
@@ -1301,6 +1301,8 @@ interface ThumbnailProps extends GenericProps, HasTheme {
1301
1301
  size?: ThumbnailSize;
1302
1302
  /** Image loading mode. */
1303
1303
  loading?: ImgHTMLProps['loading'];
1304
+ /** Ref of an existing placeholder image to display while loading. */
1305
+ loadingPlaceholderImageRef?: React.RefObject<HTMLImageElement>;
1304
1306
  /** On click callback. */
1305
1307
  onClick?: MouseEventHandler<HTMLDivElement>;
1306
1308
  /** On key press callback. */
@@ -1376,6 +1378,68 @@ interface ImageBlockProps extends GenericProps, HasTheme, ImageCaptionMetadata {
1376
1378
  */
1377
1379
  declare const ImageBlock: Comp<ImageBlockProps, HTMLDivElement>;
1378
1380
 
1381
+ type InheritedSlideShowProps = Pick<SlideshowProps, 'slideshowControlsProps' | 'slideGroupLabel'>;
1382
+ interface ZoomButtonProps {
1383
+ /** Zoom in button props */
1384
+ zoomInButtonProps?: IconButtonProps;
1385
+ /** Zoom out button props */
1386
+ zoomOutButtonProps?: IconButtonProps;
1387
+ }
1388
+ type InheritedThumbnailProps = Pick<ThumbnailProps, 'image' | 'alt' | 'imgProps' | 'imgRef' | 'loadingPlaceholderImageRef'>;
1389
+ type InheritedImageMetadata = Pick<ImageCaptionMetadata, 'title' | 'description' | 'tags'>;
1390
+ type ImageProps = InheritedThumbnailProps & InheritedImageMetadata;
1391
+ interface ImagesProps {
1392
+ /** Index of the active image to show on open */
1393
+ activeImageIndex?: number;
1394
+ /** List of images to display */
1395
+ images: Array<ImageProps>;
1396
+ /** Ref of the active image when the lightbox is open */
1397
+ activeImageRef?: React.Ref<HTMLImageElement>;
1398
+ }
1399
+ type InheritedLightboxProps = Pick<LightboxProps, 'isOpen' | 'parentElement' | 'onClose' | 'closeButtonProps' | 'aria-label' | 'aria-labelledby'>;
1400
+ type ForwardedProps = React.ComponentPropsWithoutRef<'div'>;
1401
+ /**
1402
+ * ImageLightbox component props
1403
+ */
1404
+ interface ImageLightboxProps extends HasClassName, ZoomButtonProps, ImagesProps, InheritedSlideShowProps, InheritedLightboxProps, ForwardedProps {
1405
+ }
1406
+
1407
+ /** Subset of the ImageLightboxProps managed by the useImageLightbox hook */
1408
+ type ManagedProps = Pick<ImageLightboxProps, 'isOpen' | 'images' | 'parentElement' | 'activeImageRef' | 'onClose' | 'activeImageIndex'>;
1409
+ type TriggerOptions = Pick<ImageLightboxProps, 'activeImageIndex'>;
1410
+ /**
1411
+ * Set up an ImageLightbox with images and triggers.
1412
+ *
1413
+ * - Associate a trigger with the lightbox to properly focus the trigger on close
1414
+ * - Associate a trigger with an image to display on open
1415
+ * - Automatically provide a view transition between an image trigger and the displayed image on open & close
1416
+ *
1417
+ * @param initialProps Images to display in the image lightbox
1418
+ */
1419
+ declare function useImageLightbox<P extends Partial<ImageLightboxProps>>(initialProps: P): {
1420
+ /**
1421
+ * Generates trigger props
1422
+ * @param index Provide an index to choose which image to display when the image lightbox opens.
1423
+ * */
1424
+ getTriggerProps: (options?: TriggerOptions) => {
1425
+ onClick: React.MouseEventHandler;
1426
+ ref: React.Ref<any>;
1427
+ };
1428
+ /** Props to forward to the ImageLightbox */
1429
+ imageLightboxProps: ManagedProps & P;
1430
+ };
1431
+
1432
+ /**
1433
+ * ImageLightbox component.
1434
+ *
1435
+ * @param props Component props.
1436
+ * @param ref Component ref.
1437
+ * @return React element.
1438
+ */
1439
+ declare const ImageLightbox: Comp<ImageLightboxProps, HTMLDivElement> & {
1440
+ useImageLightbox: typeof useImageLightbox;
1441
+ };
1442
+
1379
1443
  /**
1380
1444
  * Defines the props of the component.
1381
1445
  */
@@ -2915,4 +2979,4 @@ interface UserBlockProps extends GenericProps, HasTheme {
2915
2979
  */
2916
2980
  declare const UserBlock: Comp<UserBlockProps, HTMLDivElement>;
2917
2981
 
2918
- 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 };
2982
+ 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 };