@sproutsocial/seeds-react-accordion 0.4.32 → 0.4.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.css +159 -0
- package/dist/esm/index.js +236 -78
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +21 -10
- package/dist/index.d.ts +21 -10
- package/dist/index.js +235 -79
- package/dist/index.js.map +1 -1
- package/package.json +21 -10
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -4
- package/.turbo/turbo-build.log +0 -21
- package/CHANGELOG.md +0 -527
- package/jest.config.js +0 -9
- package/src/Accordion.stories.tsx +0 -844
- package/src/Accordion.tsx +0 -83
- package/src/AccordionContent.tsx +0 -23
- package/src/AccordionItem.tsx +0 -11
- package/src/AccordionTrigger.tsx +0 -161
- package/src/AccordionTypes.ts +0 -80
- package/src/__tests__/accordion.test.tsx +0 -536
- package/src/index.ts +0 -7
- package/src/styled.d.ts +0 -7
- package/src/styles.ts +0 -164
- package/tsconfig.json +0 -9
- package/tsup.config.ts +0 -12
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds Accordion component classes
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* These classes mirror the styled-components implementation in styles.ts so the
|
|
9
|
+
* Tailwind and styled-components rendering paths are visually identical. The
|
|
10
|
+
* `[data-styled="true"]` rules deliver the bordered "card" appearance when the
|
|
11
|
+
* accordion is rendered with `styled` enabled.
|
|
12
|
+
*
|
|
13
|
+
* Rules live in the Tailwind `components` layer so consumer utility classes
|
|
14
|
+
* (e.g. `mx-200`, `p-300`, `inline-flex`) win the cascade and can override the
|
|
15
|
+
* component's own styles. Keyframes are at-rules unaffected by layering and stay
|
|
16
|
+
* outside the `@layer` wrapper.
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* <div class="accordion-item">
|
|
20
|
+
* <div class="seeds-accordion-trigger" data-styled="true">…</div>
|
|
21
|
+
* <div class="seeds-accordion-content" data-styled="true">
|
|
22
|
+
* <div class="seeds-accordion-content-inner" data-styled="true">…</div>
|
|
23
|
+
* </div>
|
|
24
|
+
* </div>
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/* Keyframes are prefixed to avoid collisions in the aggregated stylesheet
|
|
28
|
+
(styled-components previously scoped slideDown/slideUp per component). */
|
|
29
|
+
@keyframes seeds-accordion-slideDown {
|
|
30
|
+
from {
|
|
31
|
+
height: 0;
|
|
32
|
+
}
|
|
33
|
+
to {
|
|
34
|
+
height: var(--radix-accordion-content-height);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@keyframes seeds-accordion-slideUp {
|
|
39
|
+
from {
|
|
40
|
+
height: var(--radix-accordion-content-height);
|
|
41
|
+
}
|
|
42
|
+
to {
|
|
43
|
+
height: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@layer components {
|
|
48
|
+
/* TriggerContainer -> .seeds-accordion-trigger */
|
|
49
|
+
.seeds-accordion-trigger {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
color: var(--color-text-body);
|
|
53
|
+
font-size: var(--font-size-200);
|
|
54
|
+
line-height: var(--line-height-200);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Override Text.Headline styles to match original accordion trigger typography */
|
|
58
|
+
.seeds-accordion-trigger h1,
|
|
59
|
+
.seeds-accordion-trigger h2,
|
|
60
|
+
.seeds-accordion-trigger h3,
|
|
61
|
+
.seeds-accordion-trigger h4,
|
|
62
|
+
.seeds-accordion-trigger h5,
|
|
63
|
+
.seeds-accordion-trigger h6 {
|
|
64
|
+
font-size: inherit;
|
|
65
|
+
font-weight: normal;
|
|
66
|
+
line-height: inherit;
|
|
67
|
+
color: inherit;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.seeds-accordion-trigger[data-styled="true"] h1,
|
|
71
|
+
.seeds-accordion-trigger[data-styled="true"] h2,
|
|
72
|
+
.seeds-accordion-trigger[data-styled="true"] h3,
|
|
73
|
+
.seeds-accordion-trigger[data-styled="true"] h4,
|
|
74
|
+
.seeds-accordion-trigger[data-styled="true"] h5,
|
|
75
|
+
.seeds-accordion-trigger[data-styled="true"] h6 {
|
|
76
|
+
font-weight: var(--font-weight-semibold);
|
|
77
|
+
color: var(--color-text-headline);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.seeds-accordion-trigger[data-styled="true"] {
|
|
81
|
+
border-top: 1px solid var(--color-container-border-base);
|
|
82
|
+
border-left: 1px solid var(--color-container-border-base);
|
|
83
|
+
border-right: 1px solid var(--color-container-border-base);
|
|
84
|
+
background: var(--color-container-bg-base);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.accordion-item[data-state="open"] .seeds-accordion-trigger[data-styled="true"] {
|
|
88
|
+
border-bottom: 1px solid transparent;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.accordion-item[data-state="closed"]
|
|
92
|
+
.seeds-accordion-trigger[data-styled="true"] {
|
|
93
|
+
transition: border-bottom-color 0s ease-in-out 0.3s;
|
|
94
|
+
border-bottom: 1px solid transparent;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.accordion-item:first-child .seeds-accordion-trigger[data-styled="true"] {
|
|
98
|
+
border-top-left-radius: var(--radius-outer);
|
|
99
|
+
border-top-right-radius: var(--radius-outer);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.accordion-item:last-child[data-state="closed"]
|
|
103
|
+
.seeds-accordion-trigger[data-styled="true"] {
|
|
104
|
+
transition: border-radius 0s linear 0.3s,
|
|
105
|
+
border-bottom-color 0s ease-in-out 0.3s;
|
|
106
|
+
border-bottom: 1px solid var(--color-container-border-base);
|
|
107
|
+
border-bottom-left-radius: var(--radius-outer);
|
|
108
|
+
border-bottom-right-radius: var(--radius-outer);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* StyledRadixAccordionContent -> .seeds-accordion-content */
|
|
112
|
+
.seeds-accordion-content {
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.seeds-accordion-content[data-state="open"] {
|
|
117
|
+
animation: seeds-accordion-slideDown 300ms ease-in-out;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.seeds-accordion-content[data-state="closed"] {
|
|
121
|
+
animation: seeds-accordion-slideUp 300ms ease-in-out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.seeds-accordion-content[data-styled="true"] {
|
|
125
|
+
border-left: 1px solid var(--color-container-border-base);
|
|
126
|
+
border-right: 1px solid var(--color-container-border-base);
|
|
127
|
+
background: var(--color-container-bg-base);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.accordion-item:last-child[data-state="open"]
|
|
131
|
+
.seeds-accordion-content[data-styled="true"],
|
|
132
|
+
.accordion-item:last-child[data-state="closed"]
|
|
133
|
+
.seeds-accordion-content[data-styled="true"] {
|
|
134
|
+
border-bottom: 1px solid var(--color-container-border-base);
|
|
135
|
+
border-bottom-left-radius: var(--radius-outer);
|
|
136
|
+
border-bottom-right-radius: var(--radius-outer);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* ContentContainer -> .seeds-accordion-content-inner */
|
|
140
|
+
.seeds-accordion-content-inner {
|
|
141
|
+
color: var(--color-text-body);
|
|
142
|
+
background: transparent;
|
|
143
|
+
font-family: var(--font-family);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.seeds-accordion-content-inner[data-styled="true"] {
|
|
147
|
+
padding: 0 var(--space-400) var(--space-400);
|
|
148
|
+
font-size: var(--font-size-200);
|
|
149
|
+
line-height: var(--line-height-200);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.accordion-item:last-child[data-state="open"]
|
|
153
|
+
.seeds-accordion-content-inner[data-styled="true"],
|
|
154
|
+
.accordion-item:last-child[data-state="closed"]
|
|
155
|
+
.seeds-accordion-content-inner[data-styled="true"] {
|
|
156
|
+
border-bottom-left-radius: var(--radius-outer);
|
|
157
|
+
border-bottom-right-radius: var(--radius-outer);
|
|
158
|
+
}
|
|
159
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -61,11 +61,22 @@ var Accordion = ({
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
// src/AccordionItem.tsx
|
|
64
|
-
import "@radix-ui/react-accordion";
|
|
64
|
+
import * as RadixAccordion2 from "@radix-ui/react-accordion";
|
|
65
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
66
|
+
var AccordionItem = ({ children, value }) => {
|
|
67
|
+
return /* @__PURE__ */ jsx2(RadixAccordion2.Item, { className: "accordion-item", value, children });
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/AccordionContent.tsx
|
|
71
|
+
import "react";
|
|
72
|
+
|
|
73
|
+
// src/AccordionContentHybrid.tsx
|
|
74
|
+
import { useContext as useContext2 } from "react";
|
|
75
|
+
import { needsStyledComponents } from "@sproutsocial/seeds-react-system-props";
|
|
65
76
|
|
|
66
77
|
// src/styles.ts
|
|
67
78
|
import styled, { css } from "styled-components";
|
|
68
|
-
import * as
|
|
79
|
+
import * as RadixAccordion3 from "@radix-ui/react-accordion";
|
|
69
80
|
import {
|
|
70
81
|
BORDER,
|
|
71
82
|
COMMON,
|
|
@@ -73,7 +84,7 @@ import {
|
|
|
73
84
|
LAYOUT,
|
|
74
85
|
TYPOGRAPHY
|
|
75
86
|
} from "@sproutsocial/seeds-react-system-props";
|
|
76
|
-
var StyledAccordionItem = styled(
|
|
87
|
+
var StyledAccordionItem = styled(RadixAccordion3.Item)``;
|
|
77
88
|
var animations = css`
|
|
78
89
|
@keyframes slideDown {
|
|
79
90
|
from {
|
|
@@ -94,7 +105,7 @@ var animations = css`
|
|
|
94
105
|
}
|
|
95
106
|
`;
|
|
96
107
|
var StyledRadixAccordionContent = styled(
|
|
97
|
-
|
|
108
|
+
RadixAccordion3.Content
|
|
98
109
|
)`
|
|
99
110
|
${animations}
|
|
100
111
|
|
|
@@ -127,7 +138,8 @@ var ContentContainer = styled.div`
|
|
|
127
138
|
font-family: ${({ theme }) => theme.fontFamily};
|
|
128
139
|
|
|
129
140
|
&[data-styled="true"] {
|
|
130
|
-
padding: ${({ theme }) => theme.space[400]}
|
|
141
|
+
padding: 0 ${({ theme }) => theme.space[400]}
|
|
142
|
+
${({ theme }) => theme.space[400]};
|
|
131
143
|
${({ theme }) => theme.typography[200]};
|
|
132
144
|
}
|
|
133
145
|
|
|
@@ -182,7 +194,7 @@ var TriggerContainer = styled.div`
|
|
|
182
194
|
`}
|
|
183
195
|
|
|
184
196
|
.accordion-item[data-state="open"] &[data-styled="true"] {
|
|
185
|
-
border-bottom: ${({ theme }) => `${theme.borderWidths[500]} solid
|
|
197
|
+
border-bottom: ${({ theme }) => `${theme.borderWidths[500]} solid transparent`};
|
|
186
198
|
}
|
|
187
199
|
|
|
188
200
|
.accordion-item[data-state="closed"] &[data-styled="true"] {
|
|
@@ -195,12 +207,10 @@ var TriggerContainer = styled.div`
|
|
|
195
207
|
border-top-right-radius: ${({ theme }) => theme.radii.outer};
|
|
196
208
|
}
|
|
197
209
|
|
|
198
|
-
.accordion-item:last-child &[data-styled="true"] {
|
|
199
|
-
border-bottom: ${({ theme }) => `${theme.borderWidths[500]} solid ${theme.colors.container.border.base}`};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
210
|
.accordion-item:last-child[data-state="closed"] &[data-styled="true"] {
|
|
203
|
-
transition: border-radius 0s linear 0.3s
|
|
211
|
+
transition: border-radius 0s linear 0.3s,
|
|
212
|
+
border-bottom-color 0s ease-in-out 0.3s;
|
|
213
|
+
border-bottom: ${({ theme }) => `${theme.borderWidths[500]} solid ${theme.colors.container.border.base}`};
|
|
204
214
|
border-bottom-left-radius: ${({ theme }) => theme.radii.outer};
|
|
205
215
|
border-bottom-right-radius: ${({ theme }) => theme.radii.outer};
|
|
206
216
|
}
|
|
@@ -211,24 +221,74 @@ var TriggerContainer = styled.div`
|
|
|
211
221
|
${FLEXBOX}
|
|
212
222
|
`;
|
|
213
223
|
|
|
214
|
-
// src/
|
|
215
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
216
|
-
var AccordionItem = ({ children, value }) => {
|
|
217
|
-
return /* @__PURE__ */ jsx2(StyledAccordionItem, { className: "accordion-item", value, children });
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
// src/AccordionContent.tsx
|
|
224
|
+
// src/AccordionContentTailwind.tsx
|
|
221
225
|
import { useContext } from "react";
|
|
226
|
+
import * as RadixAccordion4 from "@radix-ui/react-accordion";
|
|
222
227
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
223
|
-
|
|
228
|
+
function cn(...inputs) {
|
|
229
|
+
const classes = [];
|
|
230
|
+
for (const input of inputs) {
|
|
231
|
+
if (!input) continue;
|
|
232
|
+
if (typeof input === "string") {
|
|
233
|
+
classes.push(input);
|
|
234
|
+
} else if (typeof input === "object") {
|
|
235
|
+
for (const [key, value] of Object.entries(input)) {
|
|
236
|
+
if (value) {
|
|
237
|
+
classes.push(key);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return classes.join(" ");
|
|
243
|
+
}
|
|
244
|
+
var AccordionContentTailwind = ({
|
|
224
245
|
children,
|
|
246
|
+
className,
|
|
225
247
|
...rest
|
|
226
248
|
}) => {
|
|
227
249
|
const { styled: styled2 } = useContext(AccordionContext);
|
|
228
|
-
|
|
250
|
+
const contentDataAttrs = { "data-styled": styled2 };
|
|
251
|
+
return /* @__PURE__ */ jsx3(
|
|
252
|
+
RadixAccordion4.Content,
|
|
253
|
+
{
|
|
254
|
+
className: cn("seeds-accordion-content", className),
|
|
255
|
+
...contentDataAttrs,
|
|
256
|
+
children: /* @__PURE__ */ jsx3(
|
|
257
|
+
"div",
|
|
258
|
+
{
|
|
259
|
+
className: "seeds-accordion-content-inner",
|
|
260
|
+
"data-styled": styled2,
|
|
261
|
+
...rest,
|
|
262
|
+
children
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
);
|
|
229
267
|
};
|
|
230
268
|
|
|
231
|
-
// src/
|
|
269
|
+
// src/AccordionContentHybrid.tsx
|
|
270
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
271
|
+
var AccordionContentHybrid = ({
|
|
272
|
+
children,
|
|
273
|
+
...rest
|
|
274
|
+
}) => {
|
|
275
|
+
const { styled: styled2 } = useContext2(AccordionContext);
|
|
276
|
+
if (needsStyledComponents(rest)) {
|
|
277
|
+
return /* @__PURE__ */ jsx4(StyledRadixAccordionContent, { "data-styled": styled2, children: /* @__PURE__ */ jsx4(ContentContainer, { "data-styled": styled2, ...rest, children }) });
|
|
278
|
+
}
|
|
279
|
+
return /* @__PURE__ */ jsx4(AccordionContentTailwind, { ...rest, children });
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// src/AccordionContent.tsx
|
|
283
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
284
|
+
var AccordionContent = (props) => /* @__PURE__ */ jsx5(AccordionContentHybrid, { ...props });
|
|
285
|
+
|
|
286
|
+
// src/AccordionTriggerHybrid.tsx
|
|
287
|
+
import { useContext as useContext4 } from "react";
|
|
288
|
+
import { needsStyledComponents as needsStyledComponents2 } from "@sproutsocial/seeds-react-system-props";
|
|
289
|
+
|
|
290
|
+
// src/AccordionTriggerInner.tsx
|
|
291
|
+
import "react";
|
|
232
292
|
import { Box } from "@sproutsocial/seeds-react-box";
|
|
233
293
|
import { Button } from "@sproutsocial/seeds-react-button";
|
|
234
294
|
import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
@@ -239,66 +299,43 @@ import {
|
|
|
239
299
|
MenuGroup,
|
|
240
300
|
MenuToggleButton
|
|
241
301
|
} from "@sproutsocial/seeds-react-menu";
|
|
242
|
-
import {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
import
|
|
302
|
+
import {
|
|
303
|
+
CollapsibleContentHeader
|
|
304
|
+
} from "@sproutsocial/seeds-react-content-header";
|
|
305
|
+
import * as RadixAccordion5 from "@radix-ui/react-accordion";
|
|
306
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
246
307
|
var MAX_RELATED_ACTIONS = 2;
|
|
247
308
|
var AccordionTriggerWrapper = ({
|
|
248
309
|
children
|
|
249
|
-
}) => /* @__PURE__ */
|
|
250
|
-
var
|
|
251
|
-
|
|
310
|
+
}) => /* @__PURE__ */ jsx6(RadixAccordion5.Trigger, { asChild: true, children });
|
|
311
|
+
var AccordionTriggerInner = ({
|
|
312
|
+
title,
|
|
313
|
+
headingLevel,
|
|
252
314
|
leftSlot,
|
|
315
|
+
rightSlot,
|
|
253
316
|
relatedActions,
|
|
254
317
|
overflowMenu,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
...rest
|
|
318
|
+
color,
|
|
319
|
+
triggerIcon,
|
|
320
|
+
triggerPosition
|
|
259
321
|
}) => {
|
|
260
|
-
const { triggerIcon, triggerPosition, styled: styled2 } = useContext2(AccordionContext);
|
|
261
322
|
const validatedActions = relatedActions?.slice(0, MAX_RELATED_ACTIONS);
|
|
262
|
-
const {
|
|
263
|
-
color,
|
|
264
|
-
padding,
|
|
265
|
-
paddingBottom,
|
|
266
|
-
paddingTop,
|
|
267
|
-
paddingX,
|
|
268
|
-
paddingY,
|
|
269
|
-
paddingLeft,
|
|
270
|
-
paddingRight,
|
|
271
|
-
p,
|
|
272
|
-
pb,
|
|
273
|
-
pt,
|
|
274
|
-
pr,
|
|
275
|
-
pl,
|
|
276
|
-
px,
|
|
277
|
-
py,
|
|
278
|
-
fontFamily,
|
|
279
|
-
fontSize,
|
|
280
|
-
fontStyle,
|
|
281
|
-
fontWeight,
|
|
282
|
-
lineHeight,
|
|
283
|
-
textAlign,
|
|
284
|
-
...triggerProps
|
|
285
|
-
} = rest;
|
|
286
323
|
const shouldRenderActionsBlock = Boolean(overflowMenu || validatedActions);
|
|
287
|
-
const renderedOverflowMenu = overflowMenu && /* @__PURE__ */
|
|
324
|
+
const renderedOverflowMenu = overflowMenu && /* @__PURE__ */ jsx6(
|
|
288
325
|
ActionMenu,
|
|
289
326
|
{
|
|
290
|
-
menuToggleElement: /* @__PURE__ */
|
|
327
|
+
menuToggleElement: /* @__PURE__ */ jsx6(
|
|
291
328
|
MenuToggleButton,
|
|
292
329
|
{
|
|
293
330
|
"aria-label": overflowMenu["aria-label"],
|
|
294
331
|
appearance: "unstyled",
|
|
295
332
|
color,
|
|
296
|
-
children: /* @__PURE__ */
|
|
333
|
+
children: /* @__PURE__ */ jsx6(Icon2, { name: "ellipsis-horizontal-outline", "aria-hidden": "true" })
|
|
297
334
|
}
|
|
298
335
|
),
|
|
299
|
-
children: /* @__PURE__ */
|
|
300
|
-
const { iconName, id, onClick, children
|
|
301
|
-
return /* @__PURE__ */
|
|
336
|
+
children: /* @__PURE__ */ jsx6(MenuContent, { children: /* @__PURE__ */ jsx6(MenuGroup, { id: "overflow-actions", children: overflowMenu.items.map((item, index) => {
|
|
337
|
+
const { iconName, id, onClick, children, ...menuItemProps } = item;
|
|
338
|
+
return /* @__PURE__ */ jsx6(
|
|
302
339
|
MenuItem,
|
|
303
340
|
{
|
|
304
341
|
id: id || `overflow-item-${index}`,
|
|
@@ -312,24 +349,24 @@ var AccordionTrigger = ({
|
|
|
312
349
|
gap: "300",
|
|
313
350
|
color,
|
|
314
351
|
children: [
|
|
315
|
-
/* @__PURE__ */
|
|
316
|
-
|
|
352
|
+
/* @__PURE__ */ jsx6(Icon2, { name: iconName }),
|
|
353
|
+
children
|
|
317
354
|
]
|
|
318
355
|
}
|
|
319
|
-
) :
|
|
356
|
+
) : children
|
|
320
357
|
},
|
|
321
358
|
id || `overflow-item-${index}`
|
|
322
359
|
);
|
|
323
360
|
}) }) })
|
|
324
361
|
}
|
|
325
362
|
);
|
|
326
|
-
const renderedRelatedActions = validatedActions && validatedActions.length > 0 && /* @__PURE__ */
|
|
363
|
+
const renderedRelatedActions = validatedActions && validatedActions.length > 0 && /* @__PURE__ */ jsx6(Box, { display: "flex", children: validatedActions.map((action, index) => /* @__PURE__ */ jsx6(
|
|
327
364
|
Button,
|
|
328
365
|
{
|
|
329
366
|
onClick: action.onClick,
|
|
330
367
|
"aria-label": action["aria-label"],
|
|
331
368
|
color,
|
|
332
|
-
children: /* @__PURE__ */
|
|
369
|
+
children: /* @__PURE__ */ jsx6(Icon2, { name: action.iconName, "aria-hidden": "true" })
|
|
333
370
|
},
|
|
334
371
|
`${action.iconName}-${index}`
|
|
335
372
|
)) });
|
|
@@ -337,31 +374,152 @@ var AccordionTrigger = ({
|
|
|
337
374
|
renderedOverflowMenu,
|
|
338
375
|
renderedRelatedActions
|
|
339
376
|
] }) : void 0;
|
|
340
|
-
return /* @__PURE__ */
|
|
341
|
-
|
|
377
|
+
return /* @__PURE__ */ jsx6(
|
|
378
|
+
CollapsibleContentHeader,
|
|
379
|
+
{
|
|
380
|
+
title,
|
|
381
|
+
headingLevel,
|
|
382
|
+
leftSlot,
|
|
383
|
+
rightSlot,
|
|
384
|
+
headerActions: renderedActions,
|
|
385
|
+
trigger: AccordionTriggerWrapper,
|
|
386
|
+
triggerPosition,
|
|
387
|
+
triggerIcon,
|
|
388
|
+
bordered: false
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// src/AccordionTriggerTailwind.tsx
|
|
394
|
+
import { useContext as useContext3 } from "react";
|
|
395
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
396
|
+
function cn2(...inputs) {
|
|
397
|
+
const classes = [];
|
|
398
|
+
for (const input of inputs) {
|
|
399
|
+
if (!input) continue;
|
|
400
|
+
if (typeof input === "string") {
|
|
401
|
+
classes.push(input);
|
|
402
|
+
} else if (typeof input === "object") {
|
|
403
|
+
for (const [key, value] of Object.entries(input)) {
|
|
404
|
+
if (value) {
|
|
405
|
+
classes.push(key);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return classes.join(" ");
|
|
411
|
+
}
|
|
412
|
+
var AccordionTriggerTailwind = ({
|
|
413
|
+
children,
|
|
414
|
+
leftSlot,
|
|
415
|
+
relatedActions,
|
|
416
|
+
overflowMenu,
|
|
417
|
+
rightSlot,
|
|
418
|
+
title,
|
|
419
|
+
headingLevel = "h4",
|
|
420
|
+
className,
|
|
421
|
+
// In the Tailwind path the hybrid gate guarantees no styled-system props are
|
|
422
|
+
// present. `color` is still pulled out so it is forwarded to the inner content
|
|
423
|
+
// (overflow menu / related actions) but not onto the wrapper div.
|
|
424
|
+
color,
|
|
425
|
+
...triggerProps
|
|
426
|
+
}) => {
|
|
427
|
+
const { triggerIcon, triggerPosition, styled: styled2 } = useContext3(AccordionContext);
|
|
428
|
+
return /* @__PURE__ */ jsx7(
|
|
429
|
+
"div",
|
|
342
430
|
{
|
|
431
|
+
className: cn2("seeds-accordion-trigger", className),
|
|
343
432
|
"data-styled": styled2,
|
|
344
|
-
$styled: styled2,
|
|
345
433
|
"data-qa-trigger": "HERE",
|
|
346
|
-
color,
|
|
347
434
|
...triggerProps,
|
|
348
|
-
children: /* @__PURE__ */
|
|
349
|
-
|
|
435
|
+
children: /* @__PURE__ */ jsx7(
|
|
436
|
+
AccordionTriggerInner,
|
|
350
437
|
{
|
|
351
438
|
title,
|
|
352
439
|
headingLevel,
|
|
353
440
|
leftSlot,
|
|
354
441
|
rightSlot,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
442
|
+
relatedActions,
|
|
443
|
+
overflowMenu,
|
|
444
|
+
color,
|
|
358
445
|
triggerIcon,
|
|
359
|
-
|
|
446
|
+
triggerPosition
|
|
360
447
|
}
|
|
361
448
|
)
|
|
362
449
|
}
|
|
363
450
|
);
|
|
364
451
|
};
|
|
452
|
+
|
|
453
|
+
// src/AccordionTriggerHybrid.tsx
|
|
454
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
455
|
+
var AccordionTriggerHybrid = (props) => {
|
|
456
|
+
const {
|
|
457
|
+
children,
|
|
458
|
+
leftSlot,
|
|
459
|
+
relatedActions,
|
|
460
|
+
overflowMenu,
|
|
461
|
+
rightSlot,
|
|
462
|
+
title,
|
|
463
|
+
headingLevel = "h4",
|
|
464
|
+
...rest
|
|
465
|
+
} = props;
|
|
466
|
+
const { triggerIcon, triggerPosition, styled: styled2 } = useContext4(AccordionContext);
|
|
467
|
+
if (needsStyledComponents2(rest)) {
|
|
468
|
+
const {
|
|
469
|
+
color,
|
|
470
|
+
padding,
|
|
471
|
+
paddingBottom,
|
|
472
|
+
paddingTop,
|
|
473
|
+
paddingX,
|
|
474
|
+
paddingY,
|
|
475
|
+
paddingLeft,
|
|
476
|
+
paddingRight,
|
|
477
|
+
p,
|
|
478
|
+
pb,
|
|
479
|
+
pt,
|
|
480
|
+
pr,
|
|
481
|
+
pl,
|
|
482
|
+
px,
|
|
483
|
+
py,
|
|
484
|
+
fontFamily,
|
|
485
|
+
fontSize,
|
|
486
|
+
fontStyle,
|
|
487
|
+
fontWeight,
|
|
488
|
+
lineHeight,
|
|
489
|
+
textAlign,
|
|
490
|
+
...triggerProps
|
|
491
|
+
} = rest;
|
|
492
|
+
return /* @__PURE__ */ jsx8(
|
|
493
|
+
TriggerContainer,
|
|
494
|
+
{
|
|
495
|
+
"data-styled": styled2,
|
|
496
|
+
$styled: styled2,
|
|
497
|
+
"data-qa-trigger": "HERE",
|
|
498
|
+
color,
|
|
499
|
+
...triggerProps,
|
|
500
|
+
children: /* @__PURE__ */ jsx8(
|
|
501
|
+
AccordionTriggerInner,
|
|
502
|
+
{
|
|
503
|
+
title,
|
|
504
|
+
headingLevel,
|
|
505
|
+
leftSlot,
|
|
506
|
+
rightSlot,
|
|
507
|
+
relatedActions,
|
|
508
|
+
overflowMenu,
|
|
509
|
+
color,
|
|
510
|
+
triggerIcon,
|
|
511
|
+
triggerPosition
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
return /* @__PURE__ */ jsx8(AccordionTriggerTailwind, { ...props });
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// src/AccordionTrigger.tsx
|
|
521
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
522
|
+
var AccordionTrigger = (props) => /* @__PURE__ */ jsx9(AccordionTriggerHybrid, { ...props });
|
|
365
523
|
export {
|
|
366
524
|
Accordion,
|
|
367
525
|
AccordionContent,
|