@lumx/react 2.2.25 → 2.2.26-alpha-a11y-slideshow.2

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 (37) hide show
  1. package/esm/_internal/ClickAwayProvider.js +9 -5
  2. package/esm/_internal/ClickAwayProvider.js.map +1 -1
  3. package/esm/_internal/List2.js.map +1 -1
  4. package/esm/_internal/ProgressTrackerStepPanel.js +2 -1
  5. package/esm/_internal/ProgressTrackerStepPanel.js.map +1 -1
  6. package/esm/_internal/Slides.js +206 -76
  7. package/esm/_internal/Slides.js.map +1 -1
  8. package/esm/_internal/TabPanel.js +2 -1
  9. package/esm/_internal/TabPanel.js.map +1 -1
  10. package/esm/_internal/progress-tracker.js +2 -1
  11. package/esm/_internal/progress-tracker.js.map +1 -1
  12. package/esm/_internal/slideshow.js +2 -0
  13. package/esm/_internal/slideshow.js.map +1 -1
  14. package/esm/_internal/state.js +145 -0
  15. package/esm/_internal/state.js.map +1 -0
  16. package/esm/_internal/tabs.js +1 -0
  17. package/esm/_internal/tabs.js.map +1 -1
  18. package/esm/_internal/useRovingTabIndex.js +9 -144
  19. package/esm/_internal/useRovingTabIndex.js.map +1 -1
  20. package/esm/index.js +3 -1
  21. package/esm/index.js.map +1 -1
  22. package/package.json +4 -4
  23. package/src/components/slideshow/Slides.tsx +33 -3
  24. package/src/components/slideshow/Slideshow.stories.tsx +90 -2
  25. package/src/components/slideshow/Slideshow.tsx +15 -3
  26. package/src/components/slideshow/SlideshowControls.stories.tsx +1 -1
  27. package/src/components/slideshow/SlideshowControls.tsx +43 -6
  28. package/src/components/slideshow/SlideshowItem.tsx +0 -5
  29. package/src/components/slideshow/SlideshowItemGroup.tsx +56 -0
  30. package/src/components/slideshow/__snapshots__/Slideshow.test.tsx.snap +10 -1
  31. package/src/components/slideshow/useSlideFocusManagement.tsx +67 -0
  32. package/src/hooks/useRovingTabIndex.tsx +9 -0
  33. package/src/utils/focus/constants.ts +5 -0
  34. package/src/utils/focus/getFirstAndLastFocusable.ts +4 -10
  35. package/src/utils/focus/getFocusableElements.test.ts +174 -0
  36. package/src/utils/focus/getFocusableElements.ts +7 -0
  37. package/types.d.ts +19 -5
@@ -1,6 +1,6 @@
1
- import { d as _slicedToArray, _ as _objectSpread2, b as _objectWithoutProperties, c as _extends, a as _defineProperty } from './_rollupPluginBabelHelpers.js';
1
+ import { d as _slicedToArray, b as _objectWithoutProperties, c as _extends, _ as _objectSpread2, a as _defineProperty } from './_rollupPluginBabelHelpers.js';
2
2
  import { Theme, Emphasis } from './components.js';
3
- import React, { useRef, useEffect, useState, useCallback, useMemo, forwardRef } from 'react';
3
+ import React, { useRef, useEffect, useState, useCallback, useMemo, forwardRef, Children } from 'react';
4
4
  import { g as getRootClassName, c as classnames, h as handleBasicClasses, e as detectHorizontalSwipe } from './getRootClassName.js';
5
5
  import { g as mdiChevronLeft, p as mdiPauseCircleOutline, q as mdiPlayCircleOutline, f as mdiChevronRight } from './Icon2.js';
6
6
  import { W as WINDOW } from './constants.js';
@@ -9,7 +9,10 @@ import { m as mergeRefs } from './mergeRefs.js';
9
9
  import { I as IconButton } from './IconButton.js';
10
10
  import isFunction from 'lodash/isFunction';
11
11
  import range from 'lodash/range';
12
+ import { a as getFocusableElements } from './ClickAwayProvider.js';
13
+ import { u as useRovingTabIndex } from './useRovingTabIndex.js';
12
14
  import uniqueId from 'lodash/uniqueId';
15
+ import chunk from 'lodash/chunk';
13
16
 
14
17
  /**
15
18
  * Making setInterval Declarative with React Hooks.
@@ -242,6 +245,51 @@ var useSlideshowControls = function useSlideshowControls(_ref) {
242
245
  };
243
246
  };
244
247
 
248
+ /**
249
+ * Defines the props of the component.
250
+ */
251
+
252
+ /**
253
+ * Component display name.
254
+ */
255
+ var COMPONENT_NAME = 'SlideshowItemGroup';
256
+ /**
257
+ * Component default class name and class prefix.
258
+ */
259
+
260
+ var CLASSNAME = getRootClassName(COMPONENT_NAME);
261
+ var buildSlideShowGroupId = function buildSlideShowGroupId(slidesId, index) {
262
+ return "".concat(slidesId, "-slide-").concat(index);
263
+ };
264
+ /**
265
+ * SlideshowItemGroup component.
266
+ *
267
+ * @param props Component props.
268
+ * @param ref Component ref.
269
+ * @return React element.
270
+ */
271
+
272
+ var SlideshowItemGroup = forwardRef(function (props, ref) {
273
+ var className = props.className,
274
+ children = props.children,
275
+ _props$role = props.role,
276
+ role = _props$role === void 0 ? 'group' : _props$role,
277
+ label = props.label,
278
+ forwardedProps = _objectWithoutProperties(props, ["className", "children", "role", "label"]);
279
+
280
+ return React.createElement("div", _extends({
281
+ ref: ref,
282
+ role: role,
283
+ className: classnames(className, handleBasicClasses({
284
+ prefix: CLASSNAME
285
+ })),
286
+ "aria-roledescription": "slide",
287
+ "aria-label": label
288
+ }, forwardedProps), children);
289
+ });
290
+ SlideshowItemGroup.displayName = COMPONENT_NAME;
291
+ SlideshowItemGroup.className = CLASSNAME;
292
+
245
293
  /**
246
294
  * Defines the props of the component.
247
295
  */
@@ -274,7 +322,8 @@ var Slideshow = forwardRef(function (props, ref) {
274
322
  theme = props.theme,
275
323
  id = props.id,
276
324
  slidesId = props.slidesId,
277
- forwardedProps = _objectWithoutProperties(props, ["activeIndex", "autoPlay", "children", "className", "fillHeight", "groupBy", "interval", "onChange", "slideshowControlsProps", "theme", "id", "slidesId"]); // Number of slideshow items.
325
+ slideGroupLabel = props.slideGroupLabel,
326
+ forwardedProps = _objectWithoutProperties(props, ["activeIndex", "autoPlay", "children", "className", "fillHeight", "groupBy", "interval", "onChange", "slideshowControlsProps", "theme", "id", "slidesId", "slideGroupLabel"]); // Number of slideshow items.
278
327
 
279
328
 
280
329
  var itemsCount = React.Children.count(children);
@@ -310,6 +359,7 @@ var Slideshow = forwardRef(function (props, ref) {
310
359
  onFocusIn: stopAutoPlay,
311
360
  onFocusOut: startAutoPlay
312
361
  });
362
+ var showControls = slideshowControlsProps && slidesCount > 1;
313
363
  return React.createElement(Slides, _extends({
314
364
  activeIndex: currentIndex,
315
365
  id: slideshowId,
@@ -321,8 +371,9 @@ var Slideshow = forwardRef(function (props, ref) {
321
371
  autoPlay: autoPlay,
322
372
  slidesId: slideshowSlidesId,
323
373
  toggleAutoPlay: toggleAutoPlay,
324
- interval: interval,
325
374
  ref: mergeRefs(ref, setSlideshow),
375
+ hasControls: showControls,
376
+ slideGroupLabel: slideGroupLabel,
326
377
  afterSlides: slideshowControlsProps && slidesCount > 1 ? React.createElement("div", {
327
378
  className: "".concat(Slides.className, "__controls")
328
379
  }, React.createElement(SlideshowControls, _extends({}, slideshowControlsProps, {
@@ -343,7 +394,14 @@ var Slideshow = forwardRef(function (props, ref) {
343
394
  playButtonProps: autoPlay ? _objectSpread2({
344
395
  'aria-controls': slideshowSlidesId,
345
396
  onClick: toggleForcePause
346
- }, slideshowControlsProps.playButtonProps) : undefined
397
+ }, slideshowControlsProps.playButtonProps) : undefined,
398
+ paginationItemProps: function paginationItemProps(index) {
399
+ var _slideshowControlsPro;
400
+
401
+ return _objectSpread2({
402
+ 'aria-controls': buildSlideShowGroupId(slideshowSlidesId, index)
403
+ }, (_slideshowControlsPro = slideshowControlsProps.paginationItemProps) === null || _slideshowControlsPro === void 0 ? void 0 : _slideshowControlsPro.call(slideshowControlsProps, index));
404
+ }
347
405
  }))) : undefined
348
406
  }, forwardedProps), children);
349
407
  });
@@ -357,12 +415,12 @@ Slideshow.defaultProps = DEFAULT_PROPS;
357
415
  /**
358
416
  * Component display name.
359
417
  */
360
- var COMPONENT_NAME = 'SlideshowItem';
418
+ var COMPONENT_NAME$1 = 'SlideshowItem';
361
419
  /**
362
420
  * Component default class name and class prefix.
363
421
  */
364
422
 
365
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
423
+ var CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
366
424
  /**
367
425
  * SlideshowItem component.
368
426
  *
@@ -379,14 +437,12 @@ var SlideshowItem = forwardRef(function (props, ref) {
379
437
  return React.createElement("div", _extends({
380
438
  ref: ref,
381
439
  className: classnames(className, handleBasicClasses({
382
- prefix: CLASSNAME
383
- })),
384
- "aria-roledescription": "slide",
385
- role: "group"
440
+ prefix: CLASSNAME$1
441
+ }))
386
442
  }, forwardedProps), children);
387
443
  });
388
- SlideshowItem.displayName = COMPONENT_NAME;
389
- SlideshowItem.className = CLASSNAME;
444
+ SlideshowItem.displayName = COMPONENT_NAME$1;
445
+ SlideshowItem.className = CLASSNAME$1;
390
446
 
391
447
  var isTouchDevice = function isTouchDevice() {
392
448
  return 'ontouchstart' in window;
@@ -406,36 +462,6 @@ function useSwipeNavigate(element, onNext, onPrevious) {
406
462
  }, [onPrevious, onNext, element]);
407
463
  }
408
464
 
409
- /**
410
- * Listen keyboard to navigate left and right.
411
- */
412
-
413
- function useKeyNavigate(element, onNext, onPrevious) {
414
- useEffect(function () {
415
- if (!element) return undefined;
416
-
417
- var onKeyNavigate = function onKeyNavigate(evt) {
418
- var callback;
419
-
420
- if ((evt === null || evt === void 0 ? void 0 : evt.key) === 'ArrowRight') {
421
- callback = onNext;
422
- } else if ((evt === null || evt === void 0 ? void 0 : evt.key) === 'ArrowLeft') {
423
- callback = onPrevious;
424
- }
425
-
426
- if (!callback) return;
427
- callback();
428
- evt.preventDefault();
429
- evt.stopPropagation();
430
- };
431
-
432
- element.addEventListener('keydown', onKeyNavigate);
433
- return function () {
434
- element.removeEventListener('keydown', onKeyNavigate);
435
- };
436
- }, [onPrevious, onNext, element]);
437
- }
438
-
439
465
  /**
440
466
  * Calculate the currently visible pagination "bullet" range.
441
467
  */
@@ -487,12 +513,12 @@ function usePaginationVisibleRange(activeIndex, slideCount) {
487
513
  /**
488
514
  * Component display name.
489
515
  */
490
- var COMPONENT_NAME$1 = 'SlideshowControls';
516
+ var COMPONENT_NAME$2 = 'SlideshowControls';
491
517
  /**
492
518
  * Component default class name and class prefix.
493
519
  */
494
520
 
495
- var CLASSNAME$1 = getRootClassName(COMPONENT_NAME$1);
521
+ var CLASSNAME$2 = getRootClassName(COMPONENT_NAME$2);
496
522
  /**
497
523
  * Component default props.
498
524
  */
@@ -518,23 +544,24 @@ var InternalSlideshowControls = forwardRef(function (props, ref) {
518
544
  onPreviousClick = props.onPreviousClick,
519
545
  parentRef = props.parentRef,
520
546
  previousButtonProps = props.previousButtonProps,
547
+ paginationProps = props.paginationProps,
521
548
  slidesCount = props.slidesCount,
522
549
  theme = props.theme,
523
550
  _props$isAutoPlaying = props.isAutoPlaying,
524
551
  isAutoPlaying = _props$isAutoPlaying === void 0 ? false : _props$isAutoPlaying,
525
552
  playButtonProps = props.playButtonProps,
526
553
  paginationItemLabel = props.paginationItemLabel,
527
- forwardedProps = _objectWithoutProperties(props, ["activeIndex", "className", "nextButtonProps", "onNextClick", "onPaginationClick", "onPreviousClick", "parentRef", "previousButtonProps", "slidesCount", "theme", "isAutoPlaying", "playButtonProps", "paginationItemLabel"]);
554
+ paginationItemProps = props.paginationItemProps,
555
+ forwardedProps = _objectWithoutProperties(props, ["activeIndex", "className", "nextButtonProps", "onNextClick", "onPaginationClick", "onPreviousClick", "parentRef", "previousButtonProps", "paginationProps", "slidesCount", "theme", "isAutoPlaying", "playButtonProps", "paginationItemLabel", "paginationItemProps"]);
528
556
 
529
557
  var parent;
530
558
 
531
559
  if (WINDOW) {
532
560
  // Checking window object to avoid errors in SSR.
533
561
  parent = parentRef instanceof HTMLElement ? parentRef : parentRef === null || parentRef === void 0 ? void 0 : parentRef.current;
534
- } // Listen to keyboard navigate left & right.
535
-
562
+ }
536
563
 
537
- useKeyNavigate(parent, onNextClick, onPreviousClick); // Listen to touch swipe navigate left & right.
564
+ var paginationRef = React.useRef(null); // Listen to touch swipe navigate left & right.
538
565
 
539
566
  useSwipeNavigate(parent, // Go next without loopback.
540
567
  useCallback(function () {
@@ -542,7 +569,19 @@ var InternalSlideshowControls = forwardRef(function (props, ref) {
542
569
  }, [onNextClick]), // Go previous without loopback.
543
570
  useCallback(function () {
544
571
  return onPreviousClick === null || onPreviousClick === void 0 ? void 0 : onPreviousClick(false);
545
- }, [onPreviousClick])); // Pagination "bullet" range.
572
+ }, [onPreviousClick]));
573
+ /**
574
+ * Add roving tab index pattern to pagination items and activate slide on focus.
575
+ */
576
+
577
+ useRovingTabIndex({
578
+ parentRef: paginationRef,
579
+ elementSelector: 'button',
580
+ keepTabIndex: true,
581
+ onElementFocus: function onElementFocus(element) {
582
+ element.click();
583
+ }
584
+ }); // Pagination "bullet" range.
546
585
 
547
586
  var visibleRange = usePaginationVisibleRange(activeIndex, slidesCount); // Inline style of wrapper element.
548
587
 
@@ -553,71 +592,143 @@ var InternalSlideshowControls = forwardRef(function (props, ref) {
553
592
  ref: ref
554
593
  }, forwardedProps, {
555
594
  className: classnames(className, handleBasicClasses({
556
- prefix: CLASSNAME$1,
595
+ prefix: CLASSNAME$2,
557
596
  theme: theme
558
- }), _defineProperty({}, "".concat(CLASSNAME$1, "--has-infinite-pagination"), slidesCount > PAGINATION_ITEMS_MAX))
597
+ }), _defineProperty({}, "".concat(CLASSNAME$2, "--has-infinite-pagination"), slidesCount > PAGINATION_ITEMS_MAX))
559
598
  }), React.createElement(IconButton, _extends({}, previousButtonProps, {
560
599
  icon: mdiChevronLeft,
561
- className: "".concat(CLASSNAME$1, "__navigation"),
600
+ className: "".concat(CLASSNAME$2, "__navigation"),
562
601
  color: theme === Theme.dark ? 'light' : 'dark',
563
602
  emphasis: Emphasis.low,
564
603
  onClick: onPreviousClick
565
604
  })), React.createElement("div", {
566
- className: "".concat(CLASSNAME$1, "__pagination")
567
- }, React.createElement("div", {
568
- className: "".concat(CLASSNAME$1, "__pagination-items"),
569
- style: wrapperStyle
570
- }, useMemo(function () {
605
+ ref: paginationRef,
606
+ className: "".concat(CLASSNAME$2, "__pagination")
607
+ }, React.createElement("div", _extends({
608
+ className: "".concat(CLASSNAME$2, "__pagination-items"),
609
+ style: wrapperStyle,
610
+ role: "tablist"
611
+ }, paginationProps), useMemo(function () {
571
612
  return range(slidesCount).map(function (index) {
572
613
  var isOnEdge = index !== 0 && index !== slidesCount - 1 && (index === visibleRange.min || index === visibleRange.max);
573
614
  var isActive = activeIndex === index;
574
615
  var isOutRange = index < visibleRange.min || index > visibleRange.max;
616
+
617
+ var _ref = paginationItemProps ? paginationItemProps(index) : {},
618
+ _ref$className = _ref.className,
619
+ itemClassName = _ref$className === void 0 ? undefined : _ref$className,
620
+ itemProps = _objectWithoutProperties(_ref, ["className"]);
621
+
575
622
  return React.createElement("button", _extends({
576
623
  className: classnames(handleBasicClasses({
577
- prefix: "".concat(CLASSNAME$1, "__pagination-item"),
624
+ prefix: "".concat(CLASSNAME$2, "__pagination-item"),
578
625
  isActive: isActive,
579
626
  isOnEdge: isOnEdge,
580
627
  isOutRange: isOutRange
581
- })),
628
+ }), itemClassName),
582
629
  key: index,
583
630
  type: "button",
631
+ tabIndex: isActive ? undefined : -1,
632
+ role: "tab",
633
+ "aria-selected": isActive,
584
634
  onClick: function onClick() {
585
635
  return onPaginationClick === null || onPaginationClick === void 0 ? void 0 : onPaginationClick(index);
586
636
  }
587
637
  }, {
588
638
  'aria-label': paginationItemLabel ? paginationItemLabel(index) : "".concat(index + 1, " / ").concat(slidesCount)
589
- }));
639
+ }, itemProps));
590
640
  });
591
- }, [slidesCount, visibleRange.min, visibleRange.max, activeIndex, paginationItemLabel, onPaginationClick]))), playButtonProps ? React.createElement(IconButton, _extends({}, playButtonProps, {
641
+ }, [slidesCount, visibleRange.min, visibleRange.max, activeIndex, paginationItemProps, paginationItemLabel, onPaginationClick]))), playButtonProps ? React.createElement(IconButton, _extends({}, playButtonProps, {
592
642
  icon: isAutoPlaying ? mdiPauseCircleOutline : mdiPlayCircleOutline,
593
- className: "".concat(CLASSNAME$1, "__play"),
643
+ className: "".concat(CLASSNAME$2, "__play"),
594
644
  color: theme === Theme.dark ? 'light' : 'dark',
595
645
  emphasis: Emphasis.low
596
646
  })) : null, React.createElement(IconButton, _extends({}, nextButtonProps, {
597
647
  icon: mdiChevronRight,
598
- className: "".concat(CLASSNAME$1, "__navigation"),
648
+ className: "".concat(CLASSNAME$2, "__navigation"),
599
649
  color: theme === Theme.dark ? 'light' : 'dark',
600
650
  emphasis: Emphasis.low,
601
651
  onClick: onNextClick
602
652
  })));
603
653
  });
604
- InternalSlideshowControls.displayName = COMPONENT_NAME$1;
605
- InternalSlideshowControls.className = CLASSNAME$1;
654
+ InternalSlideshowControls.displayName = COMPONENT_NAME$2;
655
+ InternalSlideshowControls.className = CLASSNAME$2;
606
656
  InternalSlideshowControls.defaultProps = DEFAULT_PROPS$1;
607
657
  var SlideshowControls = Object.assign(InternalSlideshowControls, {
608
658
  useSlideshowControls: useSlideshowControls,
609
659
  useSlideshowControlsDefaultOptions: DEFAULT_OPTIONS
610
660
  });
611
661
 
662
+ /**
663
+ * Manage how slides must behave when visible or not.
664
+ * When not visible, they should be hidden from screen readers and not focusable.
665
+ */
666
+ var useSlideFocusManagement = function useSlideFocusManagement(_ref) {
667
+ var activeIndex = _ref.activeIndex,
668
+ _ref$groupBy = _ref.groupBy,
669
+ groupBy = _ref$groupBy === void 0 ? 1 : _ref$groupBy,
670
+ wrapperRef = _ref.wrapperRef;
671
+ useEffect(function () {
672
+ var element = wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current;
673
+ var startIndexVisible = activeIndex;
674
+ var endIndexVisible = startIndexVisible + 1;
675
+ var slideshowChildren = element === null || element === void 0 ? void 0 : element.querySelectorAll(".".concat(CLASSNAME));
676
+ /**
677
+ * Classname set on elements whose focus was blocked.
678
+ * This is to easily find elements that have been tempered with,
679
+ * and not elements whose focus was already initially blocked.
680
+ * */
681
+
682
+ var elementWithBlockedFocusClass = "".concat(CLASSNAME, "__no-focus");
683
+ /**
684
+ * Display given slide to screen readers and, if focus was blocked, restore focus on elements..
685
+ */
686
+
687
+ var enableSlide = function enableSlide(slide) {
688
+ // Hide from screen readers
689
+ slide.setAttribute('aria-hidden', 'false'); // Find elements we have blocked focus on
690
+
691
+ slide.querySelectorAll(".".concat(elementWithBlockedFocusClass)).forEach(function (focusableElement) {
692
+ focusableElement.removeAttribute('tabindex');
693
+ focusableElement.classList.remove(elementWithBlockedFocusClass);
694
+ });
695
+ };
696
+ /**
697
+ * Hide given slide from screen readers and block focus on all focusable elements within.
698
+ */
699
+
700
+
701
+ var blockSlide = function blockSlide(slide) {
702
+ slide.setAttribute('aria-hidden', 'true');
703
+ getFocusableElements(slide).forEach(function (focusableElement) {
704
+ focusableElement.setAttribute('tabindex', '-1');
705
+ focusableElement.classList.add(elementWithBlockedFocusClass);
706
+ });
707
+ };
708
+
709
+ if (slideshowChildren && (slideshowChildren === null || slideshowChildren === void 0 ? void 0 : slideshowChildren.length) > 0) {
710
+ Array.from(slideshowChildren).forEach(function (slide, slideIndex) {
711
+ var slideIsVisible = slideIndex >= startIndexVisible && slideIndex < endIndexVisible;
712
+
713
+ if (slideIsVisible) {
714
+ enableSlide(slide);
715
+ } else {
716
+ blockSlide(slide);
717
+ }
718
+ });
719
+ }
720
+ }, [activeIndex, groupBy, wrapperRef]);
721
+ };
722
+
612
723
  /**
613
724
  * Component display name.
614
725
  */
615
- var COMPONENT_NAME$2 = 'Slideshow';
726
+ var COMPONENT_NAME$3 = 'Slideshow';
616
727
  /**
617
728
  * Component default class name and class prefix.
618
729
  */
619
730
 
620
- var CLASSNAME$2 = getRootClassName(COMPONENT_NAME$2);
731
+ var CLASSNAME$3 = getRootClassName(COMPONENT_NAME$3);
621
732
  /**
622
733
  * Slides component.
623
734
  *
@@ -640,34 +751,53 @@ var Slides = forwardRef(function (props, ref) {
640
751
  slidesId = props.slidesId,
641
752
  children = props.children,
642
753
  afterSlides = props.afterSlides,
643
- forwardedProps = _objectWithoutProperties(props, ["activeIndex", "id", "className", "theme", "fillHeight", "groupBy", "isAutoPlaying", "toggleAutoPlay", "slidesId", "children", "afterSlides"]); // Inline style of wrapper element.
754
+ hasControls = props.hasControls,
755
+ slideGroupLabel = props.slideGroupLabel,
756
+ forwardedProps = _objectWithoutProperties(props, ["activeIndex", "id", "className", "theme", "fillHeight", "groupBy", "isAutoPlaying", "toggleAutoPlay", "slidesId", "children", "afterSlides", "hasControls", "slideGroupLabel"]);
644
757
 
758
+ var wrapperRef = React.useRef(null);
759
+ useSlideFocusManagement({
760
+ wrapperRef: wrapperRef,
761
+ activeIndex: activeIndex,
762
+ groupBy: groupBy
763
+ }); // Inline style of wrapper element.
645
764
 
646
765
  var wrapperStyle = {
647
766
  transform: "translateX(-".concat(FULL_WIDTH_PERCENT * activeIndex, "%)")
648
767
  };
768
+ var groups = React.useMemo(function () {
769
+ return groupBy && groupBy > 1 ? chunk(Children.toArray(children), groupBy) : [children];
770
+ }, [children, groupBy]);
649
771
  return React.createElement("section", _extends({
650
772
  id: id,
651
773
  ref: ref
652
774
  }, forwardedProps, {
653
775
  className: classnames(className, handleBasicClasses({
654
- prefix: CLASSNAME$2,
776
+ prefix: CLASSNAME$3,
655
777
  theme: theme
656
- }), (_classNames = {}, _defineProperty(_classNames, "".concat(CLASSNAME$2, "--fill-height"), fillHeight), _defineProperty(_classNames, "".concat(CLASSNAME$2, "--group-by-").concat(groupBy), Boolean(groupBy)), _classNames)),
778
+ }), (_classNames = {}, _defineProperty(_classNames, "".concat(CLASSNAME$3, "--fill-height"), fillHeight), _defineProperty(_classNames, "".concat(CLASSNAME$3, "--group-by-").concat(groupBy), Boolean(groupBy)), _classNames)),
657
779
  "aria-roledescription": "carousel"
658
780
  }), React.createElement("div", {
659
781
  id: slidesId,
660
- className: "".concat(CLASSNAME$2, "__slides"),
782
+ className: "".concat(CLASSNAME$3, "__slides"),
661
783
  onMouseEnter: toggleAutoPlay,
662
784
  onMouseLeave: toggleAutoPlay,
663
785
  "aria-live": isAutoPlaying ? 'off' : 'polite'
664
786
  }, React.createElement("div", {
665
- className: "".concat(CLASSNAME$2, "__wrapper"),
787
+ ref: wrapperRef,
788
+ className: "".concat(CLASSNAME$3, "__wrapper"),
666
789
  style: wrapperStyle
667
- }, children)), afterSlides);
790
+ }, groups.map(function (group, index) {
791
+ return React.createElement(SlideshowItemGroup, {
792
+ key: index,
793
+ id: slidesId && buildSlideShowGroupId(slidesId, index),
794
+ role: hasControls ? 'tabpanel' : 'group',
795
+ label: slideGroupLabel ? slideGroupLabel(index + 1, groups.length) : undefined
796
+ }, group);
797
+ }))), afterSlides);
668
798
  });
669
- Slides.displayName = COMPONENT_NAME$2;
670
- Slides.className = CLASSNAME$2;
799
+ Slides.displayName = COMPONENT_NAME$3;
800
+ Slides.className = CLASSNAME$3;
671
801
 
672
802
  export { Slideshow as S, SlideshowItem as a, SlideshowControls as b, Slides as c };
673
803
  //# sourceMappingURL=Slides.js.map