@purpurds/checkbox 5.7.0 → 5.8.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/checkbox.cjs.js +3 -3
- package/dist/checkbox.cjs.js.map +1 -1
- package/dist/checkbox.es.js +18 -18
- package/dist/checkbox.es.js.map +1 -1
- package/package.json +6 -6
package/dist/checkbox.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as U, jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as _, Children as v, isValidElement as x, createElement as p, cloneElement as R, useEffect as
|
|
2
|
+
import { forwardRef as _, Children as v, isValidElement as x, createElement as p, cloneElement as R, useEffect as O, Fragment as re, useCallback as G, createContext as K, useMemo as k, useContext as ge, useRef as $, useState as I, 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,12 +49,12 @@ 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
|
-
},
|
|
52
|
+
}, Oe = {
|
|
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
|
-
},
|
|
57
|
+
}, Ae = Ne.bind(Se), W = "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" },
|
|
@@ -73,7 +73,7 @@ const Ne = /* @__PURE__ */ xe(we), Se = {
|
|
|
73
73
|
const o = ke({
|
|
74
74
|
content: Ee(n.svg),
|
|
75
75
|
title: t
|
|
76
|
-
}), i =
|
|
76
|
+
}), i = Ae(a, W, `${W}--${u}`);
|
|
77
77
|
return /* @__PURE__ */ f(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
@@ -143,7 +143,7 @@ const De = /* @__PURE__ */ Me(Re), X = {
|
|
|
143
143
|
"aria-relevant": a,
|
|
144
144
|
...u,
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */ f(je, { svg:
|
|
146
|
+
/* @__PURE__ */ f(je, { svg: Oe, size: "xs", className: X[`${J}__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
|
|
334
|
+
return O(() => {
|
|
335
335
|
window[Symbol.for("radix-ui")] = !0;
|
|
336
336
|
}, []), /* @__PURE__ */ p(i, E({}, o, {
|
|
337
337
|
ref: u
|
|
@@ -612,7 +612,7 @@ function ee(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
|
612
612
|
}
|
|
613
613
|
function le(e) {
|
|
614
614
|
const n = $(e);
|
|
615
|
-
return
|
|
615
|
+
return O(() => {
|
|
616
616
|
n.current = e;
|
|
617
617
|
}), k(
|
|
618
618
|
() => (...t) => {
|
|
@@ -646,7 +646,7 @@ function mr({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
646
646
|
}
|
|
647
647
|
function vr({ defaultProp: e, onChange: n }) {
|
|
648
648
|
const t = I(e), [a] = t, u = $(a), r = le(n);
|
|
649
|
-
return
|
|
649
|
+
return O(() => {
|
|
650
650
|
u.current !== a && (r(a), u.current = a);
|
|
651
651
|
}, [
|
|
652
652
|
a,
|
|
@@ -726,7 +726,7 @@ function $r(e) {
|
|
|
726
726
|
MOUNT: "mounted"
|
|
727
727
|
}
|
|
728
728
|
});
|
|
729
|
-
return
|
|
729
|
+
return O(() => {
|
|
730
730
|
const s = q(a.current);
|
|
731
731
|
r.current = i === "mounted" ? s : "none";
|
|
732
732
|
}, [
|
|
@@ -847,7 +847,7 @@ const Nr = [
|
|
|
847
847
|
], fe = Nr.reduce((e, n) => {
|
|
848
848
|
const t = /* @__PURE__ */ _((a, u) => {
|
|
849
849
|
const { asChild: r, ...o } = a, i = r ? de : n;
|
|
850
|
-
return
|
|
850
|
+
return O(() => {
|
|
851
851
|
window[Symbol.for("radix-ui")] = !0;
|
|
852
852
|
}, []), /* @__PURE__ */ p(i, M({}, o, {
|
|
853
853
|
ref: u
|
|
@@ -857,7 +857,7 @@ const Nr = [
|
|
|
857
857
|
...e,
|
|
858
858
|
[n]: t
|
|
859
859
|
};
|
|
860
|
-
}, {}), he = "Checkbox", [Sr, Tr] = fr(he), [
|
|
860
|
+
}, {}), he = "Checkbox", [Sr, Tr] = fr(he), [Or, Ar] = Sr(he), Cr = /* @__PURE__ */ _((e, n) => {
|
|
861
861
|
const { __scopeCheckbox: t, name: a, checked: u, defaultChecked: r, required: o, disabled: i, value: c = "on", onCheckedChange: s, ...h } = e, [l, d] = I(null), b = se(
|
|
862
862
|
n,
|
|
863
863
|
(m) => d(m)
|
|
@@ -866,16 +866,16 @@ const Nr = [
|
|
|
866
866
|
defaultProp: r,
|
|
867
867
|
onChange: s
|
|
868
868
|
}), be = $(y);
|
|
869
|
-
return
|
|
869
|
+
return O(() => {
|
|
870
870
|
const m = l == null ? void 0 : l.form;
|
|
871
871
|
if (m) {
|
|
872
|
-
const
|
|
873
|
-
return m.addEventListener("reset",
|
|
872
|
+
const A = () => L(be.current);
|
|
873
|
+
return m.addEventListener("reset", A), () => m.removeEventListener("reset", A);
|
|
874
874
|
}
|
|
875
875
|
}, [
|
|
876
876
|
l,
|
|
877
877
|
L
|
|
878
|
-
]), /* @__PURE__ */ p(
|
|
878
|
+
]), /* @__PURE__ */ p(Or, {
|
|
879
879
|
scope: t,
|
|
880
880
|
state: y,
|
|
881
881
|
disabled: i
|
|
@@ -895,7 +895,7 @@ const Nr = [
|
|
|
895
895
|
}),
|
|
896
896
|
onClick: ee(e.onClick, (m) => {
|
|
897
897
|
L(
|
|
898
|
-
(
|
|
898
|
+
(A) => S(A) ? !0 : !A
|
|
899
899
|
), D && (g.current = m.isPropagationStopped(), g.current || m.stopPropagation());
|
|
900
900
|
})
|
|
901
901
|
})), D && /* @__PURE__ */ p(Er, {
|
|
@@ -911,7 +911,7 @@ const Nr = [
|
|
|
911
911
|
}
|
|
912
912
|
}));
|
|
913
913
|
}), Pr = "CheckboxIndicator", kr = /* @__PURE__ */ _((e, n) => {
|
|
914
|
-
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r =
|
|
914
|
+
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r = Ar(Pr, t);
|
|
915
915
|
return /* @__PURE__ */ p(pe, {
|
|
916
916
|
present: a || S(r.state) || r.state === !0
|
|
917
917
|
}, /* @__PURE__ */ p(fe.span, j({
|
|
@@ -926,7 +926,7 @@ const Nr = [
|
|
|
926
926
|
})));
|
|
927
927
|
}), Er = (e) => {
|
|
928
928
|
const { control: n, checked: t, bubbles: a = !0, ...u } = e, r = $(null), o = br(t), i = gr(n);
|
|
929
|
-
return
|
|
929
|
+
return O(() => {
|
|
930
930
|
const c = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
|
|
931
931
|
if (o !== t && l) {
|
|
932
932
|
const d = new Event("click", {
|