@lumx/react 4.1.1-alpha.4 → 4.1.1-alpha.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Kind as Kind$1, HorizontalAlignment, Size as Size$1, ColorPalette as ColorPalette$1, VerticalAlignment, Alignment, Orientation, AspectRatio, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1, Emphasis as Emphasis$1, GlobalSize, TypographyInterface as TypographyInterface$1, Theme as Theme$1 } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  import * as _lumx_core_js_types from '@lumx/core/js/types';
4
- import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf, HasAriaDisabled as HasAriaDisabled$1, HasCloseMode, HeadingElement as HeadingElement$1, Falsy, HasClassName as HasClassName$1, HasRequiredLinkHref, HasAriaLabelOrLabelledBy, ObjectValues as ObjectValues$1 } from '@lumx/core/js/types';
4
+ import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf, HasAriaDisabled as HasAriaDisabled$1, HasCloseMode, HeadingElement as HeadingElement$1, Falsy, HasClassName as HasClassName$1, HasRequiredLinkHref, HasAriaLabelOrLabelledBy } from '@lumx/core/js/types';
5
5
  export * from '@lumx/core/js/types';
6
6
  import * as React$1 from 'react';
7
7
  import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, AriaAttributes, InputHTMLAttributes, RefObject, ImgHTMLAttributes, CSSProperties, SetStateAction, Key, ElementType, ComponentProps } from 'react';
@@ -499,12 +499,6 @@ type KebabCase<S> = S extends `${infer C}${infer T}` ? T extends Uncapitalize<T>
499
499
  /** Transform the component name into the lumx class name. */
500
500
  type LumxClassName<TComponentName extends string> = `lumx-${KebabCase<TComponentName>}`;
501
501
 
502
- /**
503
- * Returns a union type of the given generic values.
504
- *
505
- */
506
- type ObjectValues<T> = T[keyof T];
507
-
508
502
  type Booleanish = boolean | 'true' | 'false';
509
503
 
510
504
  interface HasAriaDisabled {
@@ -1513,7 +1507,7 @@ declare const GridColumn: Comp<GridColumnProps, HTMLElement>;
1513
1507
 
1514
1508
  declare const ICON_SIZES: ("xxs" | "xs" | "s" | "m" | "l" | "xl" | "xxl")[];
1515
1509
 
1516
- type IconSizes = ObjectValues<typeof ICON_SIZES>;
1510
+ type IconSizes = (typeof ICON_SIZES)[number];
1517
1511
  /**
1518
1512
  * Defines the props of the component.
1519
1513
  */
@@ -2702,7 +2696,7 @@ declare const SlideMode: {
2702
2696
  /** Move slides native scroll snap (available only on supported browsers) */
2703
2697
  readonly scrollSnap: "scroll-snap";
2704
2698
  };
2705
- type SlideMode = ObjectValues$1<typeof SlideMode>;
2699
+ type SlideMode = ValueOf<typeof SlideMode>;
2706
2700
 
2707
2701
  /**
2708
2702
  * Defines the props of the component.
@@ -2856,7 +2850,7 @@ declare const SlideshowControls: Comp<SlideshowControlsProps, HTMLDivElement> &
2856
2850
  };
2857
2851
  };
2858
2852
 
2859
- interface SlidesCommonProps extends GenericProps$1, HasTheme$1 {
2853
+ interface SlidesProps extends GenericProps$1, HasTheme$1 {
2860
2854
  /** current slide active */
2861
2855
  activeIndex: number;
2862
2856
  /** slides id to be added to the wrapper */
@@ -2882,17 +2876,13 @@ interface SlidesCommonProps extends GenericProps$1, HasTheme$1 {
2882
2876
  * Receives the group position starting from 1 and the total number of groups.
2883
2877
  * */
2884
2878
  slideGroupLabel?: (groupPosition: number, groupTotal: number) => string;
2879
+ /** Whether to use CSS transform translate or native scroll snap. */
2880
+ slideMode?: SlideMode;
2881
+ /** On slide change (only triggered on scroll when slideMode=scroll-snap) */
2882
+ onChange?(index: number): void;
2885
2883
  /** Children */
2886
2884
  children?: React__default.ReactNode;
2887
2885
  }
2888
- interface SlidesTransformProps extends SlidesCommonProps {
2889
- slideMode?: Extract<SlideMode, 'transform-translate'>;
2890
- }
2891
- interface SlidesScrollSnapProps extends SlidesCommonProps {
2892
- slideMode: Extract<SlideMode, 'scroll-snap'>;
2893
- onChange: (index: number) => void;
2894
- }
2895
- type SlidesProps = SlidesTransformProps | SlidesScrollSnapProps;
2896
2886
  /**
2897
2887
  * Slides component.
2898
2888
  *
@@ -3409,4 +3399,4 @@ declare const ThemeProvider: React__default.FC<{
3409
3399
  declare function useTheme(): ThemeContextValue;
3410
3400
 
3411
3401
  export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME, COMPONENT_NAME, Checkbox, Chip, ChipGroup, CommentBlock, CommentBlockVariant, DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSubheader, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, Select, SelectMultiple, SelectMultipleField, SelectVariant, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, isClickable, useFocusPointStyle, useHeadingLevel, useTheme };
3412
- export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectMultipleProps, SelectProps, SideNavigationItemProps, SideNavigationProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesCommonProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
3402
+ export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectMultipleProps, SelectProps, SideNavigationItemProps, SideNavigationProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
package/index.js CHANGED
@@ -11496,20 +11496,11 @@ const Slideshow = forwardRef((props, ref) => {
11496
11496
  });
11497
11497
  const showControls = slideshowControlsProps && slidesCount > 1;
11498
11498
 
11499
- // Slide mode props switch
11500
- let slideModeProps;
11501
- if (slideMode === SlideMode.scrollSnap && isScrollSnapSupported()) {
11502
- slideModeProps = {
11503
- slideMode,
11504
- onChange: onPaginationClick
11505
- };
11506
- } else {
11507
- slideModeProps = {
11508
- slideMode: SlideMode.transformTranslate
11509
- };
11510
- }
11499
+ // Only enable scroll-snap if requested and browser supports it
11500
+ const isScrollsnapEnabled = slideMode === SlideMode.scrollSnap && isScrollSnapSupported();
11511
11501
  return /*#__PURE__*/jsx(Slides, {
11512
- ...slideModeProps,
11502
+ slideMode: slideMode,
11503
+ onChange: isScrollsnapEnabled ? onPaginationClick : undefined,
11513
11504
  activeIndex: currentIndex,
11514
11505
  id: slideshowId,
11515
11506
  className: className,