@purpurds/accordion 5.8.1 → 5.9.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-item.d.ts +2 -2
- package/dist/accordion-item.d.ts.map +1 -1
- package/dist/accordion.cjs.js +4 -4
- package/dist/accordion.cjs.js.map +1 -1
- package/dist/accordion.d.ts +1 -1
- package/dist/accordion.es.js +179 -176
- package/dist/accordion.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
- package/src/accordion-item.module.scss +4 -3
- package/src/accordion-item.tsx +48 -41
- package/src/accordion.module.scss +3 -1
package/dist/accordion.es.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { jsx as A, jsxs as X } from "react/jsx-runtime";
|
2
2
|
import * as be from "react";
|
3
|
-
import u, { createContext as ee, useMemo as V, createElement as y, useContext as $e, useCallback as
|
3
|
+
import u, { createContext as ee, useMemo as V, createElement as y, useContext as $e, useCallback as H, forwardRef as I, Children as S, isValidElement as U, cloneElement as G, Fragment as Le, useRef as C, useEffect as k, useState as re, useLayoutEffect as qe, useReducer as Ve } from "react";
|
4
4
|
import { flushSync as Ue } from "react-dom";
|
5
|
-
function
|
5
|
+
function ze(e) {
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
7
7
|
}
|
8
8
|
var _e = { exports: {} };
|
@@ -41,8 +41,8 @@ var _e = { exports: {} };
|
|
41
41
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
42
42
|
})();
|
43
43
|
})(_e);
|
44
|
-
var
|
45
|
-
const
|
44
|
+
var Be = _e.exports;
|
45
|
+
const He = /* @__PURE__ */ ze(Be), j = {
|
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
|
+
}, Ge = {
|
62
62
|
TITLE100: "title-100",
|
63
63
|
TITLE200: "title-200",
|
64
64
|
TITLE300: "title-300",
|
@@ -67,26 +67,26 @@ const Ge = /* @__PURE__ */ Be(He), L = {
|
|
67
67
|
TITLE600: "title-600",
|
68
68
|
TITLE700: "title-700",
|
69
69
|
SUBSECTION100: "subsection-100"
|
70
|
-
},
|
70
|
+
}, L = "purpur-heading", me = ({
|
71
71
|
["data-testid"]: e,
|
72
72
|
children: r,
|
73
73
|
className: n = "",
|
74
74
|
enableHyphenation: o = !1,
|
75
75
|
negative: c = !1,
|
76
76
|
tag: t,
|
77
|
-
variant: a =
|
77
|
+
variant: a = Ge.TITLE100,
|
78
78
|
...i
|
79
79
|
}) => {
|
80
|
-
const
|
80
|
+
const s = t, l = He([
|
81
81
|
n,
|
82
|
-
L
|
83
|
-
|
82
|
+
j[L],
|
83
|
+
j[`${L}--${a}`],
|
84
84
|
{
|
85
|
-
[
|
86
|
-
[
|
85
|
+
[j[`${L}--hyphens`]]: o,
|
86
|
+
[j[`${L}--negative`]]: c
|
87
87
|
}
|
88
88
|
]);
|
89
|
-
return /* @__PURE__ */ A(
|
89
|
+
return /* @__PURE__ */ A(s, { ...i, className: l, "data-testid": e, children: r });
|
90
90
|
};
|
91
91
|
function h() {
|
92
92
|
return h = Object.assign ? Object.assign.bind() : function(e) {
|
@@ -101,13 +101,13 @@ function h() {
|
|
101
101
|
function oe(e, r = []) {
|
102
102
|
let n = [];
|
103
103
|
function o(t, a) {
|
104
|
-
const i = /* @__PURE__ */ ee(a),
|
104
|
+
const i = /* @__PURE__ */ ee(a), s = n.length;
|
105
105
|
n = [
|
106
106
|
...n,
|
107
107
|
a
|
108
108
|
];
|
109
|
-
function
|
110
|
-
const { scope: _, children: f, ...b } = p, x = (_ == null ? void 0 : _[e][
|
109
|
+
function l(p) {
|
110
|
+
const { scope: _, children: f, ...b } = p, x = (_ == null ? void 0 : _[e][s]) || i, g = V(
|
111
111
|
() => b,
|
112
112
|
Object.values(b)
|
113
113
|
);
|
@@ -116,42 +116,42 @@ function oe(e, r = []) {
|
|
116
116
|
}, f);
|
117
117
|
}
|
118
118
|
function d(p, _) {
|
119
|
-
const f = (_ == null ? void 0 : _[e][
|
119
|
+
const f = (_ == null ? void 0 : _[e][s]) || i, b = $e(f);
|
120
120
|
if (b)
|
121
121
|
return b;
|
122
122
|
if (a !== void 0)
|
123
123
|
return a;
|
124
124
|
throw new Error(`\`${p}\` must be used within \`${t}\``);
|
125
125
|
}
|
126
|
-
return
|
127
|
-
|
126
|
+
return l.displayName = t + "Provider", [
|
127
|
+
l,
|
128
128
|
d
|
129
129
|
];
|
130
130
|
}
|
131
131
|
const c = () => {
|
132
132
|
const t = n.map((a) => /* @__PURE__ */ ee(a));
|
133
133
|
return function(i) {
|
134
|
-
const
|
134
|
+
const s = (i == null ? void 0 : i[e]) || t;
|
135
135
|
return V(
|
136
136
|
() => ({
|
137
137
|
[`__scope${e}`]: {
|
138
138
|
...i,
|
139
|
-
[e]:
|
139
|
+
[e]: s
|
140
140
|
}
|
141
141
|
}),
|
142
142
|
[
|
143
143
|
i,
|
144
|
-
|
144
|
+
s
|
145
145
|
]
|
146
146
|
);
|
147
147
|
};
|
148
148
|
};
|
149
149
|
return c.scopeName = e, [
|
150
150
|
o,
|
151
|
-
|
151
|
+
Fe(c, ...r)
|
152
152
|
];
|
153
153
|
}
|
154
|
-
function
|
154
|
+
function Fe(...e) {
|
155
155
|
const r = e[0];
|
156
156
|
if (e.length === 1)
|
157
157
|
return r;
|
@@ -163,8 +163,8 @@ function ze(...e) {
|
|
163
163
|
})
|
164
164
|
);
|
165
165
|
return function(t) {
|
166
|
-
const a = o.reduce((i, { useScope:
|
167
|
-
const p =
|
166
|
+
const a = o.reduce((i, { useScope: s, scopeName: l }) => {
|
167
|
+
const p = s(t)[`__scope${l}`];
|
168
168
|
return {
|
169
169
|
...i,
|
170
170
|
...p
|
@@ -191,30 +191,30 @@ function he(...e) {
|
|
191
191
|
);
|
192
192
|
}
|
193
193
|
function M(...e) {
|
194
|
-
return
|
194
|
+
return H(he(...e), e);
|
195
195
|
}
|
196
|
-
const
|
197
|
-
const { children: n, ...o } = e, c =
|
196
|
+
const z = /* @__PURE__ */ I((e, r) => {
|
197
|
+
const { children: n, ...o } = e, c = S.toArray(n), t = c.find(We);
|
198
198
|
if (t) {
|
199
|
-
const a = t.props.children, i = c.map((
|
199
|
+
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);
|
200
200
|
return /* @__PURE__ */ y(te, h({}, o, {
|
201
201
|
ref: r
|
202
|
-
}), /* @__PURE__ */ U(a) ? /* @__PURE__ */
|
202
|
+
}), /* @__PURE__ */ U(a) ? /* @__PURE__ */ G(a, void 0, i) : null);
|
203
203
|
}
|
204
204
|
return /* @__PURE__ */ y(te, h({}, o, {
|
205
205
|
ref: r
|
206
206
|
}), n);
|
207
207
|
});
|
208
|
-
|
209
|
-
const te = /* @__PURE__ */
|
208
|
+
z.displayName = "Slot";
|
209
|
+
const te = /* @__PURE__ */ I((e, r) => {
|
210
210
|
const { children: n, ...o } = e;
|
211
|
-
return /* @__PURE__ */ U(n) ? /* @__PURE__ */
|
211
|
+
return /* @__PURE__ */ U(n) ? /* @__PURE__ */ G(n, {
|
212
212
|
...Ye(o, n.props),
|
213
213
|
ref: r ? he(r, n.ref) : n.ref
|
214
|
-
}) :
|
214
|
+
}) : S.count(n) > 1 ? S.only(null) : null;
|
215
215
|
});
|
216
216
|
te.displayName = "SlotClone";
|
217
|
-
const Ze = ({ children: e }) => /* @__PURE__ */ y(
|
217
|
+
const Ze = ({ children: e }) => /* @__PURE__ */ y(Le, null, e);
|
218
218
|
function We(e) {
|
219
219
|
return /* @__PURE__ */ U(e) && e.type === Ze;
|
220
220
|
}
|
@@ -252,17 +252,17 @@ function Je(e) {
|
|
252
252
|
itemMap: m,
|
253
253
|
collectionRef: g
|
254
254
|
}, x);
|
255
|
-
}, i = e + "CollectionSlot",
|
255
|
+
}, i = e + "CollectionSlot", s = /* @__PURE__ */ u.forwardRef((f, b) => {
|
256
256
|
const { scope: x, children: g } = f, m = t(i, x), $ = M(b, m.collectionRef);
|
257
|
-
return /* @__PURE__ */ u.createElement(
|
257
|
+
return /* @__PURE__ */ u.createElement(z, {
|
258
258
|
ref: $
|
259
259
|
}, g);
|
260
|
-
}),
|
261
|
-
const { scope: x, children: g, ...m } = f, $ = u.useRef(null), v = M(b, $), N = t(
|
260
|
+
}), l = e + "CollectionItemSlot", d = "data-radix-collection-item", p = /* @__PURE__ */ u.forwardRef((f, b) => {
|
261
|
+
const { scope: x, children: g, ...m } = f, $ = u.useRef(null), v = M(b, $), N = t(l, x);
|
262
262
|
return u.useEffect(() => (N.itemMap.set($, {
|
263
263
|
ref: $,
|
264
264
|
...m
|
265
|
-
}), () => void N.itemMap.delete($))), /* @__PURE__ */ u.createElement(
|
265
|
+
}), () => void N.itemMap.delete($))), /* @__PURE__ */ u.createElement(z, {
|
266
266
|
[d]: "",
|
267
267
|
ref: v
|
268
268
|
}, g);
|
@@ -285,7 +285,7 @@ function Je(e) {
|
|
285
285
|
return [
|
286
286
|
{
|
287
287
|
Provider: a,
|
288
|
-
Slot:
|
288
|
+
Slot: s,
|
289
289
|
ItemSlot: p
|
290
290
|
},
|
291
291
|
_,
|
@@ -300,7 +300,7 @@ function ge(e, r, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
300
300
|
}
|
301
301
|
function ve(e) {
|
302
302
|
const r = C(e);
|
303
|
-
return
|
303
|
+
return k(() => {
|
304
304
|
r.current = e;
|
305
305
|
}), V(
|
306
306
|
() => (...n) => {
|
@@ -315,12 +315,12 @@ function ae({ prop: e, defaultProp: r, onChange: n = () => {
|
|
315
315
|
const [o, c] = Qe({
|
316
316
|
defaultProp: r,
|
317
317
|
onChange: n
|
318
|
-
}), t = e !== void 0, a = t ? e : o, i = ve(n),
|
318
|
+
}), t = e !== void 0, a = t ? e : o, i = ve(n), s = H((l) => {
|
319
319
|
if (t) {
|
320
|
-
const p = typeof
|
320
|
+
const p = typeof l == "function" ? l(e) : l;
|
321
321
|
p !== e && i(p);
|
322
322
|
} else
|
323
|
-
c(
|
323
|
+
c(l);
|
324
324
|
}, [
|
325
325
|
t,
|
326
326
|
e,
|
@@ -329,12 +329,12 @@ function ae({ prop: e, defaultProp: r, onChange: n = () => {
|
|
329
329
|
]);
|
330
330
|
return [
|
331
331
|
a,
|
332
|
-
|
332
|
+
s
|
333
333
|
];
|
334
334
|
}
|
335
335
|
function Qe({ defaultProp: e, onChange: r }) {
|
336
336
|
const n = re(e), [o] = n, c = C(o), t = ve(r);
|
337
|
-
return
|
337
|
+
return k(() => {
|
338
338
|
c.current !== o && (t(o), c.current = o);
|
339
339
|
}, [
|
340
340
|
o,
|
@@ -360,9 +360,9 @@ const Xe = [
|
|
360
360
|
"svg",
|
361
361
|
"ul"
|
362
362
|
], D = Xe.reduce((e, r) => {
|
363
|
-
const n = /* @__PURE__ */
|
364
|
-
const { asChild: t, ...a } = o, i = t ?
|
365
|
-
return
|
363
|
+
const n = /* @__PURE__ */ I((o, c) => {
|
364
|
+
const { asChild: t, ...a } = o, i = t ? z : r;
|
365
|
+
return k(() => {
|
366
366
|
window[Symbol.for("radix-ui")] = !0;
|
367
367
|
}, []), /* @__PURE__ */ y(i, h({}, a, {
|
368
368
|
ref: c
|
@@ -372,7 +372,7 @@ const Xe = [
|
|
372
372
|
...e,
|
373
373
|
[r]: n
|
374
374
|
};
|
375
|
-
}, {}),
|
375
|
+
}, {}), B = globalThis != null && globalThis.document ? qe : () => {
|
376
376
|
};
|
377
377
|
function et(e, r) {
|
378
378
|
return Ve((n, o) => {
|
@@ -383,14 +383,14 @@ function et(e, r) {
|
|
383
383
|
const xe = (e) => {
|
384
384
|
const { present: r, children: n } = e, o = tt(r), c = typeof n == "function" ? n({
|
385
385
|
present: o.isPresent
|
386
|
-
}) :
|
387
|
-
return typeof n == "function" || o.isPresent ? /* @__PURE__ */
|
386
|
+
}) : S.only(n), t = M(o.ref, c.ref);
|
387
|
+
return typeof n == "function" || o.isPresent ? /* @__PURE__ */ G(c, {
|
388
388
|
ref: t
|
389
389
|
}) : null;
|
390
390
|
};
|
391
391
|
xe.displayName = "Presence";
|
392
392
|
function tt(e) {
|
393
|
-
const [r, n] = re(), o = C({}), c = C(e), t = C("none"), a = e ? "mounted" : "unmounted", [i,
|
393
|
+
const [r, n] = re(), o = C({}), c = C(e), t = C("none"), a = e ? "mounted" : "unmounted", [i, s] = et(a, {
|
394
394
|
mounted: {
|
395
395
|
UNMOUNT: "unmounted",
|
396
396
|
ANIMATION_OUT: "unmountSuspended"
|
@@ -403,49 +403,49 @@ function tt(e) {
|
|
403
403
|
MOUNT: "mounted"
|
404
404
|
}
|
405
405
|
});
|
406
|
-
return
|
407
|
-
const
|
408
|
-
t.current = i === "mounted" ?
|
406
|
+
return k(() => {
|
407
|
+
const l = q(o.current);
|
408
|
+
t.current = i === "mounted" ? l : "none";
|
409
409
|
}, [
|
410
410
|
i
|
411
|
-
]),
|
412
|
-
const
|
411
|
+
]), B(() => {
|
412
|
+
const l = o.current, d = c.current;
|
413
413
|
if (d !== e) {
|
414
|
-
const _ = t.current, f =
|
415
|
-
e ?
|
414
|
+
const _ = t.current, f = q(l);
|
415
|
+
e ? s("MOUNT") : f === "none" || (l == null ? void 0 : l.display) === "none" ? s("UNMOUNT") : s(d && _ !== f ? "ANIMATION_OUT" : "UNMOUNT"), c.current = e;
|
416
416
|
}
|
417
417
|
}, [
|
418
418
|
e,
|
419
|
-
|
420
|
-
]),
|
419
|
+
s
|
420
|
+
]), B(() => {
|
421
421
|
if (r) {
|
422
|
-
const
|
423
|
-
const f =
|
422
|
+
const l = (p) => {
|
423
|
+
const f = q(o.current).includes(p.animationName);
|
424
424
|
p.target === r && f && Ue(
|
425
|
-
() =>
|
425
|
+
() => s("ANIMATION_END")
|
426
426
|
);
|
427
427
|
}, d = (p) => {
|
428
|
-
p.target === r && (t.current =
|
428
|
+
p.target === r && (t.current = q(o.current));
|
429
429
|
};
|
430
|
-
return r.addEventListener("animationstart", d), r.addEventListener("animationcancel",
|
431
|
-
r.removeEventListener("animationstart", d), r.removeEventListener("animationcancel",
|
430
|
+
return r.addEventListener("animationstart", d), r.addEventListener("animationcancel", l), r.addEventListener("animationend", l), () => {
|
431
|
+
r.removeEventListener("animationstart", d), r.removeEventListener("animationcancel", l), r.removeEventListener("animationend", l);
|
432
432
|
};
|
433
433
|
} else
|
434
|
-
|
434
|
+
s("ANIMATION_END");
|
435
435
|
}, [
|
436
436
|
r,
|
437
|
-
|
437
|
+
s
|
438
438
|
]), {
|
439
439
|
isPresent: [
|
440
440
|
"mounted",
|
441
441
|
"unmountSuspended"
|
442
442
|
].includes(i),
|
443
|
-
ref:
|
444
|
-
|
443
|
+
ref: H((l) => {
|
444
|
+
l && (o.current = getComputedStyle(l)), n(l);
|
445
445
|
}, [])
|
446
446
|
};
|
447
447
|
}
|
448
|
-
function
|
448
|
+
function q(e) {
|
449
449
|
return (e == null ? void 0 : e.animationName) || "none";
|
450
450
|
}
|
451
451
|
const nt = be.useId || (() => {
|
@@ -453,7 +453,7 @@ const nt = be.useId || (() => {
|
|
453
453
|
let rt = 0;
|
454
454
|
function Ae(e) {
|
455
455
|
const [r, n] = be.useState(nt());
|
456
|
-
return
|
456
|
+
return B(() => {
|
457
457
|
n(
|
458
458
|
(o) => o ?? String(rt++)
|
459
459
|
);
|
@@ -461,8 +461,8 @@ function Ae(e) {
|
|
461
461
|
e
|
462
462
|
]), r ? `radix-${r}` : "";
|
463
463
|
}
|
464
|
-
const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE__ */
|
465
|
-
const { __scopeCollapsible: n, open: o, defaultOpen: c, disabled: t, onOpenChange: a, ...i } = e, [
|
464
|
+
const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE__ */ I((e, r) => {
|
465
|
+
const { __scopeCollapsible: n, open: o, defaultOpen: c, disabled: t, onOpenChange: a, ...i } = e, [s = !1, l] = ae({
|
466
466
|
prop: o,
|
467
467
|
defaultProp: c,
|
468
468
|
onChange: a
|
@@ -471,22 +471,22 @@ const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE_
|
|
471
471
|
scope: n,
|
472
472
|
disabled: t,
|
473
473
|
contentId: Ae(),
|
474
|
-
open:
|
475
|
-
onOpenToggle:
|
476
|
-
() =>
|
474
|
+
open: s,
|
475
|
+
onOpenToggle: H(
|
476
|
+
() => l(
|
477
477
|
(d) => !d
|
478
478
|
),
|
479
479
|
[
|
480
|
-
|
480
|
+
l
|
481
481
|
]
|
482
482
|
)
|
483
483
|
}, /* @__PURE__ */ y(D.div, h({
|
484
|
-
"data-state": ie(
|
484
|
+
"data-state": ie(s),
|
485
485
|
"data-disabled": t ? "" : void 0
|
486
486
|
}, i, {
|
487
487
|
ref: r
|
488
488
|
})));
|
489
|
-
}), it = "CollapsibleTrigger", st = /* @__PURE__ */
|
489
|
+
}), it = "CollapsibleTrigger", st = /* @__PURE__ */ I((e, r) => {
|
490
490
|
const { __scopeCollapsible: n, ...o } = e, c = ce(it, n);
|
491
491
|
return /* @__PURE__ */ y(D.button, h({
|
492
492
|
type: "button",
|
@@ -499,7 +499,7 @@ const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE_
|
|
499
499
|
ref: r,
|
500
500
|
onClick: ge(e.onClick, c.onOpenToggle)
|
501
501
|
}));
|
502
|
-
}), Ne = "CollapsibleContent", lt = /* @__PURE__ */
|
502
|
+
}), Ne = "CollapsibleContent", lt = /* @__PURE__ */ I((e, r) => {
|
503
503
|
const { forceMount: n, ...o } = e, c = ce(Ne, e.__scopeCollapsible);
|
504
504
|
return /* @__PURE__ */ y(
|
505
505
|
xe,
|
@@ -511,22 +511,22 @@ const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE_
|
|
511
511
|
present: t
|
512
512
|
}))
|
513
513
|
);
|
514
|
-
}), ut = /* @__PURE__ */
|
515
|
-
const { __scopeCollapsible: n, present: o, children: c, ...t } = e, a = ce(Ne, n), [i,
|
516
|
-
return
|
514
|
+
}), ut = /* @__PURE__ */ I((e, r) => {
|
515
|
+
const { __scopeCollapsible: n, present: o, children: c, ...t } = e, a = ce(Ne, n), [i, s] = re(o), l = C(null), d = M(r, l), p = C(0), _ = p.current, f = C(0), b = f.current, x = a.open || i, g = C(x), m = C();
|
516
|
+
return k(() => {
|
517
517
|
const $ = requestAnimationFrame(
|
518
518
|
() => g.current = !1
|
519
519
|
);
|
520
520
|
return () => cancelAnimationFrame($);
|
521
|
-
}, []),
|
522
|
-
const $ =
|
521
|
+
}, []), B(() => {
|
522
|
+
const $ = l.current;
|
523
523
|
if ($) {
|
524
524
|
m.current = m.current || {
|
525
525
|
transitionDuration: $.style.transitionDuration,
|
526
526
|
animationName: $.style.animationName
|
527
527
|
}, $.style.transitionDuration = "0s", $.style.animationName = "none";
|
528
528
|
const v = $.getBoundingClientRect();
|
529
|
-
p.current = v.height, f.current = v.width, g.current || ($.style.transitionDuration = m.current.transitionDuration, $.style.animationName = m.current.animationName),
|
529
|
+
p.current = v.height, f.current = v.width, g.current || ($.style.transitionDuration = m.current.transitionDuration, $.style.animationName = m.current.animationName), s(o);
|
530
530
|
}
|
531
531
|
}, [
|
532
532
|
a.open,
|
@@ -553,14 +553,14 @@ function $t(e) {
|
|
553
553
|
const r = $e(bt);
|
554
554
|
return e || r || "ltr";
|
555
555
|
}
|
556
|
-
const
|
556
|
+
const P = "Accordion", _t = [
|
557
557
|
"Home",
|
558
558
|
"End",
|
559
559
|
"ArrowDown",
|
560
560
|
"ArrowUp",
|
561
561
|
"ArrowLeft",
|
562
562
|
"ArrowRight"
|
563
|
-
], [se, mt, ht] = Je(
|
563
|
+
], [se, mt, ht] = Je(P), [F, ln] = oe(P, [
|
564
564
|
ht,
|
565
565
|
Ce
|
566
566
|
]), le = Ce(), Ee = /* @__PURE__ */ u.forwardRef((e, r) => {
|
@@ -582,11 +582,11 @@ Ee.propTypes = {
|
|
582
582
|
].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;
|
583
583
|
}
|
584
584
|
};
|
585
|
-
const [Ie, gt] =
|
585
|
+
const [Ie, gt] = F(P), [Pe, vt] = F(P, {
|
586
586
|
collapsible: !1
|
587
587
|
}), xt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
588
588
|
const { value: n, defaultValue: o, onValueChange: c = () => {
|
589
|
-
}, collapsible: t = !1, ...a } = e, [i,
|
589
|
+
}, collapsible: t = !1, ...a } = e, [i, s] = ae({
|
590
590
|
prop: n,
|
591
591
|
defaultProp: o,
|
592
592
|
onChange: c
|
@@ -596,12 +596,12 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
596
596
|
value: i ? [
|
597
597
|
i
|
598
598
|
] : [],
|
599
|
-
onItemOpen:
|
599
|
+
onItemOpen: s,
|
600
600
|
onItemClose: u.useCallback(
|
601
|
-
() => t &&
|
601
|
+
() => t && s(""),
|
602
602
|
[
|
603
603
|
t,
|
604
|
-
|
604
|
+
s
|
605
605
|
]
|
606
606
|
)
|
607
607
|
}, /* @__PURE__ */ u.createElement(Pe, {
|
@@ -616,7 +616,7 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
616
616
|
prop: n,
|
617
617
|
defaultProp: o,
|
618
618
|
onChange: c
|
619
|
-
}),
|
619
|
+
}), s = u.useCallback(
|
620
620
|
(d) => i(
|
621
621
|
(p = []) => [
|
622
622
|
...p,
|
@@ -626,7 +626,7 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
626
626
|
[
|
627
627
|
i
|
628
628
|
]
|
629
|
-
),
|
629
|
+
), l = u.useCallback(
|
630
630
|
(d) => i(
|
631
631
|
(p = []) => p.filter(
|
632
632
|
(_) => _ !== d
|
@@ -639,20 +639,20 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
639
639
|
return /* @__PURE__ */ u.createElement(Ie, {
|
640
640
|
scope: e.__scopeAccordion,
|
641
641
|
value: a,
|
642
|
-
onItemOpen:
|
643
|
-
onItemClose:
|
642
|
+
onItemOpen: s,
|
643
|
+
onItemClose: l
|
644
644
|
}, /* @__PURE__ */ u.createElement(Pe, {
|
645
645
|
scope: e.__scopeAccordion,
|
646
646
|
collapsible: !0
|
647
647
|
}, /* @__PURE__ */ u.createElement(we, h({}, t, {
|
648
648
|
ref: r
|
649
649
|
}))));
|
650
|
-
}), [yt, K] =
|
651
|
-
const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null),
|
650
|
+
}), [yt, K] = F(P), we = /* @__PURE__ */ u.forwardRef((e, r) => {
|
651
|
+
const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null), s = M(i, r), l = mt(n), p = $t(c) === "ltr", _ = ge(e.onKeyDown, (f) => {
|
652
652
|
var b;
|
653
653
|
if (!_t.includes(f.key))
|
654
654
|
return;
|
655
|
-
const x = f.target, g =
|
655
|
+
const x = f.target, g = l().filter((Y) => {
|
656
656
|
var J;
|
657
657
|
return !((J = Y.ref.current) !== null && J !== void 0 && J.disabled);
|
658
658
|
}), m = g.findIndex(
|
@@ -687,8 +687,8 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
687
687
|
t === "vertical" && W();
|
688
688
|
break;
|
689
689
|
}
|
690
|
-
const
|
691
|
-
(b = g[
|
690
|
+
const je = v % $;
|
691
|
+
(b = g[je].ref.current) === null || b === void 0 || b.focus();
|
692
692
|
});
|
693
693
|
return /* @__PURE__ */ u.createElement(yt, {
|
694
694
|
scope: n,
|
@@ -699,29 +699,29 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
699
699
|
scope: n
|
700
700
|
}, /* @__PURE__ */ u.createElement(D.div, h({}, a, {
|
701
701
|
"data-orientation": t,
|
702
|
-
ref:
|
702
|
+
ref: s,
|
703
703
|
onKeyDown: o ? void 0 : _
|
704
704
|
}))));
|
705
|
-
}), ne = "AccordionItem", [Ct, ue] =
|
706
|
-
const { __scopeAccordion: n, value: o, ...c } = e, t = K(ne, n), a = gt(ne, n), i = le(n),
|
705
|
+
}), ne = "AccordionItem", [Ct, ue] = F(ne), Nt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
706
|
+
const { __scopeAccordion: n, value: o, ...c } = e, t = K(ne, n), a = gt(ne, n), i = le(n), s = Ae(), l = o && a.value.includes(o) || !1, d = t.disabled || e.disabled;
|
707
707
|
return /* @__PURE__ */ u.createElement(Ct, {
|
708
708
|
scope: n,
|
709
|
-
open:
|
709
|
+
open: l,
|
710
710
|
disabled: d,
|
711
|
-
triggerId:
|
711
|
+
triggerId: s
|
712
712
|
}, /* @__PURE__ */ u.createElement(pt, h({
|
713
713
|
"data-orientation": t.orientation,
|
714
|
-
"data-state": Se(
|
714
|
+
"data-state": Se(l)
|
715
715
|
}, i, c, {
|
716
716
|
ref: r,
|
717
717
|
disabled: d,
|
718
|
-
open:
|
718
|
+
open: l,
|
719
719
|
onOpenChange: (p) => {
|
720
720
|
p ? a.onItemOpen(o) : a.onItemClose(o);
|
721
721
|
}
|
722
722
|
})));
|
723
723
|
}), Et = "AccordionHeader", It = /* @__PURE__ */ u.forwardRef((e, r) => {
|
724
|
-
const { __scopeAccordion: n, ...o } = e, c = K(
|
724
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = ue(Et, n);
|
725
725
|
return /* @__PURE__ */ u.createElement(D.h3, h({
|
726
726
|
"data-orientation": c.orientation,
|
727
727
|
"data-state": Se(t.open),
|
@@ -730,7 +730,7 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
730
730
|
ref: r
|
731
731
|
}));
|
732
732
|
}), pe = "AccordionTrigger", Pt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
733
|
-
const { __scopeAccordion: n, ...o } = e, c = K(
|
733
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = ue(pe, n), a = vt(pe, n), i = le(n);
|
734
734
|
return /* @__PURE__ */ u.createElement(se.ItemSlot, {
|
735
735
|
scope: n
|
736
736
|
}, /* @__PURE__ */ u.createElement(dt, h({
|
@@ -741,7 +741,7 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
741
741
|
ref: r
|
742
742
|
})));
|
743
743
|
}), wt = "AccordionContent", St = /* @__PURE__ */ u.forwardRef((e, r) => {
|
744
|
-
const { __scopeAccordion: n, ...o } = e, c = K(
|
744
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = ue(wt, n), a = le(n);
|
745
745
|
return /* @__PURE__ */ u.createElement(ft, h({
|
746
746
|
role: "region",
|
747
747
|
"aria-labelledby": t.triggerId,
|
@@ -758,7 +758,7 @@ const [Ie, gt] = z(I), [Pe, vt] = z(I, {
|
|
758
758
|
function Se(e) {
|
759
759
|
return e ? "open" : "closed";
|
760
760
|
}
|
761
|
-
const Ot = Ee, Rt = Nt, Tt = It, Mt = Pt,
|
761
|
+
const Ot = Ee, Rt = Nt, Tt = It, Mt = Pt, kt = St;
|
762
762
|
function Dt(e) {
|
763
763
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
764
764
|
}
|
@@ -798,13 +798,13 @@ var Oe = { exports: {} };
|
|
798
798
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
799
799
|
})();
|
800
800
|
})(Oe);
|
801
|
-
var
|
802
|
-
const Re = /* @__PURE__ */ Dt(
|
803
|
-
"purpur-accordion": "_purpur-
|
804
|
-
"purpur-accordion__title": "_purpur-
|
805
|
-
"purpur-accordion--negative": "_purpur-accordion--
|
801
|
+
var jt = Oe.exports;
|
802
|
+
const Re = /* @__PURE__ */ Dt(jt), Lt = {
|
803
|
+
"purpur-accordion": "_purpur-accordion_u887g_1",
|
804
|
+
"purpur-accordion__title": "_purpur-accordion__title_u887g_4",
|
805
|
+
"purpur-accordion--negative": "_purpur-accordion--negative_u887g_13"
|
806
806
|
};
|
807
|
-
function
|
807
|
+
function qt(e) {
|
808
808
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
809
809
|
}
|
810
810
|
var Te = { exports: {} };
|
@@ -844,7 +844,7 @@ var Te = { exports: {} };
|
|
844
844
|
})();
|
845
845
|
})(Te);
|
846
846
|
var Vt = Te.exports;
|
847
|
-
const Ut = /* @__PURE__ */
|
847
|
+
const Ut = /* @__PURE__ */ qt(Vt), zt = {
|
848
848
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
849
849
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
850
850
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
@@ -852,7 +852,7 @@ const Ut = /* @__PURE__ */ jt(Vt), Bt = {
|
|
852
852
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
853
853
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
854
854
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
855
|
-
},
|
855
|
+
}, Bt = {
|
856
856
|
name: "chevron-down",
|
857
857
|
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>',
|
858
858
|
keywords: ["chevron-down"],
|
@@ -861,30 +861,30 @@ const Ut = /* @__PURE__ */ jt(Vt), Bt = {
|
|
861
861
|
Wt,
|
862
862
|
{
|
863
863
|
...e,
|
864
|
-
svg:
|
864
|
+
svg: Bt
|
865
865
|
}
|
866
866
|
);
|
867
867
|
Me.displayName = "IconChevronDown";
|
868
|
-
const
|
868
|
+
const Ht = Ut.bind(zt), de = "purpur-icon", Gt = "md", Ft = (e) => e.filter((r) => Object.keys(r).length >= 1).map((r) => `${r.name}="${r.value}"`).join(" "), Kt = ({ content: e = "", title: r } = {}) => {
|
869
869
|
const n = [
|
870
870
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
871
871
|
{ name: "fill", value: "currentColor" },
|
872
872
|
{ name: "viewBox", value: "0 0 24 24" },
|
873
873
|
r ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
874
874
|
], o = r ? `<title>${r}</title>` : "";
|
875
|
-
return `<svg ${
|
875
|
+
return `<svg ${Ft(n)}>${o}${e}</svg>`;
|
876
876
|
}, Zt = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Wt = ({
|
877
877
|
["data-testid"]: e,
|
878
878
|
svg: r,
|
879
879
|
allyTitle: n,
|
880
880
|
className: o = "",
|
881
|
-
size: c =
|
881
|
+
size: c = Gt,
|
882
882
|
...t
|
883
883
|
}) => {
|
884
884
|
const a = Kt({
|
885
885
|
content: Zt(r.svg),
|
886
886
|
title: n
|
887
|
-
}), i =
|
887
|
+
}), i = Ht(o, de, `${de}--${c}`);
|
888
888
|
return /* @__PURE__ */ A(
|
889
889
|
"span",
|
890
890
|
{
|
@@ -899,7 +899,7 @@ const Gt = Ut.bind(Bt), de = "purpur-icon", Ft = "md", zt = (e) => e.filter((r)
|
|
899
899
|
function Yt(e) {
|
900
900
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
901
901
|
}
|
902
|
-
var
|
902
|
+
var ke = { exports: {} };
|
903
903
|
/*!
|
904
904
|
Copyright (c) 2018 Jed Watson.
|
905
905
|
Licensed under the MIT License (MIT), see
|
@@ -934,8 +934,8 @@ var qe = { exports: {} };
|
|
934
934
|
}
|
935
935
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
936
936
|
})();
|
937
|
-
})(
|
938
|
-
var Jt =
|
937
|
+
})(ke);
|
938
|
+
var Jt = ke.exports;
|
939
939
|
const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
940
940
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
941
941
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
@@ -972,7 +972,7 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
972
972
|
variant: a = Xt.PARAGRAPH100,
|
973
973
|
...i
|
974
974
|
}) => {
|
975
|
-
const
|
975
|
+
const s = Qt([
|
976
976
|
n,
|
977
977
|
R[T],
|
978
978
|
R[`${T}--${a}`],
|
@@ -982,49 +982,52 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
982
982
|
[R[`${T}--negative`]]: t
|
983
983
|
}
|
984
984
|
]);
|
985
|
-
return /* @__PURE__ */ A("p", { ...i, className:
|
986
|
-
}, tn = "
|
987
|
-
"purpur-accordion-item": "_purpur-accordion-
|
988
|
-
"purpur-accordion-item__header": "_purpur-accordion-
|
989
|
-
"purpur-accordion-item__trigger": "_purpur-accordion-
|
990
|
-
"purpur-accordion-item__content": "_purpur-accordion-
|
985
|
+
return /* @__PURE__ */ A("p", { ...i, className: s, "data-testid": e, children: r });
|
986
|
+
}, tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
987
|
+
"purpur-accordion-item": "_purpur-accordion-item_aukzj_1",
|
988
|
+
"purpur-accordion-item__header": "_purpur-accordion-item__header_aukzj_8",
|
989
|
+
"purpur-accordion-item__trigger": "_purpur-accordion-item__trigger_aukzj_11",
|
990
|
+
"purpur-accordion-item__content": "_purpur-accordion-item__content_aukzj_41",
|
991
991
|
slideDown: tn,
|
992
992
|
slideUp: nn,
|
993
|
-
"purpur-accordion-item__contentText": "_purpur-accordion-
|
994
|
-
"purpur-accordion-item__icon": "_purpur-accordion-
|
995
|
-
"purpur-accordion-item__title": "_purpur-accordion-
|
996
|
-
"purpur-accordion-item--negative": "_purpur-accordion-item--
|
997
|
-
},
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
[`${E}--negative`]: c
|
1011
|
-
}
|
1012
|
-
]);
|
1013
|
-
return /* @__PURE__ */ X(Rt, { className: i, value: n, ...a, children: [
|
1014
|
-
/* @__PURE__ */ A(Tt, { className: P(`${E}__header`), asChild: !0, children: /* @__PURE__ */ A(me, { tag: o, variant: "title-100", className: P(`${E}__title`), children: /* @__PURE__ */ X(
|
1015
|
-
Mt,
|
993
|
+
"purpur-accordion-item__contentText": "_purpur-accordion-item__contentText_aukzj_50",
|
994
|
+
"purpur-accordion-item__icon": "_purpur-accordion-item__icon_aukzj_54",
|
995
|
+
"purpur-accordion-item__title": "_purpur-accordion-item__title_aukzj_67",
|
996
|
+
"purpur-accordion-item--negative": "_purpur-accordion-item--negative_aukzj_88"
|
997
|
+
}, w = Re.bind(rn), E = "purpur-accordion-item", on = I(
|
998
|
+
({
|
999
|
+
children: e,
|
1000
|
+
className: r,
|
1001
|
+
title: n,
|
1002
|
+
titleTag: o = "h3",
|
1003
|
+
negative: c,
|
1004
|
+
onClick: t,
|
1005
|
+
...a
|
1006
|
+
}, i) => {
|
1007
|
+
const s = w([
|
1008
|
+
r,
|
1009
|
+
E,
|
1016
1010
|
{
|
1017
|
-
|
1018
|
-
className: P(`${E}__trigger`, r),
|
1019
|
-
children: [
|
1020
|
-
n,
|
1021
|
-
/* @__PURE__ */ A(Me, { size: "md", className: P(`${E}__icon`), "aria-hidden": !0 })
|
1022
|
-
]
|
1011
|
+
[`${E}--negative`]: c
|
1023
1012
|
}
|
1024
|
-
)
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1013
|
+
]);
|
1014
|
+
return /* @__PURE__ */ X(Rt, { className: s, value: n, ...a, children: [
|
1015
|
+
/* @__PURE__ */ A(Tt, { className: w(`${E}__header`), asChild: !0, children: /* @__PURE__ */ A(me, { tag: o, variant: "title-100", className: w(`${E}__title`), children: /* @__PURE__ */ X(
|
1016
|
+
Mt,
|
1017
|
+
{
|
1018
|
+
ref: i,
|
1019
|
+
onClick: t,
|
1020
|
+
className: w(`${E}__trigger`, r),
|
1021
|
+
children: [
|
1022
|
+
n,
|
1023
|
+
/* @__PURE__ */ A(Me, { size: "md", className: w(`${E}__icon`), "aria-hidden": !0 })
|
1024
|
+
]
|
1025
|
+
}
|
1026
|
+
) }) }),
|
1027
|
+
/* @__PURE__ */ A(kt, { className: w(`${E}__content`, r), children: /* @__PURE__ */ A("div", { className: w(`${E}__contentText`), children: typeof e == "string" ? /* @__PURE__ */ A(en, { variant: "paragraph-200", children: e }) : e }) })
|
1028
|
+
] });
|
1029
|
+
}
|
1030
|
+
), fe = Re.bind(Lt), Q = "purpur-accordion", De = ({
|
1028
1031
|
["data-testid"]: e,
|
1029
1032
|
children: r,
|
1030
1033
|
className: n,
|
@@ -1039,12 +1042,12 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
1039
1042
|
{
|
1040
1043
|
[`${Q}--negative`]: o
|
1041
1044
|
}
|
1042
|
-
]),
|
1045
|
+
]), s = () => S.map(r, (l) => G(l, {
|
1043
1046
|
negative: o
|
1044
1047
|
}));
|
1045
1048
|
return /* @__PURE__ */ X(Ot, { className: i, type: "multiple", "data-testid": e, children: [
|
1046
1049
|
c ? /* @__PURE__ */ A(me, { tag: t, variant: a, className: fe(`${Q}__title`), children: c }) : null,
|
1047
|
-
|
1050
|
+
s()
|
1048
1051
|
] });
|
1049
1052
|
};
|
1050
1053
|
De.Item = on;
|