@zendeskgarden/react-accordions 8.49.2 → 8.50.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.
package/dist/index.esm.js CHANGED
@@ -6,15 +6,15 @@
6
6
  */
7
7
 
8
8
  import * as React from 'react';
9
- import React__default, { cloneElement, Children, createContext, useContext, forwardRef, useState, useLayoutEffect, useMemo, useRef, useCallback, useEffect } from 'react';
9
+ import React__default, { cloneElement, Children, createContext, useContext, forwardRef, useRef, useState, useMemo, useCallback, useEffect, useLayoutEffect } from 'react';
10
+ import { useAccordion } from '@zendeskgarden/container-accordion';
10
11
  import styled, { css } from 'styled-components';
11
12
  import { retrieveComponentStyles, DEFAULT_THEME, getColor, getLineHeight } from '@zendeskgarden/react-theming';
12
13
  import { math } from 'polished';
13
- import PropTypes from 'prop-types';
14
- import mergeRefs from 'react-merge-refs';
15
- import debounce from 'lodash.debounce';
16
- import { useAccordion } from '@zendeskgarden/container-accordion';
17
14
  import { composeEventHandlers } from '@zendeskgarden/container-utilities';
15
+ import debounce from 'lodash.debounce';
16
+ import mergeRefs from 'react-merge-refs';
17
+ import PropTypes from 'prop-types';
18
18
 
19
19
  function ownKeys(object, enumerableOnly) {
20
20
  var keys = Object.keys(object);
@@ -185,7 +185,7 @@ var sizeStyles$1 = function sizeStyles(props) {
185
185
  };
186
186
  var StyledContent = styled.div.attrs({
187
187
  'data-garden-id': COMPONENT_ID$k,
188
- 'data-garden-version': '8.49.2'
188
+ 'data-garden-version': '8.50.0'
189
189
  }).withConfig({
190
190
  displayName: "StyledContent",
191
191
  componentId: "sc-mazvvo-0"
@@ -201,7 +201,7 @@ StyledContent.defaultProps = {
201
201
  var COMPONENT_ID$j = 'accordions.step_line';
202
202
  var StyledLine = styled.div.attrs({
203
203
  'data-garden-id': COMPONENT_ID$j,
204
- 'data-garden-version': '8.49.2'
204
+ 'data-garden-version': '8.50.0'
205
205
  }).withConfig({
206
206
  displayName: "StyledLine",
207
207
  componentId: "sc-1gkpjbr-0"
@@ -223,7 +223,7 @@ StyledLine.defaultProps = {
223
223
  var COMPONENT_ID$i = 'accordions.step';
224
224
  var StyledStep = styled.li.attrs({
225
225
  'data-garden-id': COMPONENT_ID$i,
226
- 'data-garden-version': '8.49.2'
226
+ 'data-garden-version': '8.50.0'
227
227
  }).withConfig({
228
228
  displayName: "StyledStep",
229
229
  componentId: "sc-12fiwtz-0"
@@ -253,7 +253,7 @@ StyledStep.defaultProps = {
253
253
  var COMPONENT_ID$h = 'accordions.step_inner_content';
254
254
  var StyledInnerContent = styled.div.attrs({
255
255
  'data-garden-id': COMPONENT_ID$h,
256
- 'data-garden-version': '8.49.2'
256
+ 'data-garden-version': '8.50.0'
257
257
  }).withConfig({
258
258
  displayName: "StyledInnerContent",
259
259
  componentId: "sc-1xs9fh7-0"
@@ -275,7 +275,7 @@ StyledInnerContent.defaultProps = {
275
275
  var COMPONENT_ID$g = 'accordions.stepper';
276
276
  var StyledStepper = styled.ol.attrs({
277
277
  'data-garden-id': COMPONENT_ID$g,
278
- 'data-garden-version': '8.49.2'
278
+ 'data-garden-version': '8.50.0'
279
279
  }).withConfig({
280
280
  displayName: "StyledStepper",
281
281
  componentId: "sc-dsxw0f-0"
@@ -303,7 +303,7 @@ var colorStyles$2 = function colorStyles(props) {
303
303
  };
304
304
  var StyledIcon = styled.div.attrs({
305
305
  'data-garden-id': COMPONENT_ID$f,
306
- 'data-garden-version': '8.49.2'
306
+ 'data-garden-version': '8.50.0'
307
307
  }).withConfig({
308
308
  displayName: "StyledIcon",
309
309
  componentId: "sc-v20nz9-1"
@@ -320,7 +320,7 @@ StyledIcon.defaultProps = {
320
320
  var COMPONENT_ID$e = 'accordions.step_label';
321
321
  var StyledLabel = styled.div.attrs({
322
322
  'data-garden-id': COMPONENT_ID$e,
323
- 'data-garden-version': '8.49.2'
323
+ 'data-garden-version': '8.50.0'
324
324
  }).withConfig({
325
325
  displayName: "StyledLabel",
326
326
  componentId: "sc-1o82llj-0"
@@ -348,7 +348,7 @@ StyledLabel.defaultProps = {
348
348
  var COMPONENT_ID$d = 'accordions.step_label_text';
349
349
  var StyledLabelText = styled.div.attrs({
350
350
  'data-garden-id': COMPONENT_ID$d,
351
- 'data-garden-version': '8.49.2'
351
+ 'data-garden-version': '8.50.0'
352
352
  }).withConfig({
353
353
  displayName: "StyledLabelText",
354
354
  componentId: "sc-111m5zo-0"
@@ -366,7 +366,7 @@ StyledLabelText.defaultProps = {
366
366
  var COMPONENT_ID$c = 'accordions.accordion';
367
367
  var StyledAccordion = styled.div.attrs({
368
368
  'data-garden-id': COMPONENT_ID$c,
369
- 'data-garden-version': '8.49.2'
369
+ 'data-garden-version': '8.50.0'
370
370
  }).withConfig({
371
371
  displayName: "StyledAccordion",
372
372
  componentId: "sc-niv9ic-0"
@@ -396,7 +396,7 @@ var paddingStyles = function paddingStyles(props) {
396
396
  };
397
397
  var StyledPanel = styled.section.attrs({
398
398
  'data-garden-id': COMPONENT_ID$b,
399
- 'data-garden-version': '8.49.2'
399
+ 'data-garden-version': '8.50.0'
400
400
  }).withConfig({
401
401
  displayName: "StyledPanel",
402
402
  componentId: "sc-1piryze-0"
@@ -413,7 +413,7 @@ StyledPanel.defaultProps = {
413
413
  var COMPONENT_ID$a = 'accordions.section';
414
414
  var StyledSection = styled.div.attrs({
415
415
  'data-garden-id': COMPONENT_ID$a,
416
- 'data-garden-version': '8.49.2'
416
+ 'data-garden-version': '8.50.0'
417
417
  }).withConfig({
418
418
  displayName: "StyledSection",
419
419
  componentId: "sc-v2t9bd-0"
@@ -427,7 +427,7 @@ StyledSection.defaultProps = {
427
427
  var COMPONENT_ID$9 = 'accordions.header';
428
428
  var StyledHeader = styled.div.attrs({
429
429
  'data-garden-id': COMPONENT_ID$9,
430
- 'data-garden-version': '8.49.2'
430
+ 'data-garden-version': '8.50.0'
431
431
  }).withConfig({
432
432
  displayName: "StyledHeader",
433
433
  componentId: "sc-2c6rbr-0"
@@ -455,7 +455,7 @@ var colorStyles$1 = function colorStyles(props) {
455
455
  };
456
456
  var StyledButton = styled.button.attrs({
457
457
  'data-garden-id': COMPONENT_ID$8,
458
- 'data-garden-version': '8.49.2'
458
+ 'data-garden-version': '8.50.0'
459
459
  }).withConfig({
460
460
  displayName: "StyledButton",
461
461
  componentId: "sc-xj3hy7-0"
@@ -481,7 +481,7 @@ StyledButton.defaultProps = {
481
481
  var COMPONENT_ID$7 = 'accordions.step_inner_panel';
482
482
  var StyledInnerPanel = styled.div.attrs({
483
483
  'data-garden-id': COMPONENT_ID$7,
484
- 'data-garden-version': '8.49.2'
484
+ 'data-garden-version': '8.50.0'
485
485
  }).withConfig({
486
486
  displayName: "StyledInnerPanel",
487
487
  componentId: "sc-8nbueg-0"
@@ -501,7 +501,7 @@ StyledInnerPanel.defaultProps = {
501
501
  theme: DEFAULT_THEME
502
502
  };
503
503
 
504
- var _excluded$6 = ["children", "isRotated", "isHovered", "isCompact", "isCollapsible"];
504
+ var _excluded$7 = ["children", "isRotated", "isHovered", "isCompact", "isCollapsible"];
505
505
  var COMPONENT_ID$6 = 'accordions.rotate_icon';
506
506
  var colorStyles = function colorStyles(props) {
507
507
  var showColor = props.isCollapsible || !props.isRotated;
@@ -518,11 +518,11 @@ function (_ref) {
518
518
  _ref.isHovered;
519
519
  _ref.isCompact;
520
520
  _ref.isCollapsible;
521
- var props = _objectWithoutProperties(_ref, _excluded$6);
521
+ var props = _objectWithoutProperties(_ref, _excluded$7);
522
522
  return cloneElement(Children.only(children), props);
523
523
  }).attrs({
524
524
  'data-garden-id': COMPONENT_ID$6,
525
- 'data-garden-version': '8.49.2'
525
+ 'data-garden-version': '8.50.0'
526
526
  }).withConfig({
527
527
  displayName: "StyledRotateIcon",
528
528
  componentId: "sc-hp435q-0"
@@ -544,7 +544,7 @@ StyledRotateIcon.defaultProps = {
544
544
  var COMPONENT_ID$5 = 'timeline';
545
545
  var StyledTimeline = styled.ol.attrs({
546
546
  'data-garden-id': COMPONENT_ID$5,
547
- 'data-garden-version': '8.49.2'
547
+ 'data-garden-version': '8.50.0'
548
548
  }).withConfig({
549
549
  displayName: "StyledTimeline",
550
550
  componentId: "sc-pig5kv-0"
@@ -558,7 +558,7 @@ StyledTimeline.defaultProps = {
558
558
  var COMPONENT_ID$4 = 'timeline.content.separator';
559
559
  var StyledSeparator = styled.div.attrs({
560
560
  'data-garden-id': COMPONENT_ID$4,
561
- 'data-garden-version': '8.49.2'
561
+ 'data-garden-version': '8.50.0'
562
562
  }).withConfig({
563
563
  displayName: "StyledSeparator",
564
564
  componentId: "sc-fki51e-0"
@@ -576,7 +576,7 @@ StyledSeparator.defaultProps = {
576
576
  var COMPONENT_ID$3 = 'timeline.content';
577
577
  var StyledTimelineContent = styled.div.attrs({
578
578
  'data-garden-id': COMPONENT_ID$3,
579
- 'data-garden-version': '8.49.2'
579
+ 'data-garden-version': '8.50.0'
580
580
  }).withConfig({
581
581
  displayName: "StyledContent__StyledTimelineContent",
582
582
  componentId: "sc-19phgu1-0"
@@ -592,7 +592,7 @@ StyledTimelineContent.defaultProps = {
592
592
  var COMPONENT_ID$2 = 'timeline.opposite.content';
593
593
  var StyledOppositeContent = styled.div.attrs({
594
594
  'data-garden-id': COMPONENT_ID$2,
595
- 'data-garden-version': '8.49.2'
595
+ 'data-garden-version': '8.50.0'
596
596
  }).withConfig({
597
597
  displayName: "StyledOppositeContent",
598
598
  componentId: "sc-jurh2k-0"
@@ -610,11 +610,17 @@ StyledOppositeContent.defaultProps = {
610
610
  var COMPONENT_ID$1 = 'timeline.item';
611
611
  var StyledTimelineItem = styled.li.attrs({
612
612
  'data-garden-id': COMPONENT_ID$1,
613
- 'data-garden-version': '8.49.2'
613
+ 'data-garden-version': '8.50.0'
614
614
  }).withConfig({
615
615
  displayName: "StyledItem__StyledTimelineItem",
616
616
  componentId: "sc-5mcnzm-0"
617
- })(["display:flex;position:relative;&:last-of-type ", "::after{display:none;}", " ", " ", ";"], StyledSeparator, function (props) {
617
+ })(["display:flex;position:relative;line-height:", ";color:", ";font-size:", ";&:last-of-type ", "::after{display:none;}", " ", " ", ";"], function (props) {
618
+ return getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md);
619
+ }, function (props) {
620
+ return props.theme.colors.foreground;
621
+ }, function (props) {
622
+ return props.theme.fontSizes.md;
623
+ }, StyledSeparator, function (props) {
618
624
  return !props.hasOppositeContent && props.isAlternate && css(["&:before{flex:1;content:'';padding:", "px;}"], props.theme.space.base * 4);
619
625
  }, function (props) {
620
626
  return props.isAlternate && css(["&:nth-child(even){flex-direction:row-reverse;", "{text-align:", ";}", "{text-align:", ";}}"], StyledOppositeContent, props.theme.rtl ? 'right' : 'left', StyledTimelineContent, props.theme.rtl ? 'left' : 'right');
@@ -625,16 +631,16 @@ StyledTimelineItem.defaultProps = {
625
631
  theme: DEFAULT_THEME
626
632
  };
627
633
 
628
- var _excluded$5 = ["surfaceColor", "children"];
634
+ var _excluded$6 = ["surfaceColor", "children"];
629
635
  var COMPONENT_ID = 'timeline.icon';
630
636
  var StyledItemIcon = styled(function (_ref) {
631
637
  _ref.surfaceColor;
632
638
  var children = _ref.children,
633
- props = _objectWithoutProperties(_ref, _excluded$5);
639
+ props = _objectWithoutProperties(_ref, _excluded$6);
634
640
  return cloneElement(Children.only(children), props);
635
641
  }).attrs({
636
642
  'data-garden-id': COMPONENT_ID,
637
- 'data-garden-version': '8.49.2'
643
+ 'data-garden-version': '8.50.0'
638
644
  }).withConfig({
639
645
  displayName: "StyledItemIcon",
640
646
  componentId: "sc-vz2l6e-0"
@@ -718,155 +724,6 @@ var useTimelineItemContext = function useTimelineItemContext() {
718
724
  return context;
719
725
  };
720
726
 
721
- var StepComponent = forwardRef(function (props, ref) {
722
- var _useStepperContext = useStepperContext(),
723
- currentIndexRef = _useStepperContext.currentIndexRef,
724
- isHorizontal = _useStepperContext.isHorizontal;
725
- var _useState = useState(currentIndexRef.current),
726
- _useState2 = _slicedToArray(_useState, 2),
727
- currentStepIndex = _useState2[0],
728
- setIndex = _useState2[1];
729
- useLayoutEffect(function () {
730
- setIndex(currentIndexRef.current);
731
- currentIndexRef.current++;
732
- var currentIndex = currentIndexRef;
733
- return function () {
734
- currentIndex.current--;
735
- };
736
- }, [currentIndexRef]);
737
- var value = useMemo(function () {
738
- return {
739
- currentStepIndex: currentStepIndex
740
- };
741
- }, [currentStepIndex]);
742
- return React__default.createElement(StepContext.Provider, {
743
- value: value
744
- }, React__default.createElement(StyledStep, _extends$3({
745
- ref: ref,
746
- isHorizontal: isHorizontal
747
- }, props), isHorizontal && React__default.createElement(StyledLine, null), props.children));
748
- });
749
- StepComponent.displayName = 'Stepper.Step';
750
- var Step = StepComponent;
751
-
752
- var _path$1;
753
-
754
- function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
755
-
756
- var SvgCheckSmStroke = function SvgCheckSmStroke(props) {
757
- return /*#__PURE__*/React.createElement("svg", _extends$2({
758
- xmlns: "http://www.w3.org/2000/svg",
759
- width: 16,
760
- height: 16,
761
- focusable: "false",
762
- viewBox: "0 0 16 16",
763
- "aria-hidden": "true"
764
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
765
- fill: "none",
766
- stroke: "currentColor",
767
- strokeLinecap: "round",
768
- strokeLinejoin: "round",
769
- strokeWidth: 1.25,
770
- d: "M3 9l3 3 7-7"
771
- })));
772
- };
773
-
774
- var LabelComponent$1 = forwardRef(function (props, ref) {
775
- var _useStepContext = useStepContext(),
776
- currentStepIndex = _useStepContext.currentStepIndex;
777
- var _useStepperContext = useStepperContext(),
778
- activeIndex = _useStepperContext.activeIndex,
779
- isHorizontal = _useStepperContext.isHorizontal;
780
- var numericStep = currentStepIndex + 1;
781
- var stepIcon = props.icon || numericStep;
782
- var isActive = activeIndex === currentStepIndex;
783
- var isCompleted = activeIndex > currentStepIndex;
784
- var styledIcon = React__default.createElement(StyledIcon, {
785
- isActive: isActive,
786
- isHorizontal: isHorizontal
787
- }, isCompleted ? React__default.createElement(SvgCheckSmStroke, null) : stepIcon);
788
- return React__default.createElement(StyledLabel, _extends$3({
789
- ref: ref,
790
- isActive: isActive,
791
- isHorizontal: isHorizontal
792
- }, props), isHorizontal ? React__default.createElement(StyledIconFlexContainer, null, styledIcon) : styledIcon, React__default.createElement(StyledLabelText, {
793
- isHidden: props.isHidden,
794
- isHorizontal: isHorizontal
795
- }, props.children));
796
- });
797
- LabelComponent$1.displayName = 'Stepper.Label';
798
- LabelComponent$1.propTypes = {
799
- icon: PropTypes.node,
800
- isHidden: PropTypes.bool
801
- };
802
- var Label$1 = LabelComponent$1;
803
-
804
- var ContentComponent$1 = forwardRef(function (props, ref) {
805
- var contentRef = useRef();
806
- var _useStepperContext = useStepperContext(),
807
- activeIndex = _useStepperContext.activeIndex,
808
- isHorizontal = _useStepperContext.isHorizontal;
809
- var _useStepContext = useStepContext(),
810
- currentStepIndex = _useStepContext.currentStepIndex;
811
- var isActive = currentStepIndex === activeIndex;
812
- var updateMaxHeight = useCallback(debounce(function () {
813
- if (contentRef.current) {
814
- var child = contentRef.current.children[0];
815
- child.style.maxHeight = "".concat(child.scrollHeight, "px");
816
- }
817
- }, 100), [contentRef]);
818
- useEffect(function () {
819
- if (isActive && isHorizontal === false) {
820
- addEventListener('resize', updateMaxHeight);
821
- updateMaxHeight();
822
- return function () {
823
- removeEventListener('resize', updateMaxHeight);
824
- };
825
- }
826
- return undefined;
827
- }, [isActive, isHorizontal, props.children, updateMaxHeight]);
828
- return isHorizontal === false ? React__default.createElement(StyledContent, _extends$3({
829
- ref: mergeRefs([contentRef, ref]),
830
- isActive: isActive
831
- }, props), React__default.createElement(StyledInnerContent, {
832
- isActive: isActive
833
- }, props.children)) : null;
834
- });
835
- ContentComponent$1.displayName = 'Stepper.Content';
836
- var Content$1 = ContentComponent$1;
837
-
838
- var _excluded$4 = ["isHorizontal", "activeIndex"];
839
- var StepperComponent = forwardRef(function (_ref, ref) {
840
- var isHorizontal = _ref.isHorizontal,
841
- activeIndex = _ref.activeIndex,
842
- props = _objectWithoutProperties(_ref, _excluded$4);
843
- var currentIndexRef = useRef(0);
844
- var stepperContext = useMemo(function () {
845
- return {
846
- isHorizontal: isHorizontal || false,
847
- activeIndex: activeIndex,
848
- currentIndexRef: currentIndexRef
849
- };
850
- }, [isHorizontal, activeIndex, currentIndexRef]);
851
- useEffect(function () {
852
- currentIndexRef.current = 0;
853
- });
854
- return React__default.createElement(StepperContext.Provider, {
855
- value: stepperContext
856
- }, React__default.createElement(StyledStepper, _extends$3({
857
- ref: ref,
858
- isHorizontal: isHorizontal
859
- }, props)));
860
- });
861
- StepperComponent.displayName = 'Stepper';
862
- StepperComponent.defaultProps = {
863
- activeIndex: 0
864
- };
865
- var Stepper = StepperComponent;
866
- Stepper.Content = Content$1;
867
- Stepper.Label = Label$1;
868
- Stepper.Step = Step;
869
-
870
727
  var SectionComponent = forwardRef(function (props, ref) {
871
728
  var _useAccordionContext = useAccordionContext(),
872
729
  currentIndexRef = _useAccordionContext.currentIndexRef;
@@ -881,25 +738,25 @@ var SectionComponent = forwardRef(function (props, ref) {
881
738
  SectionComponent.displayName = 'Accordion.Section';
882
739
  var Section = SectionComponent;
883
740
 
884
- var _path;
741
+ var _path$1;
885
742
 
886
- function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
743
+ function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
887
744
 
888
745
  var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
889
- return /*#__PURE__*/React.createElement("svg", _extends$1({
746
+ return /*#__PURE__*/React.createElement("svg", _extends$2({
890
747
  xmlns: "http://www.w3.org/2000/svg",
891
748
  width: 16,
892
749
  height: 16,
893
750
  focusable: "false",
894
751
  viewBox: "0 0 16 16",
895
752
  "aria-hidden": "true"
896
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
753
+ }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
897
754
  fill: "currentColor",
898
755
  d: "M12.688 5.61a.5.5 0 01.69.718l-.066.062-5 4a.5.5 0 01-.542.054l-.082-.054-5-4a.5.5 0 01.55-.83l.074.05L8 9.359l4.688-3.75z"
899
756
  })));
900
757
  };
901
758
 
902
- var _excluded$3 = ["onClick", "onFocus", "onBlur", "onMouseOver", "onMouseOut", "children"],
759
+ var _excluded$5 = ["onClick", "onFocus", "onBlur", "onMouseOver", "onMouseOut", "children"],
903
760
  _excluded2 = ["onClick", "onKeyDown"];
904
761
  var HeaderComponent = forwardRef(function (props, ref) {
905
762
  var _useAccordionContext = useAccordionContext(),
@@ -915,7 +772,7 @@ var HeaderComponent = forwardRef(function (props, ref) {
915
772
  onMouseOver = props.onMouseOver,
916
773
  onMouseOut = props.onMouseOut,
917
774
  children = props.children,
918
- other = _objectWithoutProperties(props, _excluded$3);
775
+ other = _objectWithoutProperties(props, _excluded$5);
919
776
  var sectionIndex = useSectionContext();
920
777
  var _useState = useState(false),
921
778
  _useState2 = _slicedToArray(_useState, 2),
@@ -985,7 +842,7 @@ var HeaderComponent = forwardRef(function (props, ref) {
985
842
  HeaderComponent.displayName = 'Accordion.Header';
986
843
  var Header = HeaderComponent;
987
844
 
988
- var LabelComponent = forwardRef(function (props, ref) {
845
+ var LabelComponent$1 = forwardRef(function (props, ref) {
989
846
  var sectionIndex = useSectionContext();
990
847
  var _useAccordionContext = useAccordionContext(),
991
848
  isCompact = _useAccordionContext.isCompact,
@@ -1003,8 +860,8 @@ var LabelComponent = forwardRef(function (props, ref) {
1003
860
  isCollapsible: isCollapsible
1004
861
  }, otherTriggerProps, props));
1005
862
  });
1006
- LabelComponent.displayName = 'Accordion.Label';
1007
- var Label = LabelComponent;
863
+ LabelComponent$1.displayName = 'Accordion.Label';
864
+ var Label$1 = LabelComponent$1;
1008
865
 
1009
866
  var PanelComponent = forwardRef(function (props, ref) {
1010
867
  var _useAccordionContext = useAccordionContext(),
@@ -1048,7 +905,7 @@ var PanelComponent = forwardRef(function (props, ref) {
1048
905
  PanelComponent.displayName = 'Accordion.Panel';
1049
906
  var Panel = PanelComponent;
1050
907
 
1051
- var _excluded$2 = ["level", "isBare", "onChange", "isCompact", "isAnimated", "isExpandable", "isCollapsible", "defaultExpandedSections", "expandedSections"];
908
+ var _excluded$4 = ["level", "isBare", "onChange", "isCompact", "isAnimated", "isExpandable", "isCollapsible", "defaultExpandedSections", "expandedSections"];
1052
909
  var AccordionComponent = forwardRef(function (_ref, ref) {
1053
910
  var level = _ref.level,
1054
911
  isBare = _ref.isBare,
@@ -1059,7 +916,7 @@ var AccordionComponent = forwardRef(function (_ref, ref) {
1059
916
  isCollapsible = _ref.isCollapsible,
1060
917
  defaultExpandedSections = _ref.defaultExpandedSections,
1061
918
  controlledExpandedSections = _ref.expandedSections,
1062
- props = _objectWithoutProperties(_ref, _excluded$2);
919
+ props = _objectWithoutProperties(_ref, _excluded$4);
1063
920
  var _useAccordion = useAccordion({
1064
921
  collapsible: isCollapsible,
1065
922
  expandable: isExpandable || false,
@@ -1102,10 +959,167 @@ AccordionComponent.defaultProps = {
1102
959
  };
1103
960
  var Accordion = AccordionComponent;
1104
961
  Accordion.Header = Header;
1105
- Accordion.Label = Label;
962
+ Accordion.Label = Label$1;
1106
963
  Accordion.Panel = Panel;
1107
964
  Accordion.Section = Section;
1108
965
 
966
+ var StepComponent = forwardRef(function (props, ref) {
967
+ var _useStepperContext = useStepperContext(),
968
+ currentIndexRef = _useStepperContext.currentIndexRef,
969
+ isHorizontal = _useStepperContext.isHorizontal;
970
+ var _useState = useState(currentIndexRef.current),
971
+ _useState2 = _slicedToArray(_useState, 2),
972
+ currentStepIndex = _useState2[0],
973
+ setIndex = _useState2[1];
974
+ useLayoutEffect(function () {
975
+ setIndex(currentIndexRef.current);
976
+ currentIndexRef.current++;
977
+ var currentIndex = currentIndexRef;
978
+ return function () {
979
+ currentIndex.current--;
980
+ };
981
+ }, [currentIndexRef]);
982
+ var value = useMemo(function () {
983
+ return {
984
+ currentStepIndex: currentStepIndex
985
+ };
986
+ }, [currentStepIndex]);
987
+ return React__default.createElement(StepContext.Provider, {
988
+ value: value
989
+ }, React__default.createElement(StyledStep, _extends$3({
990
+ ref: ref,
991
+ isHorizontal: isHorizontal
992
+ }, props), isHorizontal && React__default.createElement(StyledLine, null), props.children));
993
+ });
994
+ StepComponent.displayName = 'Stepper.Step';
995
+ var Step = StepComponent;
996
+
997
+ var _path;
998
+
999
+ function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
1000
+
1001
+ var SvgCheckSmStroke = function SvgCheckSmStroke(props) {
1002
+ return /*#__PURE__*/React.createElement("svg", _extends$1({
1003
+ xmlns: "http://www.w3.org/2000/svg",
1004
+ width: 16,
1005
+ height: 16,
1006
+ focusable: "false",
1007
+ viewBox: "0 0 16 16",
1008
+ "aria-hidden": "true"
1009
+ }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
1010
+ fill: "none",
1011
+ stroke: "currentColor",
1012
+ strokeLinecap: "round",
1013
+ strokeLinejoin: "round",
1014
+ strokeWidth: 1.25,
1015
+ d: "M3 9l3 3 7-7"
1016
+ })));
1017
+ };
1018
+
1019
+ var _excluded$3 = ["icon", "iconProps", "isHidden", "children"];
1020
+ var LabelComponent = forwardRef(function (_ref, ref) {
1021
+ var icon = _ref.icon,
1022
+ iconProps = _ref.iconProps,
1023
+ isHidden = _ref.isHidden,
1024
+ children = _ref.children,
1025
+ other = _objectWithoutProperties(_ref, _excluded$3);
1026
+ var _useStepContext = useStepContext(),
1027
+ currentStepIndex = _useStepContext.currentStepIndex;
1028
+ var _useStepperContext = useStepperContext(),
1029
+ activeIndex = _useStepperContext.activeIndex,
1030
+ isHorizontal = _useStepperContext.isHorizontal;
1031
+ var numericStep = currentStepIndex + 1;
1032
+ var stepIcon = icon || numericStep;
1033
+ var isActive = activeIndex === currentStepIndex;
1034
+ var isCompleted = activeIndex > currentStepIndex;
1035
+ var styledIcon = React__default.createElement(StyledIcon, {
1036
+ isActive: isActive,
1037
+ isHorizontal: isHorizontal
1038
+ }, isCompleted ? React__default.createElement(SvgCheckSmStroke, iconProps) : stepIcon);
1039
+ return React__default.createElement(StyledLabel, _extends$3({
1040
+ ref: ref,
1041
+ isActive: isActive,
1042
+ isHorizontal: isHorizontal
1043
+ }, other), isHorizontal ? React__default.createElement(StyledIconFlexContainer, null, styledIcon) : styledIcon, React__default.createElement(StyledLabelText, {
1044
+ isHidden: isHidden,
1045
+ isHorizontal: isHorizontal
1046
+ }, children));
1047
+ });
1048
+ LabelComponent.displayName = 'Stepper.Label';
1049
+ LabelComponent.propTypes = {
1050
+ icon: PropTypes.node,
1051
+ iconProps: PropTypes.object,
1052
+ isHidden: PropTypes.bool
1053
+ };
1054
+ var Label = LabelComponent;
1055
+
1056
+ var ContentComponent$1 = forwardRef(function (props, ref) {
1057
+ var contentRef = useRef();
1058
+ var _useStepperContext = useStepperContext(),
1059
+ activeIndex = _useStepperContext.activeIndex,
1060
+ isHorizontal = _useStepperContext.isHorizontal;
1061
+ var _useStepContext = useStepContext(),
1062
+ currentStepIndex = _useStepContext.currentStepIndex;
1063
+ var isActive = currentStepIndex === activeIndex;
1064
+ var updateMaxHeight = useCallback(debounce(function () {
1065
+ if (contentRef.current) {
1066
+ var child = contentRef.current.children[0];
1067
+ child.style.maxHeight = "".concat(child.scrollHeight, "px");
1068
+ }
1069
+ }, 100), [contentRef]);
1070
+ useEffect(function () {
1071
+ if (isActive && isHorizontal === false) {
1072
+ addEventListener('resize', updateMaxHeight);
1073
+ updateMaxHeight();
1074
+ return function () {
1075
+ removeEventListener('resize', updateMaxHeight);
1076
+ };
1077
+ }
1078
+ return undefined;
1079
+ }, [isActive, isHorizontal, props.children, updateMaxHeight]);
1080
+ return isHorizontal === false ? React__default.createElement(StyledContent, _extends$3({
1081
+ ref: mergeRefs([contentRef, ref]),
1082
+ isActive: isActive
1083
+ }, props), React__default.createElement(StyledInnerContent, {
1084
+ isActive: isActive,
1085
+ "aria-hidden": !isActive
1086
+ }, props.children)) : null;
1087
+ });
1088
+ ContentComponent$1.displayName = 'Stepper.Content';
1089
+ var Content$1 = ContentComponent$1;
1090
+
1091
+ var _excluded$2 = ["isHorizontal", "activeIndex"];
1092
+ var StepperComponent = forwardRef(function (_ref, ref) {
1093
+ var isHorizontal = _ref.isHorizontal,
1094
+ activeIndex = _ref.activeIndex,
1095
+ props = _objectWithoutProperties(_ref, _excluded$2);
1096
+ var currentIndexRef = useRef(0);
1097
+ var stepperContext = useMemo(function () {
1098
+ return {
1099
+ isHorizontal: isHorizontal || false,
1100
+ activeIndex: activeIndex,
1101
+ currentIndexRef: currentIndexRef
1102
+ };
1103
+ }, [isHorizontal, activeIndex, currentIndexRef]);
1104
+ useEffect(function () {
1105
+ currentIndexRef.current = 0;
1106
+ });
1107
+ return React__default.createElement(StepperContext.Provider, {
1108
+ value: stepperContext
1109
+ }, React__default.createElement(StyledStepper, _extends$3({
1110
+ ref: ref,
1111
+ isHorizontal: isHorizontal
1112
+ }, props)));
1113
+ });
1114
+ StepperComponent.displayName = 'Stepper';
1115
+ StepperComponent.defaultProps = {
1116
+ activeIndex: 0
1117
+ };
1118
+ var Stepper = StepperComponent;
1119
+ Stepper.Content = Content$1;
1120
+ Stepper.Label = Label;
1121
+ Stepper.Step = Step;
1122
+
1109
1123
  var OppositeContentComponent = forwardRef(function (props, ref) {
1110
1124
  return React__default.createElement(StyledOppositeContent, _extends$3({
1111
1125
  ref: ref
@@ -4,35 +4,12 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import React, { HTMLAttributes } from 'react';
7
+ import React from 'react';
8
+ import { IAccordionProps } from '../../types';
8
9
  import { Section } from '../accordion/components/Section';
9
10
  import { Header } from '../accordion/components/Header';
10
11
  import { Label } from '../accordion/components/Label';
11
12
  import { Panel } from '../accordion/components/Panel';
12
- export interface IAccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
13
- /** Sets `aria-level` heading rank in the document structure */
14
- level: number;
15
- /** Sets the expanded sections in a controlled accordion */
16
- expandedSections?: number[];
17
- /** Sets the default expanded sections in an uncontrolled accordion */
18
- defaultExpandedSections?: number[];
19
- /** Hides section borders */
20
- isBare?: boolean;
21
- /** Allows uncontrolled accordion sections to collapse */
22
- isCollapsible?: boolean;
23
- /** Applies compact styling */
24
- isCompact?: boolean;
25
- /** Animates section expansion and collapse */
26
- isAnimated?: boolean;
27
- /** Enables simultaneous expansion of uncontrolled accordion sections */
28
- isExpandable?: boolean;
29
- /**
30
- * Handles accordion expansion changes
31
- *
32
- * @param {number} index A section index
33
- */
34
- onChange?: (index: number) => void;
35
- }
36
13
  /**
37
14
  * @extends HTMLAttributes<HTMLDivElement>
38
15
  */