@purpurds/accordion 5.4.1 → 5.4.3

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.
@@ -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 U, createElement as y, useContext as $e, useCallback as G, forwardRef as S, Children as w, isValidElement as M, cloneElement as F, Fragment as qe, useRef as C, useEffect as D, useState as re, useLayoutEffect as Ve, useReducer as Ue } from "react";
3
+ import u, { createContext as ee, useMemo as U, createElement as y, useContext as $e, useCallback as G, forwardRef as S, Children as w, isValidElement as M, cloneElement as F, Fragment as qe, useRef as C, useEffect as L, useState as re, useLayoutEffect as Ve, useReducer as Ue } from "react";
4
4
  import { flushSync as Be } from "react-dom";
5
5
  function He(e) {
6
6
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -190,7 +190,7 @@ function he(...e) {
190
190
  (n) => Ze(n, r)
191
191
  );
192
192
  }
193
- function k(...e) {
193
+ function D(...e) {
194
194
  return G(he(...e), e);
195
195
  }
196
196
  const B = /* @__PURE__ */ S((e, r) => {
@@ -253,12 +253,12 @@ function We(e) {
253
253
  collectionRef: g
254
254
  }, x);
255
255
  }, i = e + "CollectionSlot", s = /* @__PURE__ */ u.forwardRef((f, b) => {
256
- const { scope: x, children: g } = f, m = t(i, x), $ = k(b, m.collectionRef);
256
+ const { scope: x, children: g } = f, m = t(i, x), $ = D(b, m.collectionRef);
257
257
  return /* @__PURE__ */ u.createElement(B, {
258
258
  ref: $
259
259
  }, g);
260
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 = k(b, $), N = t(l, x);
261
+ const { scope: x, children: g, ...m } = f, $ = u.useRef(null), v = D(b, $), N = t(l, x);
262
262
  return u.useEffect(() => (N.itemMap.set($, {
263
263
  ref: $,
264
264
  ...m
@@ -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 D(() => {
303
+ return L(() => {
304
304
  r.current = e;
305
305
  }), U(
306
306
  () => (...n) => {
@@ -334,7 +334,7 @@ function ae({ prop: e, defaultProp: r, onChange: n = () => {
334
334
  }
335
335
  function Xe({ defaultProp: e, onChange: r }) {
336
336
  const n = re(e), [o] = n, c = C(o), t = ve(r);
337
- return D(() => {
337
+ return L(() => {
338
338
  c.current !== o && (t(o), c.current = o);
339
339
  }, [
340
340
  o,
@@ -359,10 +359,10 @@ const et = [
359
359
  "span",
360
360
  "svg",
361
361
  "ul"
362
- ], L = et.reduce((e, r) => {
362
+ ], k = et.reduce((e, r) => {
363
363
  const n = /* @__PURE__ */ S((o, c) => {
364
364
  const { asChild: t, ...a } = o, i = t ? B : r;
365
- return D(() => {
365
+ return L(() => {
366
366
  window[Symbol.for("radix-ui")] = !0;
367
367
  }, []), /* @__PURE__ */ y(i, h({}, a, {
368
368
  ref: c
@@ -383,7 +383,7 @@ function tt(e, r) {
383
383
  const xe = (e) => {
384
384
  const { present: r, children: n } = e, o = nt(r), c = typeof n == "function" ? n({
385
385
  present: o.isPresent
386
- }) : w.only(n), t = k(o.ref, c.ref);
386
+ }) : w.only(n), t = D(o.ref, c.ref);
387
387
  return typeof n == "function" || o.isPresent ? /* @__PURE__ */ F(c, {
388
388
  ref: t
389
389
  }) : null;
@@ -403,7 +403,7 @@ function nt(e) {
403
403
  MOUNT: "mounted"
404
404
  }
405
405
  });
406
- return D(() => {
406
+ return L(() => {
407
407
  const l = V(o.current);
408
408
  t.current = i === "mounted" ? l : "none";
409
409
  }, [
@@ -480,7 +480,7 @@ const ye = "Collapsible", [at, Ce] = oe(ye), [ct, ce] = at(ye), it = /* @__PURE_
480
480
  l
481
481
  ]
482
482
  )
483
- }, /* @__PURE__ */ y(L.div, h({
483
+ }, /* @__PURE__ */ y(k.div, h({
484
484
  "data-state": ie(s),
485
485
  "data-disabled": t ? "" : void 0
486
486
  }, i, {
@@ -488,7 +488,7 @@ const ye = "Collapsible", [at, Ce] = oe(ye), [ct, ce] = at(ye), it = /* @__PURE_
488
488
  })));
489
489
  }), st = "CollapsibleTrigger", lt = /* @__PURE__ */ S((e, r) => {
490
490
  const { __scopeCollapsible: n, ...o } = e, c = ce(st, n);
491
- return /* @__PURE__ */ y(L.button, h({
491
+ return /* @__PURE__ */ y(k.button, h({
492
492
  type: "button",
493
493
  "aria-controls": c.contentId,
494
494
  "aria-expanded": c.open || !1,
@@ -512,8 +512,8 @@ const ye = "Collapsible", [at, Ce] = oe(ye), [ct, ce] = at(ye), it = /* @__PURE_
512
512
  }))
513
513
  );
514
514
  }), pt = /* @__PURE__ */ S((e, r) => {
515
- const { __scopeCollapsible: n, present: o, children: c, ...t } = e, a = ce(Ne, n), [i, s] = re(o), l = C(null), d = k(r, l), p = C(0), _ = p.current, f = C(0), b = f.current, x = a.open || i, g = C(x), m = C();
516
- return D(() => {
515
+ const { __scopeCollapsible: n, present: o, children: c, ...t } = e, a = ce(Ne, n), [i, s] = re(o), l = C(null), d = D(r, l), p = C(0), _ = p.current, f = C(0), b = f.current, x = a.open || i, g = C(x), m = C();
516
+ return L(() => {
517
517
  const $ = requestAnimationFrame(
518
518
  () => g.current = !1
519
519
  );
@@ -531,7 +531,7 @@ const ye = "Collapsible", [at, Ce] = oe(ye), [ct, ce] = at(ye), it = /* @__PURE_
531
531
  }, [
532
532
  a.open,
533
533
  o
534
- ]), /* @__PURE__ */ y(L.div, h({
534
+ ]), /* @__PURE__ */ y(k.div, h({
535
535
  "data-state": ie(a.open),
536
536
  "data-disabled": a.disabled ? "" : void 0,
537
537
  id: a.contentId,
@@ -648,7 +648,7 @@ const [Ie, vt] = z(I), [Pe, xt] = z(I, {
648
648
  ref: r
649
649
  }))));
650
650
  }), [Ct, K] = z(I), we = /* @__PURE__ */ u.forwardRef((e, r) => {
651
- const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null), s = k(i, r), l = ht(n), p = _t(c) === "ltr", _ = ge(e.onKeyDown, (f) => {
651
+ const { __scopeAccordion: n, disabled: o, dir: c, orientation: t = "vertical", ...a } = e, i = u.useRef(null), s = D(i, r), l = ht(n), p = _t(c) === "ltr", _ = ge(e.onKeyDown, (f) => {
652
652
  var b;
653
653
  if (!mt.includes(f.key))
654
654
  return;
@@ -697,7 +697,7 @@ const [Ie, vt] = z(I), [Pe, xt] = z(I, {
697
697
  orientation: t
698
698
  }, /* @__PURE__ */ u.createElement(se.Slot, {
699
699
  scope: n
700
- }, /* @__PURE__ */ u.createElement(L.div, h({}, a, {
700
+ }, /* @__PURE__ */ u.createElement(k.div, h({}, a, {
701
701
  "data-orientation": t,
702
702
  ref: s,
703
703
  onKeyDown: o ? void 0 : _
@@ -722,7 +722,7 @@ const [Ie, vt] = z(I), [Pe, xt] = z(I, {
722
722
  })));
723
723
  }), It = "AccordionHeader", Pt = /* @__PURE__ */ u.forwardRef((e, r) => {
724
724
  const { __scopeAccordion: n, ...o } = e, c = K(I, n), t = ue(It, n);
725
- return /* @__PURE__ */ u.createElement(L.h3, h({
725
+ return /* @__PURE__ */ u.createElement(k.h3, h({
726
726
  "data-orientation": c.orientation,
727
727
  "data-state": Se(t.open),
728
728
  "data-disabled": t.disabled ? "" : void 0
@@ -758,8 +758,8 @@ const [Ie, vt] = z(I), [Pe, xt] = z(I, {
758
758
  function Se(e) {
759
759
  return e ? "open" : "closed";
760
760
  }
761
- const Rt = Ee, Tt = Et, Mt = Pt, kt = wt, Dt = Ot;
762
- function Lt(e) {
761
+ const Rt = Ee, Tt = Et, Mt = Pt, Dt = wt, Lt = Ot;
762
+ function kt(e) {
763
763
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
764
764
  }
765
765
  var Oe = { exports: {} };
@@ -799,7 +799,7 @@ var Oe = { exports: {} };
799
799
  })();
800
800
  })(Oe);
801
801
  var jt = Oe.exports;
802
- const Re = /* @__PURE__ */ Lt(jt), qt = {
802
+ const Re = /* @__PURE__ */ kt(jt), qt = {
803
803
  "purpur-accordion__title": "_purpur-accordion__title_1ower_1",
804
804
  "purpur-accordion--negative": "_purpur-accordion--negative_1ower_10"
805
805
  };
@@ -898,7 +898,7 @@ const Ft = Bt.bind(Ht), de = "purpur-icon", zt = "md", Kt = (e) => e.filter((r)
898
898
  function Qt(e) {
899
899
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
900
900
  }
901
- var ke = { exports: {} };
901
+ var De = { exports: {} };
902
902
  /*!
903
903
  Copyright (c) 2018 Jed Watson.
904
904
  Licensed under the MIT License (MIT), see
@@ -933,8 +933,8 @@ var ke = { exports: {} };
933
933
  }
934
934
  e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
935
935
  })();
936
- })(ke);
937
- var Wt = ke.exports;
936
+ })(De);
937
+ var Wt = De.exports;
938
938
  const Xt = /* @__PURE__ */ Qt(Wt), R = {
939
939
  "purpur-paragraph": "_purpur-paragraph_1rh57_1",
940
940
  "purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
@@ -982,18 +982,18 @@ const Xt = /* @__PURE__ */ Qt(Wt), R = {
982
982
  }
983
983
  ]);
984
984
  return /* @__PURE__ */ A("p", { ...i, className: s, "data-testid": e, children: r });
985
- }, nn = "_slideDown_8k8nf_1", rn = "_slideUp_8k8nf_1", on = {
986
- "purpur-accordion-item": "_purpur-accordion-item_8k8nf_1",
987
- "purpur-accordion-item__header": "_purpur-accordion-item__header_8k8nf_8",
988
- "purpur-accordion-item__trigger": "_purpur-accordion-item__trigger_8k8nf_11",
989
- "purpur-accordion-item__content": "_purpur-accordion-item__content_8k8nf_35",
985
+ }, nn = "_slideDown_1frh3_1", rn = "_slideUp_1frh3_1", on = {
986
+ "purpur-accordion-item": "_purpur-accordion-item_1frh3_1",
987
+ "purpur-accordion-item__header": "_purpur-accordion-item__header_1frh3_8",
988
+ "purpur-accordion-item__trigger": "_purpur-accordion-item__trigger_1frh3_11",
989
+ "purpur-accordion-item__content": "_purpur-accordion-item__content_1frh3_35",
990
990
  slideDown: nn,
991
991
  slideUp: rn,
992
- "purpur-accordion-item__contentText": "_purpur-accordion-item__contentText_8k8nf_44",
993
- "purpur-accordion-item__icon": "_purpur-accordion-item__icon_8k8nf_48",
994
- "purpur-accordion-item__title": "_purpur-accordion-item__title_8k8nf_60",
995
- "purpur-accordion-item--negative": "_purpur-accordion-item--negative_8k8nf_78"
996
- }, P = Re.bind(on), E = "purpur-accordion-item", De = ({
992
+ "purpur-accordion-item__contentText": "_purpur-accordion-item__contentText_1frh3_44",
993
+ "purpur-accordion-item__icon": "_purpur-accordion-item__icon_1frh3_48",
994
+ "purpur-accordion-item__title": "_purpur-accordion-item__title_1frh3_60",
995
+ "purpur-accordion-item--negative": "_purpur-accordion-item--negative_1frh3_81"
996
+ }, P = Re.bind(on), E = "purpur-accordion-item", Le = ({
997
997
  children: e,
998
998
  className: r,
999
999
  title: n,
@@ -1010,7 +1010,7 @@ const Xt = /* @__PURE__ */ Qt(Wt), R = {
1010
1010
  ]);
1011
1011
  return /* @__PURE__ */ X(Tt, { className: a, value: n, ...t, children: [
1012
1012
  /* @__PURE__ */ A(Mt, { className: P(`${E}__header`), asChild: !0, children: /* @__PURE__ */ X(
1013
- kt,
1013
+ Dt,
1014
1014
  {
1015
1015
  onClick: c,
1016
1016
  className: P(`${E}__trigger`, r),
@@ -1020,9 +1020,9 @@ const Xt = /* @__PURE__ */ Qt(Wt), R = {
1020
1020
  ]
1021
1021
  }
1022
1022
  ) }),
1023
- /* @__PURE__ */ A(Dt, { className: P(`${E}__content`, r), children: /* @__PURE__ */ A("div", { className: P(`${E}__contentText`), children: typeof e == "string" ? /* @__PURE__ */ A(tn, { variant: "paragraph-200", children: e }) : e }) })
1023
+ /* @__PURE__ */ A(Lt, { className: P(`${E}__content`, r), children: /* @__PURE__ */ A("div", { className: P(`${E}__contentText`), children: typeof e == "string" ? /* @__PURE__ */ A(tn, { variant: "paragraph-200", children: e }) : e }) })
1024
1024
  ] });
1025
- }, an = (e) => M(e) && (e == null ? void 0 : e.type) === De, fe = Re.bind(qt), W = "purpur-accordion", Le = ({
1025
+ }, an = (e) => M(e) && (e == null ? void 0 : e.type) === Le, fe = Re.bind(qt), W = "purpur-accordion", ke = ({
1026
1026
  ["data-testid"]: e,
1027
1027
  children: r,
1028
1028
  className: n,
@@ -1042,9 +1042,9 @@ const Xt = /* @__PURE__ */ Qt(Wt), R = {
1042
1042
  i()
1043
1043
  ] });
1044
1044
  };
1045
- Le.Item = De;
1046
- Le.displayName = "Accordion";
1045
+ ke.Item = Le;
1046
+ ke.displayName = "Accordion";
1047
1047
  export {
1048
- Le as Accordion
1048
+ ke as Accordion
1049
1049
  };
1050
1050
  //# sourceMappingURL=accordion.es.js.map