@sproutsocial/seeds-react-accordion 0.1.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.
- package/.eslintignore +6 -0
- package/.eslintrc.js +4 -0
- package/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +7 -0
- package/dist/esm/index.js +267 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +300 -0
- package/dist/index.js.map +1 -0
- package/jest.config.js +9 -0
- package/package.json +47 -0
- package/src/Accordion.stories.tsx +563 -0
- package/src/Accordion.tsx +63 -0
- package/src/AccordionContent.tsx +23 -0
- package/src/AccordionItem.tsx +11 -0
- package/src/AccordionTrigger.tsx +188 -0
- package/src/AccordionTypes.ts +54 -0
- package/src/__tests__/accordion.test.tsx +419 -0
- package/src/index.ts +6 -0
- package/src/styled.d.ts +7 -0
- package/src/styles.ts +194 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +12 -0
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type StoryFn, type Meta } from "@storybook/react";
|
|
3
|
+
import { Accordion } from "./Accordion";
|
|
4
|
+
import { AccordionTrigger } from "./AccordionTrigger";
|
|
5
|
+
import { AccordionContent } from "./AccordionContent";
|
|
6
|
+
import { AccordionItem } from "./AccordionItem";
|
|
7
|
+
import { Box } from "@sproutsocial/seeds-react-box";
|
|
8
|
+
import { Token } from "@sproutsocial/seeds-react-token";
|
|
9
|
+
import { Text } from "@sproutsocial/seeds-react-text";
|
|
10
|
+
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: "Components/Accordion",
|
|
14
|
+
component: Accordion,
|
|
15
|
+
} as Meta<typeof Accordion>;
|
|
16
|
+
|
|
17
|
+
export const Default = {
|
|
18
|
+
args: {
|
|
19
|
+
defaultValue: ["section-1"],
|
|
20
|
+
styled: true,
|
|
21
|
+
},
|
|
22
|
+
render: (args: any) => {
|
|
23
|
+
return (
|
|
24
|
+
<Accordion {...args}>
|
|
25
|
+
<AccordionItem value="section-1">
|
|
26
|
+
<AccordionTrigger title="Paint with Bob" />
|
|
27
|
+
<AccordionContent>
|
|
28
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
29
|
+
We don't really know where this goes - and I'm not sure we really
|
|
30
|
+
care. Paint anything you want on the canvas. Create your own
|
|
31
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
32
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
33
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
34
|
+
you want. Every time you practice, you learn more.
|
|
35
|
+
</Text.SmallBodyCopy>
|
|
36
|
+
<Text.SmallBodyCopy as="p">
|
|
37
|
+
A tree needs to be your friend if you're going to paint him. It's
|
|
38
|
+
amazing what you can do with a little love in your heart. If there
|
|
39
|
+
are two big trees, eventually there will be a little tree. Think
|
|
40
|
+
about a cloud. Just float around and be there.
|
|
41
|
+
</Text.SmallBodyCopy>
|
|
42
|
+
</AccordionContent>
|
|
43
|
+
</AccordionItem>
|
|
44
|
+
</Accordion>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Configurable = {
|
|
50
|
+
args: {
|
|
51
|
+
defaultValue: ["section-1"],
|
|
52
|
+
triggerPosition: "left",
|
|
53
|
+
triggerIcon: <Icon className="triggerIcon" name="caret-down-solid" />,
|
|
54
|
+
styled: true,
|
|
55
|
+
},
|
|
56
|
+
render: (args: any) => {
|
|
57
|
+
return (
|
|
58
|
+
<Accordion {...args}>
|
|
59
|
+
<AccordionItem value="section-1">
|
|
60
|
+
<AccordionTrigger title="Paint with Bob" />
|
|
61
|
+
<AccordionContent>
|
|
62
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
63
|
+
We don't really know where this goes - and I'm not sure we really
|
|
64
|
+
care. Paint anything you want on the canvas. Create your own
|
|
65
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
66
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
67
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
68
|
+
you want. Every time you practice, you learn more.
|
|
69
|
+
</Text.SmallBodyCopy>
|
|
70
|
+
<Text.SmallBodyCopy as="p">
|
|
71
|
+
A tree needs to be your friend if you're going to paint him. It's
|
|
72
|
+
amazing what you can do with a little love in your heart. If there
|
|
73
|
+
are two big trees, eventually there will be a little tree. Think
|
|
74
|
+
about a cloud. Just float around and be there.
|
|
75
|
+
</Text.SmallBodyCopy>
|
|
76
|
+
</AccordionContent>
|
|
77
|
+
</AccordionItem>
|
|
78
|
+
</Accordion>
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const RelatedActions = {
|
|
84
|
+
args: {
|
|
85
|
+
defaultValue: ["section-1"],
|
|
86
|
+
triggerPosition: "left",
|
|
87
|
+
styled: true,
|
|
88
|
+
},
|
|
89
|
+
render: (args: any) => (
|
|
90
|
+
<Box p={300} width="100%" height="100%" bg="app.background.base">
|
|
91
|
+
<Accordion {...args}>
|
|
92
|
+
<AccordionItem value="section-1">
|
|
93
|
+
<AccordionTrigger
|
|
94
|
+
title="Paint with Bob"
|
|
95
|
+
overflowMenu={{
|
|
96
|
+
items: [
|
|
97
|
+
{
|
|
98
|
+
id: "edit",
|
|
99
|
+
iconName: "pencil-to-square-outline",
|
|
100
|
+
children: "Edit",
|
|
101
|
+
onClick: () => alert("Edit clicked"),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "share",
|
|
105
|
+
iconName: "arrow-up-from-bracket-outline",
|
|
106
|
+
children: "Share",
|
|
107
|
+
onClick: () => alert("Share clicked"),
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "archive",
|
|
111
|
+
iconName: "folder-outline",
|
|
112
|
+
children: "Archive",
|
|
113
|
+
onClick: () => alert("Archive clicked"),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "delete",
|
|
117
|
+
iconName: "trash-outline",
|
|
118
|
+
children: "Delete",
|
|
119
|
+
onClick: () => alert("Delete clicked"),
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
}}
|
|
123
|
+
relatedActions={[
|
|
124
|
+
{
|
|
125
|
+
iconName: "heart-outline",
|
|
126
|
+
onClick: () => alert("Like clicked"),
|
|
127
|
+
"aria-label": "Like",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
iconName: "alarm-clock",
|
|
131
|
+
onClick: () => alert("Set alarm"),
|
|
132
|
+
"aria-label": "Set alarm",
|
|
133
|
+
},
|
|
134
|
+
]}
|
|
135
|
+
/>
|
|
136
|
+
<AccordionContent>
|
|
137
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
138
|
+
We don't really know where this goes - and I'm not sure we really
|
|
139
|
+
care. Paint anything you want on the canvas. Create your own
|
|
140
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
141
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
142
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
143
|
+
you want. Every time you practice, you learn more.
|
|
144
|
+
</Text.SmallBodyCopy>
|
|
145
|
+
<Text.SmallBodyCopy as="p">
|
|
146
|
+
A tree needs to be your friend if you're going to paint him. It's
|
|
147
|
+
amazing what you can do with a little love in your heart. If there
|
|
148
|
+
are two big trees, eventually there will be a little tree. Think
|
|
149
|
+
about a cloud. Just float around and be there.
|
|
150
|
+
</Text.SmallBodyCopy>
|
|
151
|
+
</AccordionContent>
|
|
152
|
+
</AccordionItem>
|
|
153
|
+
<AccordionItem value="section-2">
|
|
154
|
+
<AccordionTrigger
|
|
155
|
+
title="Learn with Bob"
|
|
156
|
+
relatedActions={[
|
|
157
|
+
{
|
|
158
|
+
iconName: "alarm-clock",
|
|
159
|
+
onClick: () => alert("hello"),
|
|
160
|
+
"aria-label": "Set alarm",
|
|
161
|
+
},
|
|
162
|
+
]}
|
|
163
|
+
rightSlot={
|
|
164
|
+
<Box ml={300}>
|
|
165
|
+
<Token mr={200} closeable={false}>
|
|
166
|
+
Happy
|
|
167
|
+
</Token>
|
|
168
|
+
<Token closeable={false}>Trees</Token>
|
|
169
|
+
</Box>
|
|
170
|
+
}
|
|
171
|
+
/>
|
|
172
|
+
<AccordionContent>
|
|
173
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
174
|
+
We don't really know where this goes - and I'm not sure we really
|
|
175
|
+
care. Paint anything you want on the canvas. Create your own
|
|
176
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
177
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
178
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
179
|
+
you want. Every time you practice, you learn more.
|
|
180
|
+
</Text.SmallBodyCopy>
|
|
181
|
+
<Text.SmallBodyCopy as="p">
|
|
182
|
+
A tree needs to be your friend if you're going to paint him. It's
|
|
183
|
+
amazing what you can do with a little love in your heart. If there
|
|
184
|
+
are two big trees, eventually there will be a little tree. Think
|
|
185
|
+
about a cloud. Just float around and be there.
|
|
186
|
+
</Text.SmallBodyCopy>
|
|
187
|
+
</AccordionContent>
|
|
188
|
+
</AccordionItem>
|
|
189
|
+
<AccordionItem value="section-3">
|
|
190
|
+
<AccordionTrigger title="Laugh with Bob" />
|
|
191
|
+
<AccordionContent>
|
|
192
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
193
|
+
We don't really know where this goes - and I'm not sure we really
|
|
194
|
+
care. Paint anything you want on the canvas. Create your own
|
|
195
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
196
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
197
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
198
|
+
you want. Every time you practice, you learn more.
|
|
199
|
+
</Text.SmallBodyCopy>
|
|
200
|
+
<Text.SmallBodyCopy as="p">
|
|
201
|
+
A tree needs to be your friend if you're going to paint him. It's
|
|
202
|
+
amazing what you can do with a little love in your heart. If there
|
|
203
|
+
are two big trees, eventually there will be a little tree. Think
|
|
204
|
+
about a cloud. Just float around and be there.
|
|
205
|
+
</Text.SmallBodyCopy>
|
|
206
|
+
</AccordionContent>
|
|
207
|
+
</AccordionItem>
|
|
208
|
+
</Accordion>
|
|
209
|
+
</Box>
|
|
210
|
+
),
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const Styleable = {
|
|
214
|
+
render: () => {
|
|
215
|
+
return (
|
|
216
|
+
<Accordion
|
|
217
|
+
triggerPosition="left"
|
|
218
|
+
defaultValue={["section-1"]}
|
|
219
|
+
styled={false}
|
|
220
|
+
>
|
|
221
|
+
<AccordionItem value="section-1">
|
|
222
|
+
<AccordionTrigger
|
|
223
|
+
title="Paint with Bob"
|
|
224
|
+
bg="blue.100"
|
|
225
|
+
p={400}
|
|
226
|
+
color="red.500"
|
|
227
|
+
fontWeight="bold"
|
|
228
|
+
fontSize={400}
|
|
229
|
+
/>
|
|
230
|
+
<AccordionContent bg="blue.300" p={400}>
|
|
231
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
232
|
+
We don't really know where this goes - and I'm not sure we really
|
|
233
|
+
care. Paint anything you want on the canvas. Create your own
|
|
234
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
235
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
236
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
237
|
+
you want. Every time you practice, you learn more.
|
|
238
|
+
</Text.SmallBodyCopy>
|
|
239
|
+
<Text.SmallBodyCopy as="p">
|
|
240
|
+
We don't really know where this goes - and I'm not sure we really
|
|
241
|
+
care. Paint anything you want on the canvas. Create your own
|
|
242
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
243
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
244
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
245
|
+
you want. Every time you practice, you learn more.
|
|
246
|
+
</Text.SmallBodyCopy>
|
|
247
|
+
</AccordionContent>
|
|
248
|
+
</AccordionItem>
|
|
249
|
+
<AccordionItem value="section-2">
|
|
250
|
+
<AccordionTrigger
|
|
251
|
+
bg="red.300"
|
|
252
|
+
p={400}
|
|
253
|
+
title="Learn with Bob"
|
|
254
|
+
relatedActions={[
|
|
255
|
+
{
|
|
256
|
+
iconName: "alarm-clock",
|
|
257
|
+
onClick: () => alert("hello"),
|
|
258
|
+
"aria-label": "Set alarm",
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
iconName: "ellipsis-horizontal-outline",
|
|
262
|
+
onClick: () => alert("goodbye"),
|
|
263
|
+
"aria-label": "More options",
|
|
264
|
+
},
|
|
265
|
+
]}
|
|
266
|
+
/>
|
|
267
|
+
<AccordionContent bg="blue.300" p={400}>
|
|
268
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
269
|
+
We don't really know where this goes - and I'm not sure we really
|
|
270
|
+
care. Paint anything you want on the canvas. Create your own
|
|
271
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
272
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
273
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
274
|
+
you want. Every time you practice, you learn more.
|
|
275
|
+
</Text.SmallBodyCopy>
|
|
276
|
+
<Text.SmallBodyCopy as="p">
|
|
277
|
+
We don't really know where this goes - and I'm not sure we really
|
|
278
|
+
care. Paint anything you want on the canvas. Create your own
|
|
279
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
280
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
281
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
282
|
+
you want. Every time you practice, you learn more.
|
|
283
|
+
</Text.SmallBodyCopy>
|
|
284
|
+
</AccordionContent>
|
|
285
|
+
</AccordionItem>
|
|
286
|
+
</Accordion>
|
|
287
|
+
);
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
export const Single = {
|
|
292
|
+
args: {
|
|
293
|
+
defaultValue: ["section-1"],
|
|
294
|
+
type: "single",
|
|
295
|
+
styled: true,
|
|
296
|
+
},
|
|
297
|
+
render: (args: any) => (
|
|
298
|
+
<Box p={300} width="100%" height="100%" bg="app.background.base">
|
|
299
|
+
<Accordion {...args}>
|
|
300
|
+
<AccordionItem value="section-1">
|
|
301
|
+
<AccordionTrigger
|
|
302
|
+
title="Paint with Bob"
|
|
303
|
+
relatedActions={[
|
|
304
|
+
{
|
|
305
|
+
iconName: "alarm-clock",
|
|
306
|
+
onClick: () => alert("hello"),
|
|
307
|
+
"aria-label": "Set alarm",
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
iconName: "ellipsis-horizontal-outline",
|
|
311
|
+
onClick: () => alert("goodbye"),
|
|
312
|
+
"aria-label": "More options",
|
|
313
|
+
},
|
|
314
|
+
]}
|
|
315
|
+
/>
|
|
316
|
+
<AccordionContent>
|
|
317
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
318
|
+
We don't really know where this goes - and I'm not sure we really
|
|
319
|
+
care. Paint anything you want on the canvas. Create your own
|
|
320
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
321
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
322
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
323
|
+
you want. Every time you practice, you learn more.
|
|
324
|
+
</Text.SmallBodyCopy>
|
|
325
|
+
<Text.SmallBodyCopy as="p">
|
|
326
|
+
We don't really know where this goes - and I'm not sure we really
|
|
327
|
+
care. Paint anything you want on the canvas. Create your own
|
|
328
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
329
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
330
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
331
|
+
you want. Every time you practice, you learn more.
|
|
332
|
+
</Text.SmallBodyCopy>
|
|
333
|
+
</AccordionContent>
|
|
334
|
+
</AccordionItem>
|
|
335
|
+
<AccordionItem value="section-2">
|
|
336
|
+
<AccordionTrigger
|
|
337
|
+
title="Learn with Bob"
|
|
338
|
+
relatedActions={[
|
|
339
|
+
{
|
|
340
|
+
iconName: "alarm-clock",
|
|
341
|
+
onClick: () => alert("hello"),
|
|
342
|
+
"aria-label": "Set alarm",
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
iconName: "ellipsis-horizontal-outline",
|
|
346
|
+
onClick: () => alert("goodbye"),
|
|
347
|
+
"aria-label": "More options",
|
|
348
|
+
},
|
|
349
|
+
]}
|
|
350
|
+
rightSlot={
|
|
351
|
+
<Box ml={300}>
|
|
352
|
+
<Token mr={200} closeable={false}>
|
|
353
|
+
Happy
|
|
354
|
+
</Token>
|
|
355
|
+
<Token closeable={false}>Trees</Token>
|
|
356
|
+
</Box>
|
|
357
|
+
}
|
|
358
|
+
/>
|
|
359
|
+
<AccordionContent>
|
|
360
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
361
|
+
We don't really know where this goes - and I'm not sure we really
|
|
362
|
+
care. Paint anything you want on the canvas. Create your own
|
|
363
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
364
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
365
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
366
|
+
you want. Every time you practice, you learn more.
|
|
367
|
+
</Text.SmallBodyCopy>
|
|
368
|
+
<Text.SmallBodyCopy as="p">
|
|
369
|
+
We don't really know where this goes - and I'm not sure we really
|
|
370
|
+
care. Paint anything you want on the canvas. Create your own
|
|
371
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
372
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
373
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
374
|
+
you want. Every time you practice, you learn more.
|
|
375
|
+
</Text.SmallBodyCopy>
|
|
376
|
+
</AccordionContent>
|
|
377
|
+
</AccordionItem>
|
|
378
|
+
<AccordionItem value="section-3">
|
|
379
|
+
<AccordionTrigger title="Laugh with Bob" />
|
|
380
|
+
<AccordionContent>
|
|
381
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
382
|
+
We don't really know where this goes - and I'm not sure we really
|
|
383
|
+
care. Paint anything you want on the canvas. Create your own
|
|
384
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
385
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
386
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
387
|
+
you want. Every time you practice, you learn more.
|
|
388
|
+
</Text.SmallBodyCopy>
|
|
389
|
+
<Text.SmallBodyCopy as="p">
|
|
390
|
+
We don't really know where this goes - and I'm not sure we really
|
|
391
|
+
care. Paint anything you want on the canvas. Create your own
|
|
392
|
+
world. We don't need any guidelines or formats. All we need to do
|
|
393
|
+
is just let it flow right out of us. Use absolutely no pressure.
|
|
394
|
+
Just like an angel's wing. In your imagination you can go anywhere
|
|
395
|
+
you want. Every time you practice, you learn more.
|
|
396
|
+
</Text.SmallBodyCopy>
|
|
397
|
+
</AccordionContent>
|
|
398
|
+
</AccordionItem>
|
|
399
|
+
</Accordion>
|
|
400
|
+
</Box>
|
|
401
|
+
),
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export const RenderTest = {
|
|
405
|
+
args: {
|
|
406
|
+
defaultValue: ["section-1"],
|
|
407
|
+
styled: true,
|
|
408
|
+
},
|
|
409
|
+
render: (args: any) => {
|
|
410
|
+
return (
|
|
411
|
+
<>
|
|
412
|
+
<Box mb={500}>
|
|
413
|
+
<Accordion {...args}>
|
|
414
|
+
<AccordionItem value="section-1">
|
|
415
|
+
<AccordionTrigger title="Paint with Bob" />
|
|
416
|
+
<AccordionContent>
|
|
417
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
418
|
+
We don't really know where this goes - and I'm not sure we
|
|
419
|
+
really care. Paint anything you want on the canvas. Create
|
|
420
|
+
your own world. We don't need any guidelines or formats. All
|
|
421
|
+
we need to do is just let it flow right out of us. Use
|
|
422
|
+
absolutely no pressure. Just like an angel's wing. In your
|
|
423
|
+
imagination you can go anywhere you want. Every time you
|
|
424
|
+
practice, you learn more.
|
|
425
|
+
</Text.SmallBodyCopy>
|
|
426
|
+
<Text.SmallBodyCopy as="p">
|
|
427
|
+
We don't really know where this goes - and I'm not sure we
|
|
428
|
+
really care. Paint anything you want on the canvas. Create
|
|
429
|
+
your own world. We don't need any guidelines or formats. All
|
|
430
|
+
we need to do is just let it flow right out of us. Use
|
|
431
|
+
absolutely no pressure. Just like an angel's wing. In your
|
|
432
|
+
imagination you can go anywhere you want. Every time you
|
|
433
|
+
practice, you learn more.
|
|
434
|
+
</Text.SmallBodyCopy>
|
|
435
|
+
</AccordionContent>
|
|
436
|
+
</AccordionItem>
|
|
437
|
+
</Accordion>
|
|
438
|
+
</Box>
|
|
439
|
+
|
|
440
|
+
<Accordion
|
|
441
|
+
triggerPosition="left"
|
|
442
|
+
defaultValue={["section-1"]}
|
|
443
|
+
styled={false}
|
|
444
|
+
>
|
|
445
|
+
<AccordionItem value="section-1">
|
|
446
|
+
<AccordionTrigger title="Paint with Bob" bg="red.300" p={400} />
|
|
447
|
+
<AccordionContent bg="blue.300" p={400}>
|
|
448
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
449
|
+
We don't really know where this goes - and I'm not sure we
|
|
450
|
+
really care. Paint anything you want on the canvas. Create your
|
|
451
|
+
own world. We don't need any guidelines or formats. All we need
|
|
452
|
+
to do is just let it flow right out of us. Use absolutely no
|
|
453
|
+
pressure. Just like an angel's wing. In your imagination you can
|
|
454
|
+
go anywhere you want. Every time you practice, you learn more.
|
|
455
|
+
</Text.SmallBodyCopy>
|
|
456
|
+
<Text.SmallBodyCopy as="p">
|
|
457
|
+
We don't really know where this goes - and I'm not sure we
|
|
458
|
+
really care. Paint anything you want on the canvas. Create your
|
|
459
|
+
own world. We don't need any guidelines or formats. All we need
|
|
460
|
+
to do is just let it flow right out of us. Use absolutely no
|
|
461
|
+
pressure. Just like an angel's wing. In your imagination you can
|
|
462
|
+
go anywhere you want. Every time you practice, you learn more.
|
|
463
|
+
</Text.SmallBodyCopy>
|
|
464
|
+
</AccordionContent>
|
|
465
|
+
</AccordionItem>
|
|
466
|
+
<AccordionItem value="section-2">
|
|
467
|
+
<AccordionTrigger
|
|
468
|
+
bg="red.300"
|
|
469
|
+
p={400}
|
|
470
|
+
title="Learn with Bob"
|
|
471
|
+
relatedActions={[
|
|
472
|
+
{
|
|
473
|
+
iconName: "alarm-clock",
|
|
474
|
+
onClick: () => alert("hello"),
|
|
475
|
+
"aria-label": "Set alarm",
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
iconName: "ellipsis-horizontal-outline",
|
|
479
|
+
onClick: () => alert("goodbye"),
|
|
480
|
+
"aria-label": "More options",
|
|
481
|
+
},
|
|
482
|
+
]}
|
|
483
|
+
/>
|
|
484
|
+
<AccordionContent bg="blue.300" p={400}>
|
|
485
|
+
<Text.SmallBodyCopy as="p" mb={400}>
|
|
486
|
+
We don't really know where this goes - and I'm not sure we
|
|
487
|
+
really care. Paint anything you want on the canvas. Create your
|
|
488
|
+
own world. We don't need any guidelines or formats. All we need
|
|
489
|
+
to do is just let it flow right out of us. Use absolutely no
|
|
490
|
+
pressure. Just like an angel's wing. In your imagination you can
|
|
491
|
+
go anywhere you want. Every time you practice, you learn more.
|
|
492
|
+
</Text.SmallBodyCopy>
|
|
493
|
+
<Text.SmallBodyCopy as="p">
|
|
494
|
+
We don't really know where this goes - and I'm not sure we
|
|
495
|
+
really care. Paint anything you want on the canvas. Create your
|
|
496
|
+
own world. We don't need any guidelines or formats. All we need
|
|
497
|
+
to do is just let it flow right out of us. Use absolutely no
|
|
498
|
+
pressure. Just like an angel's wing. In your imagination you can
|
|
499
|
+
go anywhere you want. Every time you practice, you learn more.
|
|
500
|
+
</Text.SmallBodyCopy>
|
|
501
|
+
</AccordionContent>
|
|
502
|
+
</AccordionItem>
|
|
503
|
+
</Accordion>
|
|
504
|
+
</>
|
|
505
|
+
);
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
export const OverflowMenu = {
|
|
510
|
+
name: "Overflow Menu",
|
|
511
|
+
args: {
|
|
512
|
+
defaultValue: ["section-1"],
|
|
513
|
+
styled: true,
|
|
514
|
+
},
|
|
515
|
+
render: (args: any) => (
|
|
516
|
+
<Box p={300} width="100%" height="100%" bg="app.background.base">
|
|
517
|
+
<Accordion {...args}>
|
|
518
|
+
<AccordionItem value="section-1">
|
|
519
|
+
<AccordionTrigger
|
|
520
|
+
title="Paint with Bob"
|
|
521
|
+
overflowMenu={{
|
|
522
|
+
items: [
|
|
523
|
+
{
|
|
524
|
+
id: "edit",
|
|
525
|
+
iconName: "pencil-to-square-outline",
|
|
526
|
+
children: "Edit",
|
|
527
|
+
onClick: () => alert("Edit clicked"),
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
id: "duplicate",
|
|
531
|
+
iconName: "plus-outline",
|
|
532
|
+
children: "Duplicate",
|
|
533
|
+
onClick: () => alert("Duplicate clicked"),
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
id: "delete",
|
|
537
|
+
iconName: "trash-outline",
|
|
538
|
+
children: "Delete",
|
|
539
|
+
onClick: () => alert("Delete clicked"),
|
|
540
|
+
},
|
|
541
|
+
],
|
|
542
|
+
"aria-label": "More options for Paint with Bob",
|
|
543
|
+
}}
|
|
544
|
+
relatedActions={[
|
|
545
|
+
{
|
|
546
|
+
iconName: "alarm-clock",
|
|
547
|
+
onClick: () => alert("Set alarm"),
|
|
548
|
+
"aria-label": "Set alarm",
|
|
549
|
+
},
|
|
550
|
+
]}
|
|
551
|
+
/>
|
|
552
|
+
<AccordionContent>
|
|
553
|
+
<Text.SmallBodyCopy as="p">
|
|
554
|
+
We don't really know where this goes - and I'm not sure we really
|
|
555
|
+
care. Paint anything you want on the canvas. Create your own
|
|
556
|
+
world.
|
|
557
|
+
</Text.SmallBodyCopy>
|
|
558
|
+
</AccordionContent>
|
|
559
|
+
</AccordionItem>
|
|
560
|
+
</Accordion>
|
|
561
|
+
</Box>
|
|
562
|
+
),
|
|
563
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { createContext, type ReactElement } from "react";
|
|
2
|
+
import * as RadixAccordion from "@radix-ui/react-accordion";
|
|
3
|
+
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
4
|
+
import { type TypeAccordionProps } from "./AccordionTypes";
|
|
5
|
+
|
|
6
|
+
export const AccordionContext = createContext<{
|
|
7
|
+
triggerIcon: ReactElement | null;
|
|
8
|
+
triggerPosition: string;
|
|
9
|
+
styled: boolean;
|
|
10
|
+
}>({
|
|
11
|
+
triggerIcon: null,
|
|
12
|
+
triggerPosition: "",
|
|
13
|
+
styled: false,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const Accordion = ({
|
|
17
|
+
children,
|
|
18
|
+
collapsible,
|
|
19
|
+
defaultValue = ["item-0"],
|
|
20
|
+
triggerPosition = "right",
|
|
21
|
+
triggerIcon = <Icon className="triggerIcon" name="chevron-down-outline" />,
|
|
22
|
+
type = "multiple",
|
|
23
|
+
styled = true,
|
|
24
|
+
}: TypeAccordionProps) => {
|
|
25
|
+
if (type === "single") {
|
|
26
|
+
return (
|
|
27
|
+
<RadixAccordion.Root
|
|
28
|
+
type="single"
|
|
29
|
+
defaultValue={
|
|
30
|
+
Array.isArray(defaultValue) ? defaultValue[0] : defaultValue
|
|
31
|
+
}
|
|
32
|
+
collapsible={collapsible}
|
|
33
|
+
>
|
|
34
|
+
<AccordionContext.Provider
|
|
35
|
+
value={{
|
|
36
|
+
triggerIcon: React.isValidElement(triggerIcon) ? triggerIcon : null,
|
|
37
|
+
triggerPosition,
|
|
38
|
+
styled,
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</AccordionContext.Provider>
|
|
43
|
+
</RadixAccordion.Root>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<RadixAccordion.Root
|
|
49
|
+
type="multiple"
|
|
50
|
+
defaultValue={Array.isArray(defaultValue) ? defaultValue : [defaultValue]}
|
|
51
|
+
>
|
|
52
|
+
<AccordionContext.Provider
|
|
53
|
+
value={{
|
|
54
|
+
triggerIcon: React.isValidElement(triggerIcon) ? triggerIcon : null,
|
|
55
|
+
triggerPosition,
|
|
56
|
+
styled,
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{children}
|
|
60
|
+
</AccordionContext.Provider>
|
|
61
|
+
</RadixAccordion.Root>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StyledRadixAccordionContent, ContentContainer } from "./styles";
|
|
2
|
+
import { type TypeAccordionSystemProps } from "./AccordionTypes";
|
|
3
|
+
import { AccordionContext } from "./Accordion";
|
|
4
|
+
import { useContext } from "react";
|
|
5
|
+
|
|
6
|
+
interface TypeAccordionContentProps extends TypeAccordionSystemProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const AccordionContent = ({
|
|
11
|
+
children,
|
|
12
|
+
...rest
|
|
13
|
+
}: TypeAccordionContentProps) => {
|
|
14
|
+
const { styled } = useContext(AccordionContext);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<StyledRadixAccordionContent data-styled={styled}>
|
|
18
|
+
<ContentContainer data-styled={styled} {...rest}>
|
|
19
|
+
{children}
|
|
20
|
+
</ContentContainer>
|
|
21
|
+
</StyledRadixAccordionContent>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as RadixAccordion from "@radix-ui/react-accordion";
|
|
2
|
+
import { type TypeAccordionItemProps } from "./AccordionTypes";
|
|
3
|
+
import { StyledAccordionItem } from "./styles";
|
|
4
|
+
|
|
5
|
+
export const AccordionItem = ({ children, value }: TypeAccordionItemProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<StyledAccordionItem className="accordion-item" value={value}>
|
|
8
|
+
{children}
|
|
9
|
+
</StyledAccordionItem>
|
|
10
|
+
);
|
|
11
|
+
};
|