@purpurds/checkbox 3.0.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.
@@ -0,0 +1,1063 @@
1
+ import { jsxs as z, jsx as f } from "react/jsx-runtime";
2
+ import { forwardRef as g, Children as v, isValidElement as x, createElement as p, cloneElement as E, useEffect as C, Fragment as re, useCallback as F, createContext as V, useMemo as A, useContext as _e, useRef as $, useState as I, useLayoutEffect as ge, useReducer as $e } from "react";
3
+ import { flushSync as ye } from "react-dom";
4
+ function xe(e) {
5
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
6
+ }
7
+ var te = { exports: {} };
8
+ /*!
9
+ Copyright (c) 2018 Jed Watson.
10
+ Licensed under the MIT License (MIT), see
11
+ http://jedwatson.github.io/classnames
12
+ */
13
+ (function(e) {
14
+ (function() {
15
+ var n = {}.hasOwnProperty;
16
+ function t() {
17
+ for (var r = "", o = 0; o < arguments.length; o++) {
18
+ var u = arguments[o];
19
+ u && (r = i(r, a.call(this, u)));
20
+ }
21
+ return r;
22
+ }
23
+ function a(r) {
24
+ if (typeof r == "string" || typeof r == "number")
25
+ return this && this[r] || r;
26
+ if (typeof r != "object")
27
+ return "";
28
+ if (Array.isArray(r))
29
+ return t.apply(this, r);
30
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
31
+ return r.toString();
32
+ var o = "";
33
+ for (var u in r)
34
+ n.call(r, u) && r[u] && (o = i(o, this && this[u] || u));
35
+ return o;
36
+ }
37
+ function i(r, o) {
38
+ return o ? r ? r + " " + o : r + o : r;
39
+ }
40
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
41
+ })();
42
+ })(te);
43
+ var we = te.exports;
44
+ const Ne = /* @__PURE__ */ xe(we), Se = {
45
+ "purpur-icon": "_purpur-icon_8u1lq_1",
46
+ "purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
47
+ "purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
48
+ "purpur-icon--sm": "_purpur-icon--sm_8u1lq_12",
49
+ "purpur-icon--md": "_purpur-icon--md_8u1lq_16",
50
+ "purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
51
+ "purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
52
+ }, Ce = {
53
+ name: "error-filled",
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
+ keywords: ["error-filled"],
56
+ category: "status"
57
+ }, Oe = Ne.bind(Se), G = "purpur-icon", Ae = "md", Pe = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), ke = ({ content: e = "", title: n } = {}) => {
58
+ const t = [
59
+ { name: "xmlns", value: "http://www.w3.org/2000/svg" },
60
+ { name: "fill", value: "currentColor" },
61
+ { name: "viewBox", value: "0 0 24 24" },
62
+ n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
63
+ ], a = n ? `<title>${n}</title>` : "";
64
+ return `<svg ${Pe(t)}>${a}${e}</svg>`;
65
+ }, je = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Ee = ({
66
+ ["data-testid"]: e,
67
+ svg: n,
68
+ allyTitle: t,
69
+ className: a = "",
70
+ size: i = Ae,
71
+ ...r
72
+ }) => {
73
+ const o = ke({
74
+ content: je(n.svg),
75
+ title: t
76
+ }), u = Oe(a, G, `${G}--${i}`);
77
+ return /* @__PURE__ */ f(
78
+ "span",
79
+ {
80
+ "aria-label": t,
81
+ className: u,
82
+ "data-testid": e,
83
+ dangerouslySetInnerHTML: { __html: o },
84
+ ...r
85
+ }
86
+ );
87
+ };
88
+ function Me(e) {
89
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
90
+ }
91
+ var ne = { exports: {} };
92
+ /*!
93
+ Copyright (c) 2018 Jed Watson.
94
+ Licensed under the MIT License (MIT), see
95
+ http://jedwatson.github.io/classnames
96
+ */
97
+ (function(e) {
98
+ (function() {
99
+ var n = {}.hasOwnProperty;
100
+ function t() {
101
+ for (var r = "", o = 0; o < arguments.length; o++) {
102
+ var u = arguments[o];
103
+ u && (r = i(r, a(u)));
104
+ }
105
+ return r;
106
+ }
107
+ function a(r) {
108
+ if (typeof r == "string" || typeof r == "number")
109
+ return r;
110
+ if (typeof r != "object")
111
+ return "";
112
+ if (Array.isArray(r))
113
+ return t.apply(null, r);
114
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
115
+ return r.toString();
116
+ var o = "";
117
+ for (var u in r)
118
+ n.call(r, u) && r[u] && (o = i(o, u));
119
+ return o;
120
+ }
121
+ function i(r, o) {
122
+ return o ? r ? r + " " + o : r + o : r;
123
+ }
124
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
125
+ })();
126
+ })(ne);
127
+ var Re = ne.exports;
128
+ const De = /* @__PURE__ */ Me(Re), K = {
129
+ "purpur-field-error-text": "_purpur-field-error-text_1h4gy_1",
130
+ "purpur-field-error-text__icon": "_purpur-field-error-text__icon_1h4gy_12"
131
+ }, W = "purpur-field-error-text", qe = ({
132
+ ["data-testid"]: e,
133
+ children: n,
134
+ className: t,
135
+ relevant: a = "additions text",
136
+ ...i
137
+ }) => /* @__PURE__ */ z(
138
+ "div",
139
+ {
140
+ className: De([t, K[W]]),
141
+ "data-testid": e,
142
+ "aria-live": "assertive",
143
+ "aria-relevant": a,
144
+ ...i,
145
+ children: [
146
+ /* @__PURE__ */ f(Ee, { svg: Ce, size: "xs", className: K[`${W}__icon`] }),
147
+ n
148
+ ]
149
+ }
150
+ );
151
+ function Ie(e) {
152
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
153
+ }
154
+ var oe = { exports: {} };
155
+ /*!
156
+ Copyright (c) 2018 Jed Watson.
157
+ Licensed under the MIT License (MIT), see
158
+ http://jedwatson.github.io/classnames
159
+ */
160
+ (function(e) {
161
+ (function() {
162
+ var n = {}.hasOwnProperty;
163
+ function t() {
164
+ for (var r = "", o = 0; o < arguments.length; o++) {
165
+ var u = arguments[o];
166
+ u && (r = i(r, a.call(this, u)));
167
+ }
168
+ return r;
169
+ }
170
+ function a(r) {
171
+ if (typeof r == "string" || typeof r == "number")
172
+ return this && this[r] || r;
173
+ if (typeof r != "object")
174
+ return "";
175
+ if (Array.isArray(r))
176
+ return t.apply(this, r);
177
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
178
+ return r.toString();
179
+ var o = "";
180
+ for (var u in r)
181
+ n.call(r, u) && r[u] && (o = i(o, this && this[u] || u));
182
+ return o;
183
+ }
184
+ function i(r, o) {
185
+ return o ? r ? r + " " + o : r + o : r;
186
+ }
187
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
188
+ })();
189
+ })(oe);
190
+ var Be = oe.exports;
191
+ const Le = /* @__PURE__ */ Ie(Be), ze = {
192
+ "purpur-icon": "_purpur-icon_8u1lq_1",
193
+ "purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
194
+ "purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
195
+ "purpur-icon--sm": "_purpur-icon--sm_8u1lq_12",
196
+ "purpur-icon--md": "_purpur-icon--md_8u1lq_16",
197
+ "purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
198
+ "purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
199
+ }, Te = {
200
+ name: "checkmark-bold",
201
+ svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M21.243 4.176a2 2 0 0 1 .324 2.81l-10.45 13.176a2.092 2.092 0 0 1-3.118.18l-5.413-5.413A2 2 0 1 1 5.414 12.1l3.9 3.9 9.118-11.5a2 2 0 0 1 2.81-.324Z" clip-rule="evenodd"/></svg>',
202
+ keywords: ["checkmark-bold"],
203
+ category: "utility"
204
+ }, Ue = {
205
+ name: "minus-bold",
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
+ keywords: ["minus-bold"],
208
+ category: "utility"
209
+ }, He = Le.bind(ze), X = "purpur-icon", Ze = "md", Fe = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), Ve = ({ content: e = "", title: n } = {}) => {
210
+ const t = [
211
+ { name: "xmlns", value: "http://www.w3.org/2000/svg" },
212
+ { name: "fill", value: "currentColor" },
213
+ { name: "viewBox", value: "0 0 24 24" },
214
+ n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
215
+ ], a = n ? `<title>${n}</title>` : "";
216
+ return `<svg ${Fe(t)}>${a}${e}</svg>`;
217
+ }, Ge = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), J = ({
218
+ ["data-testid"]: e,
219
+ svg: n,
220
+ allyTitle: t,
221
+ className: a = "",
222
+ size: i = Ze,
223
+ ...r
224
+ }) => {
225
+ const o = Ve({
226
+ content: Ge(n.svg),
227
+ title: t
228
+ }), u = He(a, X, `${X}--${i}`);
229
+ return /* @__PURE__ */ f(
230
+ "span",
231
+ {
232
+ "aria-label": t,
233
+ className: u,
234
+ "data-testid": e,
235
+ dangerouslySetInnerHTML: { __html: o },
236
+ ...r
237
+ }
238
+ );
239
+ };
240
+ function T() {
241
+ return T = Object.assign ? Object.assign.bind() : function(e) {
242
+ for (var n = 1; n < arguments.length; n++) {
243
+ var t = arguments[n];
244
+ for (var a in t)
245
+ Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
246
+ }
247
+ return e;
248
+ }, T.apply(this, arguments);
249
+ }
250
+ function P() {
251
+ return P = Object.assign ? Object.assign.bind() : function(e) {
252
+ for (var n = 1; n < arguments.length; n++) {
253
+ var t = arguments[n];
254
+ for (var a in t)
255
+ Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
256
+ }
257
+ return e;
258
+ }, P.apply(this, arguments);
259
+ }
260
+ function Ke(e, n) {
261
+ typeof e == "function" ? e(n) : e != null && (e.current = n);
262
+ }
263
+ function We(...e) {
264
+ return (n) => e.forEach(
265
+ (t) => Ke(t, n)
266
+ );
267
+ }
268
+ const ae = /* @__PURE__ */ g((e, n) => {
269
+ const { children: t, ...a } = e, i = v.toArray(t), r = i.find(Je);
270
+ if (r) {
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);
272
+ return /* @__PURE__ */ p(U, P({}, a, {
273
+ ref: n
274
+ }), /* @__PURE__ */ x(o) ? /* @__PURE__ */ E(o, void 0, u) : null);
275
+ }
276
+ return /* @__PURE__ */ p(U, P({}, a, {
277
+ ref: n
278
+ }), t);
279
+ });
280
+ ae.displayName = "Slot";
281
+ const U = /* @__PURE__ */ g((e, n) => {
282
+ const { children: t, ...a } = e;
283
+ return /* @__PURE__ */ x(t) ? /* @__PURE__ */ E(t, {
284
+ ...Qe(a, t.props),
285
+ ref: n ? We(n, t.ref) : t.ref
286
+ }) : v.count(t) > 1 ? v.only(null) : null;
287
+ });
288
+ U.displayName = "SlotClone";
289
+ const Xe = ({ children: e }) => /* @__PURE__ */ p(re, null, e);
290
+ function Je(e) {
291
+ return /* @__PURE__ */ x(e) && e.type === Xe;
292
+ }
293
+ function Qe(e, n) {
294
+ const t = {
295
+ ...n
296
+ };
297
+ for (const a in n) {
298
+ const i = e[a], r = n[a];
299
+ /^on[A-Z]/.test(a) ? i && r ? t[a] = (...o) => {
300
+ r(...o), i(...o);
301
+ } : i && (t[a] = i) : a === "style" ? t[a] = {
302
+ ...i,
303
+ ...r
304
+ } : a === "className" && (t[a] = [
305
+ i,
306
+ r
307
+ ].filter(Boolean).join(" "));
308
+ }
309
+ return {
310
+ ...e,
311
+ ...t
312
+ };
313
+ }
314
+ const Ye = [
315
+ "a",
316
+ "button",
317
+ "div",
318
+ "form",
319
+ "h2",
320
+ "h3",
321
+ "img",
322
+ "input",
323
+ "label",
324
+ "li",
325
+ "nav",
326
+ "ol",
327
+ "p",
328
+ "span",
329
+ "svg",
330
+ "ul"
331
+ ], er = Ye.reduce((e, n) => {
332
+ const t = /* @__PURE__ */ g((a, i) => {
333
+ const { asChild: r, ...o } = a, u = r ? ae : n;
334
+ return C(() => {
335
+ window[Symbol.for("radix-ui")] = !0;
336
+ }, []), /* @__PURE__ */ p(u, P({}, o, {
337
+ ref: i
338
+ }));
339
+ });
340
+ return t.displayName = `Primitive.${n}`, {
341
+ ...e,
342
+ [n]: t
343
+ };
344
+ }, {}), rr = /* @__PURE__ */ g((e, n) => /* @__PURE__ */ p(er.label, T({}, e, {
345
+ ref: n,
346
+ onMouseDown: (t) => {
347
+ var a;
348
+ (a = e.onMouseDown) === null || a === void 0 || a.call(e, t), !t.defaultPrevented && t.detail > 1 && t.preventDefault();
349
+ }
350
+ }))), tr = rr;
351
+ function nr(e) {
352
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
353
+ }
354
+ var ie = { exports: {} };
355
+ /*!
356
+ Copyright (c) 2018 Jed Watson.
357
+ Licensed under the MIT License (MIT), see
358
+ http://jedwatson.github.io/classnames
359
+ */
360
+ (function(e) {
361
+ (function() {
362
+ var n = {}.hasOwnProperty;
363
+ function t() {
364
+ for (var r = "", o = 0; o < arguments.length; o++) {
365
+ var u = arguments[o];
366
+ u && (r = i(r, a(u)));
367
+ }
368
+ return r;
369
+ }
370
+ function a(r) {
371
+ if (typeof r == "string" || typeof r == "number")
372
+ return r;
373
+ if (typeof r != "object")
374
+ return "";
375
+ if (Array.isArray(r))
376
+ return t.apply(null, r);
377
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
378
+ return r.toString();
379
+ var o = "";
380
+ for (var u in r)
381
+ n.call(r, u) && r[u] && (o = i(o, u));
382
+ return o;
383
+ }
384
+ function i(r, o) {
385
+ return o ? r ? r + " " + o : r + o : r;
386
+ }
387
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
388
+ })();
389
+ })(ie);
390
+ var or = ie.exports;
391
+ const ar = /* @__PURE__ */ nr(or), Q = {
392
+ "purpur-label": "_purpur-label_1jub8_1",
393
+ "purpur-label--disabled": "_purpur-label--disabled_1jub8_9"
394
+ }, Y = "purpur-label", ir = ({
395
+ children: e,
396
+ className: n,
397
+ htmlFor: t,
398
+ "data-testid": a,
399
+ disabled: i,
400
+ ...r
401
+ }) => {
402
+ const o = ar([
403
+ n,
404
+ Q[Y],
405
+ { [Q[`${Y}--disabled`]]: i }
406
+ ]);
407
+ return /* @__PURE__ */ f(tr, { className: o, "data-testid": a, htmlFor: t, ...r, children: e });
408
+ };
409
+ function ur(e) {
410
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
411
+ }
412
+ var ue = { exports: {} };
413
+ /*!
414
+ Copyright (c) 2018 Jed Watson.
415
+ Licensed under the MIT License (MIT), see
416
+ http://jedwatson.github.io/classnames
417
+ */
418
+ (function(e) {
419
+ (function() {
420
+ var n = {}.hasOwnProperty;
421
+ function t() {
422
+ for (var r = "", o = 0; o < arguments.length; o++) {
423
+ var u = arguments[o];
424
+ u && (r = i(r, a(u)));
425
+ }
426
+ return r;
427
+ }
428
+ function a(r) {
429
+ if (typeof r == "string" || typeof r == "number")
430
+ return r;
431
+ if (typeof r != "object")
432
+ return "";
433
+ if (Array.isArray(r))
434
+ return t.apply(null, r);
435
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
436
+ return r.toString();
437
+ var o = "";
438
+ for (var u in r)
439
+ n.call(r, u) && r[u] && (o = i(o, u));
440
+ return o;
441
+ }
442
+ function i(r, o) {
443
+ return o ? r ? r + " " + o : r + o : r;
444
+ }
445
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
446
+ })();
447
+ })(ue);
448
+ var cr = ue.exports;
449
+ const sr = /* @__PURE__ */ ur(cr), R = {
450
+ "purpur-paragraph": "_purpur-paragraph_hwaj6_1",
451
+ "purpur-paragraph--disabled": "_purpur-paragraph--disabled_hwaj6_7",
452
+ "purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_hwaj6_10",
453
+ "purpur-paragraph--paragraph-100": "_purpur-paragraph--paragraph-100_hwaj6_13",
454
+ "purpur-paragraph--paragraph-100-medium": "_purpur-paragraph--paragraph-100-medium_hwaj6_19",
455
+ "purpur-paragraph--paragraph-100-bold": "_purpur-paragraph--paragraph-100-bold_hwaj6_26",
456
+ "purpur-paragraph--paragraph-200": "_purpur-paragraph--paragraph-200_hwaj6_33",
457
+ "purpur-paragraph--preamble-100": "_purpur-paragraph--preamble-100_hwaj6_39",
458
+ "purpur-paragraph--preamble-200": "_purpur-paragraph--preamble-200_hwaj6_45",
459
+ "purpur-paragraph--additional-100": "_purpur-paragraph--additional-100_hwaj6_51",
460
+ "purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_hwaj6_57",
461
+ "purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_hwaj6_64",
462
+ "purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_hwaj6_71"
463
+ }, lr = {
464
+ PARAGRAPH100: "paragraph-100",
465
+ PARAGRAPH100MEDIUM: "paragraph-100-medium",
466
+ PARAGRAPH100BOLD: "paragraph-100-bold",
467
+ PARAGRAPH200: "paragraph-200",
468
+ PREAMBLE100: "preamble-100",
469
+ PREAMBLE200: "preamble-200",
470
+ ADDITIONAL100: "additional-100",
471
+ ADDITIONAL100MEDIUM: "additional-100-medium",
472
+ OVERLINE100: "overline-100",
473
+ OVERLINE200: "overline-200"
474
+ }, D = "purpur-paragraph", pr = ({
475
+ ["data-testid"]: e,
476
+ children: n,
477
+ className: t = "",
478
+ disabled: a,
479
+ enableHyphenation: i = !1,
480
+ variant: r = lr.PARAGRAPH100,
481
+ ...o
482
+ }) => {
483
+ const u = sr([
484
+ t,
485
+ R[D],
486
+ R[`${D}--${r}`],
487
+ {
488
+ [R[`${D}--hyphens`]]: i,
489
+ [R[`${D}--disabled`]]: a
490
+ }
491
+ ]);
492
+ return /* @__PURE__ */ f("p", { ...o, className: u, "data-testid": e, children: n });
493
+ };
494
+ function k() {
495
+ return k = Object.assign ? Object.assign.bind() : function(e) {
496
+ for (var n = 1; n < arguments.length; n++) {
497
+ var t = arguments[n];
498
+ for (var a in t)
499
+ Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
500
+ }
501
+ return e;
502
+ }, k.apply(this, arguments);
503
+ }
504
+ function dr(e, n) {
505
+ typeof e == "function" ? e(n) : e != null && (e.current = n);
506
+ }
507
+ function ce(...e) {
508
+ return (n) => e.forEach(
509
+ (t) => dr(t, n)
510
+ );
511
+ }
512
+ function se(...e) {
513
+ return F(ce(...e), e);
514
+ }
515
+ function fr(e, n = []) {
516
+ let t = [];
517
+ function a(r, o) {
518
+ const u = /* @__PURE__ */ V(o), c = t.length;
519
+ t = [
520
+ ...t,
521
+ o
522
+ ];
523
+ function s(l) {
524
+ const { scope: d, children: b, ..._ } = l, M = (d == null ? void 0 : d[e][c]) || u, y = A(
525
+ () => _,
526
+ Object.values(_)
527
+ );
528
+ return /* @__PURE__ */ p(M.Provider, {
529
+ value: y
530
+ }, b);
531
+ }
532
+ function h(l, d) {
533
+ const b = (d == null ? void 0 : d[e][c]) || u, _ = _e(b);
534
+ if (_)
535
+ return _;
536
+ if (o !== void 0)
537
+ return o;
538
+ throw new Error(`\`${l}\` must be used within \`${r}\``);
539
+ }
540
+ return s.displayName = r + "Provider", [
541
+ s,
542
+ h
543
+ ];
544
+ }
545
+ const i = () => {
546
+ const r = t.map((o) => /* @__PURE__ */ V(o));
547
+ return function(u) {
548
+ const c = (u == null ? void 0 : u[e]) || r;
549
+ return A(
550
+ () => ({
551
+ [`__scope${e}`]: {
552
+ ...u,
553
+ [e]: c
554
+ }
555
+ }),
556
+ [
557
+ u,
558
+ c
559
+ ]
560
+ );
561
+ };
562
+ };
563
+ return i.scopeName = e, [
564
+ a,
565
+ hr(i, ...n)
566
+ ];
567
+ }
568
+ function hr(...e) {
569
+ const n = e[0];
570
+ if (e.length === 1)
571
+ return n;
572
+ const t = () => {
573
+ const a = e.map(
574
+ (i) => ({
575
+ useScope: i(),
576
+ scopeName: i.scopeName
577
+ })
578
+ );
579
+ return function(r) {
580
+ const o = a.reduce((u, { useScope: c, scopeName: s }) => {
581
+ const l = c(r)[`__scope${s}`];
582
+ return {
583
+ ...u,
584
+ ...l
585
+ };
586
+ }, {});
587
+ return A(
588
+ () => ({
589
+ [`__scope${n.scopeName}`]: o
590
+ }),
591
+ [
592
+ o
593
+ ]
594
+ );
595
+ };
596
+ };
597
+ return t.scopeName = n.scopeName, t;
598
+ }
599
+ function ee(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
600
+ return function(i) {
601
+ if (e == null || e(i), t === !1 || !i.defaultPrevented)
602
+ return n == null ? void 0 : n(i);
603
+ };
604
+ }
605
+ function le(e) {
606
+ const n = $(e);
607
+ return C(() => {
608
+ n.current = e;
609
+ }), A(
610
+ () => (...t) => {
611
+ var a;
612
+ return (a = n.current) === null || a === void 0 ? void 0 : a.call(n, ...t);
613
+ },
614
+ []
615
+ );
616
+ }
617
+ function mr({ prop: e, defaultProp: n, onChange: t = () => {
618
+ } }) {
619
+ const [a, i] = vr({
620
+ defaultProp: n,
621
+ onChange: t
622
+ }), r = e !== void 0, o = r ? e : a, u = le(t), c = F((s) => {
623
+ if (r) {
624
+ const l = typeof s == "function" ? s(e) : s;
625
+ l !== e && u(l);
626
+ } else
627
+ i(s);
628
+ }, [
629
+ r,
630
+ e,
631
+ i,
632
+ u
633
+ ]);
634
+ return [
635
+ o,
636
+ c
637
+ ];
638
+ }
639
+ function vr({ defaultProp: e, onChange: n }) {
640
+ const t = I(e), [a] = t, i = $(a), r = le(n);
641
+ return C(() => {
642
+ i.current !== a && (r(a), i.current = a);
643
+ }, [
644
+ a,
645
+ i,
646
+ r
647
+ ]), t;
648
+ }
649
+ function br(e) {
650
+ const n = $({
651
+ value: e,
652
+ previous: e
653
+ });
654
+ return A(() => (n.current.value !== e && (n.current.previous = n.current.value, n.current.value = e), n.current.previous), [
655
+ e
656
+ ]);
657
+ }
658
+ const H = globalThis != null && globalThis.document ? ge : () => {
659
+ };
660
+ function _r(e) {
661
+ const [n, t] = I(void 0);
662
+ return H(() => {
663
+ if (e) {
664
+ t({
665
+ width: e.offsetWidth,
666
+ height: e.offsetHeight
667
+ });
668
+ const a = new ResizeObserver((i) => {
669
+ if (!Array.isArray(i) || !i.length)
670
+ return;
671
+ const r = i[0];
672
+ let o, u;
673
+ if ("borderBoxSize" in r) {
674
+ const c = r.borderBoxSize, s = Array.isArray(c) ? c[0] : c;
675
+ o = s.inlineSize, u = s.blockSize;
676
+ } else
677
+ o = e.offsetWidth, u = e.offsetHeight;
678
+ t({
679
+ width: o,
680
+ height: u
681
+ });
682
+ });
683
+ return a.observe(e, {
684
+ box: "border-box"
685
+ }), () => a.unobserve(e);
686
+ } else
687
+ t(void 0);
688
+ }, [
689
+ e
690
+ ]), n;
691
+ }
692
+ function gr(e, n) {
693
+ return $e((t, a) => {
694
+ const i = n[t][a];
695
+ return i ?? t;
696
+ }, e);
697
+ }
698
+ const pe = (e) => {
699
+ const { present: n, children: t } = e, a = $r(n), i = typeof t == "function" ? t({
700
+ present: a.isPresent
701
+ }) : v.only(t), r = se(a.ref, i.ref);
702
+ return typeof t == "function" || a.isPresent ? /* @__PURE__ */ E(i, {
703
+ ref: r
704
+ }) : null;
705
+ };
706
+ pe.displayName = "Presence";
707
+ function $r(e) {
708
+ const [n, t] = I(), a = $({}), i = $(e), r = $("none"), o = e ? "mounted" : "unmounted", [u, c] = gr(o, {
709
+ mounted: {
710
+ UNMOUNT: "unmounted",
711
+ ANIMATION_OUT: "unmountSuspended"
712
+ },
713
+ unmountSuspended: {
714
+ MOUNT: "mounted",
715
+ ANIMATION_END: "unmounted"
716
+ },
717
+ unmounted: {
718
+ MOUNT: "mounted"
719
+ }
720
+ });
721
+ return C(() => {
722
+ const s = q(a.current);
723
+ r.current = u === "mounted" ? s : "none";
724
+ }, [
725
+ u
726
+ ]), H(() => {
727
+ const s = a.current, h = i.current;
728
+ if (h !== e) {
729
+ const d = r.current, b = q(s);
730
+ e ? c("MOUNT") : b === "none" || (s == null ? void 0 : s.display) === "none" ? c("UNMOUNT") : c(h && d !== b ? "ANIMATION_OUT" : "UNMOUNT"), i.current = e;
731
+ }
732
+ }, [
733
+ e,
734
+ c
735
+ ]), H(() => {
736
+ if (n) {
737
+ const s = (l) => {
738
+ const b = q(a.current).includes(l.animationName);
739
+ l.target === n && b && ye(
740
+ () => c("ANIMATION_END")
741
+ );
742
+ }, h = (l) => {
743
+ l.target === n && (r.current = q(a.current));
744
+ };
745
+ return n.addEventListener("animationstart", h), n.addEventListener("animationcancel", s), n.addEventListener("animationend", s), () => {
746
+ n.removeEventListener("animationstart", h), n.removeEventListener("animationcancel", s), n.removeEventListener("animationend", s);
747
+ };
748
+ } else
749
+ c("ANIMATION_END");
750
+ }, [
751
+ n,
752
+ c
753
+ ]), {
754
+ isPresent: [
755
+ "mounted",
756
+ "unmountSuspended"
757
+ ].includes(u),
758
+ ref: F((s) => {
759
+ s && (a.current = getComputedStyle(s)), t(s);
760
+ }, [])
761
+ };
762
+ }
763
+ function q(e) {
764
+ return (e == null ? void 0 : e.animationName) || "none";
765
+ }
766
+ function j() {
767
+ return j = Object.assign ? Object.assign.bind() : function(e) {
768
+ for (var n = 1; n < arguments.length; n++) {
769
+ var t = arguments[n];
770
+ for (var a in t)
771
+ Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
772
+ }
773
+ return e;
774
+ }, j.apply(this, arguments);
775
+ }
776
+ const de = /* @__PURE__ */ g((e, n) => {
777
+ const { children: t, ...a } = e, i = v.toArray(t), r = i.find(xr);
778
+ if (r) {
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);
780
+ return /* @__PURE__ */ p(Z, j({}, a, {
781
+ ref: n
782
+ }), /* @__PURE__ */ x(o) ? /* @__PURE__ */ E(o, void 0, u) : null);
783
+ }
784
+ return /* @__PURE__ */ p(Z, j({}, a, {
785
+ ref: n
786
+ }), t);
787
+ });
788
+ de.displayName = "Slot";
789
+ const Z = /* @__PURE__ */ g((e, n) => {
790
+ const { children: t, ...a } = e;
791
+ return /* @__PURE__ */ x(t) ? /* @__PURE__ */ E(t, {
792
+ ...wr(a, t.props),
793
+ ref: n ? ce(n, t.ref) : t.ref
794
+ }) : v.count(t) > 1 ? v.only(null) : null;
795
+ });
796
+ Z.displayName = "SlotClone";
797
+ const yr = ({ children: e }) => /* @__PURE__ */ p(re, null, e);
798
+ function xr(e) {
799
+ return /* @__PURE__ */ x(e) && e.type === yr;
800
+ }
801
+ function wr(e, n) {
802
+ const t = {
803
+ ...n
804
+ };
805
+ for (const a in n) {
806
+ const i = e[a], r = n[a];
807
+ /^on[A-Z]/.test(a) ? i && r ? t[a] = (...u) => {
808
+ r(...u), i(...u);
809
+ } : i && (t[a] = i) : a === "style" ? t[a] = {
810
+ ...i,
811
+ ...r
812
+ } : a === "className" && (t[a] = [
813
+ i,
814
+ r
815
+ ].filter(Boolean).join(" "));
816
+ }
817
+ return {
818
+ ...e,
819
+ ...t
820
+ };
821
+ }
822
+ const Nr = [
823
+ "a",
824
+ "button",
825
+ "div",
826
+ "form",
827
+ "h2",
828
+ "h3",
829
+ "img",
830
+ "input",
831
+ "label",
832
+ "li",
833
+ "nav",
834
+ "ol",
835
+ "p",
836
+ "span",
837
+ "svg",
838
+ "ul"
839
+ ], fe = Nr.reduce((e, n) => {
840
+ const t = /* @__PURE__ */ g((a, i) => {
841
+ const { asChild: r, ...o } = a, u = r ? de : n;
842
+ return C(() => {
843
+ window[Symbol.for("radix-ui")] = !0;
844
+ }, []), /* @__PURE__ */ p(u, j({}, o, {
845
+ ref: i
846
+ }));
847
+ });
848
+ return t.displayName = `Primitive.${n}`, {
849
+ ...e,
850
+ [n]: t
851
+ };
852
+ }, {}), he = "Checkbox", [Sr, Tr] = fr(he), [Cr, Or] = Sr(he), Ar = /* @__PURE__ */ g((e, n) => {
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
+ n,
855
+ (m) => d(m)
856
+ ), _ = $(!1), M = l ? !!l.closest("form") : !0, [y = !1, B] = mr({
857
+ prop: i,
858
+ defaultProp: r,
859
+ onChange: s
860
+ }), be = $(y);
861
+ return C(() => {
862
+ const m = l == null ? void 0 : l.form;
863
+ if (m) {
864
+ const O = () => B(be.current);
865
+ return m.addEventListener("reset", O), () => m.removeEventListener("reset", O);
866
+ }
867
+ }, [
868
+ l,
869
+ B
870
+ ]), /* @__PURE__ */ p(Cr, {
871
+ scope: t,
872
+ state: y,
873
+ disabled: u
874
+ }, /* @__PURE__ */ p(fe.button, k({
875
+ type: "button",
876
+ role: "checkbox",
877
+ "aria-checked": S(y) ? "mixed" : y,
878
+ "aria-required": o,
879
+ "data-state": me(y),
880
+ "data-disabled": u ? "" : void 0,
881
+ disabled: u,
882
+ value: c
883
+ }, h, {
884
+ ref: b,
885
+ onKeyDown: ee(e.onKeyDown, (m) => {
886
+ m.key === "Enter" && m.preventDefault();
887
+ }),
888
+ onClick: ee(e.onClick, (m) => {
889
+ B(
890
+ (O) => S(O) ? !0 : !O
891
+ ), M && (_.current = m.isPropagationStopped(), _.current || m.stopPropagation());
892
+ })
893
+ })), M && /* @__PURE__ */ p(jr, {
894
+ control: l,
895
+ bubbles: !_.current,
896
+ name: a,
897
+ value: c,
898
+ checked: y,
899
+ required: o,
900
+ disabled: u,
901
+ style: {
902
+ transform: "translateX(-100%)"
903
+ }
904
+ }));
905
+ }), Pr = "CheckboxIndicator", kr = /* @__PURE__ */ g((e, n) => {
906
+ const { __scopeCheckbox: t, forceMount: a, ...i } = e, r = Or(Pr, t);
907
+ return /* @__PURE__ */ p(pe, {
908
+ present: a || S(r.state) || r.state === !0
909
+ }, /* @__PURE__ */ p(fe.span, k({
910
+ "data-state": me(r.state),
911
+ "data-disabled": r.disabled ? "" : void 0
912
+ }, i, {
913
+ ref: n,
914
+ style: {
915
+ pointerEvents: "none",
916
+ ...e.style
917
+ }
918
+ })));
919
+ }), jr = (e) => {
920
+ const { control: n, checked: t, bubbles: a = !0, ...i } = e, r = $(null), o = br(t), u = _r(n);
921
+ return C(() => {
922
+ const c = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
923
+ if (o !== t && l) {
924
+ const d = new Event("click", {
925
+ bubbles: a
926
+ });
927
+ c.indeterminate = S(t), l.call(c, S(t) ? !1 : t), c.dispatchEvent(d);
928
+ }
929
+ }, [
930
+ o,
931
+ t,
932
+ a
933
+ ]), /* @__PURE__ */ p("input", k({
934
+ type: "checkbox",
935
+ "aria-hidden": !0,
936
+ defaultChecked: S(t) ? !1 : t
937
+ }, i, {
938
+ tabIndex: -1,
939
+ ref: r,
940
+ style: {
941
+ ...e.style,
942
+ ...u,
943
+ position: "absolute",
944
+ pointerEvents: "none",
945
+ opacity: 0,
946
+ margin: 0
947
+ }
948
+ }));
949
+ };
950
+ function S(e) {
951
+ return e === "indeterminate";
952
+ }
953
+ function me(e) {
954
+ return S(e) ? "indeterminate" : e ? "checked" : "unchecked";
955
+ }
956
+ const Er = Ar, Mr = kr;
957
+ function Rr(e) {
958
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
959
+ }
960
+ var ve = { exports: {} };
961
+ /*!
962
+ Copyright (c) 2018 Jed Watson.
963
+ Licensed under the MIT License (MIT), see
964
+ http://jedwatson.github.io/classnames
965
+ */
966
+ (function(e) {
967
+ (function() {
968
+ var n = {}.hasOwnProperty;
969
+ function t() {
970
+ for (var r = "", o = 0; o < arguments.length; o++) {
971
+ var u = arguments[o];
972
+ u && (r = i(r, a(u)));
973
+ }
974
+ return r;
975
+ }
976
+ function a(r) {
977
+ if (typeof r == "string" || typeof r == "number")
978
+ return r;
979
+ if (typeof r != "object")
980
+ return "";
981
+ if (Array.isArray(r))
982
+ return t.apply(null, r);
983
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
984
+ return r.toString();
985
+ var o = "";
986
+ for (var u in r)
987
+ n.call(r, u) && r[u] && (o = i(o, u));
988
+ return o;
989
+ }
990
+ function i(r, o) {
991
+ return o ? r ? r + " " + o : r + o : r;
992
+ }
993
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
994
+ })();
995
+ })(ve);
996
+ var Dr = ve.exports;
997
+ const L = /* @__PURE__ */ Rr(Dr), w = {
998
+ "purpur-checkbox": "_purpur-checkbox_10fl8_1",
999
+ "purpur-checkbox__box": "_purpur-checkbox__box_10fl8_7",
1000
+ "purpur-checkbox--error": "_purpur-checkbox--error_10fl8_16",
1001
+ "purpur-checkbox__indicator": "_purpur-checkbox__indicator_10fl8_59",
1002
+ "purpur-checkbox__label": "_purpur-checkbox__label_10fl8_70",
1003
+ "purpur-checkbox__wrapper": "_purpur-checkbox__wrapper_10fl8_73",
1004
+ "purpur-checkbox__container": "_purpur-checkbox__container_10fl8_79"
1005
+ }, N = "purpur-checkbox", qr = ({
1006
+ ["data-testid"]: e,
1007
+ checked: n,
1008
+ className: t,
1009
+ errorText: a,
1010
+ label: i,
1011
+ onChange: r,
1012
+ ...o
1013
+ }, u) => {
1014
+ const c = a && !n;
1015
+ return /* @__PURE__ */ z("div", { className: L([t, w[`${N}__wrapper`]]), children: [
1016
+ /* @__PURE__ */ z("div", { className: L([t, w[`${N}__container`]]), children: [
1017
+ /* @__PURE__ */ f(
1018
+ Er,
1019
+ {
1020
+ ...o,
1021
+ checked: n,
1022
+ className: L(w[N], {
1023
+ [w[`${N}--error`]]: c
1024
+ }),
1025
+ "data-testid": e,
1026
+ onCheckedChange: r,
1027
+ ref: u,
1028
+ children: /* @__PURE__ */ f("span", { className: w[`${N}__box`], children: /* @__PURE__ */ f(Mr, { className: w[`${N}__indicator`], children: n === "indeterminate" ? /* @__PURE__ */ f(
1029
+ J,
1030
+ {
1031
+ "data-testid": e && `${e}-checked-icon`,
1032
+ size: "xs",
1033
+ svg: Ue
1034
+ }
1035
+ ) : /* @__PURE__ */ f(
1036
+ J,
1037
+ {
1038
+ "data-testid": e && `${e}-indeterminate-icon`,
1039
+ size: "xs",
1040
+ svg: Te
1041
+ }
1042
+ ) }) })
1043
+ }
1044
+ ),
1045
+ i && /* @__PURE__ */ f(
1046
+ ir,
1047
+ {
1048
+ htmlFor: o.id,
1049
+ "data-testid": e && `${e}-label`,
1050
+ disabled: o.disabled,
1051
+ className: w[`${N}__label`],
1052
+ children: /* @__PURE__ */ f(pr, { variant: "paragraph-100", disabled: o.disabled, children: `${o.required ? "* " : ""}${i}` })
1053
+ }
1054
+ )
1055
+ ] }),
1056
+ c && /* @__PURE__ */ f(qe, { "data-testid": e && `${e}-error-text`, children: a })
1057
+ ] });
1058
+ }, Ir = g(qr);
1059
+ Ir.displayName = "Checkbox";
1060
+ export {
1061
+ Ir as Checkbox
1062
+ };
1063
+ //# sourceMappingURL=checkbox.es.js.map