@purpurds/checkbox 5.11.0 → 5.11.1
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 +7 -7
- package/dist/checkbox.cjs.js.map +1 -1
- package/dist/checkbox.d.ts +2 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.es.js +123 -127
- package/dist/checkbox.es.js.map +1 -1
- package/package.json +17 -17
- package/src/checkbox.stories.tsx +22 -24
- package/src/checkbox.tsx +3 -1
- package/readme.mdx +0 -156
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
|
|
3
|
-
import { flushSync as
|
|
4
|
-
function
|
|
2
|
+
import { forwardRef as _, Children as v, isValidElement as x, createElement as p, cloneElement as R, useEffect as O, Fragment as re, useCallback as V, createContext as K, useMemo as k, useContext as _e, useRef as $, useState as I, useLayoutEffect as $e, useReducer as ye } from "react";
|
|
3
|
+
import { flushSync as xe } from "react-dom";
|
|
4
|
+
function we(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
|
|
43
|
+
var Ne = te.exports;
|
|
44
|
+
const Se = /* @__PURE__ */ we(Ne), Oe = {
|
|
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",
|
|
@@ -54,26 +54,26 @@ const Ne = /* @__PURE__ */ xe(we), Se = {
|
|
|
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
|
+
}, Pe = Se.bind(Oe), W = "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" },
|
|
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 ${
|
|
65
|
-
},
|
|
64
|
+
return `<svg ${ke(t)}>${a}${e}</svg>`;
|
|
65
|
+
}, Ee = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Me = ({
|
|
66
66
|
["data-testid"]: e,
|
|
67
67
|
svg: n,
|
|
68
68
|
allyTitle: t,
|
|
69
|
-
className: a
|
|
69
|
+
className: a,
|
|
70
70
|
size: u = Ce,
|
|
71
71
|
...r
|
|
72
72
|
}) => {
|
|
73
|
-
const o =
|
|
74
|
-
content:
|
|
73
|
+
const o = je({
|
|
74
|
+
content: Ee(n.svg),
|
|
75
75
|
title: t
|
|
76
|
-
}), i =
|
|
76
|
+
}), i = Pe(a, W, `${W}--${u}`);
|
|
77
77
|
return /* @__PURE__ */ f(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
@@ -85,7 +85,7 @@ const Ne = /* @__PURE__ */ xe(we), Se = {
|
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
};
|
|
88
|
-
function
|
|
88
|
+
function Re(e) {
|
|
89
89
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
90
90
|
}
|
|
91
91
|
var ne = { exports: {} };
|
|
@@ -124,11 +124,11 @@ var ne = { exports: {} };
|
|
|
124
124
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
125
125
|
})();
|
|
126
126
|
})(ne);
|
|
127
|
-
var
|
|
128
|
-
const
|
|
127
|
+
var De = ne.exports;
|
|
128
|
+
const qe = /* @__PURE__ */ Re(De), X = {
|
|
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", Ie = ({
|
|
132
132
|
["data-testid"]: e,
|
|
133
133
|
children: n,
|
|
134
134
|
className: t,
|
|
@@ -137,18 +137,18 @@ const De = /* @__PURE__ */ Me(Re), X = {
|
|
|
137
137
|
}) => /* @__PURE__ */ U(
|
|
138
138
|
"div",
|
|
139
139
|
{
|
|
140
|
-
className:
|
|
140
|
+
className: qe([t, X[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(
|
|
146
|
+
/* @__PURE__ */ f(Me, { svg: Ae, size: "xs", className: X[`${J}__icon`] }),
|
|
147
147
|
n
|
|
148
148
|
]
|
|
149
149
|
}
|
|
150
150
|
);
|
|
151
|
-
function
|
|
151
|
+
function Be(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
|
|
190
|
+
var Le = oe.exports;
|
|
191
|
+
const ze = /* @__PURE__ */ Be(Le), 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",
|
|
@@ -196,36 +196,36 @@ const Le = /* @__PURE__ */ Ie(Be), ze = {
|
|
|
196
196
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
197
197
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
198
198
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
199
|
-
},
|
|
199
|
+
}, Ue = {
|
|
200
200
|
name: "checkmark-bold",
|
|
201
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
202
|
keywords: ["checkmark-bold"],
|
|
203
203
|
category: "utility"
|
|
204
|
-
},
|
|
204
|
+
}, He = {
|
|
205
205
|
name: "minus-bold",
|
|
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
|
-
},
|
|
209
|
+
}, Fe = ze.bind(Te), Q = "purpur-icon", Ze = "md", Ge = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), Ve = ({ 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
|
-
},
|
|
216
|
+
return `<svg ${Ge(t)}>${a}${e}</svg>`;
|
|
217
|
+
}, Ke = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Y = ({
|
|
218
218
|
["data-testid"]: e,
|
|
219
219
|
svg: n,
|
|
220
220
|
allyTitle: t,
|
|
221
|
-
className: a
|
|
222
|
-
size: u =
|
|
221
|
+
className: a,
|
|
222
|
+
size: u = Ze,
|
|
223
223
|
...r
|
|
224
224
|
}) => {
|
|
225
|
-
const o =
|
|
226
|
-
content:
|
|
225
|
+
const o = Ve({
|
|
226
|
+
content: Ke(n.svg),
|
|
227
227
|
title: t
|
|
228
|
-
}), i =
|
|
228
|
+
}), i = Fe(a, Q, `${Q}--${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 We(e, n) {
|
|
261
261
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Xe(...e) {
|
|
264
264
|
return (n) => e.forEach(
|
|
265
|
-
(t) =>
|
|
265
|
+
(t) => We(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(Qe);
|
|
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
|
+
...Ye(a, t.props),
|
|
285
|
+
ref: n ? Xe(n, t.ref) : t.ref
|
|
286
286
|
}) : v.count(t) > 1 ? v.only(null) : null;
|
|
287
287
|
});
|
|
288
288
|
F.displayName = "SlotClone";
|
|
289
|
-
const
|
|
290
|
-
function
|
|
291
|
-
return /* @__PURE__ */ x(e) && e.type ===
|
|
289
|
+
const Je = ({ children: e }) => /* @__PURE__ */ p(re, null, e);
|
|
290
|
+
function Qe(e) {
|
|
291
|
+
return /* @__PURE__ */ x(e) && e.type === Je;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function Ye(e, n) {
|
|
294
294
|
const t = {
|
|
295
295
|
...n
|
|
296
296
|
};
|
|
@@ -311,7 +311,7 @@ function Qe(e, n) {
|
|
|
311
311
|
...t
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const er = [
|
|
315
315
|
"a",
|
|
316
316
|
"button",
|
|
317
317
|
"div",
|
|
@@ -328,10 +328,10 @@ const Ye = [
|
|
|
328
328
|
"span",
|
|
329
329
|
"svg",
|
|
330
330
|
"ul"
|
|
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 O(() => {
|
|
335
335
|
window[Symbol.for("radix-ui")] = !0;
|
|
336
336
|
}, []), /* @__PURE__ */ p(i, j({}, o, {
|
|
337
337
|
ref: u
|
|
@@ -341,14 +341,14 @@ const Ye = [
|
|
|
341
341
|
...e,
|
|
342
342
|
[n]: t
|
|
343
343
|
};
|
|
344
|
-
}, {}),
|
|
344
|
+
}, {}), tr = /* @__PURE__ */ _((e, n) => /* @__PURE__ */ p(rr.label, H({}, e, {
|
|
345
345
|
ref: n,
|
|
346
346
|
onMouseDown: (t) => {
|
|
347
347
|
var a;
|
|
348
348
|
(a = e.onMouseDown) === null || a === void 0 || a.call(e, t), !t.defaultPrevented && t.detail > 1 && t.preventDefault();
|
|
349
349
|
}
|
|
350
|
-
}))),
|
|
351
|
-
function
|
|
350
|
+
}))), nr = tr;
|
|
351
|
+
function or(e) {
|
|
352
352
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
353
353
|
}
|
|
354
354
|
var ie = { exports: {} };
|
|
@@ -387,12 +387,12 @@ var ie = { exports: {} };
|
|
|
387
387
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
388
388
|
})();
|
|
389
389
|
})(ie);
|
|
390
|
-
var
|
|
391
|
-
const
|
|
390
|
+
var ar = ie.exports;
|
|
391
|
+
const ir = /* @__PURE__ */ or(ar), L = {
|
|
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"
|
|
395
|
-
}, z = "purpur-label",
|
|
395
|
+
}, z = "purpur-label", ur = ({
|
|
396
396
|
children: e,
|
|
397
397
|
className: n,
|
|
398
398
|
htmlFor: t,
|
|
@@ -401,7 +401,7 @@ const ar = /* @__PURE__ */ nr(or), L = {
|
|
|
401
401
|
negative: r = !1,
|
|
402
402
|
...o
|
|
403
403
|
}) => {
|
|
404
|
-
const i =
|
|
404
|
+
const i = ir([
|
|
405
405
|
n,
|
|
406
406
|
L[z],
|
|
407
407
|
{
|
|
@@ -409,9 +409,9 @@ const ar = /* @__PURE__ */ nr(or), L = {
|
|
|
409
409
|
[L[`${z}--negative`]]: r
|
|
410
410
|
}
|
|
411
411
|
]);
|
|
412
|
-
return /* @__PURE__ */ f(
|
|
412
|
+
return /* @__PURE__ */ f(nr, { className: i, "data-testid": a, htmlFor: t, ...o, children: e });
|
|
413
413
|
};
|
|
414
|
-
function
|
|
414
|
+
function cr(e) {
|
|
415
415
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
416
416
|
}
|
|
417
417
|
var ue = { exports: {} };
|
|
@@ -450,8 +450,8 @@ var ue = { exports: {} };
|
|
|
450
450
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
451
451
|
})();
|
|
452
452
|
})(ue);
|
|
453
|
-
var
|
|
454
|
-
const
|
|
453
|
+
var sr = ue.exports;
|
|
454
|
+
const lr = /* @__PURE__ */ cr(sr), P = {
|
|
455
455
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
|
456
456
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
|
457
457
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
|
@@ -466,7 +466,7 @@ const sr = /* @__PURE__ */ ur(cr), C = {
|
|
|
466
466
|
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_1rh57_60",
|
|
467
467
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
|
468
468
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
|
469
|
-
},
|
|
469
|
+
}, pr = {
|
|
470
470
|
PARAGRAPH100: "paragraph-100",
|
|
471
471
|
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
472
472
|
PARAGRAPH100BOLD: "paragraph-100-bold",
|
|
@@ -477,28 +477,29 @@ const sr = /* @__PURE__ */ ur(cr), C = {
|
|
|
477
477
|
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
478
478
|
OVERLINE100: "overline-100",
|
|
479
479
|
OVERLINE200: "overline-200"
|
|
480
|
-
},
|
|
480
|
+
}, C = "purpur-paragraph", ce = ({
|
|
481
481
|
["data-testid"]: e,
|
|
482
482
|
children: n,
|
|
483
|
-
className: t
|
|
483
|
+
className: t,
|
|
484
484
|
disabled: a,
|
|
485
485
|
enableHyphenation: u = !1,
|
|
486
486
|
negative: r = !1,
|
|
487
|
-
variant: o =
|
|
487
|
+
variant: o = pr.PARAGRAPH100,
|
|
488
488
|
...i
|
|
489
489
|
}) => {
|
|
490
|
-
const c =
|
|
490
|
+
const c = lr([
|
|
491
491
|
t,
|
|
492
|
-
C
|
|
493
|
-
|
|
492
|
+
P[C],
|
|
493
|
+
P[`${C}--${o}`],
|
|
494
494
|
{
|
|
495
|
-
[
|
|
496
|
-
[
|
|
497
|
-
[
|
|
495
|
+
[P[`${C}--hyphens`]]: u,
|
|
496
|
+
[P[`${C}--disabled`]]: a,
|
|
497
|
+
[P[`${C}--negative`]]: r
|
|
498
498
|
}
|
|
499
499
|
]);
|
|
500
500
|
return /* @__PURE__ */ f("p", { ...i, className: c, "data-testid": e, children: n });
|
|
501
501
|
};
|
|
502
|
+
ce.displayName = "Paragraph";
|
|
502
503
|
function E() {
|
|
503
504
|
return E = Object.assign ? Object.assign.bind() : function(e) {
|
|
504
505
|
for (var n = 1; n < arguments.length; n++) {
|
|
@@ -512,13 +513,13 @@ function E() {
|
|
|
512
513
|
function dr(e, n) {
|
|
513
514
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
514
515
|
}
|
|
515
|
-
function
|
|
516
|
+
function se(...e) {
|
|
516
517
|
return (n) => e.forEach(
|
|
517
518
|
(t) => dr(t, n)
|
|
518
519
|
);
|
|
519
520
|
}
|
|
520
|
-
function
|
|
521
|
-
return V(
|
|
521
|
+
function le(...e) {
|
|
522
|
+
return V(se(...e), e);
|
|
522
523
|
}
|
|
523
524
|
function fr(e, n = []) {
|
|
524
525
|
let t = [];
|
|
@@ -538,11 +539,9 @@ function fr(e, n = []) {
|
|
|
538
539
|
}, b);
|
|
539
540
|
}
|
|
540
541
|
function h(l, d) {
|
|
541
|
-
const b = (d == null ? void 0 : d[e][c]) || i, g =
|
|
542
|
-
if (g)
|
|
543
|
-
|
|
544
|
-
if (o !== void 0)
|
|
545
|
-
return o;
|
|
542
|
+
const b = (d == null ? void 0 : d[e][c]) || i, g = _e(b);
|
|
543
|
+
if (g) return g;
|
|
544
|
+
if (o !== void 0) return o;
|
|
546
545
|
throw new Error(`\`${l}\` must be used within \`${r}\``);
|
|
547
546
|
}
|
|
548
547
|
return s.displayName = r + "Provider", [
|
|
@@ -575,8 +574,7 @@ function fr(e, n = []) {
|
|
|
575
574
|
}
|
|
576
575
|
function hr(...e) {
|
|
577
576
|
const n = e[0];
|
|
578
|
-
if (e.length === 1)
|
|
579
|
-
return n;
|
|
577
|
+
if (e.length === 1) return n;
|
|
580
578
|
const t = () => {
|
|
581
579
|
const a = e.map(
|
|
582
580
|
(u) => ({
|
|
@@ -606,13 +604,12 @@ function hr(...e) {
|
|
|
606
604
|
}
|
|
607
605
|
function ee(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
608
606
|
return function(u) {
|
|
609
|
-
if (e == null || e(u), t === !1 || !u.defaultPrevented)
|
|
610
|
-
return n == null ? void 0 : n(u);
|
|
607
|
+
if (e == null || e(u), t === !1 || !u.defaultPrevented) return n == null ? void 0 : n(u);
|
|
611
608
|
};
|
|
612
609
|
}
|
|
613
|
-
function
|
|
610
|
+
function pe(e) {
|
|
614
611
|
const n = $(e);
|
|
615
|
-
return
|
|
612
|
+
return O(() => {
|
|
616
613
|
n.current = e;
|
|
617
614
|
}), k(
|
|
618
615
|
() => (...t) => {
|
|
@@ -627,12 +624,11 @@ function mr({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
627
624
|
const [a, u] = vr({
|
|
628
625
|
defaultProp: n,
|
|
629
626
|
onChange: t
|
|
630
|
-
}), r = e !== void 0, o = r ? e : a, i =
|
|
627
|
+
}), r = e !== void 0, o = r ? e : a, i = pe(t), c = V((s) => {
|
|
631
628
|
if (r) {
|
|
632
629
|
const l = typeof s == "function" ? s(e) : s;
|
|
633
630
|
l !== e && i(l);
|
|
634
|
-
} else
|
|
635
|
-
u(s);
|
|
631
|
+
} else u(s);
|
|
636
632
|
}, [
|
|
637
633
|
r,
|
|
638
634
|
e,
|
|
@@ -645,8 +641,8 @@ function mr({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
645
641
|
];
|
|
646
642
|
}
|
|
647
643
|
function vr({ defaultProp: e, onChange: n }) {
|
|
648
|
-
const t = I(e), [a] = t, u = $(a), r =
|
|
649
|
-
return
|
|
644
|
+
const t = I(e), [a] = t, u = $(a), r = pe(n);
|
|
645
|
+
return O(() => {
|
|
650
646
|
u.current !== a && (r(a), u.current = a);
|
|
651
647
|
}, [
|
|
652
648
|
a,
|
|
@@ -663,7 +659,7 @@ function br(e) {
|
|
|
663
659
|
e
|
|
664
660
|
]);
|
|
665
661
|
}
|
|
666
|
-
const Z = globalThis != null && globalThis.document ?
|
|
662
|
+
const Z = globalThis != null && globalThis.document ? $e : () => {
|
|
667
663
|
};
|
|
668
664
|
function gr(e) {
|
|
669
665
|
const [n, t] = I(void 0);
|
|
@@ -674,8 +670,7 @@ function gr(e) {
|
|
|
674
670
|
height: e.offsetHeight
|
|
675
671
|
});
|
|
676
672
|
const a = new ResizeObserver((u) => {
|
|
677
|
-
if (!Array.isArray(u) || !u.length)
|
|
678
|
-
return;
|
|
673
|
+
if (!Array.isArray(u) || !u.length) return;
|
|
679
674
|
const r = u[0];
|
|
680
675
|
let o, i;
|
|
681
676
|
if ("borderBoxSize" in r) {
|
|
@@ -698,20 +693,20 @@ function gr(e) {
|
|
|
698
693
|
]), n;
|
|
699
694
|
}
|
|
700
695
|
function _r(e, n) {
|
|
701
|
-
return
|
|
696
|
+
return ye((t, a) => {
|
|
702
697
|
const u = n[t][a];
|
|
703
698
|
return u ?? t;
|
|
704
699
|
}, e);
|
|
705
700
|
}
|
|
706
|
-
const
|
|
701
|
+
const de = (e) => {
|
|
707
702
|
const { present: n, children: t } = e, a = $r(n), u = typeof t == "function" ? t({
|
|
708
703
|
present: a.isPresent
|
|
709
|
-
}) : v.only(t), r =
|
|
704
|
+
}) : v.only(t), r = le(a.ref, u.ref);
|
|
710
705
|
return typeof t == "function" || a.isPresent ? /* @__PURE__ */ R(u, {
|
|
711
706
|
ref: r
|
|
712
707
|
}) : null;
|
|
713
708
|
};
|
|
714
|
-
|
|
709
|
+
de.displayName = "Presence";
|
|
715
710
|
function $r(e) {
|
|
716
711
|
const [n, t] = I(), a = $({}), u = $(e), r = $("none"), o = e ? "mounted" : "unmounted", [i, c] = _r(o, {
|
|
717
712
|
mounted: {
|
|
@@ -726,7 +721,7 @@ function $r(e) {
|
|
|
726
721
|
MOUNT: "mounted"
|
|
727
722
|
}
|
|
728
723
|
});
|
|
729
|
-
return
|
|
724
|
+
return O(() => {
|
|
730
725
|
const s = q(a.current);
|
|
731
726
|
r.current = i === "mounted" ? s : "none";
|
|
732
727
|
}, [
|
|
@@ -744,7 +739,7 @@ function $r(e) {
|
|
|
744
739
|
if (n) {
|
|
745
740
|
const s = (l) => {
|
|
746
741
|
const b = q(a.current).includes(l.animationName);
|
|
747
|
-
l.target === n && b &&
|
|
742
|
+
l.target === n && b && xe(
|
|
748
743
|
() => c("ANIMATION_END")
|
|
749
744
|
);
|
|
750
745
|
}, h = (l) => {
|
|
@@ -781,7 +776,7 @@ function M() {
|
|
|
781
776
|
return e;
|
|
782
777
|
}, M.apply(this, arguments);
|
|
783
778
|
}
|
|
784
|
-
const
|
|
779
|
+
const fe = /* @__PURE__ */ _((e, n) => {
|
|
785
780
|
const { children: t, ...a } = e, u = v.toArray(t), r = u.find(xr);
|
|
786
781
|
if (r) {
|
|
787
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);
|
|
@@ -793,12 +788,12 @@ const de = /* @__PURE__ */ _((e, n) => {
|
|
|
793
788
|
ref: n
|
|
794
789
|
}), t);
|
|
795
790
|
});
|
|
796
|
-
|
|
791
|
+
fe.displayName = "Slot";
|
|
797
792
|
const G = /* @__PURE__ */ _((e, n) => {
|
|
798
793
|
const { children: t, ...a } = e;
|
|
799
794
|
return /* @__PURE__ */ x(t) ? /* @__PURE__ */ R(t, {
|
|
800
795
|
...wr(a, t.props),
|
|
801
|
-
ref: n ?
|
|
796
|
+
ref: n ? se(n, t.ref) : t.ref
|
|
802
797
|
}) : v.count(t) > 1 ? v.only(null) : null;
|
|
803
798
|
});
|
|
804
799
|
G.displayName = "SlotClone";
|
|
@@ -844,10 +839,10 @@ const Nr = [
|
|
|
844
839
|
"span",
|
|
845
840
|
"svg",
|
|
846
841
|
"ul"
|
|
847
|
-
],
|
|
842
|
+
], he = Nr.reduce((e, n) => {
|
|
848
843
|
const t = /* @__PURE__ */ _((a, u) => {
|
|
849
|
-
const { asChild: r, ...o } = a, i = r ?
|
|
850
|
-
return
|
|
844
|
+
const { asChild: r, ...o } = a, i = r ? fe : n;
|
|
845
|
+
return O(() => {
|
|
851
846
|
window[Symbol.for("radix-ui")] = !0;
|
|
852
847
|
}, []), /* @__PURE__ */ p(i, M({}, o, {
|
|
853
848
|
ref: u
|
|
@@ -857,34 +852,34 @@ const Nr = [
|
|
|
857
852
|
...e,
|
|
858
853
|
[n]: t
|
|
859
854
|
};
|
|
860
|
-
}, {}),
|
|
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 =
|
|
855
|
+
}, {}), me = "Checkbox", [Sr, Tr] = fr(me), [Or, Ar] = 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] = I(null), b = le(
|
|
862
857
|
n,
|
|
863
858
|
(m) => d(m)
|
|
864
859
|
), g = $(!1), D = l ? !!l.closest("form") : !0, [y = !1, B] = mr({
|
|
865
860
|
prop: u,
|
|
866
861
|
defaultProp: r,
|
|
867
862
|
onChange: s
|
|
868
|
-
}),
|
|
869
|
-
return
|
|
863
|
+
}), ge = $(y);
|
|
864
|
+
return O(() => {
|
|
870
865
|
const m = l == null ? void 0 : l.form;
|
|
871
866
|
if (m) {
|
|
872
|
-
const
|
|
873
|
-
return m.addEventListener("reset",
|
|
867
|
+
const A = () => B(ge.current);
|
|
868
|
+
return m.addEventListener("reset", A), () => m.removeEventListener("reset", A);
|
|
874
869
|
}
|
|
875
870
|
}, [
|
|
876
871
|
l,
|
|
877
872
|
B
|
|
878
|
-
]), /* @__PURE__ */ p(
|
|
873
|
+
]), /* @__PURE__ */ p(Or, {
|
|
879
874
|
scope: t,
|
|
880
875
|
state: y,
|
|
881
876
|
disabled: i
|
|
882
|
-
}, /* @__PURE__ */ p(
|
|
877
|
+
}, /* @__PURE__ */ p(he.button, E({
|
|
883
878
|
type: "button",
|
|
884
879
|
role: "checkbox",
|
|
885
880
|
"aria-checked": S(y) ? "mixed" : y,
|
|
886
881
|
"aria-required": o,
|
|
887
|
-
"data-state":
|
|
882
|
+
"data-state": ve(y),
|
|
888
883
|
"data-disabled": i ? "" : void 0,
|
|
889
884
|
disabled: i,
|
|
890
885
|
value: c
|
|
@@ -895,7 +890,7 @@ const Nr = [
|
|
|
895
890
|
}),
|
|
896
891
|
onClick: ee(e.onClick, (m) => {
|
|
897
892
|
B(
|
|
898
|
-
(
|
|
893
|
+
(A) => S(A) ? !0 : !A
|
|
899
894
|
), D && (g.current = m.isPropagationStopped(), g.current || m.stopPropagation());
|
|
900
895
|
})
|
|
901
896
|
})), D && /* @__PURE__ */ p(jr, {
|
|
@@ -910,12 +905,12 @@ const Nr = [
|
|
|
910
905
|
transform: "translateX(-100%)"
|
|
911
906
|
}
|
|
912
907
|
}));
|
|
913
|
-
}),
|
|
914
|
-
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r =
|
|
915
|
-
return /* @__PURE__ */ p(
|
|
908
|
+
}), Cr = "CheckboxIndicator", kr = /* @__PURE__ */ _((e, n) => {
|
|
909
|
+
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r = Ar(Cr, t);
|
|
910
|
+
return /* @__PURE__ */ p(de, {
|
|
916
911
|
present: a || S(r.state) || r.state === !0
|
|
917
|
-
}, /* @__PURE__ */ p(
|
|
918
|
-
"data-state":
|
|
912
|
+
}, /* @__PURE__ */ p(he.span, E({
|
|
913
|
+
"data-state": ve(r.state),
|
|
919
914
|
"data-disabled": r.disabled ? "" : void 0
|
|
920
915
|
}, u, {
|
|
921
916
|
ref: n,
|
|
@@ -926,7 +921,7 @@ const Nr = [
|
|
|
926
921
|
})));
|
|
927
922
|
}), jr = (e) => {
|
|
928
923
|
const { control: n, checked: t, bubbles: a = !0, ...u } = e, r = $(null), o = br(t), i = gr(n);
|
|
929
|
-
return
|
|
924
|
+
return O(() => {
|
|
930
925
|
const c = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
|
|
931
926
|
if (o !== t && l) {
|
|
932
927
|
const d = new Event("click", {
|
|
@@ -958,14 +953,14 @@ const Nr = [
|
|
|
958
953
|
function S(e) {
|
|
959
954
|
return e === "indeterminate";
|
|
960
955
|
}
|
|
961
|
-
function
|
|
956
|
+
function ve(e) {
|
|
962
957
|
return S(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
963
958
|
}
|
|
964
|
-
const Er =
|
|
959
|
+
const Er = Pr, Mr = kr;
|
|
965
960
|
function Rr(e) {
|
|
966
961
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
967
962
|
}
|
|
968
|
-
var
|
|
963
|
+
var be = { exports: {} };
|
|
969
964
|
/*!
|
|
970
965
|
Copyright (c) 2018 Jed Watson.
|
|
971
966
|
Licensed under the MIT License (MIT), see
|
|
@@ -1000,8 +995,8 @@ var ve = { exports: {} };
|
|
|
1000
995
|
}
|
|
1001
996
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
1002
997
|
})();
|
|
1003
|
-
})(
|
|
1004
|
-
var Dr =
|
|
998
|
+
})(be);
|
|
999
|
+
var Dr = be.exports;
|
|
1005
1000
|
const T = /* @__PURE__ */ Rr(Dr), w = {
|
|
1006
1001
|
"purpur-checkbox": "_purpur-checkbox_10fl8_1",
|
|
1007
1002
|
"purpur-checkbox__box": "_purpur-checkbox__box_10fl8_7",
|
|
@@ -1010,7 +1005,7 @@ const T = /* @__PURE__ */ Rr(Dr), w = {
|
|
|
1010
1005
|
"purpur-checkbox__label": "_purpur-checkbox__label_10fl8_70",
|
|
1011
1006
|
"purpur-checkbox__wrapper": "_purpur-checkbox__wrapper_10fl8_73",
|
|
1012
1007
|
"purpur-checkbox__container": "_purpur-checkbox__container_10fl8_79"
|
|
1013
|
-
}, N = "purpur-checkbox", qr = ({
|
|
1008
|
+
}, Ur = ["indeterminate", !0, !1], N = "purpur-checkbox", qr = ({
|
|
1014
1009
|
["data-testid"]: e,
|
|
1015
1010
|
checked: n,
|
|
1016
1011
|
className: t,
|
|
@@ -1038,34 +1033,35 @@ const T = /* @__PURE__ */ Rr(Dr), w = {
|
|
|
1038
1033
|
{
|
|
1039
1034
|
"data-testid": e && `${e}-checked-icon`,
|
|
1040
1035
|
size: "xs",
|
|
1041
|
-
svg:
|
|
1036
|
+
svg: He
|
|
1042
1037
|
}
|
|
1043
1038
|
) : /* @__PURE__ */ f(
|
|
1044
1039
|
Y,
|
|
1045
1040
|
{
|
|
1046
1041
|
"data-testid": e && `${e}-indeterminate-icon`,
|
|
1047
1042
|
size: "xs",
|
|
1048
|
-
svg:
|
|
1043
|
+
svg: Ue
|
|
1049
1044
|
}
|
|
1050
1045
|
) }) })
|
|
1051
1046
|
}
|
|
1052
1047
|
),
|
|
1053
1048
|
u && /* @__PURE__ */ f(
|
|
1054
|
-
|
|
1049
|
+
ur,
|
|
1055
1050
|
{
|
|
1056
1051
|
htmlFor: o.id,
|
|
1057
1052
|
"data-testid": e && `${e}-label`,
|
|
1058
1053
|
disabled: o.disabled,
|
|
1059
1054
|
className: w[`${N}__label`],
|
|
1060
|
-
children: /* @__PURE__ */ f(
|
|
1055
|
+
children: /* @__PURE__ */ f(ce, { variant: "paragraph-100", disabled: o.disabled, children: `${o.required ? "* " : ""}${u}` })
|
|
1061
1056
|
}
|
|
1062
1057
|
)
|
|
1063
1058
|
] }),
|
|
1064
|
-
c && /* @__PURE__ */ f(
|
|
1059
|
+
c && /* @__PURE__ */ f(Ie, { "data-testid": e && `${e}-error-text`, children: a })
|
|
1065
1060
|
] });
|
|
1066
1061
|
}, Ir = _(qr);
|
|
1067
1062
|
Ir.displayName = "Checkbox";
|
|
1068
1063
|
export {
|
|
1069
|
-
Ir as Checkbox
|
|
1064
|
+
Ir as Checkbox,
|
|
1065
|
+
Ur as checkedState
|
|
1070
1066
|
};
|
|
1071
1067
|
//# sourceMappingURL=checkbox.es.js.map
|