@purpurds/accordion 5.11.0 → 5.11.2
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 +1 -0
- package/dist/accordion-item.d.ts.map +1 -1
- package/dist/accordion.cjs.js +5 -5
- package/dist/accordion.cjs.js.map +1 -1
- package/dist/accordion.es.js +153 -158
- package/dist/accordion.es.js.map +1 -1
- package/package.json +14 -14
- package/src/accordion-item.tsx +1 -0
- package/src/accordion.stories.tsx +32 -3
- package/src/{accordion-item.stories.tsx → accordions-item.stories.tsx} +8 -8
- package/readme.mdx +0 -76
package/dist/accordion.es.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import * as
|
3
|
-
import u, { createContext as ee, useMemo as U, createElement as
|
4
|
-
import { flushSync as
|
5
|
-
function
|
1
|
+
import { jsx as y, jsxs as X } from "react/jsx-runtime";
|
2
|
+
import * as $e from "react";
|
3
|
+
import u, { createContext as ee, useMemo as U, createElement as A, useContext as _e, useCallback as H, forwardRef as I, Children as S, isValidElement as V, cloneElement as G, Fragment as qe, useRef as C, useEffect as k, useState as re, useLayoutEffect as Ue, useReducer as Ve } from "react";
|
4
|
+
import { flushSync as ze } from "react-dom";
|
5
|
+
function Be(e) {
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
7
7
|
}
|
8
|
-
var
|
8
|
+
var me = { exports: {} };
|
9
9
|
/*!
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
11
11
|
Licensed under the MIT License (MIT), see
|
@@ -40,9 +40,9 @@ var _e = { exports: {} };
|
|
40
40
|
}
|
41
41
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
42
42
|
})();
|
43
|
-
})(
|
44
|
-
var
|
45
|
-
const
|
43
|
+
})(me);
|
44
|
+
var He = me.exports;
|
45
|
+
const Ge = /* @__PURE__ */ Be(He), 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 He = /* @__PURE__ */ ze(Be), j = {
|
|
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
|
+
}, Fe = {
|
62
62
|
TITLE100: "title-100",
|
63
63
|
TITLE200: "title-200",
|
64
64
|
TITLE300: "title-300",
|
@@ -67,17 +67,17 @@ const He = /* @__PURE__ */ ze(Be), j = {
|
|
67
67
|
TITLE600: "title-600",
|
68
68
|
TITLE700: "title-700",
|
69
69
|
SUBSECTION100: "subsection-100"
|
70
|
-
}, L = "purpur-heading",
|
70
|
+
}, L = "purpur-heading", oe = ({
|
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 = Fe.TITLE100,
|
78
78
|
...i
|
79
79
|
}) => {
|
80
|
-
const s = t, l =
|
80
|
+
const s = t, l = Ge([
|
81
81
|
n,
|
82
82
|
j[L],
|
83
83
|
j[`${L}--${a}`],
|
@@ -86,8 +86,9 @@ const He = /* @__PURE__ */ ze(Be), j = {
|
|
86
86
|
[j[`${L}--negative`]]: c
|
87
87
|
}
|
88
88
|
]);
|
89
|
-
return /* @__PURE__ */
|
89
|
+
return /* @__PURE__ */ y(s, { ...i, className: l, "data-testid": e, children: r });
|
90
90
|
};
|
91
|
+
oe.displayName = "Heading";
|
91
92
|
function h() {
|
92
93
|
return h = Object.assign ? Object.assign.bind() : function(e) {
|
93
94
|
for (var r = 1; r < arguments.length; r++) {
|
@@ -98,7 +99,7 @@ function h() {
|
|
98
99
|
return e;
|
99
100
|
}, h.apply(this, arguments);
|
100
101
|
}
|
101
|
-
function
|
102
|
+
function ae(e, r = []) {
|
102
103
|
let n = [];
|
103
104
|
function o(t, a) {
|
104
105
|
const i = /* @__PURE__ */ ee(a), s = n.length;
|
@@ -111,16 +112,14 @@ function oe(e, r = []) {
|
|
111
112
|
() => b,
|
112
113
|
Object.values(b)
|
113
114
|
);
|
114
|
-
return /* @__PURE__ */
|
115
|
+
return /* @__PURE__ */ A(x.Provider, {
|
115
116
|
value: g
|
116
117
|
}, f);
|
117
118
|
}
|
118
119
|
function d(p, _) {
|
119
|
-
const f = (_ == null ? void 0 : _[e][s]) || i, b =
|
120
|
-
if (b)
|
121
|
-
|
122
|
-
if (a !== void 0)
|
123
|
-
return a;
|
120
|
+
const f = (_ == null ? void 0 : _[e][s]) || i, b = _e(f);
|
121
|
+
if (b) return b;
|
122
|
+
if (a !== void 0) return a;
|
124
123
|
throw new Error(`\`${p}\` must be used within \`${t}\``);
|
125
124
|
}
|
126
125
|
return l.displayName = t + "Provider", [
|
@@ -148,13 +147,12 @@ function oe(e, r = []) {
|
|
148
147
|
};
|
149
148
|
return c.scopeName = e, [
|
150
149
|
o,
|
151
|
-
|
150
|
+
Ke(c, ...r)
|
152
151
|
];
|
153
152
|
}
|
154
|
-
function
|
153
|
+
function Ke(...e) {
|
155
154
|
const r = e[0];
|
156
|
-
if (e.length === 1)
|
157
|
-
return r;
|
155
|
+
if (e.length === 1) return r;
|
158
156
|
const n = () => {
|
159
157
|
const o = e.map(
|
160
158
|
(c) => ({
|
@@ -182,26 +180,26 @@ function Fe(...e) {
|
|
182
180
|
};
|
183
181
|
return n.scopeName = r.scopeName, n;
|
184
182
|
}
|
185
|
-
function
|
183
|
+
function Ze(e, r) {
|
186
184
|
typeof e == "function" ? e(r) : e != null && (e.current = r);
|
187
185
|
}
|
188
186
|
function he(...e) {
|
189
187
|
return (r) => e.forEach(
|
190
|
-
(n) =>
|
188
|
+
(n) => Ze(n, r)
|
191
189
|
);
|
192
190
|
}
|
193
191
|
function M(...e) {
|
194
192
|
return H(he(...e), e);
|
195
193
|
}
|
196
194
|
const z = /* @__PURE__ */ I((e, r) => {
|
197
|
-
const { children: n, ...o } = e, c = S.toArray(n), t = c.find(
|
195
|
+
const { children: n, ...o } = e, c = S.toArray(n), t = c.find(Ye);
|
198
196
|
if (t) {
|
199
197
|
const a = t.props.children, i = c.map((s) => s === t ? S.count(a) > 1 ? S.only(null) : /* @__PURE__ */ V(a) ? a.props.children : null : s);
|
200
|
-
return /* @__PURE__ */
|
198
|
+
return /* @__PURE__ */ A(te, h({}, o, {
|
201
199
|
ref: r
|
202
200
|
}), /* @__PURE__ */ V(a) ? /* @__PURE__ */ G(a, void 0, i) : null);
|
203
201
|
}
|
204
|
-
return /* @__PURE__ */
|
202
|
+
return /* @__PURE__ */ A(te, h({}, o, {
|
205
203
|
ref: r
|
206
204
|
}), n);
|
207
205
|
});
|
@@ -209,16 +207,16 @@ z.displayName = "Slot";
|
|
209
207
|
const te = /* @__PURE__ */ I((e, r) => {
|
210
208
|
const { children: n, ...o } = e;
|
211
209
|
return /* @__PURE__ */ V(n) ? /* @__PURE__ */ G(n, {
|
212
|
-
...
|
210
|
+
...Je(o, n.props),
|
213
211
|
ref: r ? he(r, n.ref) : n.ref
|
214
212
|
}) : S.count(n) > 1 ? S.only(null) : null;
|
215
213
|
});
|
216
214
|
te.displayName = "SlotClone";
|
217
|
-
const
|
218
|
-
function
|
219
|
-
return /* @__PURE__ */ V(e) && e.type ===
|
215
|
+
const We = ({ children: e }) => /* @__PURE__ */ A(qe, null, e);
|
216
|
+
function Ye(e) {
|
217
|
+
return /* @__PURE__ */ V(e) && e.type === We;
|
220
218
|
}
|
221
|
-
function
|
219
|
+
function Je(e, r) {
|
222
220
|
const n = {
|
223
221
|
...r
|
224
222
|
};
|
@@ -239,8 +237,8 @@ function Ye(e, r) {
|
|
239
237
|
...n
|
240
238
|
};
|
241
239
|
}
|
242
|
-
function
|
243
|
-
const r = e + "CollectionProvider", [n, o] =
|
240
|
+
function Qe(e) {
|
241
|
+
const r = e + "CollectionProvider", [n, o] = ae(r), [c, t] = n(r, {
|
244
242
|
collectionRef: {
|
245
243
|
current: null
|
246
244
|
},
|
@@ -271,8 +269,7 @@ function Je(e) {
|
|
271
269
|
const b = t(e + "CollectionConsumer", f);
|
272
270
|
return u.useCallback(() => {
|
273
271
|
const g = b.collectionRef.current;
|
274
|
-
if (!g)
|
275
|
-
return [];
|
272
|
+
if (!g) return [];
|
276
273
|
const m = Array.from(g.querySelectorAll(`[${d}]`));
|
277
274
|
return Array.from(b.itemMap.values()).sort(
|
278
275
|
(N, O) => m.indexOf(N.ref.current) - m.indexOf(O.ref.current)
|
@@ -294,8 +291,7 @@ function Je(e) {
|
|
294
291
|
}
|
295
292
|
function ge(e, r, { checkForDefaultPrevented: n = !0 } = {}) {
|
296
293
|
return function(c) {
|
297
|
-
if (e == null || e(c), n === !1 || !c.defaultPrevented)
|
298
|
-
return r == null ? void 0 : r(c);
|
294
|
+
if (e == null || e(c), n === !1 || !c.defaultPrevented) return r == null ? void 0 : r(c);
|
299
295
|
};
|
300
296
|
}
|
301
297
|
function ve(e) {
|
@@ -310,17 +306,16 @@ function ve(e) {
|
|
310
306
|
[]
|
311
307
|
);
|
312
308
|
}
|
313
|
-
function
|
309
|
+
function ce({ prop: e, defaultProp: r, onChange: n = () => {
|
314
310
|
} }) {
|
315
|
-
const [o, c] =
|
311
|
+
const [o, c] = Xe({
|
316
312
|
defaultProp: r,
|
317
313
|
onChange: n
|
318
314
|
}), t = e !== void 0, a = t ? e : o, i = ve(n), s = H((l) => {
|
319
315
|
if (t) {
|
320
316
|
const p = typeof l == "function" ? l(e) : l;
|
321
317
|
p !== e && i(p);
|
322
|
-
} else
|
323
|
-
c(l);
|
318
|
+
} else c(l);
|
324
319
|
}, [
|
325
320
|
t,
|
326
321
|
e,
|
@@ -332,7 +327,7 @@ function ae({ prop: e, defaultProp: r, onChange: n = () => {
|
|
332
327
|
s
|
333
328
|
];
|
334
329
|
}
|
335
|
-
function
|
330
|
+
function Xe({ defaultProp: e, onChange: r }) {
|
336
331
|
const n = re(e), [o] = n, c = C(o), t = ve(r);
|
337
332
|
return k(() => {
|
338
333
|
c.current !== o && (t(o), c.current = o);
|
@@ -342,7 +337,7 @@ function Qe({ defaultProp: e, onChange: r }) {
|
|
342
337
|
t
|
343
338
|
]), n;
|
344
339
|
}
|
345
|
-
const
|
340
|
+
const et = [
|
346
341
|
"a",
|
347
342
|
"button",
|
348
343
|
"div",
|
@@ -359,12 +354,12 @@ const Xe = [
|
|
359
354
|
"span",
|
360
355
|
"svg",
|
361
356
|
"ul"
|
362
|
-
], D =
|
357
|
+
], D = et.reduce((e, r) => {
|
363
358
|
const n = /* @__PURE__ */ I((o, c) => {
|
364
359
|
const { asChild: t, ...a } = o, i = t ? z : r;
|
365
360
|
return k(() => {
|
366
361
|
window[Symbol.for("radix-ui")] = !0;
|
367
|
-
}, []), /* @__PURE__ */
|
362
|
+
}, []), /* @__PURE__ */ A(i, h({}, a, {
|
368
363
|
ref: c
|
369
364
|
}));
|
370
365
|
});
|
@@ -372,16 +367,16 @@ const Xe = [
|
|
372
367
|
...e,
|
373
368
|
[r]: n
|
374
369
|
};
|
375
|
-
}, {}), B = globalThis != null && globalThis.document ?
|
370
|
+
}, {}), B = globalThis != null && globalThis.document ? Ue : () => {
|
376
371
|
};
|
377
|
-
function
|
378
|
-
return
|
372
|
+
function tt(e, r) {
|
373
|
+
return Ve((n, o) => {
|
379
374
|
const c = r[n][o];
|
380
375
|
return c ?? n;
|
381
376
|
}, e);
|
382
377
|
}
|
383
378
|
const xe = (e) => {
|
384
|
-
const { present: r, children: n } = e, o =
|
379
|
+
const { present: r, children: n } = e, o = nt(r), c = typeof n == "function" ? n({
|
385
380
|
present: o.isPresent
|
386
381
|
}) : S.only(n), t = M(o.ref, c.ref);
|
387
382
|
return typeof n == "function" || o.isPresent ? /* @__PURE__ */ G(c, {
|
@@ -389,8 +384,8 @@ const xe = (e) => {
|
|
389
384
|
}) : null;
|
390
385
|
};
|
391
386
|
xe.displayName = "Presence";
|
392
|
-
function
|
393
|
-
const [r, n] = re(), o = C({}), c = C(e), t = C("none"), a = e ? "mounted" : "unmounted", [i, s] =
|
387
|
+
function nt(e) {
|
388
|
+
const [r, n] = re(), o = C({}), c = C(e), t = C("none"), a = e ? "mounted" : "unmounted", [i, s] = tt(a, {
|
394
389
|
mounted: {
|
395
390
|
UNMOUNT: "unmounted",
|
396
391
|
ANIMATION_OUT: "unmountSuspended"
|
@@ -421,7 +416,7 @@ function tt(e) {
|
|
421
416
|
if (r) {
|
422
417
|
const l = (p) => {
|
423
418
|
const f = q(o.current).includes(p.animationName);
|
424
|
-
p.target === r && f &&
|
419
|
+
p.target === r && f && ze(
|
425
420
|
() => s("ANIMATION_END")
|
426
421
|
);
|
427
422
|
}, d = (p) => {
|
@@ -448,29 +443,29 @@ function tt(e) {
|
|
448
443
|
function q(e) {
|
449
444
|
return (e == null ? void 0 : e.animationName) || "none";
|
450
445
|
}
|
451
|
-
const
|
446
|
+
const rt = $e.useId || (() => {
|
452
447
|
});
|
453
|
-
let
|
454
|
-
function
|
455
|
-
const [r, n] =
|
448
|
+
let ot = 0;
|
449
|
+
function ye(e) {
|
450
|
+
const [r, n] = $e.useState(rt());
|
456
451
|
return B(() => {
|
457
452
|
n(
|
458
|
-
(o) => o ?? String(
|
453
|
+
(o) => o ?? String(ot++)
|
459
454
|
);
|
460
455
|
}, [
|
461
456
|
e
|
462
457
|
]), r ? `radix-${r}` : "";
|
463
458
|
}
|
464
|
-
const
|
465
|
-
const { __scopeCollapsible: n, open: o, defaultOpen: c, disabled: t, onOpenChange: a, ...i } = e, [s = !1, l] =
|
459
|
+
const Ae = "Collapsible", [at, Ce] = ae(Ae), [ct, ie] = at(Ae), it = /* @__PURE__ */ I((e, r) => {
|
460
|
+
const { __scopeCollapsible: n, open: o, defaultOpen: c, disabled: t, onOpenChange: a, ...i } = e, [s = !1, l] = ce({
|
466
461
|
prop: o,
|
467
462
|
defaultProp: c,
|
468
463
|
onChange: a
|
469
464
|
});
|
470
|
-
return /* @__PURE__ */
|
465
|
+
return /* @__PURE__ */ A(ct, {
|
471
466
|
scope: n,
|
472
467
|
disabled: t,
|
473
|
-
contentId:
|
468
|
+
contentId: ye(),
|
474
469
|
open: s,
|
475
470
|
onOpenToggle: H(
|
476
471
|
() => l(
|
@@ -480,39 +475,39 @@ const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE_
|
|
480
475
|
l
|
481
476
|
]
|
482
477
|
)
|
483
|
-
}, /* @__PURE__ */
|
484
|
-
"data-state":
|
478
|
+
}, /* @__PURE__ */ A(D.div, h({
|
479
|
+
"data-state": se(s),
|
485
480
|
"data-disabled": t ? "" : void 0
|
486
481
|
}, i, {
|
487
482
|
ref: r
|
488
483
|
})));
|
489
|
-
}),
|
490
|
-
const { __scopeCollapsible: n, ...o } = e, c =
|
491
|
-
return /* @__PURE__ */
|
484
|
+
}), st = "CollapsibleTrigger", lt = /* @__PURE__ */ I((e, r) => {
|
485
|
+
const { __scopeCollapsible: n, ...o } = e, c = ie(st, n);
|
486
|
+
return /* @__PURE__ */ A(D.button, h({
|
492
487
|
type: "button",
|
493
488
|
"aria-controls": c.contentId,
|
494
489
|
"aria-expanded": c.open || !1,
|
495
|
-
"data-state":
|
490
|
+
"data-state": se(c.open),
|
496
491
|
"data-disabled": c.disabled ? "" : void 0,
|
497
492
|
disabled: c.disabled
|
498
493
|
}, o, {
|
499
494
|
ref: r,
|
500
495
|
onClick: ge(e.onClick, c.onOpenToggle)
|
501
496
|
}));
|
502
|
-
}), Ne = "CollapsibleContent",
|
503
|
-
const { forceMount: n, ...o } = e, c =
|
504
|
-
return /* @__PURE__ */
|
497
|
+
}), Ne = "CollapsibleContent", ut = /* @__PURE__ */ I((e, r) => {
|
498
|
+
const { forceMount: n, ...o } = e, c = ie(Ne, e.__scopeCollapsible);
|
499
|
+
return /* @__PURE__ */ A(
|
505
500
|
xe,
|
506
501
|
{
|
507
502
|
present: n || c.open
|
508
503
|
},
|
509
|
-
({ present: t }) => /* @__PURE__ */
|
504
|
+
({ present: t }) => /* @__PURE__ */ A(pt, h({}, o, {
|
510
505
|
ref: r,
|
511
506
|
present: t
|
512
507
|
}))
|
513
508
|
);
|
514
|
-
}),
|
515
|
-
const { __scopeCollapsible: n, present: o, children: c, ...t } = e, a =
|
509
|
+
}), pt = /* @__PURE__ */ I((e, r) => {
|
510
|
+
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, x = a.open || i, g = C(x), m = C();
|
516
511
|
return k(() => {
|
517
512
|
const $ = requestAnimationFrame(
|
518
513
|
() => g.current = !1
|
@@ -531,8 +526,8 @@ const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE_
|
|
531
526
|
}, [
|
532
527
|
a.open,
|
533
528
|
o
|
534
|
-
]), /* @__PURE__ */
|
535
|
-
"data-state":
|
529
|
+
]), /* @__PURE__ */ A(D.div, h({
|
530
|
+
"data-state": se(a.open),
|
536
531
|
"data-disabled": a.disabled ? "" : void 0,
|
537
532
|
id: a.contentId,
|
538
533
|
hidden: !x
|
@@ -545,31 +540,31 @@ const ye = "Collapsible", [ot, Ce] = oe(ye), [at, ce] = ot(ye), ct = /* @__PURE_
|
|
545
540
|
}
|
546
541
|
}), x && c);
|
547
542
|
});
|
548
|
-
function
|
543
|
+
function se(e) {
|
549
544
|
return e ? "open" : "closed";
|
550
545
|
}
|
551
|
-
const
|
552
|
-
function
|
553
|
-
const r = $
|
546
|
+
const dt = it, ft = lt, bt = ut, $t = /* @__PURE__ */ ee(void 0);
|
547
|
+
function _t(e) {
|
548
|
+
const r = _e($t);
|
554
549
|
return e || r || "ltr";
|
555
550
|
}
|
556
|
-
const P = "Accordion",
|
551
|
+
const P = "Accordion", mt = [
|
557
552
|
"Home",
|
558
553
|
"End",
|
559
554
|
"ArrowDown",
|
560
555
|
"ArrowUp",
|
561
556
|
"ArrowLeft",
|
562
557
|
"ArrowRight"
|
563
|
-
], [
|
564
|
-
|
558
|
+
], [le, ht, gt] = Qe(P), [F, ln] = ae(P, [
|
559
|
+
gt,
|
565
560
|
Ce
|
566
|
-
]),
|
561
|
+
]), ue = Ce(), Ee = /* @__PURE__ */ u.forwardRef((e, r) => {
|
567
562
|
const { type: n, ...o } = e, c = o, t = o;
|
568
|
-
return /* @__PURE__ */ u.createElement(
|
563
|
+
return /* @__PURE__ */ u.createElement(le.Provider, {
|
569
564
|
scope: e.__scopeAccordion
|
570
565
|
}, n === "multiple" ? /* @__PURE__ */ u.createElement(At, h({}, t, {
|
571
566
|
ref: r
|
572
|
-
})) : /* @__PURE__ */ u.createElement(
|
567
|
+
})) : /* @__PURE__ */ u.createElement(yt, h({}, c, {
|
573
568
|
ref: r
|
574
569
|
})));
|
575
570
|
});
|
@@ -582,11 +577,11 @@ Ee.propTypes = {
|
|
582
577
|
].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
578
|
}
|
584
579
|
};
|
585
|
-
const [Ie,
|
580
|
+
const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
586
581
|
collapsible: !1
|
587
|
-
}),
|
582
|
+
}), yt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
588
583
|
const { value: n, defaultValue: o, onValueChange: c = () => {
|
589
|
-
}, collapsible: t = !1, ...a } = e, [i, s] =
|
584
|
+
}, collapsible: t = !1, ...a } = e, [i, s] = ce({
|
590
585
|
prop: n,
|
591
586
|
defaultProp: o,
|
592
587
|
onChange: c
|
@@ -612,7 +607,7 @@ const [Ie, gt] = F(P), [Pe, vt] = F(P, {
|
|
612
607
|
}))));
|
613
608
|
}), At = /* @__PURE__ */ u.forwardRef((e, r) => {
|
614
609
|
const { value: n, defaultValue: o, onValueChange: c = () => {
|
615
|
-
}, ...t } = e, [a = [], i] =
|
610
|
+
}, ...t } = e, [a = [], i] = ce({
|
616
611
|
prop: n,
|
617
612
|
defaultProp: o,
|
618
613
|
onChange: c
|
@@ -647,19 +642,17 @@ const [Ie, gt] = F(P), [Pe, vt] = F(P, {
|
|
647
642
|
}, /* @__PURE__ */ u.createElement(we, h({}, t, {
|
648
643
|
ref: r
|
649
644
|
}))));
|
650
|
-
}), [
|
651
|
-
const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null), s = M(i, r), l =
|
645
|
+
}), [Ct, K] = F(P), we = /* @__PURE__ */ u.forwardRef((e, r) => {
|
646
|
+
const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null), s = M(i, r), l = ht(n), p = _t(c) === "ltr", _ = ge(e.onKeyDown, (f) => {
|
652
647
|
var b;
|
653
|
-
if (!
|
654
|
-
return;
|
648
|
+
if (!mt.includes(f.key)) return;
|
655
649
|
const x = f.target, g = l().filter((Y) => {
|
656
650
|
var J;
|
657
651
|
return !((J = Y.ref.current) !== null && J !== void 0 && J.disabled);
|
658
652
|
}), m = g.findIndex(
|
659
653
|
(Y) => Y.ref.current === x
|
660
654
|
), $ = g.length;
|
661
|
-
if (m === -1)
|
662
|
-
return;
|
655
|
+
if (m === -1) return;
|
663
656
|
f.preventDefault();
|
664
657
|
let v = m;
|
665
658
|
const N = 0, O = $ - 1, Z = () => {
|
@@ -687,29 +680,29 @@ const [Ie, gt] = F(P), [Pe, vt] = F(P, {
|
|
687
680
|
t === "vertical" && W();
|
688
681
|
break;
|
689
682
|
}
|
690
|
-
const
|
691
|
-
(b = g[
|
683
|
+
const Le = v % $;
|
684
|
+
(b = g[Le].ref.current) === null || b === void 0 || b.focus();
|
692
685
|
});
|
693
|
-
return /* @__PURE__ */ u.createElement(
|
686
|
+
return /* @__PURE__ */ u.createElement(Ct, {
|
694
687
|
scope: n,
|
695
688
|
disabled: o,
|
696
689
|
direction: c,
|
697
690
|
orientation: t
|
698
|
-
}, /* @__PURE__ */ u.createElement(
|
691
|
+
}, /* @__PURE__ */ u.createElement(le.Slot, {
|
699
692
|
scope: n
|
700
693
|
}, /* @__PURE__ */ u.createElement(D.div, h({}, a, {
|
701
694
|
"data-orientation": t,
|
702
695
|
ref: s,
|
703
696
|
onKeyDown: o ? void 0 : _
|
704
697
|
}))));
|
705
|
-
}), ne = "AccordionItem", [
|
706
|
-
const { __scopeAccordion: n, value: o, ...c } = e, t = K(ne, n), a =
|
707
|
-
return /* @__PURE__ */ u.createElement(
|
698
|
+
}), ne = "AccordionItem", [Nt, pe] = F(ne), Et = /* @__PURE__ */ u.forwardRef((e, r) => {
|
699
|
+
const { __scopeAccordion: n, value: o, ...c } = e, t = K(ne, n), a = vt(ne, n), i = ue(n), s = ye(), l = o && a.value.includes(o) || !1, d = t.disabled || e.disabled;
|
700
|
+
return /* @__PURE__ */ u.createElement(Nt, {
|
708
701
|
scope: n,
|
709
702
|
open: l,
|
710
703
|
disabled: d,
|
711
704
|
triggerId: s
|
712
|
-
}, /* @__PURE__ */ u.createElement(
|
705
|
+
}, /* @__PURE__ */ u.createElement(dt, h({
|
713
706
|
"data-orientation": t.orientation,
|
714
707
|
"data-state": Se(l)
|
715
708
|
}, i, c, {
|
@@ -720,8 +713,8 @@ const [Ie, gt] = F(P), [Pe, vt] = F(P, {
|
|
720
713
|
p ? a.onItemOpen(o) : a.onItemClose(o);
|
721
714
|
}
|
722
715
|
})));
|
723
|
-
}),
|
724
|
-
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t =
|
716
|
+
}), It = "AccordionHeader", Pt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
717
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(It, n);
|
725
718
|
return /* @__PURE__ */ u.createElement(D.h3, h({
|
726
719
|
"data-orientation": c.orientation,
|
727
720
|
"data-state": Se(t.open),
|
@@ -729,20 +722,20 @@ const [Ie, gt] = F(P), [Pe, vt] = F(P, {
|
|
729
722
|
}, o, {
|
730
723
|
ref: r
|
731
724
|
}));
|
732
|
-
}),
|
733
|
-
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t =
|
734
|
-
return /* @__PURE__ */ u.createElement(
|
725
|
+
}), de = "AccordionTrigger", wt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
726
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(de, n), a = xt(de, n), i = ue(n);
|
727
|
+
return /* @__PURE__ */ u.createElement(le.ItemSlot, {
|
735
728
|
scope: n
|
736
|
-
}, /* @__PURE__ */ u.createElement(
|
729
|
+
}, /* @__PURE__ */ u.createElement(ft, h({
|
737
730
|
"aria-disabled": t.open && !a.collapsible || void 0,
|
738
731
|
"data-orientation": c.orientation,
|
739
732
|
id: t.triggerId
|
740
733
|
}, i, o, {
|
741
734
|
ref: r
|
742
735
|
})));
|
743
|
-
}),
|
744
|
-
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t =
|
745
|
-
return /* @__PURE__ */ u.createElement(
|
736
|
+
}), St = "AccordionContent", Ot = /* @__PURE__ */ u.forwardRef((e, r) => {
|
737
|
+
const { __scopeAccordion: n, ...o } = e, c = K(P, n), t = pe(St, n), a = ue(n);
|
738
|
+
return /* @__PURE__ */ u.createElement(bt, h({
|
746
739
|
role: "region",
|
747
740
|
"aria-labelledby": t.triggerId,
|
748
741
|
"data-orientation": c.orientation
|
@@ -758,8 +751,8 @@ const [Ie, gt] = F(P), [Pe, vt] = F(P, {
|
|
758
751
|
function Se(e) {
|
759
752
|
return e ? "open" : "closed";
|
760
753
|
}
|
761
|
-
const
|
762
|
-
function
|
754
|
+
const Rt = Ee, Tt = Et, Mt = Pt, kt = wt, Dt = Ot;
|
755
|
+
function jt(e) {
|
763
756
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
764
757
|
}
|
765
758
|
var Oe = { exports: {} };
|
@@ -798,13 +791,13 @@ var Oe = { exports: {} };
|
|
798
791
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
799
792
|
})();
|
800
793
|
})(Oe);
|
801
|
-
var
|
802
|
-
const Re = /* @__PURE__ */
|
794
|
+
var Lt = Oe.exports;
|
795
|
+
const Re = /* @__PURE__ */ jt(Lt), qt = {
|
803
796
|
"purpur-accordion": "_purpur-accordion_u887g_1",
|
804
797
|
"purpur-accordion__title": "_purpur-accordion__title_u887g_4",
|
805
798
|
"purpur-accordion--negative": "_purpur-accordion--negative_u887g_13"
|
806
799
|
};
|
807
|
-
function
|
800
|
+
function Ut(e) {
|
808
801
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
809
802
|
}
|
810
803
|
var Te = { exports: {} };
|
@@ -843,8 +836,8 @@ var Te = { exports: {} };
|
|
843
836
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
844
837
|
})();
|
845
838
|
})(Te);
|
846
|
-
var
|
847
|
-
const
|
839
|
+
var Vt = Te.exports;
|
840
|
+
const zt = /* @__PURE__ */ Ut(Vt), Bt = {
|
848
841
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
849
842
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
850
843
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
@@ -852,40 +845,40 @@ const Vt = /* @__PURE__ */ qt(Ut), zt = {
|
|
852
845
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
853
846
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
854
847
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
855
|
-
},
|
848
|
+
}, Ht = {
|
856
849
|
name: "chevron-down",
|
857
850
|
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
851
|
keywords: ["chevron-down"],
|
859
852
|
category: "utility"
|
860
|
-
}, Me = (e) => /* @__PURE__ */
|
861
|
-
|
853
|
+
}, Me = (e) => /* @__PURE__ */ y(
|
854
|
+
Yt,
|
862
855
|
{
|
863
856
|
...e,
|
864
|
-
svg:
|
857
|
+
svg: Ht
|
865
858
|
}
|
866
859
|
);
|
867
860
|
Me.displayName = "IconChevronDown";
|
868
|
-
const
|
861
|
+
const Gt = zt.bind(Bt), fe = "purpur-icon", Ft = "md", Kt = (e) => e.filter((r) => Object.keys(r).length >= 1).map((r) => `${r.name}="${r.value}"`).join(" "), Zt = ({ content: e = "", title: r } = {}) => {
|
869
862
|
const n = [
|
870
863
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
871
864
|
{ name: "fill", value: "currentColor" },
|
872
865
|
{ name: "viewBox", value: "0 0 24 24" },
|
873
866
|
r ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
874
867
|
], o = r ? `<title>${r}</title>` : "";
|
875
|
-
return `<svg ${
|
876
|
-
},
|
868
|
+
return `<svg ${Kt(n)}>${o}${e}</svg>`;
|
869
|
+
}, Wt = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Yt = ({
|
877
870
|
["data-testid"]: e,
|
878
871
|
svg: r,
|
879
872
|
allyTitle: n,
|
880
|
-
className: o
|
881
|
-
size: c =
|
873
|
+
className: o,
|
874
|
+
size: c = Ft,
|
882
875
|
...t
|
883
876
|
}) => {
|
884
|
-
const a =
|
885
|
-
content:
|
877
|
+
const a = Zt({
|
878
|
+
content: Wt(r.svg),
|
886
879
|
title: n
|
887
|
-
}), i =
|
888
|
-
return /* @__PURE__ */
|
880
|
+
}), i = Gt(o, fe, `${fe}--${c}`);
|
881
|
+
return /* @__PURE__ */ y(
|
889
882
|
"span",
|
890
883
|
{
|
891
884
|
"aria-label": n,
|
@@ -896,7 +889,7 @@ const Ht = Vt.bind(zt), de = "purpur-icon", Gt = "md", Ft = (e) => e.filter((r)
|
|
896
889
|
}
|
897
890
|
);
|
898
891
|
};
|
899
|
-
function
|
892
|
+
function Jt(e) {
|
900
893
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
901
894
|
}
|
902
895
|
var ke = { exports: {} };
|
@@ -935,8 +928,8 @@ var ke = { exports: {} };
|
|
935
928
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
936
929
|
})();
|
937
930
|
})(ke);
|
938
|
-
var
|
939
|
-
const
|
931
|
+
var Qt = ke.exports;
|
932
|
+
const Xt = /* @__PURE__ */ Jt(Qt), R = {
|
940
933
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
941
934
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
942
935
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
@@ -951,7 +944,7 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
951
944
|
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_1rh57_60",
|
952
945
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
953
946
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
954
|
-
},
|
947
|
+
}, en = {
|
955
948
|
PARAGRAPH100: "paragraph-100",
|
956
949
|
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
957
950
|
PARAGRAPH100BOLD: "paragraph-100-bold",
|
@@ -962,17 +955,17 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
962
955
|
ADDITIONAL100MEDIUM: "additional-100-medium",
|
963
956
|
OVERLINE100: "overline-100",
|
964
957
|
OVERLINE200: "overline-200"
|
965
|
-
}, T = "purpur-paragraph",
|
958
|
+
}, T = "purpur-paragraph", De = ({
|
966
959
|
["data-testid"]: e,
|
967
960
|
children: r,
|
968
|
-
className: n
|
961
|
+
className: n,
|
969
962
|
disabled: o,
|
970
963
|
enableHyphenation: c = !1,
|
971
964
|
negative: t = !1,
|
972
|
-
variant: a =
|
965
|
+
variant: a = en.PARAGRAPH100,
|
973
966
|
...i
|
974
967
|
}) => {
|
975
|
-
const s =
|
968
|
+
const s = Xt([
|
976
969
|
n,
|
977
970
|
R[T],
|
978
971
|
R[`${T}--${a}`],
|
@@ -982,8 +975,10 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
982
975
|
[R[`${T}--negative`]]: t
|
983
976
|
}
|
984
977
|
]);
|
985
|
-
return /* @__PURE__ */
|
986
|
-
}
|
978
|
+
return /* @__PURE__ */ y("p", { ...i, className: s, "data-testid": e, children: r });
|
979
|
+
};
|
980
|
+
De.displayName = "Paragraph";
|
981
|
+
const tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
987
982
|
"purpur-accordion-item": "_purpur-accordion-item_aukzj_1",
|
988
983
|
"purpur-accordion-item__header": "_purpur-accordion-item__header_aukzj_8",
|
989
984
|
"purpur-accordion-item__trigger": "_purpur-accordion-item__trigger_aukzj_11",
|
@@ -1011,23 +1006,23 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
1011
1006
|
[`${E}--negative`]: c
|
1012
1007
|
}
|
1013
1008
|
]);
|
1014
|
-
return /* @__PURE__ */ X(
|
1015
|
-
/* @__PURE__ */
|
1016
|
-
|
1009
|
+
return /* @__PURE__ */ X(Tt, { className: s, value: n, ...a, children: [
|
1010
|
+
/* @__PURE__ */ y(Mt, { className: w(`${E}__header`), asChild: !0, children: /* @__PURE__ */ y(oe, { tag: o, variant: "title-100", className: w(`${E}__title`), children: /* @__PURE__ */ X(
|
1011
|
+
kt,
|
1017
1012
|
{
|
1018
1013
|
ref: i,
|
1019
1014
|
onClick: t,
|
1020
1015
|
className: w(`${E}__trigger`, r),
|
1021
1016
|
children: [
|
1022
1017
|
n,
|
1023
|
-
/* @__PURE__ */
|
1018
|
+
/* @__PURE__ */ y(Me, { size: "md", className: w(`${E}__icon`), "aria-hidden": !0 })
|
1024
1019
|
]
|
1025
1020
|
}
|
1026
1021
|
) }) }),
|
1027
|
-
/* @__PURE__ */
|
1022
|
+
/* @__PURE__ */ y(Dt, { className: w(`${E}__content`, r), children: /* @__PURE__ */ y("div", { className: w(`${E}__contentText`), children: typeof e == "string" ? /* @__PURE__ */ y(De, { variant: "paragraph-200", children: e }) : e }) })
|
1028
1023
|
] });
|
1029
1024
|
}
|
1030
|
-
),
|
1025
|
+
), be = Re.bind(qt), Q = "purpur-accordion", je = ({
|
1031
1026
|
["data-testid"]: e,
|
1032
1027
|
children: r,
|
1033
1028
|
className: n,
|
@@ -1036,7 +1031,7 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
1036
1031
|
titleTag: t = "h2",
|
1037
1032
|
titleVariant: a = "title-300"
|
1038
1033
|
}) => {
|
1039
|
-
const i =
|
1034
|
+
const i = be([
|
1040
1035
|
n,
|
1041
1036
|
Q,
|
1042
1037
|
{
|
@@ -1045,14 +1040,14 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
1045
1040
|
]), s = () => S.map(r, (l) => G(l, {
|
1046
1041
|
negative: o
|
1047
1042
|
}));
|
1048
|
-
return /* @__PURE__ */ X(
|
1049
|
-
c ? /* @__PURE__ */
|
1043
|
+
return /* @__PURE__ */ X(Rt, { className: i, type: "multiple", "data-testid": e, children: [
|
1044
|
+
c ? /* @__PURE__ */ y(oe, { tag: t, variant: a, className: be(`${Q}__title`), children: c }) : null,
|
1050
1045
|
s()
|
1051
1046
|
] });
|
1052
1047
|
};
|
1053
|
-
|
1054
|
-
|
1048
|
+
je.Item = on;
|
1049
|
+
je.displayName = "Accordion";
|
1055
1050
|
export {
|
1056
|
-
|
1051
|
+
je as Accordion
|
1057
1052
|
};
|
1058
1053
|
//# sourceMappingURL=accordion.es.js.map
|