@zendeskgarden/react-accordions 9.0.0-next.2 → 9.0.0-next.21

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 (64) hide show
  1. package/dist/esm/elements/accordion/Accordion.js +111 -0
  2. package/dist/esm/elements/accordion/components/Header.js +96 -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 +36 -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 +56 -0
  23. package/dist/esm/styled/accordion/StyledRotateIcon.js +36 -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 +61 -0
  27. package/dist/esm/styled/stepper/StyledInnerContent.js +30 -0
  28. package/dist/esm/styled/stepper/StyledLabel.js +31 -0
  29. package/dist/esm/styled/stepper/StyledLabelText.js +22 -0
  30. package/dist/esm/styled/stepper/StyledLine.js +30 -0
  31. package/dist/esm/styled/stepper/StyledStep.js +32 -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 +33 -0
  35. package/dist/esm/styled/timeline/StyledItemIcon.js +38 -0
  36. package/dist/esm/styled/timeline/StyledOppositeContent.js +22 -0
  37. package/dist/esm/styled/timeline/StyledSeparator.js +30 -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 +231 -179
  47. package/dist/typings/elements/timeline/components/Item.d.ts +0 -4
  48. package/dist/typings/index.d.ts +0 -2
  49. package/dist/typings/styled/accordion/StyledButton.d.ts +4 -4
  50. package/dist/typings/styled/accordion/StyledHeader.d.ts +2 -3
  51. package/dist/typings/styled/accordion/StyledInnerPanel.d.ts +1 -1
  52. package/dist/typings/styled/accordion/StyledPanel.d.ts +4 -4
  53. package/dist/typings/styled/accordion/StyledRotateIcon.d.ts +5 -2
  54. package/dist/typings/styled/stepper/StyledContent.d.ts +1 -1
  55. package/dist/typings/styled/stepper/StyledIcon.d.ts +2 -2
  56. package/dist/typings/styled/stepper/StyledLabel.d.ts +2 -2
  57. package/dist/typings/styled/stepper/StyledLabelText.d.ts +2 -2
  58. package/dist/typings/styled/stepper/StyledStep.d.ts +1 -1
  59. package/dist/typings/styled/stepper/StyledStepper.d.ts +1 -1
  60. package/dist/typings/styled/timeline/StyledItem.d.ts +2 -3
  61. package/dist/typings/styled/timeline/StyledItemIcon.d.ts +3 -2
  62. package/dist/typings/types/index.d.ts +4 -4
  63. package/package.json +8 -8
  64. package/dist/index.esm.js +0 -881
@@ -0,0 +1,30 @@
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 styled from 'styled-components';
8
+ import { getLineHeight, getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'accordions.step_inner_content';
11
+ const StyledInnerContent = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledInnerContent",
16
+ componentId: "sc-1xs9fh7-0"
17
+ })(["overflow:hidden;line-height:", ";color:", ";font-size:", ";", ";"], props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), _ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return getColor({
22
+ theme,
23
+ variable: 'foreground.default'
24
+ });
25
+ }, props => props.theme.fontSizes.md, props => retrieveComponentStyles(COMPONENT_ID, props));
26
+ StyledInnerContent.defaultProps = {
27
+ theme: DEFAULT_THEME
28
+ };
29
+
30
+ export { StyledInnerContent };
@@ -0,0 +1,31 @@
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 styled from 'styled-components';
8
+ import { getLineHeight, getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'accordions.step_label';
11
+ const StyledLabel = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledLabel",
16
+ componentId: "sc-1o82llj-0"
17
+ })(["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), _ref => {
18
+ let {
19
+ $isActive,
20
+ theme
21
+ } = _ref;
22
+ return getColor({
23
+ theme,
24
+ variable: $isActive ? 'foreground.default' : 'foreground.subtle'
25
+ });
26
+ }, props => props.theme.fontSizes.md, props => props.$isActive && 600, props => retrieveComponentStyles(COMPONENT_ID, props));
27
+ StyledLabel.defaultProps = {
28
+ theme: DEFAULT_THEME
29
+ };
30
+
31
+ export { StyledLabel };
@@ -0,0 +1,22 @@
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 styled from 'styled-components';
8
+ import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'accordions.step_label_text';
11
+ const StyledLabelText = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledLabelText",
16
+ componentId: "sc-111m5zo-0"
17
+ })(["display:", ";padding:", ";word-wrap:", ";"], props => props.$isHidden && 'none', props => props.$isHorizontal && `0 ${props.theme.space.base * 3}px`, props => props.$isHorizontal && 'break-word');
18
+ StyledLabelText.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledLabelText };
@@ -0,0 +1,30 @@
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 styled from 'styled-components';
8
+ import { getColor, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'accordions.step_line';
11
+ const StyledLine = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledLine",
16
+ componentId: "sc-1gkpjbr-0"
17
+ })(["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, _ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return getColor({
22
+ theme,
23
+ variable: 'border.default'
24
+ });
25
+ });
26
+ StyledLine.defaultProps = {
27
+ theme: DEFAULT_THEME
28
+ };
29
+
30
+ export { StyledLine };
@@ -0,0 +1,32 @@
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 styled from 'styled-components';
8
+ import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { StyledContent } from './StyledContent.js';
10
+ import { StyledLine } from './StyledLine.js';
11
+
12
+ const COMPONENT_ID = 'accordions.step';
13
+ const StyledStep = styled.li.attrs({
14
+ 'data-garden-id': COMPONENT_ID,
15
+ 'data-garden-version': '9.0.0-next.21'
16
+ }).withConfig({
17
+ displayName: "StyledStep",
18
+ componentId: "sc-12fiwtz-0"
19
+ })(["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, _ref => {
20
+ let {
21
+ theme
22
+ } = _ref;
23
+ return getColor({
24
+ theme,
25
+ variable: 'border.default'
26
+ });
27
+ }, props => retrieveComponentStyles(COMPONENT_ID, props));
28
+ StyledStep.defaultProps = {
29
+ theme: DEFAULT_THEME
30
+ };
31
+
32
+ export { StyledStep };
@@ -0,0 +1,22 @@
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 styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'accordions.stepper';
11
+ const StyledStepper = styled.ol.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledStepper",
16
+ componentId: "sc-dsxw0f-0"
17
+ })(["display:", ";margin:0;padding:0;list-style:none;", ";"], props => props.$isHorizontal && 'flex', props => retrieveComponentStyles(COMPONENT_ID, props));
18
+ StyledStepper.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledStepper };
@@ -0,0 +1,22 @@
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 styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'timeline.content';
11
+ const StyledTimelineContent = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledContent__StyledTimelineContent",
16
+ componentId: "sc-19phgu1-0"
17
+ })(["flex:1;padding:", ";", ";"], props => `${props.theme.space.base * 5}px ${props.theme.space.base * 4}px`, props => retrieveComponentStyles(COMPONENT_ID, props));
18
+ StyledTimelineContent.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledTimelineContent };
@@ -0,0 +1,33 @@
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 styled, { css } from 'styled-components';
8
+ import { getLineHeight, getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { StyledSeparator } from './StyledSeparator.js';
10
+ import { StyledTimelineContent } from './StyledContent.js';
11
+ import { StyledOppositeContent } from './StyledOppositeContent.js';
12
+
13
+ const COMPONENT_ID = 'timeline.item';
14
+ const StyledTimelineItem = styled.li.attrs({
15
+ 'data-garden-id': COMPONENT_ID,
16
+ 'data-garden-version': '9.0.0-next.21'
17
+ }).withConfig({
18
+ displayName: "StyledItem__StyledTimelineItem",
19
+ componentId: "sc-5mcnzm-0"
20
+ })(["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), _ref => {
21
+ let {
22
+ theme
23
+ } = _ref;
24
+ return getColor({
25
+ theme,
26
+ variable: 'foreground.default'
27
+ });
28
+ }, 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, props));
29
+ StyledTimelineItem.defaultProps = {
30
+ theme: DEFAULT_THEME
31
+ };
32
+
33
+ export { StyledTimelineItem };
@@ -0,0 +1,38 @@
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 styled, { css } from 'styled-components';
8
+ import { math } from 'polished';
9
+ import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
10
+
11
+ const COMPONENT_ID = 'timeline.icon';
12
+ const colorStyles = _ref => {
13
+ let {
14
+ $surfaceColor,
15
+ theme
16
+ } = _ref;
17
+ const foregroundColor = getColor({
18
+ theme,
19
+ variable: 'border.emphasis'
20
+ });
21
+ const backgroundColor = $surfaceColor || getColor({
22
+ theme,
23
+ variable: 'background.default'
24
+ });
25
+ return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
26
+ };
27
+ const StyledItemIcon = styled(StyledBaseIcon).attrs({
28
+ 'data-garden-id': COMPONENT_ID,
29
+ 'data-garden-version': '9.0.0-next.21'
30
+ }).withConfig({
31
+ displayName: "StyledItemIcon",
32
+ componentId: "sc-vz2l6e-0"
33
+ })(["z-index:1;box-sizing:content-box;padding:", "px 0;width:", ";height:", ";", " ", ";"], props => props.theme.space.base, props => math(`${props.theme.iconSizes.sm} + 1`), props => math(`${props.theme.iconSizes.sm} + 1`), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
34
+ StyledItemIcon.defaultProps = {
35
+ theme: DEFAULT_THEME
36
+ };
37
+
38
+ export { StyledItemIcon };
@@ -0,0 +1,22 @@
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 styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'timeline.opposite.content';
11
+ const StyledOppositeContent = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledOppositeContent",
16
+ componentId: "sc-jurh2k-0"
17
+ })(["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, props));
18
+ StyledOppositeContent.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledOppositeContent };
@@ -0,0 +1,30 @@
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 styled from 'styled-components';
8
+ import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'timeline.content.separator';
11
+ const StyledSeparator = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledSeparator",
16
+ componentId: "sc-fki51e-0"
17
+ })(["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`, _ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return `${theme.borders.sm} ${getColor({
22
+ theme,
23
+ variable: 'border.emphasis'
24
+ })}`;
25
+ }, props => retrieveComponentStyles(COMPONENT_ID, props));
26
+ StyledSeparator.defaultProps = {
27
+ theme: DEFAULT_THEME
28
+ };
29
+
30
+ export { StyledSeparator };
@@ -0,0 +1,22 @@
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 styled from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'timeline';
11
+ const StyledTimeline = styled.ol.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.21'
14
+ }).withConfig({
15
+ displayName: "StyledTimeline",
16
+ componentId: "sc-pig5kv-0"
17
+ })(["margin:0;padding:0;list-style:none;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
18
+ StyledTimeline.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledTimeline };
@@ -0,0 +1,18 @@
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 { createContext, useContext } from 'react';
8
+
9
+ const AccordionContext = createContext(undefined);
10
+ const useAccordionContext = () => {
11
+ const context = useContext(AccordionContext);
12
+ if (context === undefined) {
13
+ throw new Error('This component must be rendered within a Accordion component');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { AccordionContext, useAccordionContext };
@@ -0,0 +1,18 @@
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 { createContext, useContext } from 'react';
8
+
9
+ const HeaderContext = createContext(undefined);
10
+ const useHeaderContext = () => {
11
+ const context = useContext(HeaderContext);
12
+ if (context === undefined) {
13
+ throw new Error('This component must be rendered within a Accordion.Header component');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { HeaderContext, useHeaderContext };
@@ -0,0 +1,18 @@
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 { createContext, useContext } from 'react';
8
+
9
+ const SectionContext = createContext(undefined);
10
+ const useSectionContext = () => {
11
+ const context = useContext(SectionContext);
12
+ if (context === undefined) {
13
+ throw new Error('This component must be rendered within an Accordion component');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { SectionContext, useSectionContext };
@@ -0,0 +1,18 @@
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 { createContext, useContext } from 'react';
8
+
9
+ const StepContext = createContext(undefined);
10
+ const useStepContext = () => {
11
+ const context = useContext(StepContext);
12
+ if (context === undefined) {
13
+ throw new Error('This component must be rendered within a Stepper component');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { StepContext, useStepContext };
@@ -0,0 +1,18 @@
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 { createContext, useContext } from 'react';
8
+
9
+ const StepperContext = createContext(undefined);
10
+ const useStepperContext = () => {
11
+ const context = useContext(StepperContext);
12
+ if (context === undefined) {
13
+ throw new Error('This component must be rendered within a Stepper component');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { StepperContext, useStepperContext };
@@ -0,0 +1,18 @@
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 { createContext, useContext } from 'react';
8
+
9
+ const TimelineContext = createContext(undefined);
10
+ const useTimelineContext = () => {
11
+ const context = useContext(TimelineContext);
12
+ if (context === undefined) {
13
+ throw new Error('This component must be rendered within a Timeline component');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { TimelineContext, useTimelineContext };
@@ -0,0 +1,18 @@
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 { createContext, useContext } from 'react';
8
+
9
+ const TimelineItemContext = createContext(undefined);
10
+ const useTimelineItemContext = () => {
11
+ const context = useContext(TimelineItemContext);
12
+ if (context === undefined) {
13
+ throw new Error('This component must be rendered within a Timeline.Item component');
14
+ }
15
+ return context;
16
+ };
17
+
18
+ export { TimelineItemContext, useTimelineItemContext };