@purpurds/checkbox 4.3.0 → 4.4.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,4 +1,5 @@
1
- import React from "react";
1
+ import { default as React } from 'react';
2
+
2
3
  export type CheckedState = boolean | "indeterminate";
3
4
  export type CheckboxProps = {
4
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { jsxs as B, jsx as f } from "react/jsx-runtime";
2
- import { forwardRef as _, Children as v, isValidElement as x, createElement as p, cloneElement as z, useEffect as O, Fragment as re, useCallback as Z, createContext as V, useMemo as k, useContext as ge, useRef as $, useState as q, useLayoutEffect as _e, useReducer as $e } from "react";
2
+ import { forwardRef as _, Children as v, isValidElement as x, createElement as p, cloneElement as z, useEffect as A, Fragment as re, useCallback as Z, createContext as V, useMemo as k, useContext as ge, useRef as $, useState as q, useLayoutEffect as _e, 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;
@@ -49,31 +49,31 @@ const Ne = /* @__PURE__ */ xe(we), Se = {
49
49
  "purpur-icon--md": "_purpur-icon--md_8u1lq_16",
50
50
  "purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
51
51
  "purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
52
- }, Oe = {
52
+ }, Ae = {
53
53
  name: "error-filled",
54
54
  svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="currentColor"><path fill-rule="evenodd" d="M14.268 3.5c-.77-1.333-2.694-1.333-3.464 0l-8.66 15c-.77 1.333.192 3 1.732 3h17.32c1.54 0 2.502-1.667 1.733-3l-8.66-15Zm-.694 5.067-.247 6.876h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.917c0 .649-.585 1.234-1.25 1.234-.648 0-1.25-.585-1.25-1.234 0-.633.602-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z" clip-rule="evenodd"/></svg>',
55
55
  keywords: ["error-filled"],
56
56
  category: "status"
57
- }, Pe = Ne.bind(Se), G = "purpur-icon", Ae = "md", Ce = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), ke = ({ content: e = "", title: n } = {}) => {
57
+ }, Oe = Ne.bind(Se), G = "purpur-icon", Ce = "md", Pe = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), ke = ({ content: e = "", title: n } = {}) => {
58
58
  const t = [
59
59
  { name: "xmlns", value: "http://www.w3.org/2000/svg" },
60
60
  { name: "fill", value: "currentColor" },
61
61
  { name: "viewBox", value: "0 0 24 24" },
62
62
  n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
63
63
  ], a = n ? `<title>${n}</title>` : "";
64
- return `<svg ${Ce(t)}>${a}${e}</svg>`;
64
+ return `<svg ${Pe(t)}>${a}${e}</svg>`;
65
65
  }, je = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Ee = ({
66
66
  ["data-testid"]: e,
67
67
  svg: n,
68
68
  allyTitle: t,
69
69
  className: a = "",
70
- size: u = Ae,
70
+ size: u = Ce,
71
71
  ...r
72
72
  }) => {
73
73
  const o = ke({
74
74
  content: je(n.svg),
75
75
  title: t
76
- }), i = Pe(a, G, `${G}--${u}`);
76
+ }), i = Oe(a, G, `${G}--${u}`);
77
77
  return /* @__PURE__ */ f(
78
78
  "span",
79
79
  {
@@ -143,7 +143,7 @@ const Re = /* @__PURE__ */ Me(ze), K = {
143
143
  "aria-relevant": a,
144
144
  ...u,
145
145
  children: [
146
- /* @__PURE__ */ f(Ee, { svg: Oe, size: "xs", className: K[`${W}__icon`] }),
146
+ /* @__PURE__ */ f(Ee, { svg: Ae, size: "xs", className: K[`${W}__icon`] }),
147
147
  n
148
148
  ]
149
149
  }
@@ -331,7 +331,7 @@ const Ye = [
331
331
  ], er = Ye.reduce((e, n) => {
332
332
  const t = /* @__PURE__ */ _((a, u) => {
333
333
  const { asChild: r, ...o } = a, i = r ? ae : n;
334
- return O(() => {
334
+ return A(() => {
335
335
  window[Symbol.for("radix-ui")] = !0;
336
336
  }, []), /* @__PURE__ */ p(i, j({}, o, {
337
337
  ref: u
@@ -446,7 +446,7 @@ var ie = { exports: {} };
446
446
  })();
447
447
  })(ie);
448
448
  var cr = ie.exports;
449
- const sr = /* @__PURE__ */ ir(cr), A = {
449
+ const sr = /* @__PURE__ */ ir(cr), C = {
450
450
  "purpur-paragraph": "_purpur-paragraph_15yuz_1",
451
451
  "purpur-paragraph--disabled": "_purpur-paragraph--disabled_15yuz_7",
452
452
  "purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_15yuz_10",
@@ -472,7 +472,7 @@ const sr = /* @__PURE__ */ ir(cr), A = {
472
472
  ADDITIONAL100MEDIUM: "additional-100-medium",
473
473
  OVERLINE100: "overline-100",
474
474
  OVERLINE200: "overline-200"
475
- }, C = "purpur-paragraph", pr = ({
475
+ }, P = "purpur-paragraph", pr = ({
476
476
  ["data-testid"]: e,
477
477
  children: n,
478
478
  className: t = "",
@@ -484,12 +484,12 @@ const sr = /* @__PURE__ */ ir(cr), A = {
484
484
  }) => {
485
485
  const c = sr([
486
486
  t,
487
- A[C],
488
- A[`${C}--${o}`],
487
+ C[P],
488
+ C[`${P}--${o}`],
489
489
  {
490
- [A[`${C}--hyphens`]]: u,
491
- [A[`${C}--disabled`]]: a,
492
- [A[`${C}--negative`]]: r
490
+ [C[`${P}--hyphens`]]: u,
491
+ [C[`${P}--disabled`]]: a,
492
+ [C[`${P}--negative`]]: r
493
493
  }
494
494
  ]);
495
495
  return /* @__PURE__ */ f("p", { ...i, className: c, "data-testid": e, children: n });
@@ -607,7 +607,7 @@ function ee(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
607
607
  }
608
608
  function le(e) {
609
609
  const n = $(e);
610
- return O(() => {
610
+ return A(() => {
611
611
  n.current = e;
612
612
  }), k(
613
613
  () => (...t) => {
@@ -641,7 +641,7 @@ function mr({ prop: e, defaultProp: n, onChange: t = () => {
641
641
  }
642
642
  function vr({ defaultProp: e, onChange: n }) {
643
643
  const t = q(e), [a] = t, u = $(a), r = le(n);
644
- return O(() => {
644
+ return A(() => {
645
645
  u.current !== a && (r(a), u.current = a);
646
646
  }, [
647
647
  a,
@@ -721,7 +721,7 @@ function $r(e) {
721
721
  MOUNT: "mounted"
722
722
  }
723
723
  });
724
- return O(() => {
724
+ return A(() => {
725
725
  const s = D(a.current);
726
726
  r.current = i === "mounted" ? s : "none";
727
727
  }, [
@@ -842,7 +842,7 @@ const Nr = [
842
842
  ], fe = Nr.reduce((e, n) => {
843
843
  const t = /* @__PURE__ */ _((a, u) => {
844
844
  const { asChild: r, ...o } = a, i = r ? de : n;
845
- return O(() => {
845
+ return A(() => {
846
846
  window[Symbol.for("radix-ui")] = !0;
847
847
  }, []), /* @__PURE__ */ p(i, M({}, o, {
848
848
  ref: u
@@ -852,7 +852,7 @@ const Nr = [
852
852
  ...e,
853
853
  [n]: t
854
854
  };
855
- }, {}), he = "Checkbox", [Sr, Tr] = fr(he), [Or, Pr] = Sr(he), Ar = /* @__PURE__ */ _((e, n) => {
855
+ }, {}), he = "Checkbox", [Sr, Tr] = fr(he), [Ar, Or] = Sr(he), Cr = /* @__PURE__ */ _((e, n) => {
856
856
  const { __scopeCheckbox: t, name: a, checked: u, defaultChecked: r, required: o, disabled: i, value: c = "on", onCheckedChange: s, ...h } = e, [l, d] = q(null), b = se(
857
857
  n,
858
858
  (m) => d(m)
@@ -861,16 +861,16 @@ const Nr = [
861
861
  defaultProp: r,
862
862
  onChange: s
863
863
  }), be = $(y);
864
- return O(() => {
864
+ return A(() => {
865
865
  const m = l == null ? void 0 : l.form;
866
866
  if (m) {
867
- const P = () => I(be.current);
868
- return m.addEventListener("reset", P), () => m.removeEventListener("reset", P);
867
+ const O = () => I(be.current);
868
+ return m.addEventListener("reset", O), () => m.removeEventListener("reset", O);
869
869
  }
870
870
  }, [
871
871
  l,
872
872
  I
873
- ]), /* @__PURE__ */ p(Or, {
873
+ ]), /* @__PURE__ */ p(Ar, {
874
874
  scope: t,
875
875
  state: y,
876
876
  disabled: i
@@ -890,7 +890,7 @@ const Nr = [
890
890
  }),
891
891
  onClick: ee(e.onClick, (m) => {
892
892
  I(
893
- (P) => S(P) ? !0 : !P
893
+ (O) => S(O) ? !0 : !O
894
894
  ), R && (g.current = m.isPropagationStopped(), g.current || m.stopPropagation());
895
895
  })
896
896
  })), R && /* @__PURE__ */ p(jr, {
@@ -905,8 +905,8 @@ const Nr = [
905
905
  transform: "translateX(-100%)"
906
906
  }
907
907
  }));
908
- }), Cr = "CheckboxIndicator", kr = /* @__PURE__ */ _((e, n) => {
909
- const { __scopeCheckbox: t, forceMount: a, ...u } = e, r = Pr(Cr, t);
908
+ }), Pr = "CheckboxIndicator", kr = /* @__PURE__ */ _((e, n) => {
909
+ const { __scopeCheckbox: t, forceMount: a, ...u } = e, r = Or(Pr, t);
910
910
  return /* @__PURE__ */ p(pe, {
911
911
  present: a || S(r.state) || r.state === !0
912
912
  }, /* @__PURE__ */ p(fe.span, E({
@@ -921,7 +921,7 @@ const Nr = [
921
921
  })));
922
922
  }), jr = (e) => {
923
923
  const { control: n, checked: t, bubbles: a = !0, ...u } = e, r = $(null), o = br(t), i = gr(n);
924
- return O(() => {
924
+ return A(() => {
925
925
  const c = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
926
926
  if (o !== t && l) {
927
927
  const d = new Event("click", {
@@ -956,7 +956,7 @@ function S(e) {
956
956
  function me(e) {
957
957
  return S(e) ? "indeterminate" : e ? "checked" : "unchecked";
958
958
  }
959
- const Er = Ar, Mr = kr;
959
+ const Er = Cr, Mr = kr;
960
960
  function zr(e) {
961
961
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
962
962
  }