@zendeskgarden/react-accordions 9.0.0-next.1 → 9.0.0-next.11
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/esm/elements/accordion/Accordion.js +111 -0
- package/dist/esm/elements/accordion/components/Header.js +96 -0
- package/dist/esm/elements/accordion/components/Label.js +60 -0
- package/dist/esm/elements/accordion/components/Panel.js +70 -0
- package/dist/esm/elements/accordion/components/Section.js +36 -0
- package/dist/esm/elements/stepper/Stepper.js +77 -0
- package/dist/esm/elements/stepper/components/Content.js +52 -0
- package/dist/esm/elements/stepper/components/Label.js +76 -0
- package/dist/esm/elements/stepper/components/Step.js +53 -0
- package/dist/esm/elements/timeline/Timeline.js +60 -0
- package/dist/esm/elements/timeline/components/Content.js +52 -0
- package/dist/esm/elements/timeline/components/Item.js +70 -0
- package/dist/esm/elements/timeline/components/OppositeContent.js +36 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/circle-full-stroke.svg.js +28 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-sm-stroke.svg.js +29 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
- package/dist/esm/styled/accordion/StyledAccordion.js +22 -0
- package/dist/esm/styled/accordion/StyledButton.js +30 -0
- package/dist/esm/styled/accordion/StyledHeader.js +27 -0
- package/dist/esm/styled/accordion/StyledInnerPanel.js +23 -0
- package/dist/esm/styled/accordion/StyledPanel.js +53 -0
- package/dist/esm/styled/accordion/StyledRotateIcon.js +30 -0
- package/dist/esm/styled/accordion/StyledSection.js +23 -0
- package/dist/esm/styled/stepper/StyledContent.js +35 -0
- package/dist/esm/styled/stepper/StyledIcon.js +37 -0
- package/dist/esm/styled/stepper/StyledInnerContent.js +22 -0
- package/dist/esm/styled/stepper/StyledLabel.js +22 -0
- package/dist/esm/styled/stepper/StyledLabelText.js +22 -0
- package/dist/esm/styled/stepper/StyledLine.js +22 -0
- package/dist/esm/styled/stepper/StyledStep.js +24 -0
- package/dist/esm/styled/stepper/StyledStepper.js +22 -0
- package/dist/esm/styled/timeline/StyledContent.js +22 -0
- package/dist/esm/styled/timeline/StyledItem.js +25 -0
- package/dist/esm/styled/timeline/StyledItemIcon.js +23 -0
- package/dist/esm/styled/timeline/StyledOppositeContent.js +22 -0
- package/dist/esm/styled/timeline/StyledSeparator.js +22 -0
- package/dist/esm/styled/timeline/StyledTimeline.js +22 -0
- package/dist/esm/utils/useAccordionContext.js +18 -0
- package/dist/esm/utils/useHeaderContext.js +18 -0
- package/dist/esm/utils/useSectionContext.js +18 -0
- package/dist/esm/utils/useStepContext.js +18 -0
- package/dist/esm/utils/useStepperContext.js +18 -0
- package/dist/esm/utils/useTimelineContext.js +18 -0
- package/dist/esm/utils/useTimelineItemContext.js +18 -0
- package/dist/index.cjs.js +81 -132
- package/dist/typings/elements/timeline/components/Item.d.ts +0 -4
- package/dist/typings/index.d.ts +0 -2
- package/dist/typings/styled/accordion/StyledHeader.d.ts +0 -1
- package/dist/typings/styled/accordion/StyledRotateIcon.d.ts +5 -2
- package/dist/typings/styled/timeline/StyledItemIcon.d.ts +2 -2
- package/dist/typings/types/index.d.ts +3 -3
- package/package.json +6 -6
- package/dist/index.esm.js +0 -881
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef, useMemo, Children, isValidElement } from 'react';
|
|
8
|
+
import { useAccordion } from '@zendeskgarden/container-accordion';
|
|
9
|
+
import '../../styled/stepper/StyledStep.js';
|
|
10
|
+
import '../../styled/stepper/StyledContent.js';
|
|
11
|
+
import '../../styled/stepper/StyledInnerContent.js';
|
|
12
|
+
import '../../styled/stepper/StyledLine.js';
|
|
13
|
+
import '../../styled/stepper/StyledStepper.js';
|
|
14
|
+
import '../../styled/stepper/StyledIcon.js';
|
|
15
|
+
import '../../styled/stepper/StyledLabel.js';
|
|
16
|
+
import '../../styled/stepper/StyledLabelText.js';
|
|
17
|
+
import { StyledAccordion } from '../../styled/accordion/StyledAccordion.js';
|
|
18
|
+
import '../../styled/accordion/StyledSection.js';
|
|
19
|
+
import '../../styled/accordion/StyledHeader.js';
|
|
20
|
+
import '../../styled/accordion/StyledButton.js';
|
|
21
|
+
import '../../styled/accordion/StyledPanel.js';
|
|
22
|
+
import '../../styled/accordion/StyledInnerPanel.js';
|
|
23
|
+
import '../../styled/accordion/StyledRotateIcon.js';
|
|
24
|
+
import '../../styled/timeline/StyledTimeline.js';
|
|
25
|
+
import '../../styled/timeline/StyledItem.js';
|
|
26
|
+
import '../../styled/timeline/StyledItemIcon.js';
|
|
27
|
+
import '../../styled/timeline/StyledContent.js';
|
|
28
|
+
import '../../styled/timeline/StyledOppositeContent.js';
|
|
29
|
+
import '../../styled/timeline/StyledSeparator.js';
|
|
30
|
+
import '../../utils/useStepperContext.js';
|
|
31
|
+
import '../../utils/useStepContext.js';
|
|
32
|
+
import { AccordionContext } from '../../utils/useAccordionContext.js';
|
|
33
|
+
import { SectionContext } from '../../utils/useSectionContext.js';
|
|
34
|
+
import '../../utils/useHeaderContext.js';
|
|
35
|
+
import '../../utils/useTimelineContext.js';
|
|
36
|
+
import '../../utils/useTimelineItemContext.js';
|
|
37
|
+
import { Section } from './components/Section.js';
|
|
38
|
+
import { Header } from './components/Header.js';
|
|
39
|
+
import { Label } from './components/Label.js';
|
|
40
|
+
import { Panel } from './components/Panel.js';
|
|
41
|
+
|
|
42
|
+
const AccordionComponent = forwardRef((_ref, ref) => {
|
|
43
|
+
let {
|
|
44
|
+
children,
|
|
45
|
+
isBare,
|
|
46
|
+
isCompact,
|
|
47
|
+
isAnimated,
|
|
48
|
+
isExpandable,
|
|
49
|
+
isCollapsible,
|
|
50
|
+
level,
|
|
51
|
+
onChange,
|
|
52
|
+
defaultExpandedSections,
|
|
53
|
+
expandedSections: controlledExpandedSections,
|
|
54
|
+
...props
|
|
55
|
+
} = _ref;
|
|
56
|
+
const {
|
|
57
|
+
sections,
|
|
58
|
+
sectionChildren
|
|
59
|
+
} = useMemo(() => Children.toArray(children).filter(isValidElement).map((child, index) => React__default.createElement(SectionContext.Provider, {
|
|
60
|
+
key: index,
|
|
61
|
+
value: index
|
|
62
|
+
}, child)).reduce((acc, child, index) => {
|
|
63
|
+
acc.sectionChildren.push(child);
|
|
64
|
+
acc.sections.push(index);
|
|
65
|
+
return acc;
|
|
66
|
+
}, {
|
|
67
|
+
sectionChildren: [],
|
|
68
|
+
sections: []
|
|
69
|
+
}), [children]);
|
|
70
|
+
const {
|
|
71
|
+
expandedSections,
|
|
72
|
+
getHeaderProps,
|
|
73
|
+
getTriggerProps,
|
|
74
|
+
getPanelProps
|
|
75
|
+
} = useAccordion({
|
|
76
|
+
sections,
|
|
77
|
+
defaultExpandedSections,
|
|
78
|
+
expandedSections: controlledExpandedSections,
|
|
79
|
+
collapsible: isCollapsible,
|
|
80
|
+
expandable: isExpandable || false,
|
|
81
|
+
onChange
|
|
82
|
+
});
|
|
83
|
+
const accordionContextValue = useMemo(() => ({
|
|
84
|
+
level,
|
|
85
|
+
isBare,
|
|
86
|
+
isCompact,
|
|
87
|
+
isAnimated,
|
|
88
|
+
isCollapsible,
|
|
89
|
+
getPanelProps,
|
|
90
|
+
getHeaderProps,
|
|
91
|
+
getTriggerProps,
|
|
92
|
+
expandedSections
|
|
93
|
+
}), [level, isBare, isCompact, isAnimated, isCollapsible, getPanelProps, getHeaderProps, getTriggerProps, expandedSections]);
|
|
94
|
+
return React__default.createElement(AccordionContext.Provider, {
|
|
95
|
+
value: accordionContextValue
|
|
96
|
+
}, React__default.createElement(StyledAccordion, Object.assign({
|
|
97
|
+
ref: ref
|
|
98
|
+
}, props), sectionChildren));
|
|
99
|
+
});
|
|
100
|
+
AccordionComponent.displayName = 'Accordion';
|
|
101
|
+
AccordionComponent.defaultProps = {
|
|
102
|
+
isAnimated: true,
|
|
103
|
+
isCollapsible: true
|
|
104
|
+
};
|
|
105
|
+
const Accordion = AccordionComponent;
|
|
106
|
+
Accordion.Header = Header;
|
|
107
|
+
Accordion.Label = Label;
|
|
108
|
+
Accordion.Panel = Panel;
|
|
109
|
+
Accordion.Section = Section;
|
|
110
|
+
|
|
111
|
+
export { Accordion };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef, useState, useMemo } from 'react';
|
|
8
|
+
import { composeEventHandlers } from '@zendeskgarden/container-utilities';
|
|
9
|
+
import SvgChevronDownStroke from '../../../node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js';
|
|
10
|
+
import '../../../utils/useStepperContext.js';
|
|
11
|
+
import '../../../utils/useStepContext.js';
|
|
12
|
+
import { useAccordionContext } from '../../../utils/useAccordionContext.js';
|
|
13
|
+
import { useSectionContext } from '../../../utils/useSectionContext.js';
|
|
14
|
+
import { HeaderContext } from '../../../utils/useHeaderContext.js';
|
|
15
|
+
import '../../../utils/useTimelineContext.js';
|
|
16
|
+
import '../../../utils/useTimelineItemContext.js';
|
|
17
|
+
import '../../../styled/stepper/StyledStep.js';
|
|
18
|
+
import '../../../styled/stepper/StyledContent.js';
|
|
19
|
+
import '../../../styled/stepper/StyledInnerContent.js';
|
|
20
|
+
import '../../../styled/stepper/StyledLine.js';
|
|
21
|
+
import '../../../styled/stepper/StyledStepper.js';
|
|
22
|
+
import '../../../styled/stepper/StyledIcon.js';
|
|
23
|
+
import '../../../styled/stepper/StyledLabel.js';
|
|
24
|
+
import '../../../styled/stepper/StyledLabelText.js';
|
|
25
|
+
import '../../../styled/accordion/StyledAccordion.js';
|
|
26
|
+
import '../../../styled/accordion/StyledSection.js';
|
|
27
|
+
import { StyledHeader } from '../../../styled/accordion/StyledHeader.js';
|
|
28
|
+
import '../../../styled/accordion/StyledButton.js';
|
|
29
|
+
import '../../../styled/accordion/StyledPanel.js';
|
|
30
|
+
import '../../../styled/accordion/StyledInnerPanel.js';
|
|
31
|
+
import { StyledRotateIcon } from '../../../styled/accordion/StyledRotateIcon.js';
|
|
32
|
+
import '../../../styled/timeline/StyledTimeline.js';
|
|
33
|
+
import '../../../styled/timeline/StyledItem.js';
|
|
34
|
+
import '../../../styled/timeline/StyledItemIcon.js';
|
|
35
|
+
import '../../../styled/timeline/StyledContent.js';
|
|
36
|
+
import '../../../styled/timeline/StyledOppositeContent.js';
|
|
37
|
+
import '../../../styled/timeline/StyledSeparator.js';
|
|
38
|
+
|
|
39
|
+
const HeaderComponent = forwardRef((props, ref) => {
|
|
40
|
+
const {
|
|
41
|
+
onClick,
|
|
42
|
+
onMouseOver,
|
|
43
|
+
onMouseOut,
|
|
44
|
+
role,
|
|
45
|
+
children,
|
|
46
|
+
...other
|
|
47
|
+
} = props;
|
|
48
|
+
const {
|
|
49
|
+
level: ariaLevel,
|
|
50
|
+
isCompact,
|
|
51
|
+
isCollapsible,
|
|
52
|
+
getHeaderProps,
|
|
53
|
+
getTriggerProps,
|
|
54
|
+
expandedSections
|
|
55
|
+
} = useAccordionContext();
|
|
56
|
+
const sectionValue = useSectionContext();
|
|
57
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
58
|
+
const isExpanded = expandedSections.includes(sectionValue);
|
|
59
|
+
const {
|
|
60
|
+
onClick: onTriggerClick,
|
|
61
|
+
onKeyDown,
|
|
62
|
+
...otherTriggerProps
|
|
63
|
+
} = getTriggerProps({
|
|
64
|
+
type: 'button',
|
|
65
|
+
value: sectionValue
|
|
66
|
+
});
|
|
67
|
+
const value = useMemo(() => ({
|
|
68
|
+
isHovered,
|
|
69
|
+
otherTriggerProps
|
|
70
|
+
}), [isHovered, otherTriggerProps]);
|
|
71
|
+
return React__default.createElement(HeaderContext.Provider, {
|
|
72
|
+
value: value
|
|
73
|
+
}, React__default.createElement(StyledHeader, Object.assign({
|
|
74
|
+
isCollapsible: isCollapsible,
|
|
75
|
+
isExpanded: isExpanded
|
|
76
|
+
}, getHeaderProps({
|
|
77
|
+
ref,
|
|
78
|
+
'aria-level': ariaLevel,
|
|
79
|
+
role: role === undefined || role === null ? role : 'heading',
|
|
80
|
+
onClick: composeEventHandlers(onClick, onTriggerClick),
|
|
81
|
+
onMouseOver: composeEventHandlers(onMouseOver, () => setIsHovered(true)),
|
|
82
|
+
onMouseOut: composeEventHandlers(onMouseOut, () => setIsHovered(false)),
|
|
83
|
+
...other
|
|
84
|
+
})), children, React__default.createElement(StyledRotateIcon, {
|
|
85
|
+
$isCompact: isCompact,
|
|
86
|
+
$isHovered: isHovered,
|
|
87
|
+
$isRotated: isExpanded,
|
|
88
|
+
$isCollapsible: isCollapsible,
|
|
89
|
+
onMouseOver: composeEventHandlers(onMouseOver, () => setIsHovered(true)),
|
|
90
|
+
onMouseOut: composeEventHandlers(onMouseOut, () => setIsHovered(false))
|
|
91
|
+
}, React__default.createElement(SvgChevronDownStroke, null))));
|
|
92
|
+
});
|
|
93
|
+
HeaderComponent.displayName = 'Accordion.Header';
|
|
94
|
+
const Header = HeaderComponent;
|
|
95
|
+
|
|
96
|
+
export { Header };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import '../../../styled/stepper/StyledStep.js';
|
|
9
|
+
import '../../../styled/stepper/StyledContent.js';
|
|
10
|
+
import '../../../styled/stepper/StyledInnerContent.js';
|
|
11
|
+
import '../../../styled/stepper/StyledLine.js';
|
|
12
|
+
import '../../../styled/stepper/StyledStepper.js';
|
|
13
|
+
import '../../../styled/stepper/StyledIcon.js';
|
|
14
|
+
import '../../../styled/stepper/StyledLabel.js';
|
|
15
|
+
import '../../../styled/stepper/StyledLabelText.js';
|
|
16
|
+
import '../../../styled/accordion/StyledAccordion.js';
|
|
17
|
+
import '../../../styled/accordion/StyledSection.js';
|
|
18
|
+
import '../../../styled/accordion/StyledHeader.js';
|
|
19
|
+
import { StyledButton } from '../../../styled/accordion/StyledButton.js';
|
|
20
|
+
import '../../../styled/accordion/StyledPanel.js';
|
|
21
|
+
import '../../../styled/accordion/StyledInnerPanel.js';
|
|
22
|
+
import '../../../styled/accordion/StyledRotateIcon.js';
|
|
23
|
+
import '../../../styled/timeline/StyledTimeline.js';
|
|
24
|
+
import '../../../styled/timeline/StyledItem.js';
|
|
25
|
+
import '../../../styled/timeline/StyledItemIcon.js';
|
|
26
|
+
import '../../../styled/timeline/StyledContent.js';
|
|
27
|
+
import '../../../styled/timeline/StyledOppositeContent.js';
|
|
28
|
+
import '../../../styled/timeline/StyledSeparator.js';
|
|
29
|
+
import '../../../utils/useStepperContext.js';
|
|
30
|
+
import '../../../utils/useStepContext.js';
|
|
31
|
+
import { useAccordionContext } from '../../../utils/useAccordionContext.js';
|
|
32
|
+
import { useSectionContext } from '../../../utils/useSectionContext.js';
|
|
33
|
+
import { useHeaderContext } from '../../../utils/useHeaderContext.js';
|
|
34
|
+
import '../../../utils/useTimelineContext.js';
|
|
35
|
+
import '../../../utils/useTimelineItemContext.js';
|
|
36
|
+
|
|
37
|
+
const LabelComponent = forwardRef((props, ref) => {
|
|
38
|
+
const sectionValue = useSectionContext();
|
|
39
|
+
const {
|
|
40
|
+
isCompact,
|
|
41
|
+
isCollapsible,
|
|
42
|
+
expandedSections
|
|
43
|
+
} = useAccordionContext();
|
|
44
|
+
const isExpanded = expandedSections.includes(sectionValue);
|
|
45
|
+
const {
|
|
46
|
+
isHovered,
|
|
47
|
+
otherTriggerProps
|
|
48
|
+
} = useHeaderContext();
|
|
49
|
+
return React__default.createElement(StyledButton, Object.assign({
|
|
50
|
+
ref: ref,
|
|
51
|
+
isCompact: isCompact,
|
|
52
|
+
isHovered: isHovered,
|
|
53
|
+
isExpanded: isExpanded,
|
|
54
|
+
isCollapsible: isCollapsible
|
|
55
|
+
}, otherTriggerProps, props));
|
|
56
|
+
});
|
|
57
|
+
LabelComponent.displayName = 'Accordion.Label';
|
|
58
|
+
const Label = LabelComponent;
|
|
59
|
+
|
|
60
|
+
export { Label };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import '../../../utils/useStepperContext.js';
|
|
9
|
+
import '../../../utils/useStepContext.js';
|
|
10
|
+
import { useAccordionContext } from '../../../utils/useAccordionContext.js';
|
|
11
|
+
import { useSectionContext } from '../../../utils/useSectionContext.js';
|
|
12
|
+
import '../../../utils/useHeaderContext.js';
|
|
13
|
+
import '../../../utils/useTimelineContext.js';
|
|
14
|
+
import '../../../utils/useTimelineItemContext.js';
|
|
15
|
+
import '../../../styled/stepper/StyledStep.js';
|
|
16
|
+
import '../../../styled/stepper/StyledContent.js';
|
|
17
|
+
import '../../../styled/stepper/StyledInnerContent.js';
|
|
18
|
+
import '../../../styled/stepper/StyledLine.js';
|
|
19
|
+
import '../../../styled/stepper/StyledStepper.js';
|
|
20
|
+
import '../../../styled/stepper/StyledIcon.js';
|
|
21
|
+
import '../../../styled/stepper/StyledLabel.js';
|
|
22
|
+
import '../../../styled/stepper/StyledLabelText.js';
|
|
23
|
+
import '../../../styled/accordion/StyledAccordion.js';
|
|
24
|
+
import '../../../styled/accordion/StyledSection.js';
|
|
25
|
+
import '../../../styled/accordion/StyledHeader.js';
|
|
26
|
+
import '../../../styled/accordion/StyledButton.js';
|
|
27
|
+
import { StyledPanel } from '../../../styled/accordion/StyledPanel.js';
|
|
28
|
+
import { StyledInnerPanel } from '../../../styled/accordion/StyledInnerPanel.js';
|
|
29
|
+
import '../../../styled/accordion/StyledRotateIcon.js';
|
|
30
|
+
import '../../../styled/timeline/StyledTimeline.js';
|
|
31
|
+
import '../../../styled/timeline/StyledItem.js';
|
|
32
|
+
import '../../../styled/timeline/StyledItemIcon.js';
|
|
33
|
+
import '../../../styled/timeline/StyledContent.js';
|
|
34
|
+
import '../../../styled/timeline/StyledOppositeContent.js';
|
|
35
|
+
import '../../../styled/timeline/StyledSeparator.js';
|
|
36
|
+
|
|
37
|
+
const PanelComponent = forwardRef((_ref, ref) => {
|
|
38
|
+
let {
|
|
39
|
+
role,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
} = _ref;
|
|
43
|
+
const {
|
|
44
|
+
isAnimated,
|
|
45
|
+
isBare,
|
|
46
|
+
isCompact,
|
|
47
|
+
expandedSections,
|
|
48
|
+
getPanelProps
|
|
49
|
+
} = useAccordionContext();
|
|
50
|
+
const sectionValue = useSectionContext();
|
|
51
|
+
const isExpanded = expandedSections.includes(sectionValue);
|
|
52
|
+
return React__default.createElement(StyledPanel, Object.assign({
|
|
53
|
+
inert: isExpanded ? undefined : '',
|
|
54
|
+
isAnimated: isAnimated,
|
|
55
|
+
isBare: isBare,
|
|
56
|
+
isCompact: isCompact,
|
|
57
|
+
isExpanded: isExpanded
|
|
58
|
+
}, getPanelProps({
|
|
59
|
+
role: role === undefined ? null : 'region',
|
|
60
|
+
ref,
|
|
61
|
+
value: sectionValue,
|
|
62
|
+
...props
|
|
63
|
+
})), React__default.createElement(StyledInnerPanel, {
|
|
64
|
+
isAnimated: isAnimated
|
|
65
|
+
}, children));
|
|
66
|
+
});
|
|
67
|
+
PanelComponent.displayName = 'Accordion.Panel';
|
|
68
|
+
const Panel = PanelComponent;
|
|
69
|
+
|
|
70
|
+
export { Panel };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import '../../../styled/stepper/StyledStep.js';
|
|
9
|
+
import '../../../styled/stepper/StyledContent.js';
|
|
10
|
+
import '../../../styled/stepper/StyledInnerContent.js';
|
|
11
|
+
import '../../../styled/stepper/StyledLine.js';
|
|
12
|
+
import '../../../styled/stepper/StyledStepper.js';
|
|
13
|
+
import '../../../styled/stepper/StyledIcon.js';
|
|
14
|
+
import '../../../styled/stepper/StyledLabel.js';
|
|
15
|
+
import '../../../styled/stepper/StyledLabelText.js';
|
|
16
|
+
import '../../../styled/accordion/StyledAccordion.js';
|
|
17
|
+
import { StyledSection } from '../../../styled/accordion/StyledSection.js';
|
|
18
|
+
import '../../../styled/accordion/StyledHeader.js';
|
|
19
|
+
import '../../../styled/accordion/StyledButton.js';
|
|
20
|
+
import '../../../styled/accordion/StyledPanel.js';
|
|
21
|
+
import '../../../styled/accordion/StyledInnerPanel.js';
|
|
22
|
+
import '../../../styled/accordion/StyledRotateIcon.js';
|
|
23
|
+
import '../../../styled/timeline/StyledTimeline.js';
|
|
24
|
+
import '../../../styled/timeline/StyledItem.js';
|
|
25
|
+
import '../../../styled/timeline/StyledItemIcon.js';
|
|
26
|
+
import '../../../styled/timeline/StyledContent.js';
|
|
27
|
+
import '../../../styled/timeline/StyledOppositeContent.js';
|
|
28
|
+
import '../../../styled/timeline/StyledSeparator.js';
|
|
29
|
+
|
|
30
|
+
const SectionComponent = forwardRef((props, ref) => React__default.createElement(StyledSection, Object.assign({
|
|
31
|
+
ref: ref
|
|
32
|
+
}, props)));
|
|
33
|
+
SectionComponent.displayName = 'Accordion.Section';
|
|
34
|
+
const Section = SectionComponent;
|
|
35
|
+
|
|
36
|
+
export { Section };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef, useMemo, Children, isValidElement } from 'react';
|
|
8
|
+
import '../../styled/stepper/StyledStep.js';
|
|
9
|
+
import '../../styled/stepper/StyledContent.js';
|
|
10
|
+
import '../../styled/stepper/StyledInnerContent.js';
|
|
11
|
+
import '../../styled/stepper/StyledLine.js';
|
|
12
|
+
import { StyledStepper } from '../../styled/stepper/StyledStepper.js';
|
|
13
|
+
import '../../styled/stepper/StyledIcon.js';
|
|
14
|
+
import '../../styled/stepper/StyledLabel.js';
|
|
15
|
+
import '../../styled/stepper/StyledLabelText.js';
|
|
16
|
+
import '../../styled/accordion/StyledAccordion.js';
|
|
17
|
+
import '../../styled/accordion/StyledSection.js';
|
|
18
|
+
import '../../styled/accordion/StyledHeader.js';
|
|
19
|
+
import '../../styled/accordion/StyledButton.js';
|
|
20
|
+
import '../../styled/accordion/StyledPanel.js';
|
|
21
|
+
import '../../styled/accordion/StyledInnerPanel.js';
|
|
22
|
+
import '../../styled/accordion/StyledRotateIcon.js';
|
|
23
|
+
import '../../styled/timeline/StyledTimeline.js';
|
|
24
|
+
import '../../styled/timeline/StyledItem.js';
|
|
25
|
+
import '../../styled/timeline/StyledItemIcon.js';
|
|
26
|
+
import '../../styled/timeline/StyledContent.js';
|
|
27
|
+
import '../../styled/timeline/StyledOppositeContent.js';
|
|
28
|
+
import '../../styled/timeline/StyledSeparator.js';
|
|
29
|
+
import { StepperContext } from '../../utils/useStepperContext.js';
|
|
30
|
+
import { StepContext } from '../../utils/useStepContext.js';
|
|
31
|
+
import '../../utils/useAccordionContext.js';
|
|
32
|
+
import '../../utils/useSectionContext.js';
|
|
33
|
+
import '../../utils/useHeaderContext.js';
|
|
34
|
+
import '../../utils/useTimelineContext.js';
|
|
35
|
+
import '../../utils/useTimelineItemContext.js';
|
|
36
|
+
import { Step } from './components/Step.js';
|
|
37
|
+
import { Label } from './components/Label.js';
|
|
38
|
+
import { Content } from './components/Content.js';
|
|
39
|
+
|
|
40
|
+
const DEFAULT_ACTIVE_INDEX = 0;
|
|
41
|
+
const StepperComponent = forwardRef((_ref, ref) => {
|
|
42
|
+
let {
|
|
43
|
+
activeIndex = DEFAULT_ACTIVE_INDEX,
|
|
44
|
+
isHorizontal,
|
|
45
|
+
children,
|
|
46
|
+
...props
|
|
47
|
+
} = _ref;
|
|
48
|
+
const stepperContext = useMemo(() => ({
|
|
49
|
+
activeIndex,
|
|
50
|
+
isHorizontal: isHorizontal || false
|
|
51
|
+
}), [activeIndex, isHorizontal]);
|
|
52
|
+
return React__default.createElement(StepperContext.Provider, {
|
|
53
|
+
value: stepperContext
|
|
54
|
+
}, React__default.createElement(StyledStepper, Object.assign({
|
|
55
|
+
ref: ref,
|
|
56
|
+
isHorizontal: isHorizontal
|
|
57
|
+
}, props), useMemo(() => Children.toArray(children).filter(isValidElement).map((child, index) => React__default.createElement(StepContext.Provider, {
|
|
58
|
+
key: index
|
|
59
|
+
,
|
|
60
|
+
value: {
|
|
61
|
+
currentStepIndex: index,
|
|
62
|
+
isActive: stepperContext.activeIndex === index,
|
|
63
|
+
isCompleted: stepperContext.activeIndex > index,
|
|
64
|
+
isHorizontal: stepperContext.isHorizontal
|
|
65
|
+
}
|
|
66
|
+
}, child)), [children, stepperContext])));
|
|
67
|
+
});
|
|
68
|
+
StepperComponent.displayName = 'Stepper';
|
|
69
|
+
StepperComponent.defaultProps = {
|
|
70
|
+
activeIndex: DEFAULT_ACTIVE_INDEX
|
|
71
|
+
};
|
|
72
|
+
const Stepper = StepperComponent;
|
|
73
|
+
Stepper.Content = Content;
|
|
74
|
+
Stepper.Label = Label;
|
|
75
|
+
Stepper.Step = Step;
|
|
76
|
+
|
|
77
|
+
export { Stepper };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import '../../../styled/stepper/StyledStep.js';
|
|
9
|
+
import { StyledContent } from '../../../styled/stepper/StyledContent.js';
|
|
10
|
+
import { StyledInnerContent } from '../../../styled/stepper/StyledInnerContent.js';
|
|
11
|
+
import '../../../styled/stepper/StyledLine.js';
|
|
12
|
+
import '../../../styled/stepper/StyledStepper.js';
|
|
13
|
+
import '../../../styled/stepper/StyledIcon.js';
|
|
14
|
+
import '../../../styled/stepper/StyledLabel.js';
|
|
15
|
+
import '../../../styled/stepper/StyledLabelText.js';
|
|
16
|
+
import '../../../styled/accordion/StyledAccordion.js';
|
|
17
|
+
import '../../../styled/accordion/StyledSection.js';
|
|
18
|
+
import '../../../styled/accordion/StyledHeader.js';
|
|
19
|
+
import '../../../styled/accordion/StyledButton.js';
|
|
20
|
+
import '../../../styled/accordion/StyledPanel.js';
|
|
21
|
+
import '../../../styled/accordion/StyledInnerPanel.js';
|
|
22
|
+
import '../../../styled/accordion/StyledRotateIcon.js';
|
|
23
|
+
import '../../../styled/timeline/StyledTimeline.js';
|
|
24
|
+
import '../../../styled/timeline/StyledItem.js';
|
|
25
|
+
import '../../../styled/timeline/StyledItemIcon.js';
|
|
26
|
+
import '../../../styled/timeline/StyledContent.js';
|
|
27
|
+
import '../../../styled/timeline/StyledOppositeContent.js';
|
|
28
|
+
import '../../../styled/timeline/StyledSeparator.js';
|
|
29
|
+
import '../../../utils/useStepperContext.js';
|
|
30
|
+
import { useStepContext } from '../../../utils/useStepContext.js';
|
|
31
|
+
import '../../../utils/useAccordionContext.js';
|
|
32
|
+
import '../../../utils/useSectionContext.js';
|
|
33
|
+
import '../../../utils/useHeaderContext.js';
|
|
34
|
+
import '../../../utils/useTimelineContext.js';
|
|
35
|
+
import '../../../utils/useTimelineItemContext.js';
|
|
36
|
+
|
|
37
|
+
const ContentComponent = forwardRef((props, ref) => {
|
|
38
|
+
const {
|
|
39
|
+
isActive,
|
|
40
|
+
isHorizontal
|
|
41
|
+
} = useStepContext();
|
|
42
|
+
return isHorizontal === false ? React__default.createElement(StyledContent, Object.assign({
|
|
43
|
+
ref: ref,
|
|
44
|
+
isActive: isActive
|
|
45
|
+
}, props), React__default.createElement(StyledInnerContent, {
|
|
46
|
+
"aria-hidden": !isActive
|
|
47
|
+
}, props.children)) : null;
|
|
48
|
+
});
|
|
49
|
+
ContentComponent.displayName = 'Stepper.Content';
|
|
50
|
+
const Content = ContentComponent;
|
|
51
|
+
|
|
52
|
+
export { Content };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import SvgCheckSmStroke from '../../../node_modules/@zendeskgarden/svg-icons/src/16/check-sm-stroke.svg.js';
|
|
10
|
+
import '../../../styled/stepper/StyledStep.js';
|
|
11
|
+
import '../../../styled/stepper/StyledContent.js';
|
|
12
|
+
import '../../../styled/stepper/StyledInnerContent.js';
|
|
13
|
+
import '../../../styled/stepper/StyledLine.js';
|
|
14
|
+
import '../../../styled/stepper/StyledStepper.js';
|
|
15
|
+
import { StyledIcon, StyledIconFlexContainer } from '../../../styled/stepper/StyledIcon.js';
|
|
16
|
+
import { StyledLabel } from '../../../styled/stepper/StyledLabel.js';
|
|
17
|
+
import { StyledLabelText } from '../../../styled/stepper/StyledLabelText.js';
|
|
18
|
+
import '../../../styled/accordion/StyledAccordion.js';
|
|
19
|
+
import '../../../styled/accordion/StyledSection.js';
|
|
20
|
+
import '../../../styled/accordion/StyledHeader.js';
|
|
21
|
+
import '../../../styled/accordion/StyledButton.js';
|
|
22
|
+
import '../../../styled/accordion/StyledPanel.js';
|
|
23
|
+
import '../../../styled/accordion/StyledInnerPanel.js';
|
|
24
|
+
import '../../../styled/accordion/StyledRotateIcon.js';
|
|
25
|
+
import '../../../styled/timeline/StyledTimeline.js';
|
|
26
|
+
import '../../../styled/timeline/StyledItem.js';
|
|
27
|
+
import '../../../styled/timeline/StyledItemIcon.js';
|
|
28
|
+
import '../../../styled/timeline/StyledContent.js';
|
|
29
|
+
import '../../../styled/timeline/StyledOppositeContent.js';
|
|
30
|
+
import '../../../styled/timeline/StyledSeparator.js';
|
|
31
|
+
import '../../../utils/useStepperContext.js';
|
|
32
|
+
import { useStepContext } from '../../../utils/useStepContext.js';
|
|
33
|
+
import '../../../utils/useAccordionContext.js';
|
|
34
|
+
import '../../../utils/useSectionContext.js';
|
|
35
|
+
import '../../../utils/useHeaderContext.js';
|
|
36
|
+
import '../../../utils/useTimelineContext.js';
|
|
37
|
+
import '../../../utils/useTimelineItemContext.js';
|
|
38
|
+
|
|
39
|
+
const LabelComponent = forwardRef((_ref, ref) => {
|
|
40
|
+
let {
|
|
41
|
+
icon,
|
|
42
|
+
iconProps,
|
|
43
|
+
isHidden,
|
|
44
|
+
children,
|
|
45
|
+
...other
|
|
46
|
+
} = _ref;
|
|
47
|
+
const {
|
|
48
|
+
currentStepIndex,
|
|
49
|
+
isActive,
|
|
50
|
+
isCompleted,
|
|
51
|
+
isHorizontal
|
|
52
|
+
} = useStepContext();
|
|
53
|
+
const numericStep = currentStepIndex + 1;
|
|
54
|
+
const stepIcon = icon || numericStep;
|
|
55
|
+
const styledIcon = React__default.createElement(StyledIcon, {
|
|
56
|
+
isActive: isActive,
|
|
57
|
+
isHorizontal: isHorizontal
|
|
58
|
+
}, isCompleted ? React__default.createElement(SvgCheckSmStroke, iconProps) : stepIcon);
|
|
59
|
+
return React__default.createElement(StyledLabel, Object.assign({
|
|
60
|
+
ref: ref,
|
|
61
|
+
isActive: isActive,
|
|
62
|
+
isHorizontal: isHorizontal
|
|
63
|
+
}, other), isHorizontal ? React__default.createElement(StyledIconFlexContainer, null, styledIcon) : styledIcon, React__default.createElement(StyledLabelText, {
|
|
64
|
+
isHidden: isHidden,
|
|
65
|
+
isHorizontal: isHorizontal
|
|
66
|
+
}, children));
|
|
67
|
+
});
|
|
68
|
+
LabelComponent.displayName = 'Stepper.Label';
|
|
69
|
+
LabelComponent.propTypes = {
|
|
70
|
+
icon: PropTypes.any,
|
|
71
|
+
iconProps: PropTypes.object,
|
|
72
|
+
isHidden: PropTypes.bool
|
|
73
|
+
};
|
|
74
|
+
const Label = LabelComponent;
|
|
75
|
+
|
|
76
|
+
export { Label };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import { StyledStep } from '../../../styled/stepper/StyledStep.js';
|
|
9
|
+
import '../../../styled/stepper/StyledContent.js';
|
|
10
|
+
import '../../../styled/stepper/StyledInnerContent.js';
|
|
11
|
+
import { StyledLine } from '../../../styled/stepper/StyledLine.js';
|
|
12
|
+
import '../../../styled/stepper/StyledStepper.js';
|
|
13
|
+
import '../../../styled/stepper/StyledIcon.js';
|
|
14
|
+
import '../../../styled/stepper/StyledLabel.js';
|
|
15
|
+
import '../../../styled/stepper/StyledLabelText.js';
|
|
16
|
+
import '../../../styled/accordion/StyledAccordion.js';
|
|
17
|
+
import '../../../styled/accordion/StyledSection.js';
|
|
18
|
+
import '../../../styled/accordion/StyledHeader.js';
|
|
19
|
+
import '../../../styled/accordion/StyledButton.js';
|
|
20
|
+
import '../../../styled/accordion/StyledPanel.js';
|
|
21
|
+
import '../../../styled/accordion/StyledInnerPanel.js';
|
|
22
|
+
import '../../../styled/accordion/StyledRotateIcon.js';
|
|
23
|
+
import '../../../styled/timeline/StyledTimeline.js';
|
|
24
|
+
import '../../../styled/timeline/StyledItem.js';
|
|
25
|
+
import '../../../styled/timeline/StyledItemIcon.js';
|
|
26
|
+
import '../../../styled/timeline/StyledContent.js';
|
|
27
|
+
import '../../../styled/timeline/StyledOppositeContent.js';
|
|
28
|
+
import '../../../styled/timeline/StyledSeparator.js';
|
|
29
|
+
import { useStepperContext } from '../../../utils/useStepperContext.js';
|
|
30
|
+
import '../../../utils/useStepContext.js';
|
|
31
|
+
import '../../../utils/useAccordionContext.js';
|
|
32
|
+
import '../../../utils/useSectionContext.js';
|
|
33
|
+
import '../../../utils/useHeaderContext.js';
|
|
34
|
+
import '../../../utils/useTimelineContext.js';
|
|
35
|
+
import '../../../utils/useTimelineItemContext.js';
|
|
36
|
+
|
|
37
|
+
const StepComponent = forwardRef((_ref, ref) => {
|
|
38
|
+
let {
|
|
39
|
+
children,
|
|
40
|
+
...props
|
|
41
|
+
} = _ref;
|
|
42
|
+
const {
|
|
43
|
+
isHorizontal
|
|
44
|
+
} = useStepperContext();
|
|
45
|
+
return React__default.createElement(StyledStep, Object.assign({
|
|
46
|
+
ref: ref,
|
|
47
|
+
isHorizontal: isHorizontal
|
|
48
|
+
}, props), isHorizontal && React__default.createElement(StyledLine, null), children);
|
|
49
|
+
});
|
|
50
|
+
StepComponent.displayName = 'Stepper.Step';
|
|
51
|
+
const Step = StepComponent;
|
|
52
|
+
|
|
53
|
+
export { Step };
|