@purpurds/checkbox 5.12.0 → 5.14.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 +6 -6
- package/dist/checkbox.cjs.js.map +1 -1
- package/dist/checkbox.es.js +76 -76
- package/dist/checkbox.es.js.map +1 -1
- package/package.json +6 -6
package/dist/checkbox.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 A, Fragment as re, useCallback as G, createContext as K, useMemo as k, useContext as _e, useRef as $, useState as L, useLayoutEffect as $e, useReducer as ye } from "react";
|
|
3
3
|
import { flushSync as xe } from "react-dom";
|
|
4
|
-
function
|
|
4
|
+
function Ne(e) {
|
|
5
5
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
6
6
|
}
|
|
7
7
|
var te = { exports: {} };
|
|
@@ -40,8 +40,8 @@ var te = { exports: {} };
|
|
|
40
40
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
41
41
|
})();
|
|
42
42
|
})(te);
|
|
43
|
-
var
|
|
44
|
-
const Se = /* @__PURE__ */ we
|
|
43
|
+
var we = te.exports;
|
|
44
|
+
const Se = /* @__PURE__ */ Ne(we), Ae = {
|
|
45
45
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
46
46
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
47
47
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -49,12 +49,12 @@ const Se = /* @__PURE__ */ we(Ne), Oe = {
|
|
|
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
|
-
}, Pe = Se.bind(
|
|
57
|
+
}, Pe = Se.bind(Ae), X = "purpur-icon", Ce = "md", ke = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), je = ({ 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 Se = /* @__PURE__ */ we(Ne), Oe = {
|
|
|
73
73
|
const o = je({
|
|
74
74
|
content: Ee(n.svg),
|
|
75
75
|
title: t
|
|
76
|
-
}), i = Pe(a,
|
|
76
|
+
}), i = Pe(a, X, `${X}--${u}`);
|
|
77
77
|
return /* @__PURE__ */ f(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
@@ -125,10 +125,10 @@ var ne = { exports: {} };
|
|
|
125
125
|
})();
|
|
126
126
|
})(ne);
|
|
127
127
|
var De = ne.exports;
|
|
128
|
-
const qe = /* @__PURE__ */ Re(De),
|
|
128
|
+
const qe = /* @__PURE__ */ Re(De), W = {
|
|
129
129
|
"purpur-field-error-text": "_purpur-field-error-text_1u768_1",
|
|
130
130
|
"purpur-field-error-text__icon": "_purpur-field-error-text__icon_1u768_12"
|
|
131
|
-
}, J = "purpur-field-error-text",
|
|
131
|
+
}, J = "purpur-field-error-text", Le = ({
|
|
132
132
|
["data-testid"]: e,
|
|
133
133
|
children: n,
|
|
134
134
|
className: t,
|
|
@@ -137,18 +137,18 @@ const qe = /* @__PURE__ */ Re(De), X = {
|
|
|
137
137
|
}) => /* @__PURE__ */ U(
|
|
138
138
|
"div",
|
|
139
139
|
{
|
|
140
|
-
className: qe([t,
|
|
140
|
+
className: qe([t, W[J]]),
|
|
141
141
|
"data-testid": e,
|
|
142
142
|
"aria-live": "assertive",
|
|
143
143
|
"aria-relevant": a,
|
|
144
144
|
...u,
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */ f(Me, { svg:
|
|
146
|
+
/* @__PURE__ */ f(Me, { svg: Oe, size: "xs", className: W[`${J}__icon`] }),
|
|
147
147
|
n
|
|
148
148
|
]
|
|
149
149
|
}
|
|
150
150
|
);
|
|
151
|
-
function
|
|
151
|
+
function Ie(e) {
|
|
152
152
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
153
153
|
}
|
|
154
154
|
var oe = { exports: {} };
|
|
@@ -187,8 +187,8 @@ var oe = { exports: {} };
|
|
|
187
187
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
188
188
|
})();
|
|
189
189
|
})(oe);
|
|
190
|
-
var
|
|
191
|
-
const ze = /* @__PURE__ */ Be
|
|
190
|
+
var Be = oe.exports;
|
|
191
|
+
const ze = /* @__PURE__ */ Ie(Be), Te = {
|
|
192
192
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
193
193
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
194
194
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -206,15 +206,15 @@ const ze = /* @__PURE__ */ Be(Le), Te = {
|
|
|
206
206
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M3 12c0-1.105.711-2 1.588-2h14.824c.877 0 1.588.895 1.588 2s-.711 2-1.588 2H4.588C3.711 14 3 13.105 3 12Z" clip-rule="evenodd"/></svg>',
|
|
207
207
|
keywords: ["minus-bold"],
|
|
208
208
|
category: "utility"
|
|
209
|
-
}, Fe = ze.bind(Te),
|
|
209
|
+
}, Fe = ze.bind(Te), Y = "purpur-icon", Ze = "md", Ve = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), Ge = ({ content: e = "", title: n } = {}) => {
|
|
210
210
|
const t = [
|
|
211
211
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
212
212
|
{ name: "fill", value: "currentColor" },
|
|
213
213
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
214
214
|
n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
215
215
|
], a = n ? `<title>${n}</title>` : "";
|
|
216
|
-
return `<svg ${
|
|
217
|
-
}, Ke = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(),
|
|
216
|
+
return `<svg ${Ve(t)}>${a}${e}</svg>`;
|
|
217
|
+
}, Ke = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Q = ({
|
|
218
218
|
["data-testid"]: e,
|
|
219
219
|
svg: n,
|
|
220
220
|
allyTitle: t,
|
|
@@ -222,10 +222,10 @@ const ze = /* @__PURE__ */ Be(Le), Te = {
|
|
|
222
222
|
size: u = Ze,
|
|
223
223
|
...r
|
|
224
224
|
}) => {
|
|
225
|
-
const o =
|
|
225
|
+
const o = Ge({
|
|
226
226
|
content: Ke(n.svg),
|
|
227
227
|
title: t
|
|
228
|
-
}), i = Fe(a,
|
|
228
|
+
}), i = Fe(a, Y, `${Y}--${u}`);
|
|
229
229
|
return /* @__PURE__ */ f(
|
|
230
230
|
"span",
|
|
231
231
|
{
|
|
@@ -257,16 +257,16 @@ function j() {
|
|
|
257
257
|
return e;
|
|
258
258
|
}, j.apply(this, arguments);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Xe(e, n) {
|
|
261
261
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function We(...e) {
|
|
264
264
|
return (n) => e.forEach(
|
|
265
|
-
(t) =>
|
|
265
|
+
(t) => Xe(t, n)
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
const ae = /* @__PURE__ */ _((e, n) => {
|
|
269
|
-
const { children: t, ...a } = e, u = v.toArray(t), r = u.find(
|
|
269
|
+
const { children: t, ...a } = e, u = v.toArray(t), r = u.find(Ye);
|
|
270
270
|
if (r) {
|
|
271
271
|
const o = r.props.children, i = u.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */ x(o) ? o.props.children : null : c);
|
|
272
272
|
return /* @__PURE__ */ p(F, j({}, a, {
|
|
@@ -281,16 +281,16 @@ ae.displayName = "Slot";
|
|
|
281
281
|
const F = /* @__PURE__ */ _((e, n) => {
|
|
282
282
|
const { children: t, ...a } = e;
|
|
283
283
|
return /* @__PURE__ */ x(t) ? /* @__PURE__ */ R(t, {
|
|
284
|
-
...
|
|
285
|
-
ref: n ?
|
|
284
|
+
...Qe(a, t.props),
|
|
285
|
+
ref: n ? We(n, t.ref) : t.ref
|
|
286
286
|
}) : v.count(t) > 1 ? v.only(null) : null;
|
|
287
287
|
});
|
|
288
288
|
F.displayName = "SlotClone";
|
|
289
289
|
const Je = ({ children: e }) => /* @__PURE__ */ p(re, null, e);
|
|
290
|
-
function
|
|
290
|
+
function Ye(e) {
|
|
291
291
|
return /* @__PURE__ */ x(e) && e.type === Je;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Qe(e, n) {
|
|
294
294
|
const t = {
|
|
295
295
|
...n
|
|
296
296
|
};
|
|
@@ -331,7 +331,7 @@ const er = [
|
|
|
331
331
|
], rr = er.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 A(() => {
|
|
335
335
|
window[Symbol.for("radix-ui")] = !0;
|
|
336
336
|
}, []), /* @__PURE__ */ p(i, j({}, o, {
|
|
337
337
|
ref: u
|
|
@@ -388,7 +388,7 @@ var ie = { exports: {} };
|
|
|
388
388
|
})();
|
|
389
389
|
})(ie);
|
|
390
390
|
var ar = ie.exports;
|
|
391
|
-
const ir = /* @__PURE__ */ or(ar),
|
|
391
|
+
const ir = /* @__PURE__ */ or(ar), B = {
|
|
392
392
|
"purpur-label": "_purpur-label_12cfi_1",
|
|
393
393
|
"purpur-label--negative": "_purpur-label--negative_12cfi_9",
|
|
394
394
|
"purpur-label--disabled": "_purpur-label--disabled_12cfi_12"
|
|
@@ -403,10 +403,10 @@ const ir = /* @__PURE__ */ or(ar), L = {
|
|
|
403
403
|
}) => {
|
|
404
404
|
const i = ir([
|
|
405
405
|
n,
|
|
406
|
-
|
|
406
|
+
B[z],
|
|
407
407
|
{
|
|
408
|
-
[
|
|
409
|
-
[
|
|
408
|
+
[B[`${z}--disabled`]]: u,
|
|
409
|
+
[B[`${z}--negative`]]: r
|
|
410
410
|
}
|
|
411
411
|
]);
|
|
412
412
|
return /* @__PURE__ */ f(nr, { className: i, "data-testid": a, htmlFor: t, ...o, children: e });
|
|
@@ -519,7 +519,7 @@ function se(...e) {
|
|
|
519
519
|
);
|
|
520
520
|
}
|
|
521
521
|
function le(...e) {
|
|
522
|
-
return
|
|
522
|
+
return G(se(...e), e);
|
|
523
523
|
}
|
|
524
524
|
function fr(e, n = []) {
|
|
525
525
|
let t = [];
|
|
@@ -609,7 +609,7 @@ function ee(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
|
609
609
|
}
|
|
610
610
|
function pe(e) {
|
|
611
611
|
const n = $(e);
|
|
612
|
-
return
|
|
612
|
+
return A(() => {
|
|
613
613
|
n.current = e;
|
|
614
614
|
}), k(
|
|
615
615
|
() => (...t) => {
|
|
@@ -624,7 +624,7 @@ function mr({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
624
624
|
const [a, u] = vr({
|
|
625
625
|
defaultProp: n,
|
|
626
626
|
onChange: t
|
|
627
|
-
}), r = e !== void 0, o = r ? e : a, i = pe(t), c =
|
|
627
|
+
}), r = e !== void 0, o = r ? e : a, i = pe(t), c = G((s) => {
|
|
628
628
|
if (r) {
|
|
629
629
|
const l = typeof s == "function" ? s(e) : s;
|
|
630
630
|
l !== e && i(l);
|
|
@@ -641,8 +641,8 @@ function mr({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
641
641
|
];
|
|
642
642
|
}
|
|
643
643
|
function vr({ defaultProp: e, onChange: n }) {
|
|
644
|
-
const t =
|
|
645
|
-
return
|
|
644
|
+
const t = L(e), [a] = t, u = $(a), r = pe(n);
|
|
645
|
+
return A(() => {
|
|
646
646
|
u.current !== a && (r(a), u.current = a);
|
|
647
647
|
}, [
|
|
648
648
|
a,
|
|
@@ -662,7 +662,7 @@ function br(e) {
|
|
|
662
662
|
const Z = globalThis != null && globalThis.document ? $e : () => {
|
|
663
663
|
};
|
|
664
664
|
function gr(e) {
|
|
665
|
-
const [n, t] =
|
|
665
|
+
const [n, t] = L(void 0);
|
|
666
666
|
return Z(() => {
|
|
667
667
|
if (e) {
|
|
668
668
|
t({
|
|
@@ -708,7 +708,7 @@ const de = (e) => {
|
|
|
708
708
|
};
|
|
709
709
|
de.displayName = "Presence";
|
|
710
710
|
function $r(e) {
|
|
711
|
-
const [n, t] =
|
|
711
|
+
const [n, t] = L(), a = $({}), u = $(e), r = $("none"), o = e ? "mounted" : "unmounted", [i, c] = _r(o, {
|
|
712
712
|
mounted: {
|
|
713
713
|
UNMOUNT: "unmounted",
|
|
714
714
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -721,7 +721,7 @@ function $r(e) {
|
|
|
721
721
|
MOUNT: "mounted"
|
|
722
722
|
}
|
|
723
723
|
});
|
|
724
|
-
return
|
|
724
|
+
return A(() => {
|
|
725
725
|
const s = q(a.current);
|
|
726
726
|
r.current = i === "mounted" ? s : "none";
|
|
727
727
|
}, [
|
|
@@ -758,7 +758,7 @@ function $r(e) {
|
|
|
758
758
|
"mounted",
|
|
759
759
|
"unmountSuspended"
|
|
760
760
|
].includes(i),
|
|
761
|
-
ref:
|
|
761
|
+
ref: G((s) => {
|
|
762
762
|
s && (a.current = getComputedStyle(s)), t(s);
|
|
763
763
|
}, [])
|
|
764
764
|
};
|
|
@@ -780,28 +780,28 @@ const fe = /* @__PURE__ */ _((e, n) => {
|
|
|
780
780
|
const { children: t, ...a } = e, u = v.toArray(t), r = u.find(xr);
|
|
781
781
|
if (r) {
|
|
782
782
|
const o = r.props.children, i = u.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */ x(o) ? o.props.children : null : c);
|
|
783
|
-
return /* @__PURE__ */ p(
|
|
783
|
+
return /* @__PURE__ */ p(V, M({}, a, {
|
|
784
784
|
ref: n
|
|
785
785
|
}), /* @__PURE__ */ x(o) ? /* @__PURE__ */ R(o, void 0, i) : null);
|
|
786
786
|
}
|
|
787
|
-
return /* @__PURE__ */ p(
|
|
787
|
+
return /* @__PURE__ */ p(V, M({}, a, {
|
|
788
788
|
ref: n
|
|
789
789
|
}), t);
|
|
790
790
|
});
|
|
791
791
|
fe.displayName = "Slot";
|
|
792
|
-
const
|
|
792
|
+
const V = /* @__PURE__ */ _((e, n) => {
|
|
793
793
|
const { children: t, ...a } = e;
|
|
794
794
|
return /* @__PURE__ */ x(t) ? /* @__PURE__ */ R(t, {
|
|
795
|
-
...
|
|
795
|
+
...Nr(a, t.props),
|
|
796
796
|
ref: n ? se(n, t.ref) : t.ref
|
|
797
797
|
}) : v.count(t) > 1 ? v.only(null) : null;
|
|
798
798
|
});
|
|
799
|
-
|
|
799
|
+
V.displayName = "SlotClone";
|
|
800
800
|
const yr = ({ children: e }) => /* @__PURE__ */ p(re, null, e);
|
|
801
801
|
function xr(e) {
|
|
802
802
|
return /* @__PURE__ */ x(e) && e.type === yr;
|
|
803
803
|
}
|
|
804
|
-
function
|
|
804
|
+
function Nr(e, n) {
|
|
805
805
|
const t = {
|
|
806
806
|
...n
|
|
807
807
|
};
|
|
@@ -822,7 +822,7 @@ function wr(e, n) {
|
|
|
822
822
|
...t
|
|
823
823
|
};
|
|
824
824
|
}
|
|
825
|
-
const
|
|
825
|
+
const wr = [
|
|
826
826
|
"a",
|
|
827
827
|
"button",
|
|
828
828
|
"div",
|
|
@@ -839,10 +839,10 @@ const Nr = [
|
|
|
839
839
|
"span",
|
|
840
840
|
"svg",
|
|
841
841
|
"ul"
|
|
842
|
-
], he =
|
|
842
|
+
], he = wr.reduce((e, n) => {
|
|
843
843
|
const t = /* @__PURE__ */ _((a, u) => {
|
|
844
844
|
const { asChild: r, ...o } = a, i = r ? fe : n;
|
|
845
|
-
return
|
|
845
|
+
return A(() => {
|
|
846
846
|
window[Symbol.for("radix-ui")] = !0;
|
|
847
847
|
}, []), /* @__PURE__ */ p(i, M({}, o, {
|
|
848
848
|
ref: u
|
|
@@ -852,25 +852,25 @@ const Nr = [
|
|
|
852
852
|
...e,
|
|
853
853
|
[n]: t
|
|
854
854
|
};
|
|
855
|
-
}, {}), me = "Checkbox", [Sr, Tr] = fr(me), [
|
|
856
|
-
const { __scopeCheckbox: t, name: a, checked: u, defaultChecked: r, required: o, disabled: i, value: c = "on", onCheckedChange: s, ...h } = e, [l, d] =
|
|
855
|
+
}, {}), me = "Checkbox", [Sr, Tr] = fr(me), [Ar, Or] = Sr(me), Pr = /* @__PURE__ */ _((e, n) => {
|
|
856
|
+
const { __scopeCheckbox: t, name: a, checked: u, defaultChecked: r, required: o, disabled: i, value: c = "on", onCheckedChange: s, ...h } = e, [l, d] = L(null), b = le(
|
|
857
857
|
n,
|
|
858
858
|
(m) => d(m)
|
|
859
|
-
), g = $(!1), D = l ? !!l.closest("form") : !0, [y = !1,
|
|
859
|
+
), g = $(!1), D = l ? !!l.closest("form") : !0, [y = !1, I] = mr({
|
|
860
860
|
prop: u,
|
|
861
861
|
defaultProp: r,
|
|
862
862
|
onChange: s
|
|
863
863
|
}), ge = $(y);
|
|
864
|
-
return
|
|
864
|
+
return A(() => {
|
|
865
865
|
const m = l == null ? void 0 : l.form;
|
|
866
866
|
if (m) {
|
|
867
|
-
const
|
|
868
|
-
return m.addEventListener("reset",
|
|
867
|
+
const O = () => I(ge.current);
|
|
868
|
+
return m.addEventListener("reset", O), () => m.removeEventListener("reset", O);
|
|
869
869
|
}
|
|
870
870
|
}, [
|
|
871
871
|
l,
|
|
872
|
-
|
|
873
|
-
]), /* @__PURE__ */ p(
|
|
872
|
+
I
|
|
873
|
+
]), /* @__PURE__ */ p(Ar, {
|
|
874
874
|
scope: t,
|
|
875
875
|
state: y,
|
|
876
876
|
disabled: i
|
|
@@ -889,8 +889,8 @@ const Nr = [
|
|
|
889
889
|
m.key === "Enter" && m.preventDefault();
|
|
890
890
|
}),
|
|
891
891
|
onClick: ee(e.onClick, (m) => {
|
|
892
|
-
|
|
893
|
-
(
|
|
892
|
+
I(
|
|
893
|
+
(O) => S(O) ? !0 : !O
|
|
894
894
|
), D && (g.current = m.isPropagationStopped(), g.current || m.stopPropagation());
|
|
895
895
|
})
|
|
896
896
|
})), D && /* @__PURE__ */ p(jr, {
|
|
@@ -906,7 +906,7 @@ const Nr = [
|
|
|
906
906
|
}
|
|
907
907
|
}));
|
|
908
908
|
}), Cr = "CheckboxIndicator", kr = /* @__PURE__ */ _((e, n) => {
|
|
909
|
-
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r =
|
|
909
|
+
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r = Or(Cr, t);
|
|
910
910
|
return /* @__PURE__ */ p(de, {
|
|
911
911
|
present: a || S(r.state) || r.state === !0
|
|
912
912
|
}, /* @__PURE__ */ p(he.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
|
|
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", {
|
|
@@ -997,7 +997,7 @@ var be = { exports: {} };
|
|
|
997
997
|
})();
|
|
998
998
|
})(be);
|
|
999
999
|
var Dr = be.exports;
|
|
1000
|
-
const T = /* @__PURE__ */ Rr(Dr),
|
|
1000
|
+
const T = /* @__PURE__ */ Rr(Dr), N = {
|
|
1001
1001
|
"purpur-checkbox": "_purpur-checkbox_10fl8_1",
|
|
1002
1002
|
"purpur-checkbox__box": "_purpur-checkbox__box_10fl8_7",
|
|
1003
1003
|
"purpur-checkbox--error": "_purpur-checkbox--error_10fl8_16",
|
|
@@ -1005,7 +1005,7 @@ const T = /* @__PURE__ */ Rr(Dr), w = {
|
|
|
1005
1005
|
"purpur-checkbox__label": "_purpur-checkbox__label_10fl8_70",
|
|
1006
1006
|
"purpur-checkbox__wrapper": "_purpur-checkbox__wrapper_10fl8_73",
|
|
1007
1007
|
"purpur-checkbox__container": "_purpur-checkbox__container_10fl8_79"
|
|
1008
|
-
}, Ur = ["indeterminate", !0, !1],
|
|
1008
|
+
}, Ur = ["indeterminate", !0, !1], w = "purpur-checkbox", qr = ({
|
|
1009
1009
|
["data-testid"]: e,
|
|
1010
1010
|
checked: n,
|
|
1011
1011
|
className: t,
|
|
@@ -1015,28 +1015,28 @@ const T = /* @__PURE__ */ Rr(Dr), w = {
|
|
|
1015
1015
|
...o
|
|
1016
1016
|
}, i) => {
|
|
1017
1017
|
const c = a && !n;
|
|
1018
|
-
return /* @__PURE__ */ U("div", { className: T([t,
|
|
1019
|
-
/* @__PURE__ */ U("div", { className: T([t,
|
|
1018
|
+
return /* @__PURE__ */ U("div", { className: T([t, N[`${w}__wrapper`]]), children: [
|
|
1019
|
+
/* @__PURE__ */ U("div", { className: T([t, N[`${w}__container`]]), children: [
|
|
1020
1020
|
/* @__PURE__ */ f(
|
|
1021
1021
|
Er,
|
|
1022
1022
|
{
|
|
1023
1023
|
...o,
|
|
1024
1024
|
checked: n,
|
|
1025
|
-
className: T(w
|
|
1026
|
-
[
|
|
1025
|
+
className: T(N[w], {
|
|
1026
|
+
[N[`${w}--error`]]: c
|
|
1027
1027
|
}),
|
|
1028
1028
|
"data-testid": e,
|
|
1029
1029
|
onCheckedChange: r,
|
|
1030
1030
|
ref: i,
|
|
1031
|
-
children: /* @__PURE__ */ f("span", { className:
|
|
1032
|
-
|
|
1031
|
+
children: /* @__PURE__ */ f("span", { className: N[`${w}__box`], children: /* @__PURE__ */ f(Mr, { className: N[`${w}__indicator`], children: n === "indeterminate" ? /* @__PURE__ */ f(
|
|
1032
|
+
Q,
|
|
1033
1033
|
{
|
|
1034
1034
|
"data-testid": e && `${e}-checked-icon`,
|
|
1035
1035
|
size: "xs",
|
|
1036
1036
|
svg: He
|
|
1037
1037
|
}
|
|
1038
1038
|
) : /* @__PURE__ */ f(
|
|
1039
|
-
|
|
1039
|
+
Q,
|
|
1040
1040
|
{
|
|
1041
1041
|
"data-testid": e && `${e}-indeterminate-icon`,
|
|
1042
1042
|
size: "xs",
|
|
@@ -1051,17 +1051,17 @@ const T = /* @__PURE__ */ Rr(Dr), w = {
|
|
|
1051
1051
|
htmlFor: o.id,
|
|
1052
1052
|
"data-testid": e && `${e}-label`,
|
|
1053
1053
|
disabled: o.disabled,
|
|
1054
|
-
className:
|
|
1054
|
+
className: N[`${w}__label`],
|
|
1055
1055
|
children: /* @__PURE__ */ f(ce, { variant: "paragraph-100", disabled: o.disabled, children: `${o.required ? "* " : ""}${u}` })
|
|
1056
1056
|
}
|
|
1057
1057
|
)
|
|
1058
1058
|
] }),
|
|
1059
|
-
c && /* @__PURE__ */ f(
|
|
1059
|
+
c && /* @__PURE__ */ f(Le, { "data-testid": e && `${e}-error-text`, children: a })
|
|
1060
1060
|
] });
|
|
1061
|
-
},
|
|
1062
|
-
|
|
1061
|
+
}, Lr = _(qr);
|
|
1062
|
+
Lr.displayName = "Checkbox";
|
|
1063
1063
|
export {
|
|
1064
|
-
|
|
1064
|
+
Lr as Checkbox,
|
|
1065
1065
|
Ur as checkedState
|
|
1066
1066
|
};
|
|
1067
1067
|
//# sourceMappingURL=checkbox.es.js.map
|