@purpurds/checkbox 3.4.0 → 3.5.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.
@@ -1,5 +1,5 @@
1
1
  import { jsxs as z, jsx as f } from "react/jsx-runtime";
2
- import { forwardRef as _, Children as v, isValidElement as x, createElement as p, cloneElement as E, useEffect as O, Fragment as re, useCallback as Z, createContext as V, useMemo as A, useContext as ge, useRef as $, useState as I, useLayoutEffect as _e, useReducer as $e } from "react";
2
+ import { forwardRef as g, Children as v, isValidElement as x, createElement as p, cloneElement as E, useEffect as O, Fragment as re, useCallback as Z, createContext as V, useMemo as A, useContext as _e, useRef as $, useState as I, useLayoutEffect as ge, useReducer as $e } from "react";
3
3
  import { flushSync as ye } from "react-dom";
4
4
  function xe(e) {
5
5
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -265,7 +265,7 @@ function We(...e) {
265
265
  (t) => Ke(t, n)
266
266
  );
267
267
  }
268
- const ae = /* @__PURE__ */ _((e, n) => {
268
+ const ae = /* @__PURE__ */ g((e, n) => {
269
269
  const { children: t, ...a } = e, i = v.toArray(t), r = i.find(Je);
270
270
  if (r) {
271
271
  const o = r.props.children, u = i.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */ x(o) ? o.props.children : null : c);
@@ -278,7 +278,7 @@ const ae = /* @__PURE__ */ _((e, n) => {
278
278
  }), t);
279
279
  });
280
280
  ae.displayName = "Slot";
281
- const U = /* @__PURE__ */ _((e, n) => {
281
+ const U = /* @__PURE__ */ g((e, n) => {
282
282
  const { children: t, ...a } = e;
283
283
  return /* @__PURE__ */ x(t) ? /* @__PURE__ */ E(t, {
284
284
  ...Qe(a, t.props),
@@ -329,7 +329,7 @@ const Ye = [
329
329
  "svg",
330
330
  "ul"
331
331
  ], er = Ye.reduce((e, n) => {
332
- const t = /* @__PURE__ */ _((a, i) => {
332
+ const t = /* @__PURE__ */ g((a, i) => {
333
333
  const { asChild: r, ...o } = a, u = r ? ae : n;
334
334
  return O(() => {
335
335
  window[Symbol.for("radix-ui")] = !0;
@@ -341,7 +341,7 @@ const Ye = [
341
341
  ...e,
342
342
  [n]: t
343
343
  };
344
- }, {}), rr = /* @__PURE__ */ _((e, n) => /* @__PURE__ */ p(er.label, T({}, e, {
344
+ }, {}), rr = /* @__PURE__ */ g((e, n) => /* @__PURE__ */ p(er.label, T({}, e, {
345
345
  ref: n,
346
346
  onMouseDown: (t) => {
347
347
  var a;
@@ -521,18 +521,18 @@ function fr(e, n = []) {
521
521
  o
522
522
  ];
523
523
  function s(l) {
524
- const { scope: d, children: b, ...g } = l, M = (d == null ? void 0 : d[e][c]) || u, y = A(
525
- () => g,
526
- Object.values(g)
524
+ const { scope: d, children: b, ..._ } = l, M = (d == null ? void 0 : d[e][c]) || u, y = A(
525
+ () => _,
526
+ Object.values(_)
527
527
  );
528
528
  return /* @__PURE__ */ p(M.Provider, {
529
529
  value: y
530
530
  }, b);
531
531
  }
532
532
  function h(l, d) {
533
- const b = (d == null ? void 0 : d[e][c]) || u, g = ge(b);
534
- if (g)
535
- return g;
533
+ const b = (d == null ? void 0 : d[e][c]) || u, _ = _e(b);
534
+ if (_)
535
+ return _;
536
536
  if (o !== void 0)
537
537
  return o;
538
538
  throw new Error(`\`${l}\` must be used within \`${r}\``);
@@ -655,9 +655,9 @@ function br(e) {
655
655
  e
656
656
  ]);
657
657
  }
658
- const H = globalThis != null && globalThis.document ? _e : () => {
658
+ const H = globalThis != null && globalThis.document ? ge : () => {
659
659
  };
660
- function gr(e) {
660
+ function _r(e) {
661
661
  const [n, t] = I(void 0);
662
662
  return H(() => {
663
663
  if (e) {
@@ -689,7 +689,7 @@ function gr(e) {
689
689
  e
690
690
  ]), n;
691
691
  }
692
- function _r(e, n) {
692
+ function gr(e, n) {
693
693
  return $e((t, a) => {
694
694
  const i = n[t][a];
695
695
  return i ?? t;
@@ -705,7 +705,7 @@ const pe = (e) => {
705
705
  };
706
706
  pe.displayName = "Presence";
707
707
  function $r(e) {
708
- const [n, t] = I(), a = $({}), i = $(e), r = $("none"), o = e ? "mounted" : "unmounted", [u, c] = _r(o, {
708
+ const [n, t] = I(), a = $({}), i = $(e), r = $("none"), o = e ? "mounted" : "unmounted", [u, c] = gr(o, {
709
709
  mounted: {
710
710
  UNMOUNT: "unmounted",
711
711
  ANIMATION_OUT: "unmountSuspended"
@@ -773,7 +773,7 @@ function j() {
773
773
  return e;
774
774
  }, j.apply(this, arguments);
775
775
  }
776
- const de = /* @__PURE__ */ _((e, n) => {
776
+ const de = /* @__PURE__ */ g((e, n) => {
777
777
  const { children: t, ...a } = e, i = v.toArray(t), r = i.find(xr);
778
778
  if (r) {
779
779
  const o = r.props.children, u = i.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */ x(o) ? o.props.children : null : c);
@@ -786,7 +786,7 @@ const de = /* @__PURE__ */ _((e, n) => {
786
786
  }), t);
787
787
  });
788
788
  de.displayName = "Slot";
789
- const F = /* @__PURE__ */ _((e, n) => {
789
+ const F = /* @__PURE__ */ g((e, n) => {
790
790
  const { children: t, ...a } = e;
791
791
  return /* @__PURE__ */ x(t) ? /* @__PURE__ */ E(t, {
792
792
  ...wr(a, t.props),
@@ -837,7 +837,7 @@ const Nr = [
837
837
  "svg",
838
838
  "ul"
839
839
  ], fe = Nr.reduce((e, n) => {
840
- const t = /* @__PURE__ */ _((a, i) => {
840
+ const t = /* @__PURE__ */ g((a, i) => {
841
841
  const { asChild: r, ...o } = a, u = r ? de : n;
842
842
  return O(() => {
843
843
  window[Symbol.for("radix-ui")] = !0;
@@ -849,11 +849,11 @@ const Nr = [
849
849
  ...e,
850
850
  [n]: t
851
851
  };
852
- }, {}), he = "Checkbox", [Sr, Tr] = fr(he), [Or, Pr] = Sr(he), Ar = /* @__PURE__ */ _((e, n) => {
852
+ }, {}), he = "Checkbox", [Sr, Tr] = fr(he), [Or, Pr] = Sr(he), Ar = /* @__PURE__ */ g((e, n) => {
853
853
  const { __scopeCheckbox: t, name: a, checked: i, defaultChecked: r, required: o, disabled: u, value: c = "on", onCheckedChange: s, ...h } = e, [l, d] = I(null), b = se(
854
854
  n,
855
855
  (m) => d(m)
856
- ), g = $(!1), M = l ? !!l.closest("form") : !0, [y = !1, L] = mr({
856
+ ), _ = $(!1), M = l ? !!l.closest("form") : !0, [y = !1, L] = mr({
857
857
  prop: i,
858
858
  defaultProp: r,
859
859
  onChange: s
@@ -888,11 +888,11 @@ const Nr = [
888
888
  onClick: ee(e.onClick, (m) => {
889
889
  L(
890
890
  (P) => S(P) ? !0 : !P
891
- ), M && (g.current = m.isPropagationStopped(), g.current || m.stopPropagation());
891
+ ), M && (_.current = m.isPropagationStopped(), _.current || m.stopPropagation());
892
892
  })
893
893
  })), M && /* @__PURE__ */ p(jr, {
894
894
  control: l,
895
- bubbles: !g.current,
895
+ bubbles: !_.current,
896
896
  name: a,
897
897
  value: c,
898
898
  checked: y,
@@ -902,7 +902,7 @@ const Nr = [
902
902
  transform: "translateX(-100%)"
903
903
  }
904
904
  }));
905
- }), Cr = "CheckboxIndicator", kr = /* @__PURE__ */ _((e, n) => {
905
+ }), Cr = "CheckboxIndicator", kr = /* @__PURE__ */ g((e, n) => {
906
906
  const { __scopeCheckbox: t, forceMount: a, ...i } = e, r = Pr(Cr, t);
907
907
  return /* @__PURE__ */ p(pe, {
908
908
  present: a || S(r.state) || r.state === !0
@@ -917,7 +917,7 @@ const Nr = [
917
917
  }
918
918
  })));
919
919
  }), jr = (e) => {
920
- const { control: n, checked: t, bubbles: a = !0, ...i } = e, r = $(null), o = br(t), u = gr(n);
920
+ const { control: n, checked: t, bubbles: a = !0, ...i } = e, r = $(null), o = br(t), u = _r(n);
921
921
  return O(() => {
922
922
  const c = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
923
923
  if (o !== t && l) {
@@ -1055,7 +1055,7 @@ const B = /* @__PURE__ */ Rr(Dr), w = {
1055
1055
  ] }),
1056
1056
  c && /* @__PURE__ */ f(qe, { "data-testid": e && `${e}-error-text`, children: a })
1057
1057
  ] });
1058
- }, Ir = _(qr);
1058
+ }, Ir = g(qr);
1059
1059
  Ir.displayName = "Checkbox";
1060
1060
  export {
1061
1061
  Ir as Checkbox