@lumx/react 4.22.1-alpha.0 → 4.22.1-next.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 CHANGED
@@ -3362,6 +3362,7 @@ declare function useImageLightbox<P extends Partial<ImageLightboxProps>>(props:
3362
3362
  getTriggerProps: (options?: TriggerOptions) => {
3363
3363
  onClick: (ev?: React__default.MouseEvent) => void;
3364
3364
  ref: React__default.Ref<any>;
3365
+ 'aria-haspopup': 'dialog';
3365
3366
  };
3366
3367
  /** Props to forward to the ImageLightbox */
3367
3368
  imageLightboxProps: ManagedProps & P;
@@ -4909,7 +4910,7 @@ type SlideMode = ValueOf$1<typeof SlideMode>;
4909
4910
  /**
4910
4911
  * Defines the props of the component.
4911
4912
  */
4912
- interface SlideshowProps extends GenericProps$1, Pick<SlidesProps, 'autoPlay' | 'slidesId' | 'id' | 'theme' | 'fillHeight' | 'groupBy' | 'slideGroupLabel'> {
4913
+ interface SlideshowProps extends GenericProps$1, Pick<SlidesProps, 'autoPlay' | 'slidesId' | 'id' | 'theme' | 'fillHeight' | 'groupBy' | 'slideGroupLabel' | 'slideGroupRoleDescription'> {
4913
4914
  /** Whether to use CSS transform translate or native scroll snap. */
4914
4915
  slideMode?: SlideMode;
4915
4916
  /** current slide active */
@@ -5084,6 +5085,11 @@ interface SlidesProps extends GenericProps$1, HasTheme$1 {
5084
5085
  * Receives the group position starting from 1 and the total number of groups.
5085
5086
  * */
5086
5087
  slideGroupLabel?: (groupPosition: number, groupTotal: number) => string;
5088
+ /**
5089
+ * Accessible role description to set on every slide group (`aria-roledescription`).
5090
+ * Applies identically to every group.
5091
+ * */
5092
+ slideGroupRoleDescription?: string;
5087
5093
  /** Whether to use CSS transform translate or native scroll snap. */
5088
5094
  slideMode?: SlideMode;
5089
5095
  /** On slide change (only triggered on scroll when slideMode=scroll-snap) */
package/index.js CHANGED
@@ -2760,37 +2760,20 @@ const useOverflowTooltipLabel = content => {
2760
2760
  */
2761
2761
  const isComponentType = type => node => /*#__PURE__*/React__default.isValidElement(node) && node.type === type;
2762
2762
 
2763
- /**
2764
- * Recursively wrap icons with spaces.
2765
- *
2766
- * `isFirst`/`isLast` tell whether the given children are at the very start/end of the whole
2767
- * children tree, so that an icon on an edge is detected even when nested in a fragment or element.
2768
- */
2769
- function wrap(children, isFirst, isLast) {
2763
+ /** Force wrap spaces around icons to make sure they are never stuck against text. */
2764
+ function wrapChildrenIconWithSpaces(children) {
2770
2765
  if (children === null || children === undefined) return undefined;
2771
- const childArray = Children.toArray(children);
2772
- return childArray.flatMap((child, index) => {
2773
- const childIsFirst = isFirst && index === 0;
2774
- const childIsLast = isLast && index === childArray.length - 1;
2766
+ return Children.toArray(children).flatMap(child => {
2775
2767
  if (isComponentType(Icon)(child)) {
2776
- // No space on the edges of the text: the icon is not stuck against anything there.
2777
- return [...(childIsFirst ? [] : [' ']), child, ...(childIsLast ? [] : [' '])];
2768
+ return [' ', child, ' '];
2778
2769
  }
2779
2770
  if (/*#__PURE__*/React__default.isValidElement(child) && child.props && typeof child.props === 'object' && 'children' in child.props) {
2780
- return /*#__PURE__*/React__default.cloneElement(child, undefined, wrap(child.props.children, childIsFirst, childIsLast));
2771
+ return /*#__PURE__*/React__default.cloneElement(child, undefined, wrapChildrenIconWithSpaces(child.props.children));
2781
2772
  }
2782
2773
  return child;
2783
2774
  });
2784
2775
  }
2785
2776
 
2786
- /**
2787
- * Force wrap spaces around icons to make sure they are never stuck against text.
2788
- * Icons at the very start or end of the text are not padded on that side.
2789
- */
2790
- function wrapChildrenIconWithSpaces(children) {
2791
- return wrap(children, true, true);
2792
- }
2793
-
2794
2777
  /**
2795
2778
  * Defines the props of the component.
2796
2779
  */
@@ -14591,7 +14574,8 @@ function useImageLightbox(props) {
14591
14574
  },
14592
14575
  onClick(e) {
14593
14576
  open(e?.target, options);
14594
- }
14577
+ },
14578
+ 'aria-haspopup': 'dialog'
14595
14579
  }));
14596
14580
  }, []);
14597
14581
  return {
@@ -20203,6 +20187,7 @@ const SlideshowItemGroup = forwardRef((props, ref) => {
20203
20187
  role = 'group',
20204
20188
  label,
20205
20189
  isDisplayed,
20190
+ 'aria-roledescription': ariaRoleDescription,
20206
20191
  ...forwardedProps
20207
20192
  } = props;
20208
20193
  const groupRef = React__default.useRef(null);
@@ -20214,7 +20199,7 @@ const SlideshowItemGroup = forwardRef((props, ref) => {
20214
20199
  ref: mergeRefs(groupRef, ref),
20215
20200
  role: role,
20216
20201
  className: classNames.join(className, CLASSNAME$g),
20217
- "aria-roledescription": "slide",
20202
+ "aria-roledescription": ariaRoleDescription ?? 'slide',
20218
20203
  "aria-label": label,
20219
20204
  ...forwardedProps,
20220
20205
  children: children
@@ -20254,6 +20239,7 @@ const Slideshow = forwardRef((props, ref) => {
20254
20239
  id,
20255
20240
  slidesId,
20256
20241
  slideGroupLabel,
20242
+ slideGroupRoleDescription,
20257
20243
  slideMode = DEFAULT_PROPS$h.slideMode,
20258
20244
  ...forwardedProps
20259
20245
  } = props;
@@ -20310,6 +20296,7 @@ const Slideshow = forwardRef((props, ref) => {
20310
20296
  ref: mergeRefs(ref, setSlideshow),
20311
20297
  hasControls: showControls,
20312
20298
  slideGroupLabel: slideGroupLabel,
20299
+ slideGroupRoleDescription: slideGroupRoleDescription,
20313
20300
  afterSlides: slideshowControlsProps && slidesCount > 1 ? /*#__PURE__*/jsx("div", {
20314
20301
  className: `${Slides.className}__controls`,
20315
20302
  children: /*#__PURE__*/jsx(SlideshowControls, {
@@ -20742,8 +20729,10 @@ const Slides = forwardRef((props, ref) => {
20742
20729
  afterSlides,
20743
20730
  hasControls,
20744
20731
  slideGroupLabel,
20732
+ slideGroupRoleDescription,
20745
20733
  slideMode = DEFAULT_PROPS$f.slideMode,
20746
20734
  onChange,
20735
+ 'aria-roledescription': ariaRoleDescription,
20747
20736
  ...forwardedProps
20748
20737
  } = props;
20749
20738
  const wrapperRef = React__default.useRef(null);
@@ -20785,7 +20774,7 @@ const Slides = forwardRef((props, ref) => {
20785
20774
  'fill-height': fillHeight,
20786
20775
  [`group-by-${groupBy}`]: Boolean(groupBy)
20787
20776
  })),
20788
- "aria-roledescription": "carousel",
20777
+ "aria-roledescription": ariaRoleDescription ?? 'carousel',
20789
20778
  children: [/*#__PURE__*/jsx("div", {
20790
20779
  id: slidesId,
20791
20780
  className: element$6('slides'),
@@ -20802,6 +20791,7 @@ const Slides = forwardRef((props, ref) => {
20802
20791
  id: slidesId && buildSlideShowGroupId(slidesId, index),
20803
20792
  role: hasControls ? 'tabpanel' : 'group',
20804
20793
  label: slideGroupLabel ? slideGroupLabel(index + 1, groups.length) : undefined,
20794
+ "aria-roledescription": slideGroupRoleDescription,
20805
20795
  isDisplayed: index >= startIndexVisible && index < endIndexVisible,
20806
20796
  children: group
20807
20797
  }, index))