@purpurds/accordion 5.14.0 → 5.15.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 +4 -4
- package/dist/accordion-item.d.ts +1 -1
- package/dist/accordion.cjs.js +1 -1
- package/dist/accordion.cjs.js.map +1 -1
- package/dist/accordion.d.ts +1 -1
- package/dist/accordion.es.js +31 -32
- package/dist/accordion.es.js.map +1 -1
- package/package.json +5 -5
package/dist/accordion.d.ts
CHANGED
package/dist/accordion.es.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { jsx as
|
1
|
+
import { jsx as y, 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
|
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 qe, useRef as C, useEffect as k, useState as re, useLayoutEffect as Ve, useReducer as Ue } from "react";
|
4
4
|
import { flushSync as ze } from "react-dom";
|
5
5
|
function Be(e) {
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
@@ -86,18 +86,17 @@ const Ge = /* @__PURE__ */ Be(He), L = {
|
|
86
86
|
[L[`${j}--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
91
|
oe.displayName = "Heading";
|
92
92
|
function h() {
|
93
93
|
return h = Object.assign ? Object.assign.bind() : function(e) {
|
94
94
|
for (var r = 1; r < arguments.length; r++) {
|
95
95
|
var n = arguments[r];
|
96
|
-
for (var o in n)
|
97
|
-
Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
|
96
|
+
for (var o in n) ({}).hasOwnProperty.call(n, o) && (e[o] = n[o]);
|
98
97
|
}
|
99
98
|
return e;
|
100
|
-
}, h.apply(
|
99
|
+
}, h.apply(null, arguments);
|
101
100
|
}
|
102
101
|
function ae(e, r = []) {
|
103
102
|
let n = [];
|
@@ -112,7 +111,7 @@ function ae(e, r = []) {
|
|
112
111
|
() => b,
|
113
112
|
Object.values(b)
|
114
113
|
);
|
115
|
-
return /* @__PURE__ */
|
114
|
+
return /* @__PURE__ */ A(x.Provider, {
|
116
115
|
value: g
|
117
116
|
}, f);
|
118
117
|
}
|
@@ -195,11 +194,11 @@ const z = /* @__PURE__ */ I((e, r) => {
|
|
195
194
|
const { children: n, ...o } = e, c = S.toArray(n), t = c.find(Je);
|
196
195
|
if (t) {
|
197
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);
|
198
|
-
return /* @__PURE__ */
|
197
|
+
return /* @__PURE__ */ A(te, h({}, o, {
|
199
198
|
ref: r
|
200
199
|
}), /* @__PURE__ */ U(a) ? /* @__PURE__ */ G(a, void 0, i) : null);
|
201
200
|
}
|
202
|
-
return /* @__PURE__ */
|
201
|
+
return /* @__PURE__ */ A(te, h({}, o, {
|
203
202
|
ref: r
|
204
203
|
}), n);
|
205
204
|
});
|
@@ -212,7 +211,7 @@ const te = /* @__PURE__ */ I((e, r) => {
|
|
212
211
|
}) : S.count(n) > 1 ? S.only(null) : null;
|
213
212
|
});
|
214
213
|
te.displayName = "SlotClone";
|
215
|
-
const Ze = ({ children: e }) => /* @__PURE__ */
|
214
|
+
const Ze = ({ children: e }) => /* @__PURE__ */ A(qe, null, e);
|
216
215
|
function Je(e) {
|
217
216
|
return /* @__PURE__ */ U(e) && e.type === Ze;
|
218
217
|
}
|
@@ -359,7 +358,7 @@ const et = [
|
|
359
358
|
const { asChild: t, ...a } = o, i = t ? z : r;
|
360
359
|
return k(() => {
|
361
360
|
window[Symbol.for("radix-ui")] = !0;
|
362
|
-
}, []), /* @__PURE__ */
|
361
|
+
}, []), /* @__PURE__ */ A(i, h({}, a, {
|
363
362
|
ref: c
|
364
363
|
}));
|
365
364
|
});
|
@@ -446,7 +445,7 @@ function q(e) {
|
|
446
445
|
const rt = $e.useId || (() => {
|
447
446
|
});
|
448
447
|
let ot = 0;
|
449
|
-
function
|
448
|
+
function ye(e) {
|
450
449
|
const [r, n] = $e.useState(rt());
|
451
450
|
return B(() => {
|
452
451
|
n(
|
@@ -456,16 +455,16 @@ function Ae(e) {
|
|
456
455
|
e
|
457
456
|
]), r ? `radix-${r}` : "";
|
458
457
|
}
|
459
|
-
const
|
458
|
+
const Ae = "Collapsible", [at, Ce] = ae(Ae), [ct, ie] = at(Ae), it = /* @__PURE__ */ I((e, r) => {
|
460
459
|
const { __scopeCollapsible: n, open: o, defaultOpen: c, disabled: t, onOpenChange: a, ...i } = e, [s = !1, l] = ce({
|
461
460
|
prop: o,
|
462
461
|
defaultProp: c,
|
463
462
|
onChange: a
|
464
463
|
});
|
465
|
-
return /* @__PURE__ */
|
464
|
+
return /* @__PURE__ */ A(ct, {
|
466
465
|
scope: n,
|
467
466
|
disabled: t,
|
468
|
-
contentId:
|
467
|
+
contentId: ye(),
|
469
468
|
open: s,
|
470
469
|
onOpenToggle: H(
|
471
470
|
() => l(
|
@@ -475,7 +474,7 @@ const ye = "Collapsible", [at, Ce] = ae(ye), [ct, ie] = at(ye), it = /* @__PURE_
|
|
475
474
|
l
|
476
475
|
]
|
477
476
|
)
|
478
|
-
}, /* @__PURE__ */
|
477
|
+
}, /* @__PURE__ */ A(D.div, h({
|
479
478
|
"data-state": se(s),
|
480
479
|
"data-disabled": t ? "" : void 0
|
481
480
|
}, i, {
|
@@ -483,7 +482,7 @@ const ye = "Collapsible", [at, Ce] = ae(ye), [ct, ie] = at(ye), it = /* @__PURE_
|
|
483
482
|
})));
|
484
483
|
}), st = "CollapsibleTrigger", lt = /* @__PURE__ */ I((e, r) => {
|
485
484
|
const { __scopeCollapsible: n, ...o } = e, c = ie(st, n);
|
486
|
-
return /* @__PURE__ */
|
485
|
+
return /* @__PURE__ */ A(D.button, h({
|
487
486
|
type: "button",
|
488
487
|
"aria-controls": c.contentId,
|
489
488
|
"aria-expanded": c.open || !1,
|
@@ -496,12 +495,12 @@ const ye = "Collapsible", [at, Ce] = ae(ye), [ct, ie] = at(ye), it = /* @__PURE_
|
|
496
495
|
}));
|
497
496
|
}), Ne = "CollapsibleContent", ut = /* @__PURE__ */ I((e, r) => {
|
498
497
|
const { forceMount: n, ...o } = e, c = ie(Ne, e.__scopeCollapsible);
|
499
|
-
return /* @__PURE__ */
|
498
|
+
return /* @__PURE__ */ A(
|
500
499
|
xe,
|
501
500
|
{
|
502
501
|
present: n || c.open
|
503
502
|
},
|
504
|
-
({ present: t }) => /* @__PURE__ */
|
503
|
+
({ present: t }) => /* @__PURE__ */ A(pt, h({}, o, {
|
505
504
|
ref: r,
|
506
505
|
present: t
|
507
506
|
}))
|
@@ -526,7 +525,7 @@ const ye = "Collapsible", [at, Ce] = ae(ye), [ct, ie] = at(ye), it = /* @__PURE_
|
|
526
525
|
}, [
|
527
526
|
a.open,
|
528
527
|
o
|
529
|
-
]), /* @__PURE__ */
|
528
|
+
]), /* @__PURE__ */ A(D.div, h({
|
530
529
|
"data-state": se(a.open),
|
531
530
|
"data-disabled": a.disabled ? "" : void 0,
|
532
531
|
id: a.contentId,
|
@@ -562,9 +561,9 @@ const P = "Accordion", mt = [
|
|
562
561
|
const { type: n, ...o } = e, c = o, t = o;
|
563
562
|
return /* @__PURE__ */ u.createElement(le.Provider, {
|
564
563
|
scope: e.__scopeAccordion
|
565
|
-
}, n === "multiple" ? /* @__PURE__ */ u.createElement(
|
564
|
+
}, n === "multiple" ? /* @__PURE__ */ u.createElement(At, h({}, t, {
|
566
565
|
ref: r
|
567
|
-
})) : /* @__PURE__ */ u.createElement(
|
566
|
+
})) : /* @__PURE__ */ u.createElement(yt, h({}, c, {
|
568
567
|
ref: r
|
569
568
|
})));
|
570
569
|
});
|
@@ -579,7 +578,7 @@ Ee.propTypes = {
|
|
579
578
|
};
|
580
579
|
const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
581
580
|
collapsible: !1
|
582
|
-
}),
|
581
|
+
}), yt = /* @__PURE__ */ u.forwardRef((e, r) => {
|
583
582
|
const { value: n, defaultValue: o, onValueChange: c = () => {
|
584
583
|
}, collapsible: t = !1, ...a } = e, [i, s] = ce({
|
585
584
|
prop: n,
|
@@ -605,7 +604,7 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
605
604
|
}, /* @__PURE__ */ u.createElement(we, h({}, a, {
|
606
605
|
ref: r
|
607
606
|
}))));
|
608
|
-
}),
|
607
|
+
}), At = /* @__PURE__ */ u.forwardRef((e, r) => {
|
609
608
|
const { value: n, defaultValue: o, onValueChange: c = () => {
|
610
609
|
}, ...t } = e, [a = [], i] = ce({
|
611
610
|
prop: n,
|
@@ -696,7 +695,7 @@ const [Ie, vt] = F(P), [Pe, xt] = F(P, {
|
|
696
695
|
onKeyDown: o ? void 0 : _
|
697
696
|
}))));
|
698
697
|
}), 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 =
|
698
|
+
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
699
|
return /* @__PURE__ */ u.createElement(Nt, {
|
701
700
|
scope: n,
|
702
701
|
open: l,
|
@@ -850,7 +849,7 @@ const zt = /* @__PURE__ */ Vt(Ut), Bt = {
|
|
850
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>',
|
851
850
|
keywords: ["chevron-down"],
|
852
851
|
category: "utility"
|
853
|
-
}, Me = (e) => /* @__PURE__ */
|
852
|
+
}, Me = (e) => /* @__PURE__ */ y(
|
854
853
|
Jt,
|
855
854
|
{
|
856
855
|
...e,
|
@@ -878,7 +877,7 @@ const Gt = zt.bind(Bt), fe = "purpur-icon", Ft = "md", Kt = (e) => e.filter((r)
|
|
878
877
|
content: Zt(r.svg),
|
879
878
|
title: n
|
880
879
|
}), i = Gt(o, fe, `${fe}--${c}`);
|
881
|
-
return /* @__PURE__ */
|
880
|
+
return /* @__PURE__ */ y(
|
882
881
|
"span",
|
883
882
|
{
|
884
883
|
"aria-label": n,
|
@@ -975,7 +974,7 @@ const Wt = /* @__PURE__ */ Xt(Qt), R = {
|
|
975
974
|
[R[`${T}--negative`]]: t
|
976
975
|
}
|
977
976
|
]);
|
978
|
-
return /* @__PURE__ */
|
977
|
+
return /* @__PURE__ */ y("p", { ...i, className: s, "data-testid": e, children: r });
|
979
978
|
};
|
980
979
|
De.displayName = "Paragraph";
|
981
980
|
const tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
@@ -1007,7 +1006,7 @@ const tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
|
1007
1006
|
}
|
1008
1007
|
]);
|
1009
1008
|
return /* @__PURE__ */ W(Tt, { className: s, value: n, ...a, children: [
|
1010
|
-
/* @__PURE__ */
|
1009
|
+
/* @__PURE__ */ y(Mt, { className: w(`${E}__header`), asChild: !0, children: /* @__PURE__ */ y(oe, { tag: o, variant: "title-100", className: w(`${E}__title`), children: /* @__PURE__ */ W(
|
1011
1010
|
kt,
|
1012
1011
|
{
|
1013
1012
|
ref: i,
|
@@ -1015,11 +1014,11 @@ const tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
|
1015
1014
|
className: w(`${E}__trigger`, r),
|
1016
1015
|
children: [
|
1017
1016
|
n,
|
1018
|
-
/* @__PURE__ */
|
1017
|
+
/* @__PURE__ */ y(Me, { size: "md", className: w(`${E}__icon`), "aria-hidden": !0 })
|
1019
1018
|
]
|
1020
1019
|
}
|
1021
1020
|
) }) }),
|
1022
|
-
/* @__PURE__ */
|
1021
|
+
/* @__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 }) })
|
1023
1022
|
] });
|
1024
1023
|
}
|
1025
1024
|
), be = Re.bind(qt), Q = "purpur-accordion", Le = ({
|
@@ -1041,7 +1040,7 @@ const tn = "_slideDown_aukzj_1", nn = "_slideUp_aukzj_1", rn = {
|
|
1041
1040
|
negative: o
|
1042
1041
|
}));
|
1043
1042
|
return /* @__PURE__ */ W(Rt, { className: i, type: "multiple", "data-testid": e, children: [
|
1044
|
-
c ? /* @__PURE__ */
|
1043
|
+
c ? /* @__PURE__ */ y(oe, { tag: t, variant: a, className: be(`${Q}__title`), children: c }) : null,
|
1045
1044
|
s()
|
1046
1045
|
] });
|
1047
1046
|
};
|