@purpurds/accordion 5.20.0 → 5.21.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/dist/LICENSE.txt +3 -3
- package/dist/accordion.cjs.js +5 -5
- package/dist/accordion.cjs.js.map +1 -1
- package/dist/accordion.d.ts +3 -11
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.es.js +129 -127
- package/dist/accordion.es.js.map +1 -1
- package/package.json +10 -10
- package/src/accordion.stories.tsx +1 -0
- package/src/accordion.tsx +4 -11
package/dist/accordion.es.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { jsx as
|
1
|
+
import { jsx as x, jsxs as W } from "react/jsx-runtime";
|
2
2
|
import * as $e from "react";
|
3
|
-
import u, { createContext as ee, useMemo as V, createElement as A, useContext as _e, useCallback as H, forwardRef as I, Children as S, isValidElement as U, cloneElement as G, Fragment as
|
4
|
-
import { flushSync as
|
5
|
-
function
|
3
|
+
import u, { createContext as ee, useMemo as V, createElement as A, useContext as _e, useCallback as H, forwardRef as I, Children as S, isValidElement as U, cloneElement as G, Fragment as Ve, useRef as C, useEffect as k, useState as re, useLayoutEffect as Ue, useReducer as ze } from "react";
|
4
|
+
import { flushSync as Be } from "react-dom";
|
5
|
+
function He(e) {
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
7
7
|
}
|
8
8
|
var me = { exports: {} };
|
@@ -41,8 +41,8 @@ var me = { exports: {} };
|
|
41
41
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
42
42
|
})();
|
43
43
|
})(me);
|
44
|
-
var
|
45
|
-
const
|
44
|
+
var Ge = me.exports;
|
45
|
+
const Fe = /* @__PURE__ */ He(Ge), L = {
|
46
46
|
"purpur-heading": "_purpur-heading_k9fhq_1",
|
47
47
|
"purpur-heading--hyphens": "_purpur-heading--hyphens_k9fhq_8",
|
48
48
|
"purpur-heading--negative": "_purpur-heading--negative_k9fhq_11",
|
@@ -58,7 +58,7 @@ const Ge = /* @__PURE__ */ Be(He), L = {
|
|
58
58
|
"purpur-heading--display-50": "_purpur-heading--display-50_k9fhq_68",
|
59
59
|
"purpur-heading--display-100": "_purpur-heading--display-100_k9fhq_74",
|
60
60
|
"purpur-heading--display-200": "_purpur-heading--display-200_k9fhq_80"
|
61
|
-
},
|
61
|
+
}, Ke = {
|
62
62
|
TITLE100: "title-100",
|
63
63
|
TITLE200: "title-200",
|
64
64
|
TITLE300: "title-300",
|
@@ -74,10 +74,10 @@ const Ge = /* @__PURE__ */ Be(He), L = {
|
|
74
74
|
enableHyphenation: o = !1,
|
75
75
|
negative: c = !1,
|
76
76
|
tag: t,
|
77
|
-
variant: a =
|
77
|
+
variant: a = Ke.TITLE100,
|
78
78
|
...i
|
79
79
|
}) => {
|
80
|
-
const s = t, l =
|
80
|
+
const s = t, l = Fe([
|
81
81
|
n,
|
82
82
|
L[j],
|
83
83
|
L[`${j}--${a}`],
|
@@ -86,7 +86,7 @@ const Ge = /* @__PURE__ */ Be(He), L = {
|
|
86
86
|
[L[`${j}--negative`]]: c
|
87
87
|
}
|
88
88
|
]);
|
89
|
-
return /* @__PURE__ */
|
89
|
+
return /* @__PURE__ */ x(s, { ...i, className: l, "data-testid": e, children: r });
|
90
90
|
};
|
91
91
|
oe.displayName = "Heading";
|
92
92
|
function h() {
|
@@ -107,11 +107,11 @@ function ae(e, r = []) {
|
|
107
107
|
a
|
108
108
|
];
|
109
109
|
function l(p) {
|
110
|
-
const { scope: _, children: f, ...b } = p,
|
110
|
+
const { scope: _, children: f, ...b } = p, y = (_ == null ? void 0 : _[e][s]) || i, g = V(
|
111
111
|
() => b,
|
112
112
|
Object.values(b)
|
113
113
|
);
|
114
|
-
return /* @__PURE__ */ A(
|
114
|
+
return /* @__PURE__ */ A(y.Provider, {
|
115
115
|
value: g
|
116
116
|
}, f);
|
117
117
|
}
|
@@ -146,10 +146,10 @@ function ae(e, r = []) {
|
|
146
146
|
};
|
147
147
|
return c.scopeName = e, [
|
148
148
|
o,
|
149
|
-
|
149
|
+
Ye(c, ...r)
|
150
150
|
];
|
151
151
|
}
|
152
|
-
function
|
152
|
+
function Ye(...e) {
|
153
153
|
const r = e[0];
|
154
154
|
if (e.length === 1) return r;
|
155
155
|
const n = () => {
|
@@ -179,19 +179,19 @@ function Ke(...e) {
|
|
179
179
|
};
|
180
180
|
return n.scopeName = r.scopeName, n;
|
181
181
|
}
|
182
|
-
function
|
182
|
+
function Ze(e, r) {
|
183
183
|
typeof e == "function" ? e(r) : e != null && (e.current = r);
|
184
184
|
}
|
185
185
|
function he(...e) {
|
186
186
|
return (r) => e.forEach(
|
187
|
-
(n) =>
|
187
|
+
(n) => Ze(n, r)
|
188
188
|
);
|
189
189
|
}
|
190
190
|
function M(...e) {
|
191
191
|
return H(he(...e), e);
|
192
192
|
}
|
193
193
|
const z = /* @__PURE__ */ I((e, r) => {
|
194
|
-
const { children: n, ...o } = e, c = S.toArray(n), t = c.find(
|
194
|
+
const { children: n, ...o } = e, c = S.toArray(n), t = c.find(Xe);
|
195
195
|
if (t) {
|
196
196
|
const a = t.props.children, i = c.map((s) => s === t ? S.count(a) > 1 ? S.only(null) : /* @__PURE__ */ U(a) ? a.props.children : null : s);
|
197
197
|
return /* @__PURE__ */ A(te, h({}, o, {
|
@@ -206,16 +206,16 @@ z.displayName = "Slot";
|
|
206
206
|
const te = /* @__PURE__ */ I((e, r) => {
|
207
207
|
const { children: n, ...o } = e;
|
208
208
|
return /* @__PURE__ */ U(n) ? /* @__PURE__ */ G(n, {
|
209
|
-
...
|
209
|
+
...Qe(o, n.props),
|
210
210
|
ref: r ? he(r, n.ref) : n.ref
|
211
211
|
}) : S.count(n) > 1 ? S.only(null) : null;
|
212
212
|
});
|
213
213
|
te.displayName = "SlotClone";
|
214
|
-
const
|
215
|
-
function
|
216
|
-
return /* @__PURE__ */ U(e) && e.type ===
|
214
|
+
const Je = ({ children: e }) => /* @__PURE__ */ A(Ve, null, e);
|
215
|
+
function Xe(e) {
|
216
|
+
return /* @__PURE__ */ U(e) && e.type === Je;
|
217
217
|
}
|
218
|
-
function
|
218
|
+
function Qe(e, r) {
|
219
219
|
const n = {
|
220
220
|
...r
|
221
221
|
};
|
@@ -236,26 +236,26 @@ function Xe(e, r) {
|
|
236
236
|
...n
|
237
237
|
};
|
238
238
|
}
|
239
|
-
function
|
239
|
+
function We(e) {
|
240
240
|
const r = e + "CollectionProvider", [n, o] = ae(r), [c, t] = n(r, {
|
241
241
|
collectionRef: {
|
242
242
|
current: null
|
243
243
|
},
|
244
244
|
itemMap: /* @__PURE__ */ new Map()
|
245
245
|
}), a = (f) => {
|
246
|
-
const { scope: b, children:
|
246
|
+
const { scope: b, children: y } = f, g = u.useRef(null), m = u.useRef(/* @__PURE__ */ new Map()).current;
|
247
247
|
return /* @__PURE__ */ u.createElement(c, {
|
248
248
|
scope: b,
|
249
249
|
itemMap: m,
|
250
250
|
collectionRef: g
|
251
|
-
},
|
251
|
+
}, y);
|
252
252
|
}, i = e + "CollectionSlot", s = /* @__PURE__ */ u.forwardRef((f, b) => {
|
253
|
-
const { scope:
|
253
|
+
const { scope: y, children: g } = f, m = t(i, y), $ = M(b, m.collectionRef);
|
254
254
|
return /* @__PURE__ */ u.createElement(z, {
|
255
255
|
ref: $
|
256
256
|
}, g);
|
257
257
|
}), l = e + "CollectionItemSlot", d = "data-radix-collection-item", p = /* @__PURE__ */ u.forwardRef((f, b) => {
|
258
|
-
const { scope:
|
258
|
+
const { scope: y, children: g, ...m } = f, $ = u.useRef(null), v = M(b, $), N = t(l, y);
|
259
259
|
return u.useEffect(() => (N.itemMap.set($, {
|
260
260
|
ref: $,
|
261
261
|
...m
|
@@ -307,7 +307,7 @@ function ve(e) {
|
|
307
307
|
}
|
308
308
|
function ce({ prop: e, defaultProp: r, onChange: n = () => {
|
309
309
|
} }) {
|
310
|
-
const [o, c] =
|
310
|
+
const [o, c] = et({
|
311
311
|
defaultProp: r,
|
312
312
|
onChange: n
|
313
313
|
}), t = e !== void 0, a = t ? e : o, i = ve(n), s = H((l) => {
|
@@ -326,7 +326,7 @@ function ce({ prop: e, defaultProp: r, onChange: n = () => {
|
|
326
326
|
s
|
327
327
|
];
|
328
328
|
}
|
329
|
-
function
|
329
|
+
function et({ defaultProp: e, onChange: r }) {
|
330
330
|
const n = re(e), [o] = n, c = C(o), t = ve(r);
|
331
331
|
return k(() => {
|
332
332
|
c.current !== o && (t(o), c.current = o);
|
@@ -336,7 +336,7 @@ function We({ defaultProp: e, onChange: r }) {
|
|
336
336
|
t
|
337
337
|
]), n;
|
338
338
|
}
|
339
|
-
const
|
339
|
+
const tt = [
|
340
340
|
"a",
|
341
341
|
"button",
|
342
342
|
"div",
|
@@ -353,7 +353,7 @@ const et = [
|
|
353
353
|
"span",
|
354
354
|
"svg",
|
355
355
|
"ul"
|
356
|
-
], D =
|
356
|
+
], D = tt.reduce((e, r) => {
|
357
357
|
const n = /* @__PURE__ */ I((o, c) => {
|
358
358
|
const { asChild: t, ...a } = o, i = t ? z : r;
|
359
359
|
return k(() => {
|
@@ -366,25 +366,25 @@ const et = [
|
|
366
366
|
...e,
|
367
367
|
[r]: n
|
368
368
|
};
|
369
|
-
}, {}), B = globalThis != null && globalThis.document ?
|
369
|
+
}, {}), B = globalThis != null && globalThis.document ? Ue : () => {
|
370
370
|
};
|
371
|
-
function
|
372
|
-
return
|
371
|
+
function nt(e, r) {
|
372
|
+
return ze((n, o) => {
|
373
373
|
const c = r[n][o];
|
374
374
|
return c ?? n;
|
375
375
|
}, e);
|
376
376
|
}
|
377
|
-
const
|
378
|
-
const { present: r, children: n } = e, o =
|
377
|
+
const ye = (e) => {
|
378
|
+
const { present: r, children: n } = e, o = rt(r), c = typeof n == "function" ? n({
|
379
379
|
present: o.isPresent
|
380
380
|
}) : S.only(n), t = M(o.ref, c.ref);
|
381
381
|
return typeof n == "function" || o.isPresent ? /* @__PURE__ */ G(c, {
|
382
382
|
ref: t
|
383
383
|
}) : null;
|
384
384
|
};
|
385
|
-
|
386
|
-
function
|
387
|
-
const [r, n] = re(), o = C({}), c = C(e), t = C("none"), a = e ? "mounted" : "unmounted", [i, s] =
|
385
|
+
ye.displayName = "Presence";
|
386
|
+
function rt(e) {
|
387
|
+
const [r, n] = re(), o = C({}), c = C(e), t = C("none"), a = e ? "mounted" : "unmounted", [i, s] = nt(a, {
|
388
388
|
mounted: {
|
389
389
|
UNMOUNT: "unmounted",
|
390
390
|
ANIMATION_OUT: "unmountSuspended"
|
@@ -415,7 +415,7 @@ function nt(e) {
|
|
415
415
|
if (r) {
|
416
416
|
const l = (p) => {
|
417
417
|
const f = q(o.current).includes(p.animationName);
|
418
|
-
p.target === r && f &&
|
418
|
+
p.target === r && f && Be(
|
419
419
|
() => s("ANIMATION_END")
|
420
420
|
);
|
421
421
|
}, d = (p) => {
|
@@ -442,29 +442,29 @@ function nt(e) {
|
|
442
442
|
function q(e) {
|
443
443
|
return (e == null ? void 0 : e.animationName) || "none";
|
444
444
|
}
|
445
|
-
const
|
445
|
+
const ot = $e.useId || (() => {
|
446
446
|
});
|
447
|
-
let
|
448
|
-
function
|
449
|
-
const [r, n] = $e.useState(
|
447
|
+
let at = 0;
|
448
|
+
function xe(e) {
|
449
|
+
const [r, n] = $e.useState(ot());
|
450
450
|
return B(() => {
|
451
451
|
n(
|
452
|
-
(o) => o ?? String(
|
452
|
+
(o) => o ?? String(at++)
|
453
453
|
);
|
454
454
|
}, [
|
455
455
|
e
|
456
456
|
]), r ? `radix-${r}` : "";
|
457
457
|
}
|
458
|
-
const Ae = "Collapsible", [
|
458
|
+
const Ae = "Collapsible", [ct, Ce] = ae(Ae), [it, ie] = ct(Ae), st = /* @__PURE__ */ I((e, r) => {
|
459
459
|
const { __scopeCollapsible: n, open: o, defaultOpen: c, disabled: t, onOpenChange: a, ...i } = e, [s = !1, l] = ce({
|
460
460
|
prop: o,
|
461
461
|
defaultProp: c,
|
462
462
|
onChange: a
|
463
463
|
});
|
464
|
-
return /* @__PURE__ */ A(
|
464
|
+
return /* @__PURE__ */ A(it, {
|
465
465
|
scope: n,
|
466
466
|
disabled: t,
|
467
|
-
contentId:
|
467
|
+
contentId: xe(),
|
468
468
|
open: s,
|
469
469
|
onOpenToggle: H(
|
470
470
|
() => l(
|
@@ -480,8 +480,8 @@ const Ae = "Collapsible", [at, Ce] = ae(Ae), [ct, ie] = at(Ae), it = /* @__PURE_
|
|
480
480
|
}, i, {
|
481
481
|
ref: r
|
482
482
|
})));
|
483
|
-
}),
|
484
|
-
const { __scopeCollapsible: n, ...o } = e, c = ie(
|
483
|
+
}), lt = "CollapsibleTrigger", ut = /* @__PURE__ */ I((e, r) => {
|
484
|
+
const { __scopeCollapsible: n, ...o } = e, c = ie(lt, n);
|
485
485
|
return /* @__PURE__ */ A(D.button, h({
|
486
486
|
type: "button",
|
487
487
|
"aria-controls": c.contentId,
|
@@ -493,20 +493,20 @@ const Ae = "Collapsible", [at, Ce] = ae(Ae), [ct, ie] = at(Ae), it = /* @__PURE_
|
|
493
493
|
ref: r,
|
494
494
|
onClick: ge(e.onClick, c.onOpenToggle)
|
495
495
|
}));
|
496
|
-
}), Ne = "CollapsibleContent",
|
496
|
+
}), Ne = "CollapsibleContent", pt = /* @__PURE__ */ I((e, r) => {
|
497
497
|
const { forceMount: n, ...o } = e, c = ie(Ne, e.__scopeCollapsible);
|
498
498
|
return /* @__PURE__ */ A(
|
499
|
-
|
499
|
+
ye,
|
500
500
|
{
|
501
501
|
present: n || c.open
|
502
502
|
},
|
503
|
-
({ present: t }) => /* @__PURE__ */ A(
|
503
|
+
({ present: t }) => /* @__PURE__ */ A(dt, h({}, o, {
|
504
504
|
ref: r,
|
505
505
|
present: t
|
506
506
|
}))
|
507
507
|
);
|
508
|
-
}),
|
509
|
-
const { __scopeCollapsible: n, present: o, children: c, ...t } = e, a = ie(Ne, n), [i, s] = re(o), l = C(null), d = M(r, l), p = C(0), _ = p.current, f = C(0), b = f.current,
|
508
|
+
}), dt = /* @__PURE__ */ I((e, r) => {
|
509
|
+
const { __scopeCollapsible: n, present: o, children: c, ...t } = e, a = ie(Ne, n), [i, s] = re(o), l = C(null), d = M(r, l), p = C(0), _ = p.current, f = C(0), b = f.current, y = a.open || i, g = C(y), m = C();
|
510
510
|
return k(() => {
|
511
511
|
const $ = requestAnimationFrame(
|
512
512
|
() => g.current = !1
|
@@ -529,7 +529,7 @@ const Ae = "Collapsible", [at, Ce] = ae(Ae), [ct, ie] = at(Ae), it = /* @__PURE_
|
|
529
529
|
"data-state": se(a.open),
|
530
530
|
"data-disabled": a.disabled ? "" : void 0,
|
531
531
|
id: a.contentId,
|
532
|
-
hidden: !
|
532
|
+
hidden: !y
|
533
533
|
}, t, {
|
534
534
|
ref: d,
|
535
535
|
style: {
|
@@ -537,33 +537,33 @@ const Ae = "Collapsible", [at, Ce] = ae(Ae), [ct, ie] = at(Ae), it = /* @__PURE_
|
|
537
537
|
"--radix-collapsible-content-width": b ? `${b}px` : void 0,
|
538
538
|
...e.style
|
539
539
|
}
|
540
|
-
}),
|
540
|
+
}), y && c);
|
541
541
|
});
|
542
542
|
function se(e) {
|
543
543
|
return e ? "open" : "closed";
|
544
544
|
}
|
545
|
-
const
|
546
|
-
function
|
547
|
-
const r = _e(
|
545
|
+
const ft = st, bt = ut, $t = pt, _t = /* @__PURE__ */ ee(void 0);
|
546
|
+
function mt(e) {
|
547
|
+
const r = _e(_t);
|
548
548
|
return e || r || "ltr";
|
549
549
|
}
|
550
|
-
const P = "Accordion",
|
550
|
+
const P = "Accordion", ht = [
|
551
551
|
"Home",
|
552
552
|
"End",
|
553
553
|
"ArrowDown",
|
554
554
|
"ArrowUp",
|
555
555
|
"ArrowLeft",
|
556
556
|
"ArrowRight"
|
557
|
-
], [le,
|
558
|
-
|
557
|
+
], [le, gt, vt] = We(P), [F, ln] = ae(P, [
|
558
|
+
vt,
|
559
559
|
Ce
|
560
560
|
]), ue = Ce(), Ee = /* @__PURE__ */ u.forwardRef((e, r) => {
|
561
561
|
const { type: n, ...o } = e, c = o, t = o;
|
562
562
|
return /* @__PURE__ */ u.createElement(le.Provider, {
|
563
563
|
scope: e.__scopeAccordion
|
564
|
-
}, n === "multiple" ? /* @__PURE__ */ u.createElement(
|
564
|
+
}, n === "multiple" ? /* @__PURE__ */ u.createElement(Ct, h({}, t, {
|
565
565
|
ref: r
|
566
|
-
})) : /* @__PURE__ */ u.createElement(
|
566
|
+
})) : /* @__PURE__ */ u.createElement(At, h({}, c, {
|
567
567
|
ref: r
|
568
568
|
})));
|
569
569
|
});
|
@@ -576,9 +576,9 @@ Ee.propTypes = {
|
|
576
576
|
].includes(e.type) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`.") : e.type === "multiple" && typeof r == "string" ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`.") : e.type === "single" && Array.isArray(r) ? new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`.") : null;
|
577
577
|
}
|
578
578
|
};
|
579
|
-
const [Ie,
|
579
|
+
const [Ie, yt] = F(P), [Pe, xt] = F(P, {
|
580
580
|
collapsible: !1
|
581
|
-
}),
|
581
|
+
}), At = /* @__PURE__ */ u.forwardRef((e, r) => {
|
582
582
|
const { value: n, defaultValue: o, onValueChange: c = () => {
|
583
583
|
}, collapsible: t = !1, ...a } = e, [i, s] = ce({
|
584
584
|
prop: n,
|
@@ -604,7 +604,7 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
604
604
|
}, /* @__PURE__ */ u.createElement(we, h({}, a, {
|
605
605
|
ref: r
|
606
606
|
}))));
|
607
|
-
}),
|
607
|
+
}), Ct = /* @__PURE__ */ u.forwardRef((e, r) => {
|
608
608
|
const { value: n, defaultValue: o, onValueChange: c = () => {
|
609
609
|
}, ...t } = e, [a = [], i] = ce({
|
610
610
|
prop: n,
|
@@ -641,15 +641,15 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
641
641
|
}, /* @__PURE__ */ u.createElement(we, h({}, t, {
|
642
642
|
ref: r
|
643
643
|
}))));
|
644
|
-
}), [
|
645
|
-
const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null), s = M(i, r), l =
|
644
|
+
}), [Nt, K] = F(P), we = /* @__PURE__ */ u.forwardRef((e, r) => {
|
645
|
+
const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null), s = M(i, r), l = gt(n), p = mt(c) === "ltr", _ = ge(e.onKeyDown, (f) => {
|
646
646
|
var b;
|
647
|
-
if (!
|
648
|
-
const
|
647
|
+
if (!ht.includes(f.key)) return;
|
648
|
+
const y = f.target, g = l().filter((J) => {
|
649
649
|
var X;
|
650
650
|
return !((X = J.ref.current) !== null && X !== void 0 && X.disabled);
|
651
651
|
}), m = g.findIndex(
|
652
|
-
(J) => J.ref.current ===
|
652
|
+
(J) => J.ref.current === y
|
653
653
|
), $ = g.length;
|
654
654
|
if (m === -1) return;
|
655
655
|
f.preventDefault();
|
@@ -679,10 +679,10 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
679
679
|
t === "vertical" && Z();
|
680
680
|
break;
|
681
681
|
}
|
682
|
-
const
|
683
|
-
(b = g[
|
682
|
+
const qe = v % $;
|
683
|
+
(b = g[qe].ref.current) === null || b === void 0 || b.focus();
|
684
684
|
});
|
685
|
-
return /* @__PURE__ */ u.createElement(
|
685
|
+
return /* @__PURE__ */ u.createElement(Nt, {
|
686
686
|
scope: n,
|
687
687
|
disabled: o,
|
688
688
|
direction: c,
|
@@ -694,14 +694,14 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
694
694
|
ref: s,
|
695
695
|
onKeyDown: o ? void 0 : _
|
696
696
|
}))));
|
697
|
-
}), ne = "AccordionItem", [
|
698
|
-
const { __scopeAccordion: n, value: o, ...c } = e, t = K(ne, n), a =
|
699
|
-
return /* @__PURE__ */ u.createElement(
|
697
|
+
}), ne = "AccordionItem", [Et, pe] = F(ne), It = /* @__PURE__ */ u.forwardRef((e, r) => {
|
698
|
+
const { __scopeAccordion: n, value: o, ...c } = e, t = K(ne, n), a = yt(ne, n), i = ue(n), s = xe(), l = o && a.value.includes(o) || !1, d = t.disabled || e.disabled;
|
699
|
+
return /* @__PURE__ */ u.createElement(Et, {
|
700
700
|
scope: n,
|
701
701
|
open: l,
|
702
702
|
disabled: d,
|
703
703
|
triggerId: s
|
704
|
-
}, /* @__PURE__ */ u.createElement(
|
704
|
+
}, /* @__PURE__ */ u.createElement(ft, h({
|
705
705
|
"data-orientation": t.orientation,
|
706
706
|
"data-state": Se(l)
|
707
707
|
}, i, c, {
|
@@ -712,8 +712,8 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
712
712
|
p ? a.onItemOpen(o) : a.onItemClose(o);
|
713
713
|
}
|
714
714
|
})));
|
715
|
-
}),
|
716
|
-
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(
|
715
|
+
}), Pt = "AccordionHeader", wt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
716
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(Pt, n);
|
717
717
|
return /* @__PURE__ */ u.createElement(D.h3, h({
|
718
718
|
"data-orientation": c.orientation,
|
719
719
|
"data-state": Se(t.open),
|
@@ -721,20 +721,20 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
721
721
|
}, o, {
|
722
722
|
ref: r
|
723
723
|
}));
|
724
|
-
}), de = "AccordionTrigger",
|
724
|
+
}), de = "AccordionTrigger", St = /* @__PURE__ */ u.forwardRef((e, r) => {
|
725
725
|
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(de, n), a = xt(de, n), i = ue(n);
|
726
726
|
return /* @__PURE__ */ u.createElement(le.ItemSlot, {
|
727
727
|
scope: n
|
728
|
-
}, /* @__PURE__ */ u.createElement(
|
728
|
+
}, /* @__PURE__ */ u.createElement(bt, h({
|
729
729
|
"aria-disabled": t.open && !a.collapsible || void 0,
|
730
730
|
"data-orientation": c.orientation,
|
731
731
|
id: t.triggerId
|
732
732
|
}, i, o, {
|
733
733
|
ref: r
|
734
734
|
})));
|
735
|
-
}),
|
736
|
-
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(
|
737
|
-
return /* @__PURE__ */ u.createElement(
|
735
|
+
}), Ot = "AccordionContent", Rt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
736
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(Ot, n), a = ue(n);
|
737
|
+
return /* @__PURE__ */ u.createElement($t, h({
|
738
738
|
role: "region",
|
739
739
|
"aria-labelledby": t.triggerId,
|
740
740
|
"data-orientation": c.orientation
|
@@ -750,8 +750,8 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
750
750
|
function Se(e) {
|
751
751
|
return e ? "open" : "closed";
|
752
752
|
}
|
753
|
-
const
|
754
|
-
function
|
753
|
+
const Tt = Ee, Mt = It, kt = wt, Dt = St, Lt = Rt;
|
754
|
+
function jt(e) {
|
755
755
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
756
756
|
}
|
757
757
|
var Oe = { exports: {} };
|
@@ -790,13 +790,13 @@ var Oe = { exports: {} };
|
|
790
790
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
791
791
|
})();
|
792
792
|
})(Oe);
|
793
|
-
var
|
794
|
-
const Re = /* @__PURE__ */
|
793
|
+
var qt = Oe.exports;
|
794
|
+
const Re = /* @__PURE__ */ jt(qt), Vt = {
|
795
795
|
"purpur-accordion": "_purpur-accordion_u887g_1",
|
796
796
|
"purpur-accordion__title": "_purpur-accordion__title_u887g_4",
|
797
797
|
"purpur-accordion--negative": "_purpur-accordion--negative_u887g_13"
|
798
798
|
};
|
799
|
-
function
|
799
|
+
function Ut(e) {
|
800
800
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
801
801
|
}
|
802
802
|
var Te = { exports: {} };
|
@@ -835,8 +835,8 @@ var Te = { exports: {} };
|
|
835
835
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
836
836
|
})();
|
837
837
|
})(Te);
|
838
|
-
var
|
839
|
-
const
|
838
|
+
var zt = Te.exports;
|
839
|
+
const Bt = /* @__PURE__ */ Ut(zt), Ht = {
|
840
840
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
841
841
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
842
842
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
@@ -844,40 +844,40 @@ const zt = /* @__PURE__ */ Vt(Ut), Bt = {
|
|
844
844
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
845
845
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
846
846
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
847
|
-
},
|
847
|
+
}, Gt = {
|
848
848
|
name: "chevron-down",
|
849
849
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M20.136 7.864a.9.9 0 0 0-1.272 0L12 14.727 5.136 7.864a.9.9 0 0 0-1.272 1.272l7.5 7.5a.9.9 0 0 0 1.272 0l7.5-7.5a.9.9 0 0 0 0-1.272Z" clip-rule="evenodd"/></svg>',
|
850
850
|
keywords: ["chevron-down"],
|
851
851
|
category: "utility"
|
852
|
-
}, Me = (e) => /* @__PURE__ */
|
853
|
-
|
852
|
+
}, Me = (e) => /* @__PURE__ */ x(
|
853
|
+
ke,
|
854
854
|
{
|
855
855
|
...e,
|
856
|
-
svg:
|
856
|
+
svg: Gt
|
857
857
|
}
|
858
858
|
);
|
859
859
|
Me.displayName = "IconChevronDown";
|
860
|
-
const
|
860
|
+
const Ft = Bt.bind(Ht), fe = "purpur-icon", Kt = "md", Yt = (e) => e.filter((r) => Object.keys(r).length >= 1).map((r) => `${r.name}="${r.value}"`).join(" "), Zt = ({ content: e = "", title: r } = {}) => {
|
861
861
|
const n = [
|
862
862
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
863
863
|
{ name: "fill", value: "currentColor" },
|
864
864
|
{ name: "viewBox", value: "0 0 24 24" },
|
865
865
|
r ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
866
866
|
], o = r ? `<title>${r}</title>` : "";
|
867
|
-
return `<svg ${
|
868
|
-
},
|
867
|
+
return `<svg ${Yt(n)}>${o}${e}</svg>`;
|
868
|
+
}, Jt = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), ke = ({
|
869
869
|
["data-testid"]: e,
|
870
870
|
svg: r,
|
871
871
|
allyTitle: n,
|
872
872
|
className: o,
|
873
|
-
size: c =
|
873
|
+
size: c = Kt,
|
874
874
|
...t
|
875
875
|
}) => {
|
876
|
-
const a =
|
877
|
-
content:
|
876
|
+
const a = Zt({
|
877
|
+
content: Jt(r.svg),
|
878
878
|
title: n
|
879
|
-
}), i =
|
880
|
-
return /* @__PURE__ */
|
879
|
+
}), i = Ft(o, fe, `${fe}--${c}`);
|
880
|
+
return /* @__PURE__ */ x(
|
881
881
|
"span",
|
882
882
|
{
|
883
883
|
"aria-label": n,
|
@@ -888,10 +888,11 @@ const Gt = zt.bind(Bt), fe = "purpur-icon", Ft = "md", Kt = (e) => e.filter((r)
|
|
888
888
|
}
|
889
889
|
);
|
890
890
|
};
|
891
|
+
ke.displayName = "Icon";
|
891
892
|
function Xt(e) {
|
892
893
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
893
894
|
}
|
894
|
-
var
|
895
|
+
var De = { exports: {} };
|
895
896
|
/*!
|
896
897
|
Copyright (c) 2018 Jed Watson.
|
897
898
|
Licensed under the MIT License (MIT), see
|
@@ -926,8 +927,8 @@ var ke = { exports: {} };
|
|
926
927
|
}
|
927
928
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
928
929
|
})();
|
929
|
-
})(
|
930
|
-
var Qt =
|
930
|
+
})(De);
|
931
|
+
var Qt = De.exports;
|
931
932
|
const Wt = /* @__PURE__ */ Xt(Qt), R = {
|
932
933
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
933
934
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
@@ -954,7 +955,7 @@ const Wt = /* @__PURE__ */ Xt(Qt), R = {
|
|
954
955
|
ADDITIONAL100MEDIUM: "additional-100-medium",
|
955
956
|
OVERLINE100: "overline-100",
|
956
957
|
OVERLINE200: "overline-200"
|
957
|
-
}, T = "purpur-paragraph",
|
958
|
+
}, T = "purpur-paragraph", Le = ({
|
958
959
|
["data-testid"]: e,
|
959
960
|
children: r,
|
960
961
|
className: n,
|
@@ -974,9 +975,9 @@ const Wt = /* @__PURE__ */ Xt(Qt), R = {
|
|
974
975
|
[R[`${T}--negative`]]: t
|
975
976
|
}
|
976
977
|
]);
|
977
|
-
return /* @__PURE__ */
|
978
|
+
return /* @__PURE__ */ x("p", { ...i, className: s, "data-testid": e, children: r });
|
978
979
|
};
|
979
|
-
|
980
|
+
Le.displayName = "Paragraph";
|
980
981
|
const tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
981
982
|
"purpur-accordion-item": "_purpur-accordion-item_aukzj_1",
|
982
983
|
"purpur-accordion-item__header": "_purpur-accordion-item__header_aukzj_8",
|
@@ -1005,48 +1006,49 @@ const tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
|
1005
1006
|
[`${E}--negative`]: c
|
1006
1007
|
}
|
1007
1008
|
]);
|
1008
|
-
return /* @__PURE__ */ W(
|
1009
|
-
/* @__PURE__ */
|
1010
|
-
|
1009
|
+
return /* @__PURE__ */ W(Mt, { className: s, value: n, ...a, children: [
|
1010
|
+
/* @__PURE__ */ x(kt, { className: w(`${E}__header`), asChild: !0, children: /* @__PURE__ */ x(oe, { tag: o, variant: "title-100", className: w(`${E}__title`), children: /* @__PURE__ */ W(
|
1011
|
+
Dt,
|
1011
1012
|
{
|
1012
1013
|
ref: i,
|
1013
1014
|
onClick: t,
|
1014
1015
|
className: w(`${E}__trigger`, r),
|
1015
1016
|
children: [
|
1016
1017
|
n,
|
1017
|
-
/* @__PURE__ */
|
1018
|
+
/* @__PURE__ */ x(Me, { size: "md", className: w(`${E}__icon`), "aria-hidden": !0 })
|
1018
1019
|
]
|
1019
1020
|
}
|
1020
1021
|
) }) }),
|
1021
|
-
/* @__PURE__ */
|
1022
|
+
/* @__PURE__ */ x(Lt, { className: w(`${E}__content`, r), children: /* @__PURE__ */ x("div", { className: w(`${E}__contentText`), children: typeof e == "string" ? /* @__PURE__ */ x(Le, { variant: "paragraph-200", children: e }) : e }) })
|
1022
1023
|
] });
|
1023
1024
|
}
|
1024
|
-
), be = Re.bind(
|
1025
|
+
), be = Re.bind(Vt), Q = "purpur-accordion", je = ({
|
1025
1026
|
["data-testid"]: e,
|
1026
1027
|
children: r,
|
1027
1028
|
className: n,
|
1028
1029
|
negative: o = !1,
|
1029
1030
|
title: c,
|
1030
1031
|
titleTag: t = "h2",
|
1031
|
-
titleVariant: a = "title-300"
|
1032
|
+
titleVariant: a = "title-300",
|
1033
|
+
...i
|
1032
1034
|
}) => {
|
1033
|
-
const
|
1035
|
+
const s = be([
|
1034
1036
|
n,
|
1035
1037
|
Q,
|
1036
1038
|
{
|
1037
1039
|
[`${Q}--negative`]: o
|
1038
1040
|
}
|
1039
|
-
]),
|
1041
|
+
]), l = () => S.map(r, (d) => G(d, {
|
1040
1042
|
negative: o
|
1041
1043
|
}));
|
1042
|
-
return /* @__PURE__ */ W(
|
1043
|
-
c ? /* @__PURE__ */
|
1044
|
-
|
1044
|
+
return /* @__PURE__ */ W(Tt, { className: s, type: "multiple", "data-testid": e, ...i, children: [
|
1045
|
+
c ? /* @__PURE__ */ x(oe, { tag: t, variant: a, className: be(`${Q}__title`), children: c }) : null,
|
1046
|
+
l()
|
1045
1047
|
] });
|
1046
1048
|
};
|
1047
|
-
|
1048
|
-
|
1049
|
+
je.Item = on;
|
1050
|
+
je.displayName = "Accordion";
|
1049
1051
|
export {
|
1050
|
-
|
1052
|
+
je as Accordion
|
1051
1053
|
};
|
1052
1054
|
//# sourceMappingURL=accordion.es.js.map
|