@purpurds/checkbox 8.8.1 → 8.9.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 +5 -5
- package/dist/checkbox.cjs.js +1 -29
- package/dist/checkbox.cjs.js.map +1 -1
- package/dist/checkbox.es.js +82 -132
- package/dist/checkbox.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +24 -24
package/dist/checkbox.es.js
CHANGED
|
@@ -5,13 +5,7 @@ import "react-dom";
|
|
|
5
5
|
function ge(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var q = { exports: {} };
|
|
9
|
-
/*!
|
|
10
|
-
Copyright (c) 2018 Jed Watson.
|
|
11
|
-
Licensed under the MIT License (MIT), see
|
|
12
|
-
http://jedwatson.github.io/classnames
|
|
13
|
-
*/
|
|
14
|
-
var z;
|
|
8
|
+
var q = { exports: {} }, z;
|
|
15
9
|
function ve() {
|
|
16
10
|
return z || (z = 1, (function(e) {
|
|
17
11
|
(function() {
|
|
@@ -78,13 +72,7 @@ const ke = {
|
|
|
78
72
|
function Oe(e) {
|
|
79
73
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
80
74
|
}
|
|
81
|
-
var W = { exports: {} };
|
|
82
|
-
/*!
|
|
83
|
-
Copyright (c) 2018 Jed Watson.
|
|
84
|
-
Licensed under the MIT License (MIT), see
|
|
85
|
-
http://jedwatson.github.io/classnames
|
|
86
|
-
*/
|
|
87
|
-
var L;
|
|
75
|
+
var W = { exports: {} }, L;
|
|
88
76
|
function Pe() {
|
|
89
77
|
return L || (L = 1, (function(e) {
|
|
90
78
|
(function() {
|
|
@@ -122,7 +110,7 @@ const Re = /* @__PURE__ */ Oe(Ae), Ee = {
|
|
|
122
110
|
"purpur-field-error-text": "_purpur-field-error-text_u1cy2_1",
|
|
123
111
|
"purpur-field-error-text--negative": "_purpur-field-error-text--negative_u1cy2_11",
|
|
124
112
|
"purpur-field-error-text__icon": "_purpur-field-error-text__icon_u1cy2_14"
|
|
125
|
-
},
|
|
113
|
+
}, H = Re.bind(Ee), A = "purpur-field-error-text", Me = ({
|
|
126
114
|
children: e,
|
|
127
115
|
className: t,
|
|
128
116
|
negative: n = !1,
|
|
@@ -131,14 +119,14 @@ const Re = /* @__PURE__ */ Oe(Ae), Ee = {
|
|
|
131
119
|
}) => /* @__PURE__ */ S(
|
|
132
120
|
"div",
|
|
133
121
|
{
|
|
134
|
-
className:
|
|
122
|
+
className: H(t, A, {
|
|
135
123
|
[`${A}--negative`]: n
|
|
136
124
|
}),
|
|
137
125
|
"aria-live": "assertive",
|
|
138
126
|
"aria-relevant": a,
|
|
139
127
|
...i,
|
|
140
128
|
children: [
|
|
141
|
-
/* @__PURE__ */ p(te, { svg: ke, size: "xs", className:
|
|
129
|
+
/* @__PURE__ */ p(te, { svg: ke, size: "xs", className: H(`${A}__icon`) }),
|
|
142
130
|
e
|
|
143
131
|
]
|
|
144
132
|
}
|
|
@@ -146,15 +134,9 @@ const Re = /* @__PURE__ */ Oe(Ae), Ee = {
|
|
|
146
134
|
function je(e) {
|
|
147
135
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
148
136
|
}
|
|
149
|
-
var
|
|
150
|
-
/*!
|
|
151
|
-
Copyright (c) 2018 Jed Watson.
|
|
152
|
-
Licensed under the MIT License (MIT), see
|
|
153
|
-
http://jedwatson.github.io/classnames
|
|
154
|
-
*/
|
|
155
|
-
var V;
|
|
137
|
+
var T = { exports: {} }, U;
|
|
156
138
|
function De() {
|
|
157
|
-
return
|
|
139
|
+
return U || (U = 1, (function(e) {
|
|
158
140
|
(function() {
|
|
159
141
|
var t = {}.hasOwnProperty;
|
|
160
142
|
function n() {
|
|
@@ -183,7 +165,7 @@ function De() {
|
|
|
183
165
|
}
|
|
184
166
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
185
167
|
})();
|
|
186
|
-
})(
|
|
168
|
+
})(T)), T.exports;
|
|
187
169
|
}
|
|
188
170
|
var Ie = De();
|
|
189
171
|
const qe = /* @__PURE__ */ je(Ie), ze = {
|
|
@@ -207,15 +189,9 @@ const qe = /* @__PURE__ */ je(Ie), ze = {
|
|
|
207
189
|
function Le(e) {
|
|
208
190
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
209
191
|
}
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
Licensed under the MIT License (MIT), see
|
|
214
|
-
http://jedwatson.github.io/classnames
|
|
215
|
-
*/
|
|
216
|
-
var Z;
|
|
217
|
-
function Te() {
|
|
218
|
-
return Z || (Z = 1, (function(e) {
|
|
192
|
+
var V = { exports: {} }, F;
|
|
193
|
+
function He() {
|
|
194
|
+
return F || (F = 1, (function(e) {
|
|
219
195
|
(function() {
|
|
220
196
|
var t = {}.hasOwnProperty;
|
|
221
197
|
function n() {
|
|
@@ -244,10 +220,10 @@ function Te() {
|
|
|
244
220
|
}
|
|
245
221
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
246
222
|
})();
|
|
247
|
-
})(
|
|
223
|
+
})(V)), V.exports;
|
|
248
224
|
}
|
|
249
|
-
var
|
|
250
|
-
const
|
|
225
|
+
var Te = He();
|
|
226
|
+
const Ue = /* @__PURE__ */ Le(Te), Ve = {
|
|
251
227
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
252
228
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
253
229
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -255,7 +231,7 @@ const Ve = /* @__PURE__ */ Le(Ue), Fe = {
|
|
|
255
231
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
256
232
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
257
233
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
258
|
-
},
|
|
234
|
+
}, Fe = Ue.bind(Ve), Z = "purpur-icon", Ze = "md", Ke = (e) => e.filter((t) => Object.keys(t).length >= 1).map((t) => `${t.name}="${t.value}"`).join(" "), Ge = ({ content: e = "", title: t } = {}) => {
|
|
259
235
|
const n = [
|
|
260
236
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
261
237
|
{ name: "fill", value: "currentColor" },
|
|
@@ -263,11 +239,11 @@ const Ve = /* @__PURE__ */ Le(Ue), Fe = {
|
|
|
263
239
|
t ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
264
240
|
], a = t ? `<title>${t}</title>` : "";
|
|
265
241
|
return `<svg ${Ke(n)}>${a}${e}</svg>`;
|
|
266
|
-
}, Xe = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), j = ({ svg: e, allyTitle: t, className: n, size: a =
|
|
242
|
+
}, Xe = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), j = ({ svg: e, allyTitle: t, className: n, size: a = Ze, ...i }) => {
|
|
267
243
|
const r = Ge({
|
|
268
244
|
content: Xe(e.svg),
|
|
269
245
|
title: t
|
|
270
|
-
}), o =
|
|
246
|
+
}), o = Fe(Z, `${Z}--${a}`, n);
|
|
271
247
|
return /* @__PURE__ */ p("span", { className: o, dangerouslySetInnerHTML: { __html: r }, ...i });
|
|
272
248
|
};
|
|
273
249
|
j.displayName = "Icon";
|
|
@@ -352,9 +328,8 @@ function ar(e, t) {
|
|
|
352
328
|
return { ...e, ...n };
|
|
353
329
|
}
|
|
354
330
|
function ur(e) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
return i ? e.ref : (a = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, i = a && "isReactWarning" in a && a.isReactWarning, i ? e.props.ref : e.props.ref || e.ref);
|
|
331
|
+
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
332
|
+
return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
358
333
|
}
|
|
359
334
|
var sr = [
|
|
360
335
|
"a",
|
|
@@ -386,8 +361,7 @@ var sr = [
|
|
|
386
361
|
...e,
|
|
387
362
|
ref: t,
|
|
388
363
|
onMouseDown: (n) => {
|
|
389
|
-
|
|
390
|
-
n.target.closest("button, input, select, textarea") || ((a = e.onMouseDown) == null || a.call(e, n), !n.defaultPrevented && n.detail > 1 && n.preventDefault());
|
|
364
|
+
n.target.closest("button, input, select, textarea") || (e.onMouseDown?.(n), !n.defaultPrevented && n.detail > 1 && n.preventDefault());
|
|
391
365
|
}
|
|
392
366
|
}
|
|
393
367
|
));
|
|
@@ -396,13 +370,7 @@ var pr = oe;
|
|
|
396
370
|
function fr(e) {
|
|
397
371
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
398
372
|
}
|
|
399
|
-
var G = { exports: {} };
|
|
400
|
-
/*!
|
|
401
|
-
Copyright (c) 2018 Jed Watson.
|
|
402
|
-
Licensed under the MIT License (MIT), see
|
|
403
|
-
http://jedwatson.github.io/classnames
|
|
404
|
-
*/
|
|
405
|
-
var X;
|
|
373
|
+
var G = { exports: {} }, X;
|
|
406
374
|
function dr() {
|
|
407
375
|
return X || (X = 1, (function(e) {
|
|
408
376
|
(function() {
|
|
@@ -456,13 +424,7 @@ const mr = /* @__PURE__ */ fr(hr), _r = {
|
|
|
456
424
|
function yr(e) {
|
|
457
425
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
458
426
|
}
|
|
459
|
-
var J = { exports: {} };
|
|
460
|
-
/*!
|
|
461
|
-
Copyright (c) 2018 Jed Watson.
|
|
462
|
-
Licensed under the MIT License (MIT), see
|
|
463
|
-
http://jedwatson.github.io/classnames
|
|
464
|
-
*/
|
|
465
|
-
var Q;
|
|
427
|
+
var J = { exports: {} }, Q;
|
|
466
428
|
function br() {
|
|
467
429
|
return Q || (Q = 1, (function(e) {
|
|
468
430
|
(function() {
|
|
@@ -560,14 +522,12 @@ function Nr(e, t = []) {
|
|
|
560
522
|
const u = s.createContext(o), c = n.length;
|
|
561
523
|
n = [...n, o];
|
|
562
524
|
const l = (f) => {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
return /* @__PURE__ */ p(v.Provider, { value: w, children: m });
|
|
525
|
+
const { scope: m, children: h, ..._ } = f, b = m?.[e]?.[c] || u, $ = s.useMemo(() => _, Object.values(_));
|
|
526
|
+
return /* @__PURE__ */ p(b.Provider, { value: $, children: h });
|
|
566
527
|
};
|
|
567
528
|
l.displayName = r + "Provider";
|
|
568
|
-
function d(f,
|
|
569
|
-
|
|
570
|
-
const m = ((v = h == null ? void 0 : h[e]) == null ? void 0 : v[c]) || u, _ = s.useContext(m);
|
|
529
|
+
function d(f, m) {
|
|
530
|
+
const h = m?.[e]?.[c] || u, _ = s.useContext(h);
|
|
571
531
|
if (_) return _;
|
|
572
532
|
if (o !== void 0) return o;
|
|
573
533
|
throw new Error(`\`${f}\` must be used within \`${r}\``);
|
|
@@ -577,7 +537,7 @@ function Nr(e, t = []) {
|
|
|
577
537
|
const i = () => {
|
|
578
538
|
const r = n.map((o) => s.createContext(o));
|
|
579
539
|
return function(u) {
|
|
580
|
-
const c =
|
|
540
|
+
const c = u?.[e] || r;
|
|
581
541
|
return s.useMemo(
|
|
582
542
|
() => ({ [`__scope${e}`]: { ...u, [e]: c } }),
|
|
583
543
|
[u, c]
|
|
@@ -606,18 +566,15 @@ function kr(...e) {
|
|
|
606
566
|
}
|
|
607
567
|
function ee(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
608
568
|
return function(i) {
|
|
609
|
-
if (e
|
|
610
|
-
return t
|
|
569
|
+
if (e?.(i), n === !1 || !i.defaultPrevented)
|
|
570
|
+
return t?.(i);
|
|
611
571
|
};
|
|
612
572
|
}
|
|
613
573
|
function se(e) {
|
|
614
574
|
const t = s.useRef(e);
|
|
615
575
|
return s.useEffect(() => {
|
|
616
576
|
t.current = e;
|
|
617
|
-
}), s.useMemo(() => (...n) =>
|
|
618
|
-
var a;
|
|
619
|
-
return (a = t.current) == null ? void 0 : a.call(t, ...n);
|
|
620
|
-
}, []);
|
|
577
|
+
}), s.useMemo(() => (...n) => t.current?.(...n), []);
|
|
621
578
|
}
|
|
622
579
|
function Or({
|
|
623
580
|
prop: e,
|
|
@@ -650,7 +607,7 @@ function Ar(e) {
|
|
|
650
607
|
const t = s.useRef({ value: e, previous: e });
|
|
651
608
|
return s.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
|
|
652
609
|
}
|
|
653
|
-
var D = globalThis
|
|
610
|
+
var D = globalThis?.document ? s.useLayoutEffect : () => {
|
|
654
611
|
};
|
|
655
612
|
function Rr(e) {
|
|
656
613
|
const [t, n] = s.useState(void 0);
|
|
@@ -702,25 +659,25 @@ function Mr(e) {
|
|
|
702
659
|
}, [u]), D(() => {
|
|
703
660
|
const l = a.current, d = i.current;
|
|
704
661
|
if (d !== e) {
|
|
705
|
-
const
|
|
706
|
-
e ? c("MOUNT") :
|
|
662
|
+
const m = r.current, h = k(l);
|
|
663
|
+
e ? c("MOUNT") : h === "none" || l?.display === "none" ? c("UNMOUNT") : c(d && m !== h ? "ANIMATION_OUT" : "UNMOUNT"), i.current = e;
|
|
707
664
|
}
|
|
708
665
|
}, [e, c]), D(() => {
|
|
709
666
|
if (t) {
|
|
710
667
|
let l;
|
|
711
|
-
const d = t.ownerDocument.defaultView ?? window, f = (
|
|
712
|
-
const
|
|
713
|
-
if (
|
|
714
|
-
const
|
|
668
|
+
const d = t.ownerDocument.defaultView ?? window, f = (h) => {
|
|
669
|
+
const b = k(a.current).includes(h.animationName);
|
|
670
|
+
if (h.target === t && b && (c("ANIMATION_END"), !i.current)) {
|
|
671
|
+
const $ = t.style.animationFillMode;
|
|
715
672
|
t.style.animationFillMode = "forwards", l = d.setTimeout(() => {
|
|
716
|
-
t.style.animationFillMode === "forwards" && (t.style.animationFillMode =
|
|
673
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = $);
|
|
717
674
|
});
|
|
718
675
|
}
|
|
719
|
-
},
|
|
720
|
-
|
|
676
|
+
}, m = (h) => {
|
|
677
|
+
h.target === t && (r.current = k(a.current));
|
|
721
678
|
};
|
|
722
|
-
return t.addEventListener("animationstart",
|
|
723
|
-
d.clearTimeout(l), t.removeEventListener("animationstart",
|
|
679
|
+
return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
|
|
680
|
+
d.clearTimeout(l), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
|
|
724
681
|
};
|
|
725
682
|
} else
|
|
726
683
|
c("ANIMATION_END");
|
|
@@ -732,12 +689,11 @@ function Mr(e) {
|
|
|
732
689
|
};
|
|
733
690
|
}
|
|
734
691
|
function k(e) {
|
|
735
|
-
return
|
|
692
|
+
return e?.animationName || "none";
|
|
736
693
|
}
|
|
737
694
|
function jr(e) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
return n ? e.ref : (t = (i = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : i.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
695
|
+
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
696
|
+
return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
741
697
|
}
|
|
742
698
|
// @__NO_SIDE_EFFECTS__
|
|
743
699
|
function Dr(e) {
|
|
@@ -778,9 +734,8 @@ function Br(e, t) {
|
|
|
778
734
|
return { ...e, ...n };
|
|
779
735
|
}
|
|
780
736
|
function Wr(e) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
return n ? e.ref : (t = (i = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : i.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
737
|
+
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
738
|
+
return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
784
739
|
}
|
|
785
740
|
var Lr = [
|
|
786
741
|
"a",
|
|
@@ -805,7 +760,7 @@ var Lr = [
|
|
|
805
760
|
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ p(c, { ...u, ref: r });
|
|
806
761
|
});
|
|
807
762
|
return a.displayName = `Primitive.${t}`, { ...e, [t]: a };
|
|
808
|
-
}, {}), I = "Checkbox", [
|
|
763
|
+
}, {}), I = "Checkbox", [Hr] = Nr(I), [Tr, Ur] = Hr(I), pe = s.forwardRef(
|
|
809
764
|
(e, t) => {
|
|
810
765
|
const {
|
|
811
766
|
__scopeCheckbox: n,
|
|
@@ -818,26 +773,26 @@ var Lr = [
|
|
|
818
773
|
onCheckedChange: l,
|
|
819
774
|
form: d,
|
|
820
775
|
...f
|
|
821
|
-
} = e, [
|
|
776
|
+
} = e, [m, h] = s.useState(null), _ = ue(t, (g) => h(g)), b = s.useRef(!1), $ = m ? d || !!m.closest("form") : !0, [w = !1, P] = Or({
|
|
822
777
|
prop: i,
|
|
823
778
|
defaultProp: r,
|
|
824
779
|
onChange: l
|
|
825
|
-
}), me = s.useRef(
|
|
780
|
+
}), me = s.useRef(w);
|
|
826
781
|
return s.useEffect(() => {
|
|
827
|
-
const g =
|
|
782
|
+
const g = m?.form;
|
|
828
783
|
if (g) {
|
|
829
784
|
const C = () => P(me.current);
|
|
830
785
|
return g.addEventListener("reset", C), () => g.removeEventListener("reset", C);
|
|
831
786
|
}
|
|
832
|
-
}, [
|
|
787
|
+
}, [m, P]), /* @__PURE__ */ S(Tr, { scope: n, state: w, disabled: u, children: [
|
|
833
788
|
/* @__PURE__ */ p(
|
|
834
789
|
le.button,
|
|
835
790
|
{
|
|
836
791
|
type: "button",
|
|
837
792
|
role: "checkbox",
|
|
838
|
-
"aria-checked":
|
|
793
|
+
"aria-checked": y(w) ? "mixed" : w,
|
|
839
794
|
"aria-required": o,
|
|
840
|
-
"data-state": he(
|
|
795
|
+
"data-state": he(w),
|
|
841
796
|
"data-disabled": u ? "" : void 0,
|
|
842
797
|
disabled: u,
|
|
843
798
|
value: c,
|
|
@@ -847,23 +802,23 @@ var Lr = [
|
|
|
847
802
|
g.key === "Enter" && g.preventDefault();
|
|
848
803
|
}),
|
|
849
804
|
onClick: ee(e.onClick, (g) => {
|
|
850
|
-
P((C) =>
|
|
805
|
+
P((C) => y(C) ? !0 : !C), $ && (b.current = g.isPropagationStopped(), b.current || g.stopPropagation());
|
|
851
806
|
})
|
|
852
807
|
}
|
|
853
808
|
),
|
|
854
|
-
|
|
855
|
-
|
|
809
|
+
$ && /* @__PURE__ */ p(
|
|
810
|
+
Vr,
|
|
856
811
|
{
|
|
857
|
-
control:
|
|
858
|
-
bubbles: !
|
|
812
|
+
control: m,
|
|
813
|
+
bubbles: !b.current,
|
|
859
814
|
name: a,
|
|
860
815
|
value: c,
|
|
861
|
-
checked:
|
|
816
|
+
checked: w,
|
|
862
817
|
required: o,
|
|
863
818
|
disabled: u,
|
|
864
819
|
form: d,
|
|
865
820
|
style: { transform: "translateX(-100%)" },
|
|
866
|
-
defaultChecked:
|
|
821
|
+
defaultChecked: y(r) ? !1 : r
|
|
867
822
|
}
|
|
868
823
|
)
|
|
869
824
|
] });
|
|
@@ -872,8 +827,8 @@ var Lr = [
|
|
|
872
827
|
pe.displayName = I;
|
|
873
828
|
var fe = "CheckboxIndicator", de = s.forwardRef(
|
|
874
829
|
(e, t) => {
|
|
875
|
-
const { __scopeCheckbox: n, forceMount: a, ...i } = e, r =
|
|
876
|
-
return /* @__PURE__ */ p(ce, { present: a ||
|
|
830
|
+
const { __scopeCheckbox: n, forceMount: a, ...i } = e, r = Ur(fe, n);
|
|
831
|
+
return /* @__PURE__ */ p(ce, { present: a || y(r.state) || r.state === !0, children: /* @__PURE__ */ p(
|
|
877
832
|
le.span,
|
|
878
833
|
{
|
|
879
834
|
"data-state": he(r.state),
|
|
@@ -886,16 +841,16 @@ var fe = "CheckboxIndicator", de = s.forwardRef(
|
|
|
886
841
|
}
|
|
887
842
|
);
|
|
888
843
|
de.displayName = fe;
|
|
889
|
-
var
|
|
844
|
+
var Vr = (e) => {
|
|
890
845
|
const { control: t, checked: n, bubbles: a = !0, defaultChecked: i, ...r } = e, o = s.useRef(null), u = Ar(n), c = Rr(t);
|
|
891
846
|
s.useEffect(() => {
|
|
892
|
-
const d = o.current, f = window.HTMLInputElement.prototype,
|
|
893
|
-
if (u !== n &&
|
|
847
|
+
const d = o.current, f = window.HTMLInputElement.prototype, h = Object.getOwnPropertyDescriptor(f, "checked").set;
|
|
848
|
+
if (u !== n && h) {
|
|
894
849
|
const _ = new Event("click", { bubbles: a });
|
|
895
|
-
d.indeterminate =
|
|
850
|
+
d.indeterminate = y(n), h.call(d, y(n) ? !1 : n), d.dispatchEvent(_);
|
|
896
851
|
}
|
|
897
852
|
}, [u, n, a]);
|
|
898
|
-
const l = s.useRef(
|
|
853
|
+
const l = s.useRef(y(n) ? !1 : n);
|
|
899
854
|
return /* @__PURE__ */ p(
|
|
900
855
|
"input",
|
|
901
856
|
{
|
|
@@ -916,22 +871,17 @@ var Fr = (e) => {
|
|
|
916
871
|
}
|
|
917
872
|
);
|
|
918
873
|
};
|
|
919
|
-
function
|
|
874
|
+
function y(e) {
|
|
920
875
|
return e === "indeterminate";
|
|
921
876
|
}
|
|
922
877
|
function he(e) {
|
|
923
|
-
return
|
|
878
|
+
return y(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
924
879
|
}
|
|
925
|
-
var
|
|
880
|
+
var Fr = pe, Zr = de;
|
|
926
881
|
function Kr(e) {
|
|
927
882
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
928
883
|
}
|
|
929
884
|
var M = { exports: {} };
|
|
930
|
-
/*!
|
|
931
|
-
Copyright (c) 2018 Jed Watson.
|
|
932
|
-
Licensed under the MIT License (MIT), see
|
|
933
|
-
http://jedwatson.github.io/classnames
|
|
934
|
-
*/
|
|
935
885
|
var re;
|
|
936
886
|
function Gr() {
|
|
937
887
|
return re || (re = 1, (function(e) {
|
|
@@ -975,7 +925,7 @@ const Jr = /* @__PURE__ */ Kr(Xr), Qr = {
|
|
|
975
925
|
"purpur-checkbox__label-container": "_purpur-checkbox__label-container_150ck_70",
|
|
976
926
|
"purpur-checkbox__wrapper": "_purpur-checkbox__wrapper_150ck_76",
|
|
977
927
|
"purpur-checkbox__container": "_purpur-checkbox__container_150ck_82"
|
|
978
|
-
},
|
|
928
|
+
}, x = Jr.bind(Qr), nt = ["indeterminate", !0, !1], v = "purpur-checkbox", Yr = _e(
|
|
979
929
|
({
|
|
980
930
|
["data-testid"]: e,
|
|
981
931
|
checked: t,
|
|
@@ -988,24 +938,24 @@ const Jr = /* @__PURE__ */ Kr(Xr), Qr = {
|
|
|
988
938
|
...c
|
|
989
939
|
}, l) => {
|
|
990
940
|
const d = i && !t, f = a && !t;
|
|
991
|
-
return /* @__PURE__ */ S("div", { className:
|
|
992
|
-
/* @__PURE__ */ S("div", { className:
|
|
941
|
+
return /* @__PURE__ */ S("div", { className: x([`${v}__wrapper`, n]), children: [
|
|
942
|
+
/* @__PURE__ */ S("div", { className: x([`${v}__container`, n]), children: [
|
|
993
943
|
/* @__PURE__ */ p(
|
|
994
|
-
|
|
944
|
+
Fr,
|
|
995
945
|
{
|
|
996
946
|
...c,
|
|
997
947
|
checked: t,
|
|
998
|
-
className:
|
|
999
|
-
|
|
948
|
+
className: x([
|
|
949
|
+
v,
|
|
1000
950
|
{
|
|
1001
|
-
[`${
|
|
1002
|
-
[`${
|
|
951
|
+
[`${v}--error`]: d,
|
|
952
|
+
[`${v}--error-checkbox`]: f
|
|
1003
953
|
}
|
|
1004
954
|
]),
|
|
1005
955
|
"data-testid": e,
|
|
1006
956
|
onCheckedChange: u,
|
|
1007
957
|
ref: l,
|
|
1008
|
-
children: /* @__PURE__ */ p("span", { className:
|
|
958
|
+
children: /* @__PURE__ */ p("span", { className: x(`${v}__box`), children: /* @__PURE__ */ p(Zr, { className: x(`${v}__indicator`), children: t === "indeterminate" ? /* @__PURE__ */ p(
|
|
1009
959
|
j,
|
|
1010
960
|
{
|
|
1011
961
|
"data-testid": e && `${e}-checked-icon`,
|
|
@@ -1022,7 +972,7 @@ const Jr = /* @__PURE__ */ Kr(Xr), Qr = {
|
|
|
1022
972
|
) }) })
|
|
1023
973
|
}
|
|
1024
974
|
),
|
|
1025
|
-
/* @__PURE__ */ S("span", { className:
|
|
975
|
+
/* @__PURE__ */ S("span", { className: x(`${v}__label-container`), children: [
|
|
1026
976
|
r && /* @__PURE__ */ p(
|
|
1027
977
|
vr,
|
|
1028
978
|
{
|
|
@@ -1038,7 +988,7 @@ const Jr = /* @__PURE__ */ Kr(Xr), Qr = {
|
|
|
1038
988
|
o && /* @__PURE__ */ p(
|
|
1039
989
|
We,
|
|
1040
990
|
{
|
|
1041
|
-
className:
|
|
991
|
+
className: x(`${v}__helper`),
|
|
1042
992
|
"data-testid": e && `${e}-helper-text`,
|
|
1043
993
|
disabled: c.disabled,
|
|
1044
994
|
id: `${c.id}-helper-text`,
|