@zendeskgarden/react-accordions 8.49.0 → 8.49.3
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.cjs.js +188 -188
- package/dist/index.esm.js +187 -187
- package/dist/typings/elements/accordion/Accordion.d.ts +2 -25
- package/dist/typings/elements/stepper/Stepper.d.ts +2 -7
- package/dist/typings/elements/stepper/components/Label.d.ts +2 -7
- package/dist/typings/elements/timeline/Timeline.d.ts +2 -5
- package/dist/typings/elements/timeline/components/Item.d.ts +2 -7
- package/dist/typings/index.d.ts +4 -6
- package/dist/typings/styled/accordion/StyledButton.d.ts +2 -1
- package/dist/typings/styled/accordion/StyledHeader.d.ts +2 -1
- package/dist/typings/styled/accordion/StyledInnerPanel.d.ts +2 -1
- package/dist/typings/styled/accordion/StyledPanel.d.ts +2 -1
- package/dist/typings/styled/accordion/StyledRotateIcon.d.ts +2 -1
- package/dist/typings/styled/stepper/StyledInnerContent.d.ts +2 -1
- package/dist/typings/styled/stepper/StyledStep.d.ts +2 -1
- package/dist/typings/styled/stepper/StyledStepper.d.ts +2 -1
- package/dist/typings/types/index.d.ts +53 -0
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
11
|
|
|
12
12
|
var React = require('react');
|
|
13
|
+
var containerAccordion = require('@zendeskgarden/container-accordion');
|
|
13
14
|
var styled = require('styled-components');
|
|
14
15
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
15
16
|
var polished = require('polished');
|
|
16
|
-
var PropTypes = require('prop-types');
|
|
17
|
-
var mergeRefs = require('react-merge-refs');
|
|
18
|
-
var debounce = require('lodash.debounce');
|
|
19
|
-
var containerAccordion = require('@zendeskgarden/container-accordion');
|
|
20
17
|
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
18
|
+
var debounce = require('lodash.debounce');
|
|
19
|
+
var mergeRefs = require('react-merge-refs');
|
|
20
|
+
var PropTypes = require('prop-types');
|
|
21
21
|
|
|
22
22
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
23
|
|
|
@@ -42,9 +42,9 @@ function _interopNamespace(e) {
|
|
|
42
42
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
43
43
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
44
44
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
45
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
46
|
-
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs);
|
|
47
45
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
46
|
+
var mergeRefs__default = /*#__PURE__*/_interopDefaultLegacy(mergeRefs);
|
|
47
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
48
48
|
|
|
49
49
|
function ownKeys(object, enumerableOnly) {
|
|
50
50
|
var keys = Object.keys(object);
|
|
@@ -215,7 +215,7 @@ var sizeStyles$1 = function sizeStyles(props) {
|
|
|
215
215
|
};
|
|
216
216
|
var StyledContent = styled__default["default"].div.attrs({
|
|
217
217
|
'data-garden-id': COMPONENT_ID$k,
|
|
218
|
-
'data-garden-version': '8.49.
|
|
218
|
+
'data-garden-version': '8.49.3'
|
|
219
219
|
}).withConfig({
|
|
220
220
|
displayName: "StyledContent",
|
|
221
221
|
componentId: "sc-mazvvo-0"
|
|
@@ -231,7 +231,7 @@ StyledContent.defaultProps = {
|
|
|
231
231
|
var COMPONENT_ID$j = 'accordions.step_line';
|
|
232
232
|
var StyledLine = styled__default["default"].div.attrs({
|
|
233
233
|
'data-garden-id': COMPONENT_ID$j,
|
|
234
|
-
'data-garden-version': '8.49.
|
|
234
|
+
'data-garden-version': '8.49.3'
|
|
235
235
|
}).withConfig({
|
|
236
236
|
displayName: "StyledLine",
|
|
237
237
|
componentId: "sc-1gkpjbr-0"
|
|
@@ -253,7 +253,7 @@ StyledLine.defaultProps = {
|
|
|
253
253
|
var COMPONENT_ID$i = 'accordions.step';
|
|
254
254
|
var StyledStep = styled__default["default"].li.attrs({
|
|
255
255
|
'data-garden-id': COMPONENT_ID$i,
|
|
256
|
-
'data-garden-version': '8.49.
|
|
256
|
+
'data-garden-version': '8.49.3'
|
|
257
257
|
}).withConfig({
|
|
258
258
|
displayName: "StyledStep",
|
|
259
259
|
componentId: "sc-12fiwtz-0"
|
|
@@ -283,7 +283,7 @@ StyledStep.defaultProps = {
|
|
|
283
283
|
var COMPONENT_ID$h = 'accordions.step_inner_content';
|
|
284
284
|
var StyledInnerContent = styled__default["default"].div.attrs({
|
|
285
285
|
'data-garden-id': COMPONENT_ID$h,
|
|
286
|
-
'data-garden-version': '8.49.
|
|
286
|
+
'data-garden-version': '8.49.3'
|
|
287
287
|
}).withConfig({
|
|
288
288
|
displayName: "StyledInnerContent",
|
|
289
289
|
componentId: "sc-1xs9fh7-0"
|
|
@@ -305,7 +305,7 @@ StyledInnerContent.defaultProps = {
|
|
|
305
305
|
var COMPONENT_ID$g = 'accordions.stepper';
|
|
306
306
|
var StyledStepper = styled__default["default"].ol.attrs({
|
|
307
307
|
'data-garden-id': COMPONENT_ID$g,
|
|
308
|
-
'data-garden-version': '8.49.
|
|
308
|
+
'data-garden-version': '8.49.3'
|
|
309
309
|
}).withConfig({
|
|
310
310
|
displayName: "StyledStepper",
|
|
311
311
|
componentId: "sc-dsxw0f-0"
|
|
@@ -333,7 +333,7 @@ var colorStyles$2 = function colorStyles(props) {
|
|
|
333
333
|
};
|
|
334
334
|
var StyledIcon = styled__default["default"].div.attrs({
|
|
335
335
|
'data-garden-id': COMPONENT_ID$f,
|
|
336
|
-
'data-garden-version': '8.49.
|
|
336
|
+
'data-garden-version': '8.49.3'
|
|
337
337
|
}).withConfig({
|
|
338
338
|
displayName: "StyledIcon",
|
|
339
339
|
componentId: "sc-v20nz9-1"
|
|
@@ -350,7 +350,7 @@ StyledIcon.defaultProps = {
|
|
|
350
350
|
var COMPONENT_ID$e = 'accordions.step_label';
|
|
351
351
|
var StyledLabel = styled__default["default"].div.attrs({
|
|
352
352
|
'data-garden-id': COMPONENT_ID$e,
|
|
353
|
-
'data-garden-version': '8.49.
|
|
353
|
+
'data-garden-version': '8.49.3'
|
|
354
354
|
}).withConfig({
|
|
355
355
|
displayName: "StyledLabel",
|
|
356
356
|
componentId: "sc-1o82llj-0"
|
|
@@ -378,7 +378,7 @@ StyledLabel.defaultProps = {
|
|
|
378
378
|
var COMPONENT_ID$d = 'accordions.step_label_text';
|
|
379
379
|
var StyledLabelText = styled__default["default"].div.attrs({
|
|
380
380
|
'data-garden-id': COMPONENT_ID$d,
|
|
381
|
-
'data-garden-version': '8.49.
|
|
381
|
+
'data-garden-version': '8.49.3'
|
|
382
382
|
}).withConfig({
|
|
383
383
|
displayName: "StyledLabelText",
|
|
384
384
|
componentId: "sc-111m5zo-0"
|
|
@@ -396,7 +396,7 @@ StyledLabelText.defaultProps = {
|
|
|
396
396
|
var COMPONENT_ID$c = 'accordions.accordion';
|
|
397
397
|
var StyledAccordion = styled__default["default"].div.attrs({
|
|
398
398
|
'data-garden-id': COMPONENT_ID$c,
|
|
399
|
-
'data-garden-version': '8.49.
|
|
399
|
+
'data-garden-version': '8.49.3'
|
|
400
400
|
}).withConfig({
|
|
401
401
|
displayName: "StyledAccordion",
|
|
402
402
|
componentId: "sc-niv9ic-0"
|
|
@@ -426,7 +426,7 @@ var paddingStyles = function paddingStyles(props) {
|
|
|
426
426
|
};
|
|
427
427
|
var StyledPanel = styled__default["default"].section.attrs({
|
|
428
428
|
'data-garden-id': COMPONENT_ID$b,
|
|
429
|
-
'data-garden-version': '8.49.
|
|
429
|
+
'data-garden-version': '8.49.3'
|
|
430
430
|
}).withConfig({
|
|
431
431
|
displayName: "StyledPanel",
|
|
432
432
|
componentId: "sc-1piryze-0"
|
|
@@ -443,7 +443,7 @@ StyledPanel.defaultProps = {
|
|
|
443
443
|
var COMPONENT_ID$a = 'accordions.section';
|
|
444
444
|
var StyledSection = styled__default["default"].div.attrs({
|
|
445
445
|
'data-garden-id': COMPONENT_ID$a,
|
|
446
|
-
'data-garden-version': '8.49.
|
|
446
|
+
'data-garden-version': '8.49.3'
|
|
447
447
|
}).withConfig({
|
|
448
448
|
displayName: "StyledSection",
|
|
449
449
|
componentId: "sc-v2t9bd-0"
|
|
@@ -457,7 +457,7 @@ StyledSection.defaultProps = {
|
|
|
457
457
|
var COMPONENT_ID$9 = 'accordions.header';
|
|
458
458
|
var StyledHeader = styled__default["default"].div.attrs({
|
|
459
459
|
'data-garden-id': COMPONENT_ID$9,
|
|
460
|
-
'data-garden-version': '8.49.
|
|
460
|
+
'data-garden-version': '8.49.3'
|
|
461
461
|
}).withConfig({
|
|
462
462
|
displayName: "StyledHeader",
|
|
463
463
|
componentId: "sc-2c6rbr-0"
|
|
@@ -485,7 +485,7 @@ var colorStyles$1 = function colorStyles(props) {
|
|
|
485
485
|
};
|
|
486
486
|
var StyledButton = styled__default["default"].button.attrs({
|
|
487
487
|
'data-garden-id': COMPONENT_ID$8,
|
|
488
|
-
'data-garden-version': '8.49.
|
|
488
|
+
'data-garden-version': '8.49.3'
|
|
489
489
|
}).withConfig({
|
|
490
490
|
displayName: "StyledButton",
|
|
491
491
|
componentId: "sc-xj3hy7-0"
|
|
@@ -511,7 +511,7 @@ StyledButton.defaultProps = {
|
|
|
511
511
|
var COMPONENT_ID$7 = 'accordions.step_inner_panel';
|
|
512
512
|
var StyledInnerPanel = styled__default["default"].div.attrs({
|
|
513
513
|
'data-garden-id': COMPONENT_ID$7,
|
|
514
|
-
'data-garden-version': '8.49.
|
|
514
|
+
'data-garden-version': '8.49.3'
|
|
515
515
|
}).withConfig({
|
|
516
516
|
displayName: "StyledInnerPanel",
|
|
517
517
|
componentId: "sc-8nbueg-0"
|
|
@@ -552,7 +552,7 @@ function (_ref) {
|
|
|
552
552
|
return React.cloneElement(React.Children.only(children), props);
|
|
553
553
|
}).attrs({
|
|
554
554
|
'data-garden-id': COMPONENT_ID$6,
|
|
555
|
-
'data-garden-version': '8.49.
|
|
555
|
+
'data-garden-version': '8.49.3'
|
|
556
556
|
}).withConfig({
|
|
557
557
|
displayName: "StyledRotateIcon",
|
|
558
558
|
componentId: "sc-hp435q-0"
|
|
@@ -574,7 +574,7 @@ StyledRotateIcon.defaultProps = {
|
|
|
574
574
|
var COMPONENT_ID$5 = 'timeline';
|
|
575
575
|
var StyledTimeline = styled__default["default"].ol.attrs({
|
|
576
576
|
'data-garden-id': COMPONENT_ID$5,
|
|
577
|
-
'data-garden-version': '8.49.
|
|
577
|
+
'data-garden-version': '8.49.3'
|
|
578
578
|
}).withConfig({
|
|
579
579
|
displayName: "StyledTimeline",
|
|
580
580
|
componentId: "sc-pig5kv-0"
|
|
@@ -588,7 +588,7 @@ StyledTimeline.defaultProps = {
|
|
|
588
588
|
var COMPONENT_ID$4 = 'timeline.content.separator';
|
|
589
589
|
var StyledSeparator = styled__default["default"].div.attrs({
|
|
590
590
|
'data-garden-id': COMPONENT_ID$4,
|
|
591
|
-
'data-garden-version': '8.49.
|
|
591
|
+
'data-garden-version': '8.49.3'
|
|
592
592
|
}).withConfig({
|
|
593
593
|
displayName: "StyledSeparator",
|
|
594
594
|
componentId: "sc-fki51e-0"
|
|
@@ -606,7 +606,7 @@ StyledSeparator.defaultProps = {
|
|
|
606
606
|
var COMPONENT_ID$3 = 'timeline.content';
|
|
607
607
|
var StyledTimelineContent = styled__default["default"].div.attrs({
|
|
608
608
|
'data-garden-id': COMPONENT_ID$3,
|
|
609
|
-
'data-garden-version': '8.49.
|
|
609
|
+
'data-garden-version': '8.49.3'
|
|
610
610
|
}).withConfig({
|
|
611
611
|
displayName: "StyledContent__StyledTimelineContent",
|
|
612
612
|
componentId: "sc-19phgu1-0"
|
|
@@ -622,7 +622,7 @@ StyledTimelineContent.defaultProps = {
|
|
|
622
622
|
var COMPONENT_ID$2 = 'timeline.opposite.content';
|
|
623
623
|
var StyledOppositeContent = styled__default["default"].div.attrs({
|
|
624
624
|
'data-garden-id': COMPONENT_ID$2,
|
|
625
|
-
'data-garden-version': '8.49.
|
|
625
|
+
'data-garden-version': '8.49.3'
|
|
626
626
|
}).withConfig({
|
|
627
627
|
displayName: "StyledOppositeContent",
|
|
628
628
|
componentId: "sc-jurh2k-0"
|
|
@@ -640,7 +640,7 @@ StyledOppositeContent.defaultProps = {
|
|
|
640
640
|
var COMPONENT_ID$1 = 'timeline.item';
|
|
641
641
|
var StyledTimelineItem = styled__default["default"].li.attrs({
|
|
642
642
|
'data-garden-id': COMPONENT_ID$1,
|
|
643
|
-
'data-garden-version': '8.49.
|
|
643
|
+
'data-garden-version': '8.49.3'
|
|
644
644
|
}).withConfig({
|
|
645
645
|
displayName: "StyledItem__StyledTimelineItem",
|
|
646
646
|
componentId: "sc-5mcnzm-0"
|
|
@@ -664,7 +664,7 @@ var StyledItemIcon = styled__default["default"](function (_ref) {
|
|
|
664
664
|
return React.cloneElement(React.Children.only(children), props);
|
|
665
665
|
}).attrs({
|
|
666
666
|
'data-garden-id': COMPONENT_ID,
|
|
667
|
-
'data-garden-version': '8.49.
|
|
667
|
+
'data-garden-version': '8.49.3'
|
|
668
668
|
}).withConfig({
|
|
669
669
|
displayName: "StyledItemIcon",
|
|
670
670
|
componentId: "sc-vz2l6e-0"
|
|
@@ -748,155 +748,6 @@ var useTimelineItemContext = function useTimelineItemContext() {
|
|
|
748
748
|
return context;
|
|
749
749
|
};
|
|
750
750
|
|
|
751
|
-
var StepComponent = React.forwardRef(function (props, ref) {
|
|
752
|
-
var _useStepperContext = useStepperContext(),
|
|
753
|
-
currentIndexRef = _useStepperContext.currentIndexRef,
|
|
754
|
-
isHorizontal = _useStepperContext.isHorizontal;
|
|
755
|
-
var _useState = React.useState(currentIndexRef.current),
|
|
756
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
757
|
-
currentStepIndex = _useState2[0],
|
|
758
|
-
setIndex = _useState2[1];
|
|
759
|
-
React.useLayoutEffect(function () {
|
|
760
|
-
setIndex(currentIndexRef.current);
|
|
761
|
-
currentIndexRef.current++;
|
|
762
|
-
var currentIndex = currentIndexRef;
|
|
763
|
-
return function () {
|
|
764
|
-
currentIndex.current--;
|
|
765
|
-
};
|
|
766
|
-
}, [currentIndexRef]);
|
|
767
|
-
var value = React.useMemo(function () {
|
|
768
|
-
return {
|
|
769
|
-
currentStepIndex: currentStepIndex
|
|
770
|
-
};
|
|
771
|
-
}, [currentStepIndex]);
|
|
772
|
-
return React__default["default"].createElement(StepContext.Provider, {
|
|
773
|
-
value: value
|
|
774
|
-
}, React__default["default"].createElement(StyledStep, _extends$3({
|
|
775
|
-
ref: ref,
|
|
776
|
-
isHorizontal: isHorizontal
|
|
777
|
-
}, props), isHorizontal && React__default["default"].createElement(StyledLine, null), props.children));
|
|
778
|
-
});
|
|
779
|
-
StepComponent.displayName = 'Stepper.Step';
|
|
780
|
-
var Step = StepComponent;
|
|
781
|
-
|
|
782
|
-
var _path$1;
|
|
783
|
-
|
|
784
|
-
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); }
|
|
785
|
-
|
|
786
|
-
var SvgCheckSmStroke = function SvgCheckSmStroke(props) {
|
|
787
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
788
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
789
|
-
width: 16,
|
|
790
|
-
height: 16,
|
|
791
|
-
focusable: "false",
|
|
792
|
-
viewBox: "0 0 16 16",
|
|
793
|
-
"aria-hidden": "true"
|
|
794
|
-
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
795
|
-
fill: "none",
|
|
796
|
-
stroke: "currentColor",
|
|
797
|
-
strokeLinecap: "round",
|
|
798
|
-
strokeLinejoin: "round",
|
|
799
|
-
strokeWidth: 1.25,
|
|
800
|
-
d: "M3 9l3 3 7-7"
|
|
801
|
-
})));
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
var LabelComponent$1 = React.forwardRef(function (props, ref) {
|
|
805
|
-
var _useStepContext = useStepContext(),
|
|
806
|
-
currentStepIndex = _useStepContext.currentStepIndex;
|
|
807
|
-
var _useStepperContext = useStepperContext(),
|
|
808
|
-
activeIndex = _useStepperContext.activeIndex,
|
|
809
|
-
isHorizontal = _useStepperContext.isHorizontal;
|
|
810
|
-
var numericStep = currentStepIndex + 1;
|
|
811
|
-
var stepIcon = props.icon || numericStep;
|
|
812
|
-
var isActive = activeIndex === currentStepIndex;
|
|
813
|
-
var isCompleted = activeIndex > currentStepIndex;
|
|
814
|
-
var styledIcon = React__default["default"].createElement(StyledIcon, {
|
|
815
|
-
isActive: isActive,
|
|
816
|
-
isHorizontal: isHorizontal
|
|
817
|
-
}, isCompleted ? React__default["default"].createElement(SvgCheckSmStroke, null) : stepIcon);
|
|
818
|
-
return React__default["default"].createElement(StyledLabel, _extends$3({
|
|
819
|
-
ref: ref,
|
|
820
|
-
isActive: isActive,
|
|
821
|
-
isHorizontal: isHorizontal
|
|
822
|
-
}, props), isHorizontal ? React__default["default"].createElement(StyledIconFlexContainer, null, styledIcon) : styledIcon, React__default["default"].createElement(StyledLabelText, {
|
|
823
|
-
isHidden: props.isHidden,
|
|
824
|
-
isHorizontal: isHorizontal
|
|
825
|
-
}, props.children));
|
|
826
|
-
});
|
|
827
|
-
LabelComponent$1.displayName = 'Stepper.Label';
|
|
828
|
-
LabelComponent$1.propTypes = {
|
|
829
|
-
icon: PropTypes__default["default"].node,
|
|
830
|
-
isHidden: PropTypes__default["default"].bool
|
|
831
|
-
};
|
|
832
|
-
var Label$1 = LabelComponent$1;
|
|
833
|
-
|
|
834
|
-
var ContentComponent$1 = React.forwardRef(function (props, ref) {
|
|
835
|
-
var contentRef = React.useRef();
|
|
836
|
-
var _useStepperContext = useStepperContext(),
|
|
837
|
-
activeIndex = _useStepperContext.activeIndex,
|
|
838
|
-
isHorizontal = _useStepperContext.isHorizontal;
|
|
839
|
-
var _useStepContext = useStepContext(),
|
|
840
|
-
currentStepIndex = _useStepContext.currentStepIndex;
|
|
841
|
-
var isActive = currentStepIndex === activeIndex;
|
|
842
|
-
var updateMaxHeight = React.useCallback(debounce__default["default"](function () {
|
|
843
|
-
if (contentRef.current) {
|
|
844
|
-
var child = contentRef.current.children[0];
|
|
845
|
-
child.style.maxHeight = "".concat(child.scrollHeight, "px");
|
|
846
|
-
}
|
|
847
|
-
}, 100), [contentRef]);
|
|
848
|
-
React.useEffect(function () {
|
|
849
|
-
if (isActive && isHorizontal === false) {
|
|
850
|
-
addEventListener('resize', updateMaxHeight);
|
|
851
|
-
updateMaxHeight();
|
|
852
|
-
return function () {
|
|
853
|
-
removeEventListener('resize', updateMaxHeight);
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
return undefined;
|
|
857
|
-
}, [isActive, isHorizontal, props.children, updateMaxHeight]);
|
|
858
|
-
return isHorizontal === false ? React__default["default"].createElement(StyledContent, _extends$3({
|
|
859
|
-
ref: mergeRefs__default["default"]([contentRef, ref]),
|
|
860
|
-
isActive: isActive
|
|
861
|
-
}, props), React__default["default"].createElement(StyledInnerContent, {
|
|
862
|
-
isActive: isActive
|
|
863
|
-
}, props.children)) : null;
|
|
864
|
-
});
|
|
865
|
-
ContentComponent$1.displayName = 'Stepper.Content';
|
|
866
|
-
var Content$1 = ContentComponent$1;
|
|
867
|
-
|
|
868
|
-
var _excluded$4 = ["isHorizontal", "activeIndex"];
|
|
869
|
-
var StepperComponent = React.forwardRef(function (_ref, ref) {
|
|
870
|
-
var isHorizontal = _ref.isHorizontal,
|
|
871
|
-
activeIndex = _ref.activeIndex,
|
|
872
|
-
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
873
|
-
var currentIndexRef = React.useRef(0);
|
|
874
|
-
var stepperContext = React.useMemo(function () {
|
|
875
|
-
return {
|
|
876
|
-
isHorizontal: isHorizontal || false,
|
|
877
|
-
activeIndex: activeIndex,
|
|
878
|
-
currentIndexRef: currentIndexRef
|
|
879
|
-
};
|
|
880
|
-
}, [isHorizontal, activeIndex, currentIndexRef]);
|
|
881
|
-
React.useEffect(function () {
|
|
882
|
-
currentIndexRef.current = 0;
|
|
883
|
-
});
|
|
884
|
-
return React__default["default"].createElement(StepperContext.Provider, {
|
|
885
|
-
value: stepperContext
|
|
886
|
-
}, React__default["default"].createElement(StyledStepper, _extends$3({
|
|
887
|
-
ref: ref,
|
|
888
|
-
isHorizontal: isHorizontal
|
|
889
|
-
}, props)));
|
|
890
|
-
});
|
|
891
|
-
StepperComponent.displayName = 'Stepper';
|
|
892
|
-
StepperComponent.defaultProps = {
|
|
893
|
-
activeIndex: 0
|
|
894
|
-
};
|
|
895
|
-
var Stepper = StepperComponent;
|
|
896
|
-
Stepper.Content = Content$1;
|
|
897
|
-
Stepper.Label = Label$1;
|
|
898
|
-
Stepper.Step = Step;
|
|
899
|
-
|
|
900
751
|
var SectionComponent = React.forwardRef(function (props, ref) {
|
|
901
752
|
var _useAccordionContext = useAccordionContext(),
|
|
902
753
|
currentIndexRef = _useAccordionContext.currentIndexRef;
|
|
@@ -911,25 +762,25 @@ var SectionComponent = React.forwardRef(function (props, ref) {
|
|
|
911
762
|
SectionComponent.displayName = 'Accordion.Section';
|
|
912
763
|
var Section = SectionComponent;
|
|
913
764
|
|
|
914
|
-
var _path;
|
|
765
|
+
var _path$1;
|
|
915
766
|
|
|
916
|
-
function _extends$
|
|
767
|
+
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); }
|
|
917
768
|
|
|
918
769
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
919
|
-
return /*#__PURE__*/React__namespace.createElement("svg", _extends$
|
|
770
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
920
771
|
xmlns: "http://www.w3.org/2000/svg",
|
|
921
772
|
width: 16,
|
|
922
773
|
height: 16,
|
|
923
774
|
focusable: "false",
|
|
924
775
|
viewBox: "0 0 16 16",
|
|
925
776
|
"aria-hidden": "true"
|
|
926
|
-
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
777
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
927
778
|
fill: "currentColor",
|
|
928
779
|
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"
|
|
929
780
|
})));
|
|
930
781
|
};
|
|
931
782
|
|
|
932
|
-
var _excluded$
|
|
783
|
+
var _excluded$4 = ["onClick", "onFocus", "onBlur", "onMouseOver", "onMouseOut", "children"],
|
|
933
784
|
_excluded2 = ["onClick", "onKeyDown"];
|
|
934
785
|
var HeaderComponent = React.forwardRef(function (props, ref) {
|
|
935
786
|
var _useAccordionContext = useAccordionContext(),
|
|
@@ -945,7 +796,7 @@ var HeaderComponent = React.forwardRef(function (props, ref) {
|
|
|
945
796
|
onMouseOver = props.onMouseOver,
|
|
946
797
|
onMouseOut = props.onMouseOut,
|
|
947
798
|
children = props.children,
|
|
948
|
-
other = _objectWithoutProperties(props, _excluded$
|
|
799
|
+
other = _objectWithoutProperties(props, _excluded$4);
|
|
949
800
|
var sectionIndex = useSectionContext();
|
|
950
801
|
var _useState = React.useState(false),
|
|
951
802
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -1015,7 +866,7 @@ var HeaderComponent = React.forwardRef(function (props, ref) {
|
|
|
1015
866
|
HeaderComponent.displayName = 'Accordion.Header';
|
|
1016
867
|
var Header = HeaderComponent;
|
|
1017
868
|
|
|
1018
|
-
var LabelComponent = React.forwardRef(function (props, ref) {
|
|
869
|
+
var LabelComponent$1 = React.forwardRef(function (props, ref) {
|
|
1019
870
|
var sectionIndex = useSectionContext();
|
|
1020
871
|
var _useAccordionContext = useAccordionContext(),
|
|
1021
872
|
isCompact = _useAccordionContext.isCompact,
|
|
@@ -1033,8 +884,8 @@ var LabelComponent = React.forwardRef(function (props, ref) {
|
|
|
1033
884
|
isCollapsible: isCollapsible
|
|
1034
885
|
}, otherTriggerProps, props));
|
|
1035
886
|
});
|
|
1036
|
-
LabelComponent.displayName = 'Accordion.Label';
|
|
1037
|
-
var Label = LabelComponent;
|
|
887
|
+
LabelComponent$1.displayName = 'Accordion.Label';
|
|
888
|
+
var Label$1 = LabelComponent$1;
|
|
1038
889
|
|
|
1039
890
|
var PanelComponent = React.forwardRef(function (props, ref) {
|
|
1040
891
|
var _useAccordionContext = useAccordionContext(),
|
|
@@ -1078,7 +929,7 @@ var PanelComponent = React.forwardRef(function (props, ref) {
|
|
|
1078
929
|
PanelComponent.displayName = 'Accordion.Panel';
|
|
1079
930
|
var Panel = PanelComponent;
|
|
1080
931
|
|
|
1081
|
-
var _excluded$
|
|
932
|
+
var _excluded$3 = ["level", "isBare", "onChange", "isCompact", "isAnimated", "isExpandable", "isCollapsible", "defaultExpandedSections", "expandedSections"];
|
|
1082
933
|
var AccordionComponent = React.forwardRef(function (_ref, ref) {
|
|
1083
934
|
var level = _ref.level,
|
|
1084
935
|
isBare = _ref.isBare,
|
|
@@ -1089,7 +940,7 @@ var AccordionComponent = React.forwardRef(function (_ref, ref) {
|
|
|
1089
940
|
isCollapsible = _ref.isCollapsible,
|
|
1090
941
|
defaultExpandedSections = _ref.defaultExpandedSections,
|
|
1091
942
|
controlledExpandedSections = _ref.expandedSections,
|
|
1092
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
943
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1093
944
|
var _useAccordion = containerAccordion.useAccordion({
|
|
1094
945
|
collapsible: isCollapsible,
|
|
1095
946
|
expandable: isExpandable || false,
|
|
@@ -1132,10 +983,159 @@ AccordionComponent.defaultProps = {
|
|
|
1132
983
|
};
|
|
1133
984
|
var Accordion = AccordionComponent;
|
|
1134
985
|
Accordion.Header = Header;
|
|
1135
|
-
Accordion.Label = Label;
|
|
986
|
+
Accordion.Label = Label$1;
|
|
1136
987
|
Accordion.Panel = Panel;
|
|
1137
988
|
Accordion.Section = Section;
|
|
1138
989
|
|
|
990
|
+
var StepComponent = React.forwardRef(function (props, ref) {
|
|
991
|
+
var _useStepperContext = useStepperContext(),
|
|
992
|
+
currentIndexRef = _useStepperContext.currentIndexRef,
|
|
993
|
+
isHorizontal = _useStepperContext.isHorizontal;
|
|
994
|
+
var _useState = React.useState(currentIndexRef.current),
|
|
995
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
996
|
+
currentStepIndex = _useState2[0],
|
|
997
|
+
setIndex = _useState2[1];
|
|
998
|
+
React.useLayoutEffect(function () {
|
|
999
|
+
setIndex(currentIndexRef.current);
|
|
1000
|
+
currentIndexRef.current++;
|
|
1001
|
+
var currentIndex = currentIndexRef;
|
|
1002
|
+
return function () {
|
|
1003
|
+
currentIndex.current--;
|
|
1004
|
+
};
|
|
1005
|
+
}, [currentIndexRef]);
|
|
1006
|
+
var value = React.useMemo(function () {
|
|
1007
|
+
return {
|
|
1008
|
+
currentStepIndex: currentStepIndex
|
|
1009
|
+
};
|
|
1010
|
+
}, [currentStepIndex]);
|
|
1011
|
+
return React__default["default"].createElement(StepContext.Provider, {
|
|
1012
|
+
value: value
|
|
1013
|
+
}, React__default["default"].createElement(StyledStep, _extends$3({
|
|
1014
|
+
ref: ref,
|
|
1015
|
+
isHorizontal: isHorizontal
|
|
1016
|
+
}, props), isHorizontal && React__default["default"].createElement(StyledLine, null), props.children));
|
|
1017
|
+
});
|
|
1018
|
+
StepComponent.displayName = 'Stepper.Step';
|
|
1019
|
+
var Step = StepComponent;
|
|
1020
|
+
|
|
1021
|
+
var _path;
|
|
1022
|
+
|
|
1023
|
+
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); }
|
|
1024
|
+
|
|
1025
|
+
var SvgCheckSmStroke = function SvgCheckSmStroke(props) {
|
|
1026
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
1027
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1028
|
+
width: 16,
|
|
1029
|
+
height: 16,
|
|
1030
|
+
focusable: "false",
|
|
1031
|
+
viewBox: "0 0 16 16",
|
|
1032
|
+
"aria-hidden": "true"
|
|
1033
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
1034
|
+
fill: "none",
|
|
1035
|
+
stroke: "currentColor",
|
|
1036
|
+
strokeLinecap: "round",
|
|
1037
|
+
strokeLinejoin: "round",
|
|
1038
|
+
strokeWidth: 1.25,
|
|
1039
|
+
d: "M3 9l3 3 7-7"
|
|
1040
|
+
})));
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
var LabelComponent = React.forwardRef(function (props, ref) {
|
|
1044
|
+
var _useStepContext = useStepContext(),
|
|
1045
|
+
currentStepIndex = _useStepContext.currentStepIndex;
|
|
1046
|
+
var _useStepperContext = useStepperContext(),
|
|
1047
|
+
activeIndex = _useStepperContext.activeIndex,
|
|
1048
|
+
isHorizontal = _useStepperContext.isHorizontal;
|
|
1049
|
+
var numericStep = currentStepIndex + 1;
|
|
1050
|
+
var stepIcon = props.icon || numericStep;
|
|
1051
|
+
var isActive = activeIndex === currentStepIndex;
|
|
1052
|
+
var isCompleted = activeIndex > currentStepIndex;
|
|
1053
|
+
var styledIcon = React__default["default"].createElement(StyledIcon, {
|
|
1054
|
+
isActive: isActive,
|
|
1055
|
+
isHorizontal: isHorizontal
|
|
1056
|
+
}, isCompleted ? React__default["default"].createElement(SvgCheckSmStroke, null) : stepIcon);
|
|
1057
|
+
return React__default["default"].createElement(StyledLabel, _extends$3({
|
|
1058
|
+
ref: ref,
|
|
1059
|
+
isActive: isActive,
|
|
1060
|
+
isHorizontal: isHorizontal
|
|
1061
|
+
}, props), isHorizontal ? React__default["default"].createElement(StyledIconFlexContainer, null, styledIcon) : styledIcon, React__default["default"].createElement(StyledLabelText, {
|
|
1062
|
+
isHidden: props.isHidden,
|
|
1063
|
+
isHorizontal: isHorizontal
|
|
1064
|
+
}, props.children));
|
|
1065
|
+
});
|
|
1066
|
+
LabelComponent.displayName = 'Stepper.Label';
|
|
1067
|
+
LabelComponent.propTypes = {
|
|
1068
|
+
icon: PropTypes__default["default"].node,
|
|
1069
|
+
isHidden: PropTypes__default["default"].bool
|
|
1070
|
+
};
|
|
1071
|
+
var Label = LabelComponent;
|
|
1072
|
+
|
|
1073
|
+
var ContentComponent$1 = React.forwardRef(function (props, ref) {
|
|
1074
|
+
var contentRef = React.useRef();
|
|
1075
|
+
var _useStepperContext = useStepperContext(),
|
|
1076
|
+
activeIndex = _useStepperContext.activeIndex,
|
|
1077
|
+
isHorizontal = _useStepperContext.isHorizontal;
|
|
1078
|
+
var _useStepContext = useStepContext(),
|
|
1079
|
+
currentStepIndex = _useStepContext.currentStepIndex;
|
|
1080
|
+
var isActive = currentStepIndex === activeIndex;
|
|
1081
|
+
var updateMaxHeight = React.useCallback(debounce__default["default"](function () {
|
|
1082
|
+
if (contentRef.current) {
|
|
1083
|
+
var child = contentRef.current.children[0];
|
|
1084
|
+
child.style.maxHeight = "".concat(child.scrollHeight, "px");
|
|
1085
|
+
}
|
|
1086
|
+
}, 100), [contentRef]);
|
|
1087
|
+
React.useEffect(function () {
|
|
1088
|
+
if (isActive && isHorizontal === false) {
|
|
1089
|
+
addEventListener('resize', updateMaxHeight);
|
|
1090
|
+
updateMaxHeight();
|
|
1091
|
+
return function () {
|
|
1092
|
+
removeEventListener('resize', updateMaxHeight);
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
return undefined;
|
|
1096
|
+
}, [isActive, isHorizontal, props.children, updateMaxHeight]);
|
|
1097
|
+
return isHorizontal === false ? React__default["default"].createElement(StyledContent, _extends$3({
|
|
1098
|
+
ref: mergeRefs__default["default"]([contentRef, ref]),
|
|
1099
|
+
isActive: isActive
|
|
1100
|
+
}, props), React__default["default"].createElement(StyledInnerContent, {
|
|
1101
|
+
isActive: isActive
|
|
1102
|
+
}, props.children)) : null;
|
|
1103
|
+
});
|
|
1104
|
+
ContentComponent$1.displayName = 'Stepper.Content';
|
|
1105
|
+
var Content$1 = ContentComponent$1;
|
|
1106
|
+
|
|
1107
|
+
var _excluded$2 = ["isHorizontal", "activeIndex"];
|
|
1108
|
+
var StepperComponent = React.forwardRef(function (_ref, ref) {
|
|
1109
|
+
var isHorizontal = _ref.isHorizontal,
|
|
1110
|
+
activeIndex = _ref.activeIndex,
|
|
1111
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1112
|
+
var currentIndexRef = React.useRef(0);
|
|
1113
|
+
var stepperContext = React.useMemo(function () {
|
|
1114
|
+
return {
|
|
1115
|
+
isHorizontal: isHorizontal || false,
|
|
1116
|
+
activeIndex: activeIndex,
|
|
1117
|
+
currentIndexRef: currentIndexRef
|
|
1118
|
+
};
|
|
1119
|
+
}, [isHorizontal, activeIndex, currentIndexRef]);
|
|
1120
|
+
React.useEffect(function () {
|
|
1121
|
+
currentIndexRef.current = 0;
|
|
1122
|
+
});
|
|
1123
|
+
return React__default["default"].createElement(StepperContext.Provider, {
|
|
1124
|
+
value: stepperContext
|
|
1125
|
+
}, React__default["default"].createElement(StyledStepper, _extends$3({
|
|
1126
|
+
ref: ref,
|
|
1127
|
+
isHorizontal: isHorizontal
|
|
1128
|
+
}, props)));
|
|
1129
|
+
});
|
|
1130
|
+
StepperComponent.displayName = 'Stepper';
|
|
1131
|
+
StepperComponent.defaultProps = {
|
|
1132
|
+
activeIndex: 0
|
|
1133
|
+
};
|
|
1134
|
+
var Stepper = StepperComponent;
|
|
1135
|
+
Stepper.Content = Content$1;
|
|
1136
|
+
Stepper.Label = Label;
|
|
1137
|
+
Stepper.Step = Step;
|
|
1138
|
+
|
|
1139
1139
|
var OppositeContentComponent = React.forwardRef(function (props, ref) {
|
|
1140
1140
|
return React__default["default"].createElement(StyledOppositeContent, _extends$3({
|
|
1141
1141
|
ref: ref
|