@purpurds/accordion 5.8.2 → 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 +2 -2
- package/dist/accordion.cjs.js.map +1 -1
- package/dist/accordion.d.ts +1 -1
- package/dist/accordion.es.js +115 -112
- package/dist/accordion.es.js.map +1 -1
- package/package.json +5 -5
- package/src/accordion-item.tsx +48 -41
package/dist/accordion.d.ts
CHANGED
@@ -24,7 +24,7 @@ export type AccordionProps = {
|
|
24
24
|
};
|
25
25
|
export declare const Accordion: {
|
26
26
|
({ ["data-testid"]: dataTestId, children, className, negative, title, titleTag, titleVariant, }: AccordionProps): React.JSX.Element;
|
27
|
-
Item:
|
27
|
+
Item: React.ForwardRefExoticComponent<import('./accordion-item').AccordionItemProps & React.RefAttributes<HTMLButtonElement>>;
|
28
28
|
displayName: string;
|
29
29
|
};
|
30
30
|
export type { AccordionItemOnClickEvent, AccordionItemProps } from './accordion-item';
|
package/dist/accordion.es.js
CHANGED
@@ -1,6 +1,6 @@
|
|
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 H, forwardRef 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
5
|
function ze(e) {
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
@@ -77,7 +77,7 @@ const He = /* @__PURE__ */ ze(Be), j = {
|
|
77
77
|
variant: a = Ge.TITLE100,
|
78
78
|
...i
|
79
79
|
}) => {
|
80
|
-
const
|
80
|
+
const s = t, l = He([
|
81
81
|
n,
|
82
82
|
j[L],
|
83
83
|
j[`${L}--${a}`],
|
@@ -86,7 +86,7 @@ const He = /* @__PURE__ */ ze(Be), j = {
|
|
86
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,32 +116,32 @@ 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
|
};
|
@@ -163,8 +163,8 @@ function Fe(...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
|
@@ -193,10 +193,10 @@ function he(...e) {
|
|
193
193
|
function M(...e) {
|
194
194
|
return H(he(...e), e);
|
195
195
|
}
|
196
|
-
const z = /* @__PURE__ */
|
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
202
|
}), /* @__PURE__ */ U(a) ? /* @__PURE__ */ G(a, void 0, i) : null);
|
@@ -206,12 +206,12 @@ const z = /* @__PURE__ */ S((e, r) => {
|
|
206
206
|
}), n);
|
207
207
|
});
|
208
208
|
z.displayName = "Slot";
|
209
|
-
const te = /* @__PURE__ */
|
209
|
+
const te = /* @__PURE__ */ I((e, r) => {
|
210
210
|
const { children: n, ...o } = e;
|
211
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
217
|
const Ze = ({ children: e }) => /* @__PURE__ */ y(Le, null, e);
|
@@ -252,13 +252,13 @@ 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
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
|
@@ -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
|
_,
|
@@ -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,7 +329,7 @@ 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 }) {
|
@@ -360,7 +360,7 @@ const Xe = [
|
|
360
360
|
"svg",
|
361
361
|
"ul"
|
362
362
|
], D = Xe.reduce((e, r) => {
|
363
|
-
const n = /* @__PURE__ */
|
363
|
+
const n = /* @__PURE__ */ I((o, c) => {
|
364
364
|
const { asChild: t, ...a } = o, i = t ? z : r;
|
365
365
|
return k(() => {
|
366
366
|
window[Symbol.for("radix-ui")] = !0;
|
@@ -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
|
-
}) :
|
386
|
+
}) : S.only(n), t = M(o.ref, c.ref);
|
387
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"
|
@@ -404,44 +404,44 @@ function tt(e) {
|
|
404
404
|
}
|
405
405
|
});
|
406
406
|
return k(() => {
|
407
|
-
const
|
408
|
-
t.current = i === "mounted" ?
|
407
|
+
const l = q(o.current);
|
408
|
+
t.current = i === "mounted" ? l : "none";
|
409
409
|
}, [
|
410
410
|
i
|
411
411
|
]), B(() => {
|
412
|
-
const
|
412
|
+
const l = o.current, d = c.current;
|
413
413
|
if (d !== e) {
|
414
|
-
const _ = t.current, f = q(
|
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
|
-
|
419
|
+
s
|
420
420
|
]), B(() => {
|
421
421
|
if (r) {
|
422
|
-
const
|
422
|
+
const l = (p) => {
|
423
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
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: H((
|
444
|
-
|
443
|
+
ref: H((l) => {
|
444
|
+
l && (o.current = getComputedStyle(l)), n(l);
|
445
445
|
}, [])
|
446
446
|
};
|
447
447
|
}
|
@@ -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:
|
474
|
+
open: s,
|
475
475
|
onOpenToggle: H(
|
476
|
-
() =>
|
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,
|
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
516
|
return k(() => {
|
517
517
|
const $ = requestAnimationFrame(
|
518
518
|
() => g.current = !1
|
519
519
|
);
|
520
520
|
return () => cancelAnimationFrame($);
|
521
521
|
}, []), B(() => {
|
522
|
-
const $ =
|
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] = F(
|
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] = F(I), [Pe, vt] = F(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] = F(I), [Pe, vt] = F(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] = F(I), [Pe, vt] = F(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] = F(I), [Pe, vt] = F(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] = F(
|
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(
|
@@ -699,29 +699,29 @@ const [Ie, gt] = F(I), [Pe, vt] = F(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
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),
|
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] = F(I), [Pe, vt] = F(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] = F(I), [Pe, vt] = F(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,
|
@@ -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,7 +982,7 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
982
982
|
[R[`${T}--negative`]]: t
|
983
983
|
}
|
984
984
|
]);
|
985
|
-
return /* @__PURE__ */ A("p", { ...i, className:
|
985
|
+
return /* @__PURE__ */ A("p", { ...i, className: s, "data-testid": e, children: r });
|
986
986
|
}, tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
987
987
|
"purpur-accordion-item": "_purpur-accordion-item_aukzj_1",
|
988
988
|
"purpur-accordion-item__header": "_purpur-accordion-item__header_aukzj_8",
|
@@ -994,37 +994,40 @@ const Qt = /* @__PURE__ */ Yt(Jt), R = {
|
|
994
994
|
"purpur-accordion-item__icon": "_purpur-accordion-item__icon_aukzj_54",
|
995
995
|
"purpur-accordion-item__title": "_purpur-accordion-item__title_aukzj_67",
|
996
996
|
"purpur-accordion-item--negative": "_purpur-accordion-item--negative_aukzj_88"
|
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,
|
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;
|