@zendeskgarden/react-accordions 8.75.1 → 8.76.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.
Files changed (48) hide show
  1. package/dist/esm/elements/accordion/Accordion.js +111 -0
  2. package/dist/esm/elements/accordion/components/Header.js +112 -0
  3. package/dist/esm/elements/accordion/components/Label.js +60 -0
  4. package/dist/esm/elements/accordion/components/Panel.js +70 -0
  5. package/dist/esm/elements/accordion/components/Section.js +36 -0
  6. package/dist/esm/elements/stepper/Stepper.js +77 -0
  7. package/dist/esm/elements/stepper/components/Content.js +52 -0
  8. package/dist/esm/elements/stepper/components/Label.js +76 -0
  9. package/dist/esm/elements/stepper/components/Step.js +53 -0
  10. package/dist/esm/elements/timeline/Timeline.js +60 -0
  11. package/dist/esm/elements/timeline/components/Content.js +52 -0
  12. package/dist/esm/elements/timeline/components/Item.js +70 -0
  13. package/dist/esm/elements/timeline/components/OppositeContent.js +36 -0
  14. package/dist/esm/index.js +9 -0
  15. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/circle-full-stroke.svg.js +28 -0
  16. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-sm-stroke.svg.js +29 -0
  17. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
  18. package/dist/esm/styled/accordion/StyledAccordion.js +22 -0
  19. package/dist/esm/styled/accordion/StyledButton.js +30 -0
  20. package/dist/esm/styled/accordion/StyledHeader.js +27 -0
  21. package/dist/esm/styled/accordion/StyledInnerPanel.js +23 -0
  22. package/dist/esm/styled/accordion/StyledPanel.js +53 -0
  23. package/dist/esm/styled/accordion/StyledRotateIcon.js +42 -0
  24. package/dist/esm/styled/accordion/StyledSection.js +23 -0
  25. package/dist/esm/styled/stepper/StyledContent.js +35 -0
  26. package/dist/esm/styled/stepper/StyledIcon.js +37 -0
  27. package/dist/esm/styled/stepper/StyledInnerContent.js +22 -0
  28. package/dist/esm/styled/stepper/StyledLabel.js +22 -0
  29. package/dist/esm/styled/stepper/StyledLabelText.js +22 -0
  30. package/dist/esm/styled/stepper/StyledLine.js +22 -0
  31. package/dist/esm/styled/stepper/StyledStep.js +24 -0
  32. package/dist/esm/styled/stepper/StyledStepper.js +22 -0
  33. package/dist/esm/styled/timeline/StyledContent.js +22 -0
  34. package/dist/esm/styled/timeline/StyledItem.js +25 -0
  35. package/dist/esm/styled/timeline/StyledItemIcon.js +31 -0
  36. package/dist/esm/styled/timeline/StyledOppositeContent.js +22 -0
  37. package/dist/esm/styled/timeline/StyledSeparator.js +22 -0
  38. package/dist/esm/styled/timeline/StyledTimeline.js +22 -0
  39. package/dist/esm/utils/useAccordionContext.js +18 -0
  40. package/dist/esm/utils/useHeaderContext.js +18 -0
  41. package/dist/esm/utils/useSectionContext.js +18 -0
  42. package/dist/esm/utils/useStepContext.js +18 -0
  43. package/dist/esm/utils/useStepperContext.js +18 -0
  44. package/dist/esm/utils/useTimelineContext.js +18 -0
  45. package/dist/esm/utils/useTimelineItemContext.js +18 -0
  46. package/dist/index.cjs.js +39 -55
  47. package/package.json +5 -5
  48. package/dist/index.esm.js +0 -881
package/dist/index.esm.js DELETED
@@ -1,881 +0,0 @@
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
-
8
- import * as React from 'react';
9
- import React__default, { cloneElement, Children, createContext, useContext, forwardRef, useState, useMemo, isValidElement } from 'react';
10
- import { useAccordion } from '@zendeskgarden/container-accordion';
11
- import styled, { css } from 'styled-components';
12
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8, getLineHeight, focusStyles } from '@zendeskgarden/react-theming';
13
- import { math } from 'polished';
14
- import { composeEventHandlers } from '@zendeskgarden/container-utilities';
15
- import PropTypes from 'prop-types';
16
-
17
- function _extends$3() {
18
- _extends$3 = Object.assign ? Object.assign.bind() : function (target) {
19
- for (var i = 1; i < arguments.length; i++) {
20
- var source = arguments[i];
21
- for (var key in source) {
22
- if (Object.prototype.hasOwnProperty.call(source, key)) {
23
- target[key] = source[key];
24
- }
25
- }
26
- }
27
- return target;
28
- };
29
- return _extends$3.apply(this, arguments);
30
- }
31
-
32
- const COMPONENT_ID$k = 'accordions.step_content';
33
- const sizeStyles$2 = props => {
34
- const {
35
- rtl,
36
- space
37
- } = props.theme;
38
- const paddingBottom = props.isActive ? space.base * 8 : space.base * 6;
39
- const paddingRight = rtl ? space.base * 6 : space.base * 5;
40
- const paddingLeft = rtl ? space.base * 5 : space.base * 6;
41
- const marginRight = rtl ? space.base * 3 : '0';
42
- const marginLeft = rtl ? '0' : space.base * 3;
43
- const marginVertical = space.base * 3;
44
- return css(["margin:", "px ", "px ", "px ", "px;padding:0 ", "px ", "px ", "px;min-width:", "px;height:auto;"], marginVertical, marginRight, marginVertical, marginLeft, paddingRight, paddingBottom, paddingLeft, space.base * 30);
45
- };
46
- const StyledContent = styled.div.attrs({
47
- 'data-garden-id': COMPONENT_ID$k,
48
- 'data-garden-version': '8.75.1'
49
- }).withConfig({
50
- displayName: "StyledContent",
51
- componentId: "sc-mazvvo-0"
52
- })(["display:grid;grid-template-rows:", "fr;transition:grid-template-rows 0.25s ease-in-out;word-break:break-word;", " ", ";"], props => props.isActive ? 1 : 0, sizeStyles$2, props => retrieveComponentStyles(COMPONENT_ID$k, props));
53
- StyledContent.defaultProps = {
54
- theme: DEFAULT_THEME
55
- };
56
-
57
- const COMPONENT_ID$j = 'accordions.step_line';
58
- const StyledLine = styled.div.attrs({
59
- 'data-garden-id': COMPONENT_ID$j,
60
- 'data-garden-version': '8.75.1'
61
- }).withConfig({
62
- displayName: "StyledLine",
63
- componentId: "sc-1gkpjbr-0"
64
- })(["display:block;position:absolute;top:", "px;right:", ";left:", ";flex:1;border-top:", ";border-color:", ";"], props => props.theme.space.base * 3, props => `calc(50% + ${props.theme.space.base * 6}px)`, props => `calc(-50% + ${props.theme.space.base * 6}px)`, props => props.theme.borders.sm, props => getColorV8('neutralHue', 300, props.theme));
65
- StyledLine.defaultProps = {
66
- theme: DEFAULT_THEME
67
- };
68
-
69
- const COMPONENT_ID$i = 'accordions.step';
70
- const StyledStep = styled.li.attrs({
71
- 'data-garden-id': COMPONENT_ID$i,
72
- 'data-garden-version': '8.75.1'
73
- }).withConfig({
74
- displayName: "StyledStep",
75
- componentId: "sc-12fiwtz-0"
76
- })(["position:", ";flex:", ";min-width:", ";&:last-of-type ", "{display:", ";}&:first-of-type ", "{display:", ";}&:not(:last-of-type) ", "{border-", ":", ";border-color:", ";}", ";"], props => props.isHorizontal && 'relative', props => props.isHorizontal && '1', props => props.isHorizontal && `${props.theme.space.base * 15}px`, StyledLine, props => props.theme.rtl && 'none', StyledLine, props => !props.theme.rtl && 'none', StyledContent, props => props.theme.rtl ? 'right' : 'left', props => props.theme.borders.sm, props => getColorV8('neutralHue', 300, props.theme), props => retrieveComponentStyles(COMPONENT_ID$i, props));
77
- StyledStep.defaultProps = {
78
- theme: DEFAULT_THEME
79
- };
80
-
81
- const COMPONENT_ID$h = 'accordions.step_inner_content';
82
- const StyledInnerContent = styled.div.attrs({
83
- 'data-garden-id': COMPONENT_ID$h,
84
- 'data-garden-version': '8.75.1'
85
- }).withConfig({
86
- displayName: "StyledInnerContent",
87
- componentId: "sc-1xs9fh7-0"
88
- })(["overflow:hidden;line-height:", ";color:", ";font-size:", ";", ";"], props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => getColorV8('foreground', 600 , props.theme), props => props.theme.fontSizes.md, props => retrieveComponentStyles(COMPONENT_ID$h, props));
89
- StyledInnerContent.defaultProps = {
90
- theme: DEFAULT_THEME
91
- };
92
-
93
- const COMPONENT_ID$g = 'accordions.stepper';
94
- const StyledStepper = styled.ol.attrs({
95
- 'data-garden-id': COMPONENT_ID$g,
96
- 'data-garden-version': '8.75.1'
97
- }).withConfig({
98
- displayName: "StyledStepper",
99
- componentId: "sc-dsxw0f-0"
100
- })(["display:", ";margin:0;padding:0;list-style:none;", ";"], props => props.isHorizontal && 'flex', props => retrieveComponentStyles(COMPONENT_ID$g, props));
101
- StyledStepper.defaultProps = {
102
- theme: DEFAULT_THEME
103
- };
104
-
105
- const COMPONENT_ID$f = 'accordions.step_icon';
106
- const StyledIconFlexContainer = styled.div.withConfig({
107
- displayName: "StyledIcon__StyledIconFlexContainer",
108
- componentId: "sc-v20nz9-0"
109
- })(["display:flex;flex-basis:100%;justify-content:center;width:100%;"]);
110
- const sizeStyles$1 = props => {
111
- const size = `${props.theme.space.base * 6}px`;
112
- const fontSize = props.theme.fontSizes.sm;
113
- return css(["margin-bottom:", ";margin-", ":", ";width:", ";min-width:", ";height:", ";min-height:", ";line-height:", ";font-size:", ";"], props.isHorizontal && `${props.theme.space.base * 2}px`, props.theme.rtl ? 'left' : 'right', !props.isHorizontal && `${props.theme.space.base * 3}px`, size, size, size, size, getLineHeight(size, fontSize), fontSize);
114
- };
115
- const colorStyles$3 = props => {
116
- return css(["background:", ";color:", ";"], props.isActive ? getColorV8('neutralHue', 600, props.theme) : getColorV8('neutralHue', 200, props.theme), props.isActive ? getColorV8('background', 600 , props.theme) : getColorV8('foreground', 600 , props.theme));
117
- };
118
- const StyledIcon = styled.div.attrs({
119
- 'data-garden-id': COMPONENT_ID$f,
120
- 'data-garden-version': '8.75.1'
121
- }).withConfig({
122
- displayName: "StyledIcon",
123
- componentId: "sc-v20nz9-1"
124
- })(["display:flex;align-items:center;justify-content:center;transition:background 0.25s ease-in-out,color 0.25s ease-in-out;border-radius:100%;", " ", " ", ";"], sizeStyles$1, colorStyles$3, props => retrieveComponentStyles(COMPONENT_ID$f, props));
125
- StyledIconFlexContainer.defaultProps = {
126
- theme: DEFAULT_THEME
127
- };
128
- StyledIcon.defaultProps = {
129
- theme: DEFAULT_THEME
130
- };
131
-
132
- const COMPONENT_ID$e = 'accordions.step_label';
133
- const StyledLabel = styled.div.attrs({
134
- 'data-garden-id': COMPONENT_ID$e,
135
- 'data-garden-version': '8.75.1'
136
- }).withConfig({
137
- displayName: "StyledLabel",
138
- componentId: "sc-1o82llj-0"
139
- })(["display:", ";align-items:", ";transition:color 0.25s ease-in-out,font-weight 0.25s ease-in-out;text-align:", ";line-height:", ";color:", ";font-size:", ";font-weight:", ";", ";"], props => !props.isHorizontal && 'flex', props => !props.isHorizontal && 'center', props => props.isHorizontal && 'center', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.isActive ? getColorV8('foreground', 600 , props.theme) : getColorV8('neutralHue', 600, props.theme), props => props.theme.fontSizes.md, props => props.isActive && 600, props => retrieveComponentStyles(COMPONENT_ID$e, props));
140
- StyledLabel.defaultProps = {
141
- theme: DEFAULT_THEME
142
- };
143
-
144
- const COMPONENT_ID$d = 'accordions.step_label_text';
145
- const StyledLabelText = styled.div.attrs({
146
- 'data-garden-id': COMPONENT_ID$d,
147
- 'data-garden-version': '8.75.1'
148
- }).withConfig({
149
- displayName: "StyledLabelText",
150
- componentId: "sc-111m5zo-0"
151
- })(["display:", ";padding:", ";word-wrap:", ";"], props => props.isHidden && 'none', props => props.isHorizontal && `0 ${props.theme.space.base * 3}px`, props => props.isHorizontal && 'break-word');
152
- StyledLabelText.defaultProps = {
153
- theme: DEFAULT_THEME
154
- };
155
-
156
- const COMPONENT_ID$c = 'accordions.accordion';
157
- const StyledAccordion = styled.div.attrs({
158
- 'data-garden-id': COMPONENT_ID$c,
159
- 'data-garden-version': '8.75.1'
160
- }).withConfig({
161
- displayName: "StyledAccordion",
162
- componentId: "sc-niv9ic-0"
163
- })(["", ";"], props => retrieveComponentStyles(COMPONENT_ID$c, props));
164
- StyledAccordion.defaultProps = {
165
- theme: DEFAULT_THEME
166
- };
167
-
168
- const COMPONENT_ID$b = 'accordions.panel';
169
- const colorStyles$2 = props => {
170
- const {
171
- theme,
172
- isBare
173
- } = props;
174
- return css(["border-bottom-color:", ";"], isBare ? 'transparent' : getColorV8('neutralHue', 300, theme));
175
- };
176
- const sizeStyles = props => {
177
- const {
178
- theme,
179
- isCompact,
180
- isExpanded
181
- } = props;
182
- const {
183
- base
184
- } = theme.space;
185
- let paddingTop = base * 2;
186
- let paddingHorizontal = base * 5;
187
- let paddingBottom = base * 8;
188
- if (isCompact) {
189
- paddingTop = base * 2;
190
- paddingHorizontal = base * 3;
191
- paddingBottom = base * 4;
192
- }
193
- if (isExpanded === false) {
194
- paddingTop = 0;
195
- paddingBottom = 0;
196
- }
197
- return css(["grid-template-rows:", "fr;border-bottom:", ";padding:", "px ", "px ", "px;line-height:", ";font-size:", ";"], isExpanded ? 1 : 0, theme.borders.sm, paddingTop, paddingHorizontal, paddingBottom, getLineHeight(base * 5, theme.fontSizes.md), theme.fontSizes.md);
198
- };
199
- const StyledPanel = styled.section.attrs({
200
- 'data-garden-id': COMPONENT_ID$b,
201
- 'data-garden-version': '8.75.1'
202
- }).withConfig({
203
- displayName: "StyledPanel",
204
- componentId: "sc-1piryze-0"
205
- })(["display:grid;transition:", ";overflow:hidden;", " ", " ", ";"], props => props.isAnimated && 'padding 0.25s ease-in-out, grid-template-rows 0.25s ease-in-out', sizeStyles, colorStyles$2, props => retrieveComponentStyles(COMPONENT_ID$b, props));
206
- StyledPanel.defaultProps = {
207
- isAnimated: true,
208
- theme: DEFAULT_THEME
209
- };
210
-
211
- const COMPONENT_ID$a = 'accordions.section';
212
- const StyledSection = styled.div.attrs({
213
- 'data-garden-id': COMPONENT_ID$a,
214
- 'data-garden-version': '8.75.1'
215
- }).withConfig({
216
- displayName: "StyledSection",
217
- componentId: "sc-v2t9bd-0"
218
- })(["&:last-child ", "{border:none;}", ";"], StyledPanel, props => retrieveComponentStyles(COMPONENT_ID$a, props));
219
- StyledSection.defaultProps = {
220
- theme: DEFAULT_THEME
221
- };
222
-
223
- const COMPONENT_ID$9 = 'accordions.header';
224
- const StyledHeader = styled.div.attrs({
225
- 'data-garden-id': COMPONENT_ID$9,
226
- 'data-garden-version': '8.75.1'
227
- }).withConfig({
228
- displayName: "StyledHeader",
229
- componentId: "sc-2c6rbr-0"
230
- })(["display:flex;align-items:center;transition:box-shadow 0.1s ease-in-out;font-size:", ";&:hover{cursor:", ";}", " ", ";"], props => props.theme.fontSizes.md, props => (props.isCollapsible || !props.isExpanded) && 'pointer', props => focusStyles({
231
- theme: props.theme,
232
- inset: true,
233
- condition: props.isFocused,
234
- selector: '&:focus-within'
235
- }), props => retrieveComponentStyles(COMPONENT_ID$9, props));
236
- StyledHeader.defaultProps = {
237
- theme: DEFAULT_THEME
238
- };
239
-
240
- const COMPONENT_ID$8 = 'accordions.button';
241
- const colorStyles$1 = props => {
242
- const showColor = props.isCollapsible || !props.isExpanded;
243
- let color = getColorV8('foreground', 600 , props.theme);
244
- if (showColor && props.isHovered) {
245
- color = getColorV8('primaryHue', 600, props.theme);
246
- }
247
- return css(["color:", ";&:hover{cursor:", ";color:", ";}"], color, showColor && 'pointer', showColor && color);
248
- };
249
- const StyledButton = styled.button.attrs({
250
- 'data-garden-id': COMPONENT_ID$8,
251
- 'data-garden-version': '8.75.1'
252
- }).withConfig({
253
- displayName: "StyledButton",
254
- componentId: "sc-xj3hy7-0"
255
- })(["transition:color 0.1s ease-in-out;outline:none;border:none;background:transparent;padding:", ";width:100%;text-align:", ";line-height:", ";font-family:inherit;font-size:", ";font-weight:", ";", " &::-moz-focus-inner{border:0;}&:hover{cursor:", ";}", ";"], props => props.isCompact ? `${props.theme.space.base * 2}px ${props.theme.space.base * 3}px` : `${props.theme.space.base * 5}px`, props => props.theme.rtl ? 'right' : 'left', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, colorStyles$1, props => (props.isCollapsible || !props.isExpanded) && 'pointer', props => retrieveComponentStyles(COMPONENT_ID$8, props));
256
- StyledButton.defaultProps = {
257
- theme: DEFAULT_THEME
258
- };
259
-
260
- const COMPONENT_ID$7 = 'accordions.step_inner_panel';
261
- const StyledInnerPanel = styled.div.attrs({
262
- 'data-garden-id': COMPONENT_ID$7,
263
- 'data-garden-version': '8.75.1'
264
- }).withConfig({
265
- displayName: "StyledInnerPanel",
266
- componentId: "sc-8nbueg-0"
267
- })(["overflow:hidden;line-height:inherit;font-size:inherit;", "[aria-hidden='true'] > &{transition:", ";visibility:hidden;}", "[aria-hidden='false'] > &{visibility:visible;}", ";"], StyledPanel, props => props.isAnimated && 'visibility 0s 0.25s', StyledPanel, props => retrieveComponentStyles(COMPONENT_ID$7, props));
268
- StyledInnerPanel.defaultProps = {
269
- theme: DEFAULT_THEME
270
- };
271
-
272
- const COMPONENT_ID$6 = 'accordions.rotate_icon';
273
- const colorStyles = props => {
274
- const showColor = props.isCollapsible || !props.isRotated;
275
- let color = getColorV8('neutralHue', 600, props.theme);
276
- if (showColor && props.isHovered) {
277
- color = getColorV8('primaryHue', 600, props.theme);
278
- }
279
- return css(["color:", ";&:hover{color:", ";}"], color, showColor && color);
280
- };
281
- const StyledRotateIcon = styled(
282
- _ref => {
283
- let {
284
- children,
285
- isRotated,
286
- isHovered,
287
- isCompact,
288
- isCollapsible,
289
- ...props
290
- } = _ref;
291
- return cloneElement(Children.only(children), props);
292
- }).attrs({
293
- 'data-garden-id': COMPONENT_ID$6,
294
- 'data-garden-version': '8.75.1'
295
- }).withConfig({
296
- displayName: "StyledRotateIcon",
297
- componentId: "sc-hp435q-0"
298
- })(["transform:", ";transition:transform 0.25s ease-in-out,color 0.1s ease-in-out;box-sizing:content-box;padding:", ";width:", ";min-width:", ";height:", ";vertical-align:middle;", " ", ";"], props => props.isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, props => props.isCompact ? `${props.theme.space.base * 1.5}px ${props.theme.space.base * 3}px` : `${props.theme.space.base * 5}px`, props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, colorStyles, props => retrieveComponentStyles(COMPONENT_ID$6, props));
299
- StyledRotateIcon.defaultProps = {
300
- theme: DEFAULT_THEME
301
- };
302
-
303
- const COMPONENT_ID$5 = 'timeline';
304
- const StyledTimeline = styled.ol.attrs({
305
- 'data-garden-id': COMPONENT_ID$5,
306
- 'data-garden-version': '8.75.1'
307
- }).withConfig({
308
- displayName: "StyledTimeline",
309
- componentId: "sc-pig5kv-0"
310
- })(["margin:0;padding:0;list-style:none;", ";"], props => retrieveComponentStyles(COMPONENT_ID$5, props));
311
- StyledTimeline.defaultProps = {
312
- theme: DEFAULT_THEME
313
- };
314
-
315
- const COMPONENT_ID$4 = 'timeline.content.separator';
316
- const StyledSeparator = styled.div.attrs({
317
- 'data-garden-id': COMPONENT_ID$4,
318
- 'data-garden-version': '8.75.1'
319
- }).withConfig({
320
- displayName: "StyledSeparator",
321
- componentId: "sc-fki51e-0"
322
- })(["display:flex;position:relative;justify-content:center;padding:", ";&::after{position:absolute;border-left:", ";height:100%;content:'';}", ";"], props => `${props.theme.space.base * 5}px ${props.theme.space.base}px`, props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 600, props.theme)}`, props => retrieveComponentStyles(COMPONENT_ID$4, props));
323
- StyledSeparator.defaultProps = {
324
- theme: DEFAULT_THEME
325
- };
326
-
327
- const COMPONENT_ID$3 = 'timeline.content';
328
- const StyledTimelineContent = styled.div.attrs({
329
- 'data-garden-id': COMPONENT_ID$3,
330
- 'data-garden-version': '8.75.1'
331
- }).withConfig({
332
- displayName: "StyledContent__StyledTimelineContent",
333
- componentId: "sc-19phgu1-0"
334
- })(["flex:1;padding:", ";", ";"], props => `${props.theme.space.base * 5}px ${props.theme.space.base * 4}px`, props => retrieveComponentStyles(COMPONENT_ID$3, props));
335
- StyledTimelineContent.defaultProps = {
336
- theme: DEFAULT_THEME
337
- };
338
-
339
- const COMPONENT_ID$2 = 'timeline.opposite.content';
340
- const StyledOppositeContent = styled.div.attrs({
341
- 'data-garden-id': COMPONENT_ID$2,
342
- 'data-garden-version': '8.75.1'
343
- }).withConfig({
344
- displayName: "StyledOppositeContent",
345
- componentId: "sc-jurh2k-0"
346
- })(["flex:1;padding:", ";text-align:", ";", ";"], props => `${props.theme.space.base * 5}px ${props.theme.space.base * 4}px`, props => props.theme.rtl ? 'left' : 'right', props => retrieveComponentStyles(COMPONENT_ID$2, props));
347
- StyledOppositeContent.defaultProps = {
348
- theme: DEFAULT_THEME
349
- };
350
-
351
- const COMPONENT_ID$1 = 'timeline.item';
352
- const StyledTimelineItem = styled.li.attrs({
353
- 'data-garden-id': COMPONENT_ID$1,
354
- 'data-garden-version': '8.75.1'
355
- }).withConfig({
356
- displayName: "StyledItem__StyledTimelineItem",
357
- componentId: "sc-5mcnzm-0"
358
- })(["display:flex;position:relative;line-height:", ";color:", ";font-size:", ";&:last-of-type ", "::after{display:none;}", " ", " ", ";"], props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => getColorV8('foreground', 600 , props.theme), props => props.theme.fontSizes.md, StyledSeparator, props => !props.hasOppositeContent && props.isAlternate && css(["&::before{flex:1;padding:", "px;content:'';}"], props.theme.space.base * 4), props => 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'), props => retrieveComponentStyles(COMPONENT_ID$1, props));
359
- StyledTimelineItem.defaultProps = {
360
- theme: DEFAULT_THEME
361
- };
362
-
363
- const COMPONENT_ID = 'timeline.icon';
364
- const StyledItemIcon = styled(_ref => {
365
- let {
366
- surfaceColor,
367
- children,
368
- ...props
369
- } = _ref;
370
- return cloneElement(Children.only(children), props);
371
- }).attrs({
372
- 'data-garden-id': COMPONENT_ID,
373
- 'data-garden-version': '8.75.1'
374
- }).withConfig({
375
- displayName: "StyledItemIcon",
376
- componentId: "sc-vz2l6e-0"
377
- })(["z-index:1;box-sizing:content-box;background-color:", ";padding:", "px 0;width:", ";height:", ";color:", ";", ";"], props => props.surfaceColor || getColorV8('background', 600 , props.theme), props => props.theme.space.base, props => math(`${props.theme.iconSizes.sm} + 1`), props => math(`${props.theme.iconSizes.sm} + 1`), props => getColorV8('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID, props));
378
- StyledItemIcon.defaultProps = {
379
- theme: DEFAULT_THEME
380
- };
381
-
382
- const StepperContext = createContext(undefined);
383
- const useStepperContext = () => {
384
- const context = useContext(StepperContext);
385
- if (context === undefined) {
386
- throw new Error('This component must be rendered within a Stepper component');
387
- }
388
- return context;
389
- };
390
-
391
- const StepContext = createContext(undefined);
392
- const useStepContext = () => {
393
- const context = useContext(StepContext);
394
- if (context === undefined) {
395
- throw new Error('This component must be rendered within a Stepper component');
396
- }
397
- return context;
398
- };
399
-
400
- const AccordionContext = createContext(undefined);
401
- const useAccordionContext = () => {
402
- const context = useContext(AccordionContext);
403
- if (context === undefined) {
404
- throw new Error('This component must be rendered within a Accordion component');
405
- }
406
- return context;
407
- };
408
-
409
- const SectionContext = createContext(undefined);
410
- const useSectionContext = () => {
411
- const context = useContext(SectionContext);
412
- if (context === undefined) {
413
- throw new Error('This component must be rendered within an Accordion component');
414
- }
415
- return context;
416
- };
417
-
418
- const HeaderContext = createContext(undefined);
419
- const useHeaderContext = () => {
420
- const context = useContext(HeaderContext);
421
- if (context === undefined) {
422
- throw new Error('This component must be rendered within a Accordion.Header component');
423
- }
424
- return context;
425
- };
426
-
427
- const TimelineContext = createContext(undefined);
428
- const useTimelineContext = () => {
429
- const context = useContext(TimelineContext);
430
- if (context === undefined) {
431
- throw new Error('This component must be rendered within a Timeline component');
432
- }
433
- return context;
434
- };
435
-
436
- const TimelineItemContext = createContext(undefined);
437
- const useTimelineItemContext = () => {
438
- const context = useContext(TimelineItemContext);
439
- if (context === undefined) {
440
- throw new Error('This component must be rendered within a Timeline.Item component');
441
- }
442
- return context;
443
- };
444
-
445
- const SectionComponent = forwardRef((props, ref) => React__default.createElement(StyledSection, _extends$3({
446
- ref: ref
447
- }, props)));
448
- SectionComponent.displayName = 'Accordion.Section';
449
- const Section = SectionComponent;
450
-
451
- var _path$1;
452
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : 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); }
453
- var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
454
- return /*#__PURE__*/React.createElement("svg", _extends$2({
455
- xmlns: "http://www.w3.org/2000/svg",
456
- width: 16,
457
- height: 16,
458
- focusable: "false",
459
- viewBox: "0 0 16 16",
460
- "aria-hidden": "true"
461
- }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
462
- fill: "currentColor",
463
- 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"
464
- })));
465
- };
466
-
467
- const HeaderComponent = forwardRef((props, ref) => {
468
- const {
469
- onClick,
470
- onFocus,
471
- onBlur,
472
- onMouseOver,
473
- onMouseOut,
474
- role,
475
- children,
476
- ...other
477
- } = props;
478
- const {
479
- level: ariaLevel,
480
- isCompact,
481
- isCollapsible,
482
- getHeaderProps,
483
- getTriggerProps,
484
- expandedSections
485
- } = useAccordionContext();
486
- const sectionValue = useSectionContext();
487
- const [isFocused, setIsFocused] = useState(false);
488
- const [isHovered, setIsHovered] = useState(false);
489
- const isExpanded = expandedSections.includes(sectionValue);
490
- const {
491
- onClick: onTriggerClick,
492
- onKeyDown,
493
- ...otherTriggerProps
494
- } = getTriggerProps({
495
- type: 'button',
496
- value: sectionValue
497
- });
498
- const onHeaderFocus = e => {
499
- e.persist();
500
- setTimeout(() => {
501
- const isAccordionButton = e.target.getAttribute('data-garden-id') === COMPONENT_ID$8;
502
- const isFocusVisible = e.target.getAttribute('data-garden-focus-visible');
503
- if (isAccordionButton && isFocusVisible) {
504
- setIsFocused(true);
505
- }
506
- }, 0);
507
- };
508
- const value = useMemo(() => ({
509
- isHovered,
510
- otherTriggerProps
511
- }), [isHovered, otherTriggerProps]);
512
- return React__default.createElement(HeaderContext.Provider, {
513
- value: value
514
- }, React__default.createElement(StyledHeader, _extends$3({
515
- isCollapsible: isCollapsible,
516
- isExpanded: isExpanded,
517
- isFocused: isFocused
518
- }, getHeaderProps({
519
- ref,
520
- 'aria-level': ariaLevel,
521
- role: role === undefined || role === null ? role : 'heading',
522
- onClick: composeEventHandlers(onClick, onTriggerClick),
523
- onFocus: composeEventHandlers(onFocus, onHeaderFocus),
524
- onBlur: composeEventHandlers(onBlur, () => setIsFocused(false)),
525
- onMouseOver: composeEventHandlers(onMouseOver, () => setIsHovered(true)),
526
- onMouseOut: composeEventHandlers(onMouseOut, () => setIsHovered(false)),
527
- ...other
528
- })), children, React__default.createElement(StyledRotateIcon, {
529
- isCompact: isCompact,
530
- isHovered: isHovered,
531
- isRotated: isExpanded,
532
- isCollapsible: isCollapsible,
533
- onMouseOver: composeEventHandlers(onMouseOver, () => setIsHovered(true)),
534
- onMouseOut: composeEventHandlers(onMouseOut, () => setIsHovered(false))
535
- }, React__default.createElement(SvgChevronDownStroke, null))));
536
- });
537
- HeaderComponent.displayName = 'Accordion.Header';
538
- const Header = HeaderComponent;
539
-
540
- const LabelComponent$1 = forwardRef((props, ref) => {
541
- const sectionValue = useSectionContext();
542
- const {
543
- isCompact,
544
- isCollapsible,
545
- expandedSections
546
- } = useAccordionContext();
547
- const isExpanded = expandedSections.includes(sectionValue);
548
- const {
549
- isHovered,
550
- otherTriggerProps
551
- } = useHeaderContext();
552
- return React__default.createElement(StyledButton, _extends$3({
553
- ref: ref,
554
- isCompact: isCompact,
555
- isHovered: isHovered,
556
- isExpanded: isExpanded,
557
- isCollapsible: isCollapsible
558
- }, otherTriggerProps, props));
559
- });
560
- LabelComponent$1.displayName = 'Accordion.Label';
561
- const Label$1 = LabelComponent$1;
562
-
563
- const PanelComponent = forwardRef((_ref, ref) => {
564
- let {
565
- role,
566
- children,
567
- ...props
568
- } = _ref;
569
- const {
570
- isAnimated,
571
- isBare,
572
- isCompact,
573
- expandedSections,
574
- getPanelProps
575
- } = useAccordionContext();
576
- const sectionValue = useSectionContext();
577
- const isExpanded = expandedSections.includes(sectionValue);
578
- return React__default.createElement(StyledPanel, _extends$3({
579
- inert: isExpanded ? undefined : '',
580
- isAnimated: isAnimated,
581
- isBare: isBare,
582
- isCompact: isCompact,
583
- isExpanded: isExpanded
584
- }, getPanelProps({
585
- role: role === undefined ? null : 'region',
586
- ref,
587
- value: sectionValue,
588
- ...props
589
- })), React__default.createElement(StyledInnerPanel, {
590
- isAnimated: isAnimated
591
- }, children));
592
- });
593
- PanelComponent.displayName = 'Accordion.Panel';
594
- const Panel = PanelComponent;
595
-
596
- const AccordionComponent = forwardRef((_ref, ref) => {
597
- let {
598
- children,
599
- isBare,
600
- isCompact,
601
- isAnimated,
602
- isExpandable,
603
- isCollapsible,
604
- level,
605
- onChange,
606
- defaultExpandedSections,
607
- expandedSections: controlledExpandedSections,
608
- ...props
609
- } = _ref;
610
- const {
611
- sections,
612
- sectionChildren
613
- } = useMemo(() => Children.toArray(children).filter(isValidElement).map((child, index) => React__default.createElement(SectionContext.Provider, {
614
- key: index,
615
- value: index
616
- }, child)).reduce((acc, child, index) => {
617
- acc.sectionChildren.push(child);
618
- acc.sections.push(index);
619
- return acc;
620
- }, {
621
- sectionChildren: [],
622
- sections: []
623
- }), [children]);
624
- const {
625
- expandedSections,
626
- getHeaderProps,
627
- getTriggerProps,
628
- getPanelProps
629
- } = useAccordion({
630
- sections,
631
- defaultExpandedSections,
632
- expandedSections: controlledExpandedSections,
633
- collapsible: isCollapsible,
634
- expandable: isExpandable || false,
635
- onChange
636
- });
637
- const accordionContextValue = useMemo(() => ({
638
- level,
639
- isBare,
640
- isCompact,
641
- isAnimated,
642
- isCollapsible,
643
- getPanelProps,
644
- getHeaderProps,
645
- getTriggerProps,
646
- expandedSections
647
- }), [level, isBare, isCompact, isAnimated, isCollapsible, getPanelProps, getHeaderProps, getTriggerProps, expandedSections]);
648
- return React__default.createElement(AccordionContext.Provider, {
649
- value: accordionContextValue
650
- }, React__default.createElement(StyledAccordion, _extends$3({
651
- ref: ref
652
- }, props), sectionChildren));
653
- });
654
- AccordionComponent.displayName = 'Accordion';
655
- AccordionComponent.defaultProps = {
656
- isAnimated: true,
657
- isCollapsible: true
658
- };
659
- const Accordion = AccordionComponent;
660
- Accordion.Header = Header;
661
- Accordion.Label = Label$1;
662
- Accordion.Panel = Panel;
663
- Accordion.Section = Section;
664
-
665
- const StepComponent = forwardRef((_ref, ref) => {
666
- let {
667
- children,
668
- ...props
669
- } = _ref;
670
- const {
671
- isHorizontal
672
- } = useStepperContext();
673
- return React__default.createElement(StyledStep, _extends$3({
674
- ref: ref,
675
- isHorizontal: isHorizontal
676
- }, props), isHorizontal && React__default.createElement(StyledLine, null), children);
677
- });
678
- StepComponent.displayName = 'Stepper.Step';
679
- const Step = StepComponent;
680
-
681
- var _path;
682
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : 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); }
683
- var SvgCheckSmStroke = function SvgCheckSmStroke(props) {
684
- return /*#__PURE__*/React.createElement("svg", _extends$1({
685
- xmlns: "http://www.w3.org/2000/svg",
686
- width: 16,
687
- height: 16,
688
- focusable: "false",
689
- viewBox: "0 0 16 16",
690
- "aria-hidden": "true"
691
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
692
- fill: "none",
693
- stroke: "currentColor",
694
- strokeLinecap: "round",
695
- strokeLinejoin: "round",
696
- strokeWidth: 1.25,
697
- d: "M3 9l3 3 7-7"
698
- })));
699
- };
700
-
701
- const LabelComponent = forwardRef((_ref, ref) => {
702
- let {
703
- icon,
704
- iconProps,
705
- isHidden,
706
- children,
707
- ...other
708
- } = _ref;
709
- const {
710
- currentStepIndex,
711
- isActive,
712
- isCompleted,
713
- isHorizontal
714
- } = useStepContext();
715
- const numericStep = currentStepIndex + 1;
716
- const stepIcon = icon || numericStep;
717
- const styledIcon = React__default.createElement(StyledIcon, {
718
- isActive: isActive,
719
- isHorizontal: isHorizontal
720
- }, isCompleted ? React__default.createElement(SvgCheckSmStroke, iconProps) : stepIcon);
721
- return React__default.createElement(StyledLabel, _extends$3({
722
- ref: ref,
723
- isActive: isActive,
724
- isHorizontal: isHorizontal
725
- }, other), isHorizontal ? React__default.createElement(StyledIconFlexContainer, null, styledIcon) : styledIcon, React__default.createElement(StyledLabelText, {
726
- isHidden: isHidden,
727
- isHorizontal: isHorizontal
728
- }, children));
729
- });
730
- LabelComponent.displayName = 'Stepper.Label';
731
- LabelComponent.propTypes = {
732
- icon: PropTypes.any,
733
- iconProps: PropTypes.object,
734
- isHidden: PropTypes.bool
735
- };
736
- const Label = LabelComponent;
737
-
738
- const ContentComponent$1 = forwardRef((props, ref) => {
739
- const {
740
- isActive,
741
- isHorizontal
742
- } = useStepContext();
743
- return isHorizontal === false ? React__default.createElement(StyledContent, _extends$3({
744
- ref: ref,
745
- isActive: isActive
746
- }, props), React__default.createElement(StyledInnerContent, {
747
- "aria-hidden": !isActive
748
- }, props.children)) : null;
749
- });
750
- ContentComponent$1.displayName = 'Stepper.Content';
751
- const Content$1 = ContentComponent$1;
752
-
753
- const DEFAULT_ACTIVE_INDEX = 0;
754
- const StepperComponent = forwardRef((_ref, ref) => {
755
- let {
756
- activeIndex = DEFAULT_ACTIVE_INDEX,
757
- isHorizontal,
758
- children,
759
- ...props
760
- } = _ref;
761
- const stepperContext = useMemo(() => ({
762
- activeIndex,
763
- isHorizontal: isHorizontal || false
764
- }), [activeIndex, isHorizontal]);
765
- return React__default.createElement(StepperContext.Provider, {
766
- value: stepperContext
767
- }, React__default.createElement(StyledStepper, _extends$3({
768
- ref: ref,
769
- isHorizontal: isHorizontal
770
- }, props), useMemo(() => Children.toArray(children).filter(isValidElement).map((child, index) => React__default.createElement(StepContext.Provider, {
771
- key: index
772
- ,
773
- value: {
774
- currentStepIndex: index,
775
- isActive: stepperContext.activeIndex === index,
776
- isCompleted: stepperContext.activeIndex > index,
777
- isHorizontal: stepperContext.isHorizontal
778
- }
779
- }, child)), [children, stepperContext])));
780
- });
781
- StepperComponent.displayName = 'Stepper';
782
- StepperComponent.defaultProps = {
783
- activeIndex: DEFAULT_ACTIVE_INDEX
784
- };
785
- const Stepper = StepperComponent;
786
- Stepper.Content = Content$1;
787
- Stepper.Label = Label;
788
- Stepper.Step = Step;
789
-
790
- const OppositeContentComponent = forwardRef((props, ref) => React__default.createElement(StyledOppositeContent, _extends$3({
791
- ref: ref
792
- }, props)));
793
- OppositeContentComponent.displayName = 'Timeline.OppositeContent';
794
- const OppositeContent = OppositeContentComponent;
795
-
796
- const ItemComponent = forwardRef((_ref, ref) => {
797
- let {
798
- icon,
799
- surfaceColor,
800
- ...props
801
- } = _ref;
802
- const value = useMemo(() => ({
803
- icon,
804
- surfaceColor
805
- }), [icon, surfaceColor]);
806
- const {
807
- isAlternate
808
- } = useTimelineContext();
809
- let hasOppositeContent = false;
810
- Children.forEach(props.children, child => {
811
- if (child) {
812
- if (child.type === OppositeContent) {
813
- hasOppositeContent = true;
814
- }
815
- }
816
- });
817
- return React__default.createElement(TimelineItemContext.Provider, {
818
- value: value
819
- }, React__default.createElement(StyledTimelineItem, _extends$3({
820
- ref: ref,
821
- isAlternate: isAlternate,
822
- hasOppositeContent: hasOppositeContent
823
- }, props)));
824
- });
825
- ItemComponent.displayName = 'Timeline.Item';
826
- const Item = ItemComponent;
827
-
828
- var _circle;
829
- function _extends() { _extends = Object.assign ? Object.assign.bind() : 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.apply(this, arguments); }
830
- var SvgCircleFullStroke = function SvgCircleFullStroke(props) {
831
- return /*#__PURE__*/React.createElement("svg", _extends({
832
- xmlns: "http://www.w3.org/2000/svg",
833
- width: 12,
834
- height: 12,
835
- focusable: "false",
836
- viewBox: "0 0 12 12",
837
- "aria-hidden": "true"
838
- }, props), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
839
- cx: 6,
840
- cy: 6,
841
- r: 4.5,
842
- fill: "none",
843
- stroke: "currentColor"
844
- })));
845
- };
846
-
847
- const ContentComponent = forwardRef((props, ref) => {
848
- const {
849
- icon,
850
- surfaceColor
851
- } = useTimelineItemContext();
852
- return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledSeparator, null, React__default.createElement(StyledItemIcon, {
853
- surfaceColor: surfaceColor
854
- }, icon || React__default.createElement(SvgCircleFullStroke, null))), React__default.createElement(StyledTimelineContent, _extends$3({
855
- ref: ref
856
- }, props)));
857
- });
858
- ContentComponent.displayName = 'Timeline.Content';
859
- const Content = ContentComponent;
860
-
861
- const TimelineComponent = forwardRef((_ref, ref) => {
862
- let {
863
- isAlternate,
864
- ...props
865
- } = _ref;
866
- const value = useMemo(() => ({
867
- isAlternate
868
- }), [isAlternate]);
869
- return React__default.createElement(TimelineContext.Provider, {
870
- value: value
871
- }, React__default.createElement(StyledTimeline, _extends$3({
872
- ref: ref
873
- }, props)));
874
- });
875
- TimelineComponent.displayName = 'Timeline';
876
- const Timeline = TimelineComponent;
877
- Timeline.Content = Content;
878
- Timeline.Item = Item;
879
- Timeline.OppositeContent = OppositeContent;
880
-
881
- export { Accordion, Stepper, Timeline };