@windstream/react-shared-components 0.0.10 → 0.0.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/README.md +623 -623
- package/dist/contentful/index.d.ts +6 -2
- package/dist/contentful/index.esm.js +1 -1
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +1 -1
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +159 -159
- package/src/components/accordion/Accordion.stories.tsx +225 -225
- package/src/components/accordion/index.tsx +36 -36
- package/src/components/accordion/types.ts +9 -9
- package/src/components/alert-card/types.ts +9 -9
- package/src/components/brand-button/BrandButton.stories.tsx +221 -221
- package/src/components/brand-button/helpers.ts +35 -35
- package/src/components/brand-button/index.tsx +90 -90
- package/src/components/brand-button/types.ts +26 -26
- package/src/components/button/Button.stories.tsx +108 -108
- package/src/components/button/index.tsx +23 -23
- package/src/components/button/types.ts +14 -14
- package/src/components/call-button/CallButton.stories.tsx +324 -324
- package/src/components/call-button/index.tsx +80 -80
- package/src/components/call-button/types.ts +9 -9
- package/src/components/checkbox/Checkbox.stories.tsx +248 -248
- package/src/components/checkbox/types.ts +23 -23
- package/src/components/checklist/Checklist.stories.tsx +151 -151
- package/src/components/checklist/index.tsx +33 -33
- package/src/components/checklist/types.ts +5 -5
- package/src/components/collapse/Collapse.stories.tsx +256 -256
- package/src/components/collapse/index.tsx +44 -44
- package/src/components/collapse/types.ts +5 -5
- package/src/components/divider/Divider.stories.tsx +206 -206
- package/src/components/divider/index.tsx +23 -23
- package/src/components/divider/type.ts +2 -2
- package/src/components/input/Input.stories.tsx +358 -358
- package/src/components/input/index.tsx +174 -174
- package/src/components/input/types.ts +36 -36
- package/src/components/link/Link.stories.tsx +163 -163
- package/src/components/link/index.tsx +96 -96
- package/src/components/link/types.ts +25 -25
- package/src/components/list/List.stories.tsx +272 -272
- package/src/components/list/index.tsx +86 -86
- package/src/components/list/list-item/index.tsx +36 -36
- package/src/components/list/list-item/types.ts +13 -13
- package/src/components/list/types.ts +29 -29
- package/src/components/material-icon/MaterialIcon.stories.tsx +330 -330
- package/src/components/material-icon/constants.ts +95 -95
- package/src/components/material-icon/index.tsx +44 -44
- package/src/components/material-icon/types.ts +31 -31
- package/src/components/modal/Modal.stories.tsx +171 -171
- package/src/components/modal/index.tsx +168 -168
- package/src/components/modal/types.ts +23 -23
- package/src/components/radio-button/index.tsx +73 -73
- package/src/components/radio-button/types.ts +21 -21
- package/src/components/see-more/SeeMore.stories.tsx +182 -182
- package/src/components/see-more/index.tsx +38 -38
- package/src/components/see-more/types.ts +3 -3
- package/src/components/select/Select.stories.tsx +410 -410
- package/src/components/select/index.tsx +150 -150
- package/src/components/select/types.ts +34 -34
- package/src/components/select-plan-button/SelectPlanButton.stories.tsx +160 -160
- package/src/components/select-plan-button/index.tsx +20 -20
- package/src/components/select-plan-button/types.ts +3 -3
- package/src/components/skeleton/Skeleton.stories.tsx +180 -180
- package/src/components/skeleton/index.tsx +61 -61
- package/src/components/skeleton/types.ts +3 -3
- package/src/components/spinner/Spinner.stories.tsx +335 -335
- package/src/components/spinner/index.tsx +44 -44
- package/src/components/spinner/types.ts +4 -4
- package/src/components/text/Text.stories.tsx +302 -302
- package/src/components/text/index.tsx +26 -26
- package/src/components/text/types.ts +45 -45
- package/src/components/tooltip/Tooltip.stories.tsx +220 -220
- package/src/components/tooltip/index.tsx +78 -78
- package/src/components/tooltip/types.ts +6 -6
- package/src/components/view-cart-button/ViewCartButton.stories.tsx +241 -241
- package/src/components/view-cart-button/index.tsx +38 -38
- package/src/components/view-cart-button/types.ts +4 -4
- package/src/contentful/blocks/accordion/index.tsx +7 -7
- package/src/contentful/blocks/button/index.tsx +5 -5
- package/src/contentful/blocks/callout/index.tsx +7 -7
- package/src/contentful/blocks/cards/index.tsx +7 -7
- package/src/contentful/blocks/carousel/index.tsx +7 -7
- package/src/contentful/blocks/cta-callout/index.tsx +6 -0
- package/src/contentful/blocks/cta-callout/types.ts +1 -0
- package/src/contentful/blocks/floating-banner/index.tsx +7 -7
- package/src/contentful/blocks/footer/index.tsx +7 -7
- package/src/contentful/blocks/image-promo-bar/index.tsx +7 -7
- package/src/contentful/blocks/modal/index.tsx +5 -5
- package/src/contentful/blocks/navigation/index.tsx +7 -7
- package/src/contentful/blocks/primary-hero/index.tsx +7 -7
- package/src/contentful/blocks/shape-background-wrapper/index.tsx +123 -123
- package/src/contentful/blocks/shape-background-wrapper/types.ts +35 -35
- package/src/contentful/blocks/text/index.tsx +6 -6
- package/src/contentful/index.ts +4 -1
- package/src/hooks/use-body-scroll-lock.ts +31 -31
- package/src/index.ts +81 -81
- package/src/setupTests.ts +46 -46
- package/src/styles/globals.css +275 -319
- package/src/types/global.d.ts +9 -9
- package/src/utils/index.ts +49 -49
|
@@ -1,225 +1,225 @@
|
|
|
1
|
-
import { Accordion } from "./index";
|
|
2
|
-
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
-
|
|
4
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Accordion> = {
|
|
7
|
-
title: "Components/Accordion",
|
|
8
|
-
component: Accordion,
|
|
9
|
-
tags: ["autodocs"],
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: "centered",
|
|
12
|
-
docs: {
|
|
13
|
-
page: DocsPage,
|
|
14
|
-
description: {
|
|
15
|
-
component:
|
|
16
|
-
"A collapsible accordion component that can expand and collapse content sections with smooth animations.",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
title: {
|
|
22
|
-
control: { type: "text" },
|
|
23
|
-
description: "Title text displayed in the accordion header",
|
|
24
|
-
},
|
|
25
|
-
defaultOpen: {
|
|
26
|
-
control: { type: "boolean" },
|
|
27
|
-
description: "Whether the accordion is open by default",
|
|
28
|
-
},
|
|
29
|
-
containerClassName: {
|
|
30
|
-
control: { type: "text" },
|
|
31
|
-
description: "Additional CSS classes for the container",
|
|
32
|
-
},
|
|
33
|
-
titleClassName: {
|
|
34
|
-
control: { type: "text" },
|
|
35
|
-
description: "Additional CSS classes for the title",
|
|
36
|
-
},
|
|
37
|
-
className: {
|
|
38
|
-
control: { type: "text" },
|
|
39
|
-
description: "Additional CSS classes for the content area",
|
|
40
|
-
},
|
|
41
|
-
buttonClassName: {
|
|
42
|
-
control: { type: "text" },
|
|
43
|
-
description: "Additional CSS classes for the button",
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
args: {
|
|
47
|
-
title: "Accordion Title",
|
|
48
|
-
defaultOpen: false,
|
|
49
|
-
children: "This is the accordion content that can be expanded or collapsed.",
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default meta;
|
|
54
|
-
type Story = StoryObj<typeof meta>;
|
|
55
|
-
|
|
56
|
-
// Default accordion
|
|
57
|
-
export const Default: Story = {
|
|
58
|
-
args: {},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// Accordion with content
|
|
62
|
-
export const WithContent: Story = {
|
|
63
|
-
args: {
|
|
64
|
-
title: "Frequently Asked Questions",
|
|
65
|
-
children: (
|
|
66
|
-
<div className="space-y-2">
|
|
67
|
-
<p className="body2 text-text">
|
|
68
|
-
This accordion contains detailed information that can be expanded or
|
|
69
|
-
collapsed by clicking the header.
|
|
70
|
-
</p>
|
|
71
|
-
<p className="body3 text-text-secondary">
|
|
72
|
-
You can include any content here, such as text, images, forms, or
|
|
73
|
-
other components.
|
|
74
|
-
</p>
|
|
75
|
-
</div>
|
|
76
|
-
),
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// Default open accordion
|
|
81
|
-
export const DefaultOpen: Story = {
|
|
82
|
-
args: {
|
|
83
|
-
title: "Open by Default",
|
|
84
|
-
defaultOpen: true,
|
|
85
|
-
children: (
|
|
86
|
-
<div className="space-y-2">
|
|
87
|
-
<p className="body2 text-text">
|
|
88
|
-
This accordion is open by default when the page loads.
|
|
89
|
-
</p>
|
|
90
|
-
<p className="body3 text-text-secondary">
|
|
91
|
-
Use the defaultOpen prop to control the initial state.
|
|
92
|
-
</p>
|
|
93
|
-
</div>
|
|
94
|
-
),
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// Multiple accordions
|
|
99
|
-
export const Multiple: Story = {
|
|
100
|
-
render: () => (
|
|
101
|
-
<div className="w-full max-w-2xl space-y-4">
|
|
102
|
-
<Accordion title="First Section">
|
|
103
|
-
<p className="body2 text-text">
|
|
104
|
-
Content for the first accordion section.
|
|
105
|
-
</p>
|
|
106
|
-
</Accordion>
|
|
107
|
-
<Accordion title="Second Section" defaultOpen>
|
|
108
|
-
<p className="body2 text-text">
|
|
109
|
-
Content for the second accordion section. This one is open by default.
|
|
110
|
-
</p>
|
|
111
|
-
</Accordion>
|
|
112
|
-
<Accordion title="Third Section">
|
|
113
|
-
<p className="body2 text-text">
|
|
114
|
-
Content for the third accordion section.
|
|
115
|
-
</p>
|
|
116
|
-
</Accordion>
|
|
117
|
-
</div>
|
|
118
|
-
),
|
|
119
|
-
parameters: {
|
|
120
|
-
docs: {
|
|
121
|
-
description: {
|
|
122
|
-
story: "Multiple accordions used together to create an FAQ or content section.",
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
// Custom styling
|
|
129
|
-
export const CustomStyling: Story = {
|
|
130
|
-
args: {
|
|
131
|
-
title: "Custom Styled Accordion",
|
|
132
|
-
containerClassName: "border-2 border-border-brand",
|
|
133
|
-
titleClassName: "text-text-brand font-bold",
|
|
134
|
-
buttonClassName: "bg-surface-secondary",
|
|
135
|
-
className: "bg-surface-tertiary",
|
|
136
|
-
children: (
|
|
137
|
-
<div className="space-y-2">
|
|
138
|
-
<p className="body2 text-text">
|
|
139
|
-
This accordion has custom styling applied to different parts.
|
|
140
|
-
</p>
|
|
141
|
-
<ul className="list-disc pl-5 space-y-1">
|
|
142
|
-
<li className="body3 text-text-secondary">Custom container border</li>
|
|
143
|
-
<li className="body3 text-text-secondary">Custom title styling</li>
|
|
144
|
-
<li className="body3 text-text-secondary">Custom button background</li>
|
|
145
|
-
<li className="body3 text-text-secondary">Custom content background</li>
|
|
146
|
-
</ul>
|
|
147
|
-
</div>
|
|
148
|
-
),
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// Long content
|
|
153
|
-
export const LongContent: Story = {
|
|
154
|
-
args: {
|
|
155
|
-
title: "Accordion with Long Content",
|
|
156
|
-
children: (
|
|
157
|
-
<div className="space-y-4">
|
|
158
|
-
<p className="body2 text-text">
|
|
159
|
-
This accordion demonstrates how it handles longer content sections.
|
|
160
|
-
The content area will expand to accommodate all the content, and
|
|
161
|
-
scrolling will be handled naturally within the page.
|
|
162
|
-
</p>
|
|
163
|
-
<div className="space-y-2">
|
|
164
|
-
<h4 className="subheading2 text-text">Subsection 1</h4>
|
|
165
|
-
<p className="body3 text-text-secondary">
|
|
166
|
-
Additional details and information can be placed here.
|
|
167
|
-
</p>
|
|
168
|
-
</div>
|
|
169
|
-
<div className="space-y-2">
|
|
170
|
-
<h4 className="subheading2 text-text">Subsection 2</h4>
|
|
171
|
-
<p className="body3 text-text-secondary">
|
|
172
|
-
More content to demonstrate scrolling behavior.
|
|
173
|
-
</p>
|
|
174
|
-
</div>
|
|
175
|
-
<div className="space-y-2">
|
|
176
|
-
<h4 className="subheading2 text-text">Subsection 3</h4>
|
|
177
|
-
<p className="body3 text-text-secondary">
|
|
178
|
-
Even more content to show how the accordion handles extended
|
|
179
|
-
content areas.
|
|
180
|
-
</p>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
),
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
// All variants showcase
|
|
188
|
-
export const AllVariants: Story = {
|
|
189
|
-
render: () => (
|
|
190
|
-
<div className="w-full max-w-2xl space-y-4">
|
|
191
|
-
<div>
|
|
192
|
-
<h3 className="mb-3 text-lg font-semibold">Default State</h3>
|
|
193
|
-
<Accordion title="Closed Accordion">
|
|
194
|
-
<p className="body2 text-text">This accordion starts closed.</p>
|
|
195
|
-
</Accordion>
|
|
196
|
-
</div>
|
|
197
|
-
<div>
|
|
198
|
-
<h3 className="mb-3 text-lg font-semibold">Open by Default</h3>
|
|
199
|
-
<Accordion title="Open Accordion" defaultOpen>
|
|
200
|
-
<p className="body2 text-text">This accordion starts open.</p>
|
|
201
|
-
</Accordion>
|
|
202
|
-
</div>
|
|
203
|
-
<div>
|
|
204
|
-
<h3 className="mb-3 text-lg font-semibold">Custom Styled</h3>
|
|
205
|
-
<Accordion
|
|
206
|
-
title="Styled Accordion"
|
|
207
|
-
containerClassName="border-2 border-border-brand"
|
|
208
|
-
titleClassName="text-text-brand"
|
|
209
|
-
>
|
|
210
|
-
<p className="body2 text-text">
|
|
211
|
-
This accordion has custom styling applied.
|
|
212
|
-
</p>
|
|
213
|
-
</Accordion>
|
|
214
|
-
</div>
|
|
215
|
-
</div>
|
|
216
|
-
),
|
|
217
|
-
parameters: {
|
|
218
|
-
docs: {
|
|
219
|
-
description: {
|
|
220
|
-
story: "Showcase of all accordion variants and states.",
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
};
|
|
225
|
-
|
|
1
|
+
import { Accordion } from "./index";
|
|
2
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Accordion> = {
|
|
7
|
+
title: "Components/Accordion",
|
|
8
|
+
component: Accordion,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
page: DocsPage,
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"A collapsible accordion component that can expand and collapse content sections with smooth animations.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
title: {
|
|
22
|
+
control: { type: "text" },
|
|
23
|
+
description: "Title text displayed in the accordion header",
|
|
24
|
+
},
|
|
25
|
+
defaultOpen: {
|
|
26
|
+
control: { type: "boolean" },
|
|
27
|
+
description: "Whether the accordion is open by default",
|
|
28
|
+
},
|
|
29
|
+
containerClassName: {
|
|
30
|
+
control: { type: "text" },
|
|
31
|
+
description: "Additional CSS classes for the container",
|
|
32
|
+
},
|
|
33
|
+
titleClassName: {
|
|
34
|
+
control: { type: "text" },
|
|
35
|
+
description: "Additional CSS classes for the title",
|
|
36
|
+
},
|
|
37
|
+
className: {
|
|
38
|
+
control: { type: "text" },
|
|
39
|
+
description: "Additional CSS classes for the content area",
|
|
40
|
+
},
|
|
41
|
+
buttonClassName: {
|
|
42
|
+
control: { type: "text" },
|
|
43
|
+
description: "Additional CSS classes for the button",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
args: {
|
|
47
|
+
title: "Accordion Title",
|
|
48
|
+
defaultOpen: false,
|
|
49
|
+
children: "This is the accordion content that can be expanded or collapsed.",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
type Story = StoryObj<typeof meta>;
|
|
55
|
+
|
|
56
|
+
// Default accordion
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Accordion with content
|
|
62
|
+
export const WithContent: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
title: "Frequently Asked Questions",
|
|
65
|
+
children: (
|
|
66
|
+
<div className="space-y-2">
|
|
67
|
+
<p className="body2 text-text">
|
|
68
|
+
This accordion contains detailed information that can be expanded or
|
|
69
|
+
collapsed by clicking the header.
|
|
70
|
+
</p>
|
|
71
|
+
<p className="body3 text-text-secondary">
|
|
72
|
+
You can include any content here, such as text, images, forms, or
|
|
73
|
+
other components.
|
|
74
|
+
</p>
|
|
75
|
+
</div>
|
|
76
|
+
),
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Default open accordion
|
|
81
|
+
export const DefaultOpen: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
title: "Open by Default",
|
|
84
|
+
defaultOpen: true,
|
|
85
|
+
children: (
|
|
86
|
+
<div className="space-y-2">
|
|
87
|
+
<p className="body2 text-text">
|
|
88
|
+
This accordion is open by default when the page loads.
|
|
89
|
+
</p>
|
|
90
|
+
<p className="body3 text-text-secondary">
|
|
91
|
+
Use the defaultOpen prop to control the initial state.
|
|
92
|
+
</p>
|
|
93
|
+
</div>
|
|
94
|
+
),
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Multiple accordions
|
|
99
|
+
export const Multiple: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<div className="w-full max-w-2xl space-y-4">
|
|
102
|
+
<Accordion title="First Section">
|
|
103
|
+
<p className="body2 text-text">
|
|
104
|
+
Content for the first accordion section.
|
|
105
|
+
</p>
|
|
106
|
+
</Accordion>
|
|
107
|
+
<Accordion title="Second Section" defaultOpen>
|
|
108
|
+
<p className="body2 text-text">
|
|
109
|
+
Content for the second accordion section. This one is open by default.
|
|
110
|
+
</p>
|
|
111
|
+
</Accordion>
|
|
112
|
+
<Accordion title="Third Section">
|
|
113
|
+
<p className="body2 text-text">
|
|
114
|
+
Content for the third accordion section.
|
|
115
|
+
</p>
|
|
116
|
+
</Accordion>
|
|
117
|
+
</div>
|
|
118
|
+
),
|
|
119
|
+
parameters: {
|
|
120
|
+
docs: {
|
|
121
|
+
description: {
|
|
122
|
+
story: "Multiple accordions used together to create an FAQ or content section.",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// Custom styling
|
|
129
|
+
export const CustomStyling: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
title: "Custom Styled Accordion",
|
|
132
|
+
containerClassName: "border-2 border-border-brand",
|
|
133
|
+
titleClassName: "text-text-brand font-bold",
|
|
134
|
+
buttonClassName: "bg-surface-secondary",
|
|
135
|
+
className: "bg-surface-tertiary",
|
|
136
|
+
children: (
|
|
137
|
+
<div className="space-y-2">
|
|
138
|
+
<p className="body2 text-text">
|
|
139
|
+
This accordion has custom styling applied to different parts.
|
|
140
|
+
</p>
|
|
141
|
+
<ul className="list-disc pl-5 space-y-1">
|
|
142
|
+
<li className="body3 text-text-secondary">Custom container border</li>
|
|
143
|
+
<li className="body3 text-text-secondary">Custom title styling</li>
|
|
144
|
+
<li className="body3 text-text-secondary">Custom button background</li>
|
|
145
|
+
<li className="body3 text-text-secondary">Custom content background</li>
|
|
146
|
+
</ul>
|
|
147
|
+
</div>
|
|
148
|
+
),
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Long content
|
|
153
|
+
export const LongContent: Story = {
|
|
154
|
+
args: {
|
|
155
|
+
title: "Accordion with Long Content",
|
|
156
|
+
children: (
|
|
157
|
+
<div className="space-y-4">
|
|
158
|
+
<p className="body2 text-text">
|
|
159
|
+
This accordion demonstrates how it handles longer content sections.
|
|
160
|
+
The content area will expand to accommodate all the content, and
|
|
161
|
+
scrolling will be handled naturally within the page.
|
|
162
|
+
</p>
|
|
163
|
+
<div className="space-y-2">
|
|
164
|
+
<h4 className="subheading2 text-text">Subsection 1</h4>
|
|
165
|
+
<p className="body3 text-text-secondary">
|
|
166
|
+
Additional details and information can be placed here.
|
|
167
|
+
</p>
|
|
168
|
+
</div>
|
|
169
|
+
<div className="space-y-2">
|
|
170
|
+
<h4 className="subheading2 text-text">Subsection 2</h4>
|
|
171
|
+
<p className="body3 text-text-secondary">
|
|
172
|
+
More content to demonstrate scrolling behavior.
|
|
173
|
+
</p>
|
|
174
|
+
</div>
|
|
175
|
+
<div className="space-y-2">
|
|
176
|
+
<h4 className="subheading2 text-text">Subsection 3</h4>
|
|
177
|
+
<p className="body3 text-text-secondary">
|
|
178
|
+
Even more content to show how the accordion handles extended
|
|
179
|
+
content areas.
|
|
180
|
+
</p>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
),
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// All variants showcase
|
|
188
|
+
export const AllVariants: Story = {
|
|
189
|
+
render: () => (
|
|
190
|
+
<div className="w-full max-w-2xl space-y-4">
|
|
191
|
+
<div>
|
|
192
|
+
<h3 className="mb-3 text-lg font-semibold">Default State</h3>
|
|
193
|
+
<Accordion title="Closed Accordion">
|
|
194
|
+
<p className="body2 text-text">This accordion starts closed.</p>
|
|
195
|
+
</Accordion>
|
|
196
|
+
</div>
|
|
197
|
+
<div>
|
|
198
|
+
<h3 className="mb-3 text-lg font-semibold">Open by Default</h3>
|
|
199
|
+
<Accordion title="Open Accordion" defaultOpen>
|
|
200
|
+
<p className="body2 text-text">This accordion starts open.</p>
|
|
201
|
+
</Accordion>
|
|
202
|
+
</div>
|
|
203
|
+
<div>
|
|
204
|
+
<h3 className="mb-3 text-lg font-semibold">Custom Styled</h3>
|
|
205
|
+
<Accordion
|
|
206
|
+
title="Styled Accordion"
|
|
207
|
+
containerClassName="border-2 border-border-brand"
|
|
208
|
+
titleClassName="text-text-brand"
|
|
209
|
+
>
|
|
210
|
+
<p className="body2 text-text">
|
|
211
|
+
This accordion has custom styling applied.
|
|
212
|
+
</p>
|
|
213
|
+
</Accordion>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
),
|
|
217
|
+
parameters: {
|
|
218
|
+
docs: {
|
|
219
|
+
description: {
|
|
220
|
+
story: "Showcase of all accordion variants and states.",
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { AccordionProps } from "@shared/components/accordion/types";
|
|
3
|
-
import { Collapse } from "@shared/components/collapse";
|
|
4
|
-
import { MaterialIcon } from "@shared/components/material-icon";
|
|
5
|
-
import { cx } from "@shared/utils";
|
|
6
|
-
import { Button } from "@shared/components/button";
|
|
7
|
-
import { BrandButton } from "../brand-button";
|
|
8
|
-
|
|
9
|
-
export const Accordion:React.FC<AccordionProps> = props => {
|
|
10
|
-
const { title, defaultOpen, children, containerClassName, titleClassName, className, buttonClassName } = props;
|
|
11
|
-
const [open, setOpen] = useState<boolean>(Boolean(defaultOpen));
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div className={cx("rounded-lg border", containerClassName)}>
|
|
15
|
-
<Button
|
|
16
|
-
type="button"
|
|
17
|
-
className={cx("flex w-full items-center justify-between gap-4 rounded-t-lg px-4 py-3 text-left", buttonClassName)}
|
|
18
|
-
onClick={() => setOpen(v => !v)}
|
|
19
|
-
>
|
|
20
|
-
<span className={cx("label5", titleClassName)}>{title}</span>
|
|
21
|
-
<MaterialIcon
|
|
22
|
-
name={open ? 'keyboard_arrow_down': 'keyboard_arrow_up'}
|
|
23
|
-
fill={1}
|
|
24
|
-
size={24}
|
|
25
|
-
/>
|
|
26
|
-
</Button>
|
|
27
|
-
<Collapse open={open}>
|
|
28
|
-
<div className={cx("px-4 py-4", className)}>{children}</div>
|
|
29
|
-
</Collapse>
|
|
30
|
-
</div>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
Accordion.displayName = "Accordion";
|
|
35
|
-
|
|
36
|
-
export type { AccordionProps };
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { AccordionProps } from "@shared/components/accordion/types";
|
|
3
|
+
import { Collapse } from "@shared/components/collapse";
|
|
4
|
+
import { MaterialIcon } from "@shared/components/material-icon";
|
|
5
|
+
import { cx } from "@shared/utils";
|
|
6
|
+
import { Button } from "@shared/components/button";
|
|
7
|
+
import { BrandButton } from "../brand-button";
|
|
8
|
+
|
|
9
|
+
export const Accordion:React.FC<AccordionProps> = props => {
|
|
10
|
+
const { title, defaultOpen, children, containerClassName, titleClassName, className, buttonClassName } = props;
|
|
11
|
+
const [open, setOpen] = useState<boolean>(Boolean(defaultOpen));
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className={cx("rounded-lg border", containerClassName)}>
|
|
15
|
+
<Button
|
|
16
|
+
type="button"
|
|
17
|
+
className={cx("flex w-full items-center justify-between gap-4 rounded-t-lg px-4 py-3 text-left", buttonClassName)}
|
|
18
|
+
onClick={() => setOpen(v => !v)}
|
|
19
|
+
>
|
|
20
|
+
<span className={cx("label5", titleClassName)}>{title}</span>
|
|
21
|
+
<MaterialIcon
|
|
22
|
+
name={open ? 'keyboard_arrow_down': 'keyboard_arrow_up'}
|
|
23
|
+
fill={1}
|
|
24
|
+
size={24}
|
|
25
|
+
/>
|
|
26
|
+
</Button>
|
|
27
|
+
<Collapse open={open}>
|
|
28
|
+
<div className={cx("px-4 py-4", className)}>{children}</div>
|
|
29
|
+
</Collapse>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Accordion.displayName = "Accordion";
|
|
35
|
+
|
|
36
|
+
export type { AccordionProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export type AccordionProps = {
|
|
2
|
-
title: string;
|
|
3
|
-
defaultOpen?: boolean;
|
|
4
|
-
containerClassName?: string;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
titleClassName?: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
buttonClassName?: string;
|
|
9
|
-
};
|
|
1
|
+
export type AccordionProps = {
|
|
2
|
+
title: string;
|
|
3
|
+
defaultOpen?: boolean;
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
titleClassName?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
buttonClassName?: string;
|
|
9
|
+
};
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
import { TextVariant } from "@shared/components/text";
|
|
4
|
-
|
|
5
|
-
export type AlertCardProps = {
|
|
6
|
-
errorMessage?: string | ReactNode;
|
|
7
|
-
className?: string;
|
|
8
|
-
textVariant?: TextVariant;
|
|
9
|
-
};
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { TextVariant } from "@shared/components/text";
|
|
4
|
+
|
|
5
|
+
export type AlertCardProps = {
|
|
6
|
+
errorMessage?: string | ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
textVariant?: TextVariant;
|
|
9
|
+
};
|