@purpurds/checkbox 5.27.3 → 5.27.4
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 +7 -7
- package/dist/checkbox.cjs.js.map +1 -1
- package/dist/checkbox.es.js +127 -118
- package/dist/checkbox.es.js.map +1 -1
- package/package.json +6 -6
- package/src/checkbox.stories.tsx +2 -0
package/dist/checkbox.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as g, Children as v, isValidElement as
|
|
1
|
+
import { jsxs as z, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as g, Children as v, isValidElement as N, createElement as p, cloneElement as j, useEffect as A, Fragment as Y, useCallback as Z, createContext as V, useMemo as M, useContext as be, useRef as $, useState as I, useLayoutEffect as _e, useReducer as ge } from "react";
|
|
3
3
|
import { flushSync as $e } from "react-dom";
|
|
4
4
|
function xe(e) {
|
|
5
5
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -41,7 +41,7 @@ var Q = { exports: {} };
|
|
|
41
41
|
})();
|
|
42
42
|
})(Q);
|
|
43
43
|
var ye = Q.exports;
|
|
44
|
-
const
|
|
44
|
+
const Ne = /* @__PURE__ */ xe(ye), we = {
|
|
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 we = /* @__PURE__ */ xe(ye), Ne = {
|
|
|
54
54
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="currentColor"><path fill-rule="evenodd" d="M14.268 3.5c-.77-1.333-2.694-1.333-3.464 0l-8.66 15c-.77 1.333.192 3 1.732 3h17.32c1.54 0 2.502-1.667 1.733-3l-8.66-15Zm-.694 5.067-.247 6.876h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.917c0 .649-.585 1.234-1.25 1.234-.648 0-1.25-.585-1.25-1.234 0-.633.602-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z" clip-rule="evenodd"/></svg>',
|
|
55
55
|
keywords: ["error-filled"],
|
|
56
56
|
category: "status"
|
|
57
|
-
},
|
|
57
|
+
}, Ae = Ne.bind(we), G = "purpur-icon", Ce = "md", ke = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), Pe = ({ 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
|
+
}, Oe = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), ee = ({
|
|
66
66
|
["data-testid"]: e,
|
|
67
67
|
svg: n,
|
|
68
68
|
allyTitle: t,
|
|
69
69
|
className: a,
|
|
70
|
-
size: u =
|
|
70
|
+
size: u = Ce,
|
|
71
71
|
...r
|
|
72
72
|
}) => {
|
|
73
|
-
const o =
|
|
74
|
-
content:
|
|
73
|
+
const o = Pe({
|
|
74
|
+
content: Oe(n.svg),
|
|
75
75
|
title: t
|
|
76
|
-
}), i =
|
|
76
|
+
}), i = Ae(a, G, `${G}--${u}`);
|
|
77
77
|
return /* @__PURE__ */ h(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
@@ -86,7 +86,7 @@ const we = /* @__PURE__ */ xe(ye), Ne = {
|
|
|
86
86
|
);
|
|
87
87
|
};
|
|
88
88
|
ee.displayName = "Icon";
|
|
89
|
-
function
|
|
89
|
+
function Ee(e) {
|
|
90
90
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
91
91
|
}
|
|
92
92
|
var re = { exports: {} };
|
|
@@ -125,31 +125,31 @@ var re = { exports: {} };
|
|
|
125
125
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
126
126
|
})();
|
|
127
127
|
})(re);
|
|
128
|
-
var
|
|
129
|
-
const
|
|
128
|
+
var Me = re.exports;
|
|
129
|
+
const je = /* @__PURE__ */ Ee(Me), K = {
|
|
130
130
|
"purpur-field-error-text": "_purpur-field-error-text_1u768_1",
|
|
131
131
|
"purpur-field-error-text__icon": "_purpur-field-error-text__icon_1u768_12"
|
|
132
|
-
},
|
|
132
|
+
}, X = "purpur-field-error-text", Re = ({
|
|
133
133
|
["data-testid"]: e,
|
|
134
134
|
children: n,
|
|
135
135
|
className: t,
|
|
136
136
|
relevant: a = "additions text",
|
|
137
137
|
...u
|
|
138
|
-
}) => /* @__PURE__ */
|
|
138
|
+
}) => /* @__PURE__ */ z(
|
|
139
139
|
"div",
|
|
140
140
|
{
|
|
141
|
-
className:
|
|
141
|
+
className: je([t, K[X]]),
|
|
142
142
|
"data-testid": e,
|
|
143
143
|
"aria-live": "assertive",
|
|
144
144
|
"aria-relevant": a,
|
|
145
145
|
...u,
|
|
146
146
|
children: [
|
|
147
|
-
/* @__PURE__ */ h(ee, { svg: Se, size: "xs", className:
|
|
147
|
+
/* @__PURE__ */ h(ee, { svg: Se, size: "xs", className: K[`${X}__icon`] }),
|
|
148
148
|
n
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
151
|
);
|
|
152
|
-
function
|
|
152
|
+
function De(e) {
|
|
153
153
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
154
154
|
}
|
|
155
155
|
var te = { exports: {} };
|
|
@@ -188,8 +188,8 @@ var te = { exports: {} };
|
|
|
188
188
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
189
189
|
})();
|
|
190
190
|
})(te);
|
|
191
|
-
var
|
|
192
|
-
const
|
|
191
|
+
var Ie = te.exports;
|
|
192
|
+
const Le = /* @__PURE__ */ De(Ie), qe = {
|
|
193
193
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
194
194
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
195
195
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -197,17 +197,17 @@ const Be = /* @__PURE__ */ Re(ze), De = {
|
|
|
197
197
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
198
198
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
199
199
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
200
|
-
},
|
|
200
|
+
}, Be = {
|
|
201
201
|
name: "checkmark-bold",
|
|
202
202
|
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>',
|
|
203
203
|
keywords: ["checkmark-bold"],
|
|
204
204
|
category: "utility"
|
|
205
|
-
},
|
|
205
|
+
}, ze = {
|
|
206
206
|
name: "minus-bold",
|
|
207
207
|
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>',
|
|
208
208
|
keywords: ["minus-bold"],
|
|
209
209
|
category: "utility"
|
|
210
|
-
}, Te =
|
|
210
|
+
}, Te = Le.bind(qe), W = "purpur-icon", Ue = "md", He = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), Fe = ({ content: e = "", title: n } = {}) => {
|
|
211
211
|
const t = [
|
|
212
212
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
213
213
|
{ name: "fill", value: "currentColor" },
|
|
@@ -239,47 +239,47 @@ const Be = /* @__PURE__ */ Re(ze), De = {
|
|
|
239
239
|
);
|
|
240
240
|
};
|
|
241
241
|
T.displayName = "Icon";
|
|
242
|
-
function
|
|
243
|
-
return
|
|
242
|
+
function k() {
|
|
243
|
+
return k = Object.assign ? Object.assign.bind() : function(e) {
|
|
244
244
|
for (var n = 1; n < arguments.length; n++) {
|
|
245
245
|
var t = arguments[n];
|
|
246
246
|
for (var a in t) ({}).hasOwnProperty.call(t, a) && (e[a] = t[a]);
|
|
247
247
|
}
|
|
248
248
|
return e;
|
|
249
|
-
},
|
|
249
|
+
}, k.apply(null, arguments);
|
|
250
250
|
}
|
|
251
251
|
function Ve(e, n) {
|
|
252
252
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Ge(...e) {
|
|
255
255
|
return (n) => e.forEach(
|
|
256
256
|
(t) => Ve(t, n)
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
259
|
const ne = /* @__PURE__ */ g((e, n) => {
|
|
260
|
-
const { children: t, ...a } = e, u = v.toArray(t), r = u.find(
|
|
260
|
+
const { children: t, ...a } = e, u = v.toArray(t), r = u.find(Xe);
|
|
261
261
|
if (r) {
|
|
262
|
-
const o = r.props.children, i = u.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */
|
|
263
|
-
return /* @__PURE__ */ p(U,
|
|
262
|
+
const o = r.props.children, i = u.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */ N(o) ? o.props.children : null : c);
|
|
263
|
+
return /* @__PURE__ */ p(U, k({}, a, {
|
|
264
264
|
ref: n
|
|
265
|
-
}), /* @__PURE__ */
|
|
265
|
+
}), /* @__PURE__ */ N(o) ? /* @__PURE__ */ j(o, void 0, i) : null);
|
|
266
266
|
}
|
|
267
|
-
return /* @__PURE__ */ p(U,
|
|
267
|
+
return /* @__PURE__ */ p(U, k({}, a, {
|
|
268
268
|
ref: n
|
|
269
269
|
}), t);
|
|
270
270
|
});
|
|
271
271
|
ne.displayName = "Slot";
|
|
272
272
|
const U = /* @__PURE__ */ g((e, n) => {
|
|
273
273
|
const { children: t, ...a } = e;
|
|
274
|
-
return /* @__PURE__ */
|
|
274
|
+
return /* @__PURE__ */ N(t) ? /* @__PURE__ */ j(t, {
|
|
275
275
|
...We(a, t.props),
|
|
276
|
-
ref: n ?
|
|
276
|
+
ref: n ? Ge(n, t.ref) : t.ref
|
|
277
277
|
}) : v.count(t) > 1 ? v.only(null) : null;
|
|
278
278
|
});
|
|
279
279
|
U.displayName = "SlotClone";
|
|
280
|
-
const
|
|
281
|
-
function
|
|
282
|
-
return /* @__PURE__ */
|
|
280
|
+
const Ke = ({ children: e }) => /* @__PURE__ */ p(Y, null, e);
|
|
281
|
+
function Xe(e) {
|
|
282
|
+
return /* @__PURE__ */ N(e) && e.type === Ke;
|
|
283
283
|
}
|
|
284
284
|
function We(e, n) {
|
|
285
285
|
const t = {
|
|
@@ -322,9 +322,9 @@ const Je = [
|
|
|
322
322
|
], Ye = Je.reduce((e, n) => {
|
|
323
323
|
const t = /* @__PURE__ */ g((a, u) => {
|
|
324
324
|
const { asChild: r, ...o } = a, i = r ? ne : n;
|
|
325
|
-
return
|
|
325
|
+
return A(() => {
|
|
326
326
|
window[Symbol.for("radix-ui")] = !0;
|
|
327
|
-
}, []), /* @__PURE__ */ p(i,
|
|
327
|
+
}, []), /* @__PURE__ */ p(i, k({}, o, {
|
|
328
328
|
ref: u
|
|
329
329
|
}));
|
|
330
330
|
});
|
|
@@ -332,7 +332,7 @@ const Je = [
|
|
|
332
332
|
...e,
|
|
333
333
|
[n]: t
|
|
334
334
|
};
|
|
335
|
-
}, {}), Qe = /* @__PURE__ */ g((e, n) => /* @__PURE__ */ p(Ye.label,
|
|
335
|
+
}, {}), Qe = /* @__PURE__ */ g((e, n) => /* @__PURE__ */ p(Ye.label, k({}, e, {
|
|
336
336
|
ref: n,
|
|
337
337
|
onMouseDown: (t) => {
|
|
338
338
|
var a;
|
|
@@ -379,11 +379,11 @@ var oe = { exports: {} };
|
|
|
379
379
|
})();
|
|
380
380
|
})(oe);
|
|
381
381
|
var tr = oe.exports;
|
|
382
|
-
const nr = /* @__PURE__ */ rr(tr),
|
|
382
|
+
const nr = /* @__PURE__ */ rr(tr), q = {
|
|
383
383
|
"purpur-label": "_purpur-label_12cfi_1",
|
|
384
384
|
"purpur-label--negative": "_purpur-label--negative_12cfi_9",
|
|
385
385
|
"purpur-label--disabled": "_purpur-label--disabled_12cfi_12"
|
|
386
|
-
},
|
|
386
|
+
}, B = "purpur-label", or = ({
|
|
387
387
|
children: e,
|
|
388
388
|
className: n,
|
|
389
389
|
htmlFor: t,
|
|
@@ -394,10 +394,10 @@ const nr = /* @__PURE__ */ rr(tr), D = {
|
|
|
394
394
|
}) => {
|
|
395
395
|
const i = nr([
|
|
396
396
|
n,
|
|
397
|
-
|
|
397
|
+
q[B],
|
|
398
398
|
{
|
|
399
|
-
[
|
|
400
|
-
[
|
|
399
|
+
[q[`${B}--disabled`]]: u,
|
|
400
|
+
[q[`${B}--negative`]]: r
|
|
401
401
|
}
|
|
402
402
|
]);
|
|
403
403
|
return /* @__PURE__ */ h(er, { className: i, "data-testid": a, htmlFor: t, ...o, children: e });
|
|
@@ -442,7 +442,7 @@ var ae = { exports: {} };
|
|
|
442
442
|
})();
|
|
443
443
|
})(ae);
|
|
444
444
|
var ir = ae.exports;
|
|
445
|
-
const ur = /* @__PURE__ */ ar(ir),
|
|
445
|
+
const ur = /* @__PURE__ */ ar(ir), O = {
|
|
446
446
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
|
447
447
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
|
448
448
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
|
@@ -458,8 +458,17 @@ const ur = /* @__PURE__ */ ar(ir), A = {
|
|
|
458
458
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
|
459
459
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
|
460
460
|
}, cr = {
|
|
461
|
-
PARAGRAPH100: "paragraph-100"
|
|
462
|
-
|
|
461
|
+
PARAGRAPH100: "paragraph-100",
|
|
462
|
+
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
463
|
+
PARAGRAPH100BOLD: "paragraph-100-bold",
|
|
464
|
+
PARAGRAPH200: "paragraph-200",
|
|
465
|
+
PREAMBLE100: "preamble-100",
|
|
466
|
+
PREAMBLE200: "preamble-200",
|
|
467
|
+
ADDITIONAL100: "additional-100",
|
|
468
|
+
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
469
|
+
OVERLINE100: "overline-100",
|
|
470
|
+
OVERLINE200: "overline-200"
|
|
471
|
+
}, E = "purpur-paragraph", ie = ({
|
|
463
472
|
["data-testid"]: e,
|
|
464
473
|
children: n,
|
|
465
474
|
className: t,
|
|
@@ -471,25 +480,25 @@ const ur = /* @__PURE__ */ ar(ir), A = {
|
|
|
471
480
|
}) => {
|
|
472
481
|
const c = ur([
|
|
473
482
|
t,
|
|
474
|
-
|
|
475
|
-
|
|
483
|
+
O[E],
|
|
484
|
+
O[`${E}--${o}`],
|
|
476
485
|
{
|
|
477
|
-
[
|
|
478
|
-
[
|
|
479
|
-
[
|
|
486
|
+
[O[`${E}--hyphens`]]: u,
|
|
487
|
+
[O[`${E}--disabled`]]: a,
|
|
488
|
+
[O[`${E}--negative`]]: r
|
|
480
489
|
}
|
|
481
490
|
]);
|
|
482
491
|
return /* @__PURE__ */ h("p", { ...i, className: c, "data-testid": e, children: n });
|
|
483
492
|
};
|
|
484
493
|
ie.displayName = "Paragraph";
|
|
485
|
-
function
|
|
486
|
-
return
|
|
494
|
+
function w() {
|
|
495
|
+
return w = Object.assign ? Object.assign.bind() : function(e) {
|
|
487
496
|
for (var n = 1; n < arguments.length; n++) {
|
|
488
497
|
var t = arguments[n];
|
|
489
498
|
for (var a in t) ({}).hasOwnProperty.call(t, a) && (e[a] = t[a]);
|
|
490
499
|
}
|
|
491
500
|
return e;
|
|
492
|
-
},
|
|
501
|
+
}, w.apply(null, arguments);
|
|
493
502
|
}
|
|
494
503
|
function sr(e, n) {
|
|
495
504
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
@@ -511,11 +520,11 @@ function lr(e, n = []) {
|
|
|
511
520
|
o
|
|
512
521
|
];
|
|
513
522
|
function s(l) {
|
|
514
|
-
const { scope: f, children: b, ..._ } = l,
|
|
523
|
+
const { scope: f, children: b, ..._ } = l, R = (f == null ? void 0 : f[e][c]) || i, x = M(
|
|
515
524
|
() => _,
|
|
516
525
|
Object.values(_)
|
|
517
526
|
);
|
|
518
|
-
return /* @__PURE__ */ p(
|
|
527
|
+
return /* @__PURE__ */ p(R.Provider, {
|
|
519
528
|
value: x
|
|
520
529
|
}, b);
|
|
521
530
|
}
|
|
@@ -534,7 +543,7 @@ function lr(e, n = []) {
|
|
|
534
543
|
const r = t.map((o) => /* @__PURE__ */ V(o));
|
|
535
544
|
return function(i) {
|
|
536
545
|
const c = (i == null ? void 0 : i[e]) || r;
|
|
537
|
-
return
|
|
546
|
+
return M(
|
|
538
547
|
() => ({
|
|
539
548
|
[`__scope${e}`]: {
|
|
540
549
|
...i,
|
|
@@ -571,7 +580,7 @@ function pr(...e) {
|
|
|
571
580
|
...l
|
|
572
581
|
};
|
|
573
582
|
}, {});
|
|
574
|
-
return
|
|
583
|
+
return M(
|
|
575
584
|
() => ({
|
|
576
585
|
[`__scope${n.scopeName}`]: o
|
|
577
586
|
}),
|
|
@@ -590,9 +599,9 @@ function J(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
|
590
599
|
}
|
|
591
600
|
function se(e) {
|
|
592
601
|
const n = $(e);
|
|
593
|
-
return
|
|
602
|
+
return A(() => {
|
|
594
603
|
n.current = e;
|
|
595
|
-
}),
|
|
604
|
+
}), M(
|
|
596
605
|
() => (...t) => {
|
|
597
606
|
var a;
|
|
598
607
|
return (a = n.current) === null || a === void 0 ? void 0 : a.call(n, ...t);
|
|
@@ -622,8 +631,8 @@ function dr({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
622
631
|
];
|
|
623
632
|
}
|
|
624
633
|
function fr({ defaultProp: e, onChange: n }) {
|
|
625
|
-
const t =
|
|
626
|
-
return
|
|
634
|
+
const t = I(e), [a] = t, u = $(a), r = se(n);
|
|
635
|
+
return A(() => {
|
|
627
636
|
u.current !== a && (r(a), u.current = a);
|
|
628
637
|
}, [
|
|
629
638
|
a,
|
|
@@ -636,14 +645,14 @@ function hr(e) {
|
|
|
636
645
|
value: e,
|
|
637
646
|
previous: e
|
|
638
647
|
});
|
|
639
|
-
return
|
|
648
|
+
return M(() => (n.current.value !== e && (n.current.previous = n.current.value, n.current.value = e), n.current.previous), [
|
|
640
649
|
e
|
|
641
650
|
]);
|
|
642
651
|
}
|
|
643
652
|
const H = globalThis != null && globalThis.document ? _e : () => {
|
|
644
653
|
};
|
|
645
654
|
function mr(e) {
|
|
646
|
-
const [n, t] =
|
|
655
|
+
const [n, t] = I(void 0);
|
|
647
656
|
return H(() => {
|
|
648
657
|
if (e) {
|
|
649
658
|
t({
|
|
@@ -683,13 +692,13 @@ const le = (e) => {
|
|
|
683
692
|
const { present: n, children: t } = e, a = br(n), u = typeof t == "function" ? t({
|
|
684
693
|
present: a.isPresent
|
|
685
694
|
}) : v.only(t), r = ce(a.ref, u.ref);
|
|
686
|
-
return typeof t == "function" || a.isPresent ? /* @__PURE__ */
|
|
695
|
+
return typeof t == "function" || a.isPresent ? /* @__PURE__ */ j(u, {
|
|
687
696
|
ref: r
|
|
688
697
|
}) : null;
|
|
689
698
|
};
|
|
690
699
|
le.displayName = "Presence";
|
|
691
700
|
function br(e) {
|
|
692
|
-
const [n, t] =
|
|
701
|
+
const [n, t] = I(), a = $({}), u = $(e), r = $("none"), o = e ? "mounted" : "unmounted", [i, c] = vr(o, {
|
|
693
702
|
mounted: {
|
|
694
703
|
UNMOUNT: "unmounted",
|
|
695
704
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -702,15 +711,15 @@ function br(e) {
|
|
|
702
711
|
MOUNT: "mounted"
|
|
703
712
|
}
|
|
704
713
|
});
|
|
705
|
-
return
|
|
706
|
-
const s =
|
|
714
|
+
return A(() => {
|
|
715
|
+
const s = D(a.current);
|
|
707
716
|
r.current = i === "mounted" ? s : "none";
|
|
708
717
|
}, [
|
|
709
718
|
i
|
|
710
719
|
]), H(() => {
|
|
711
720
|
const s = a.current, d = u.current;
|
|
712
721
|
if (d !== e) {
|
|
713
|
-
const f = r.current, b =
|
|
722
|
+
const f = r.current, b = D(s);
|
|
714
723
|
e ? c("MOUNT") : b === "none" || (s == null ? void 0 : s.display) === "none" ? c("UNMOUNT") : c(d && f !== b ? "ANIMATION_OUT" : "UNMOUNT"), u.current = e;
|
|
715
724
|
}
|
|
716
725
|
}, [
|
|
@@ -719,12 +728,12 @@ function br(e) {
|
|
|
719
728
|
]), H(() => {
|
|
720
729
|
if (n) {
|
|
721
730
|
const s = (l) => {
|
|
722
|
-
const b =
|
|
731
|
+
const b = D(a.current).includes(l.animationName);
|
|
723
732
|
l.target === n && b && $e(
|
|
724
733
|
() => c("ANIMATION_END")
|
|
725
734
|
);
|
|
726
735
|
}, d = (l) => {
|
|
727
|
-
l.target === n && (r.current =
|
|
736
|
+
l.target === n && (r.current = D(a.current));
|
|
728
737
|
};
|
|
729
738
|
return n.addEventListener("animationstart", d), n.addEventListener("animationcancel", s), n.addEventListener("animationend", s), () => {
|
|
730
739
|
n.removeEventListener("animationstart", d), n.removeEventListener("animationcancel", s), n.removeEventListener("animationend", s);
|
|
@@ -744,25 +753,25 @@ function br(e) {
|
|
|
744
753
|
}, [])
|
|
745
754
|
};
|
|
746
755
|
}
|
|
747
|
-
function
|
|
756
|
+
function D(e) {
|
|
748
757
|
return (e == null ? void 0 : e.animationName) || "none";
|
|
749
758
|
}
|
|
750
759
|
const pe = /* @__PURE__ */ g((e, n) => {
|
|
751
760
|
const { children: t, ...a } = e, u = v.toArray(t), r = u.find(gr);
|
|
752
761
|
if (r) {
|
|
753
|
-
const o = r.props.children, i = u.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */
|
|
754
|
-
return /* @__PURE__ */ p(F,
|
|
762
|
+
const o = r.props.children, i = u.map((c) => c === r ? v.count(o) > 1 ? v.only(null) : /* @__PURE__ */ N(o) ? o.props.children : null : c);
|
|
763
|
+
return /* @__PURE__ */ p(F, w({}, a, {
|
|
755
764
|
ref: n
|
|
756
|
-
}), /* @__PURE__ */
|
|
765
|
+
}), /* @__PURE__ */ N(o) ? /* @__PURE__ */ j(o, void 0, i) : null);
|
|
757
766
|
}
|
|
758
|
-
return /* @__PURE__ */ p(F,
|
|
767
|
+
return /* @__PURE__ */ p(F, w({}, a, {
|
|
759
768
|
ref: n
|
|
760
769
|
}), t);
|
|
761
770
|
});
|
|
762
771
|
pe.displayName = "Slot";
|
|
763
772
|
const F = /* @__PURE__ */ g((e, n) => {
|
|
764
773
|
const { children: t, ...a } = e;
|
|
765
|
-
return /* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ N(t) ? /* @__PURE__ */ j(t, {
|
|
766
775
|
...$r(a, t.props),
|
|
767
776
|
ref: n ? ue(n, t.ref) : t.ref
|
|
768
777
|
}) : v.count(t) > 1 ? v.only(null) : null;
|
|
@@ -770,7 +779,7 @@ const F = /* @__PURE__ */ g((e, n) => {
|
|
|
770
779
|
F.displayName = "SlotClone";
|
|
771
780
|
const _r = ({ children: e }) => /* @__PURE__ */ p(Y, null, e);
|
|
772
781
|
function gr(e) {
|
|
773
|
-
return /* @__PURE__ */
|
|
782
|
+
return /* @__PURE__ */ N(e) && e.type === _r;
|
|
774
783
|
}
|
|
775
784
|
function $r(e, n) {
|
|
776
785
|
const t = {
|
|
@@ -813,9 +822,9 @@ const xr = [
|
|
|
813
822
|
], de = xr.reduce((e, n) => {
|
|
814
823
|
const t = /* @__PURE__ */ g((a, u) => {
|
|
815
824
|
const { asChild: r, ...o } = a, i = r ? pe : n;
|
|
816
|
-
return
|
|
825
|
+
return A(() => {
|
|
817
826
|
window[Symbol.for("radix-ui")] = !0;
|
|
818
|
-
}, []), /* @__PURE__ */ p(i,
|
|
827
|
+
}, []), /* @__PURE__ */ p(i, w({}, o, {
|
|
819
828
|
ref: u
|
|
820
829
|
}));
|
|
821
830
|
});
|
|
@@ -823,29 +832,29 @@ const xr = [
|
|
|
823
832
|
...e,
|
|
824
833
|
[n]: t
|
|
825
834
|
};
|
|
826
|
-
}, {}), fe = "Checkbox", [yr,
|
|
827
|
-
const { __scopeCheckbox: t, name: a, checked: u, defaultChecked: r, required: o, disabled: i, value: c = "on", onCheckedChange: s, ...d } = e, [l, f] =
|
|
835
|
+
}, {}), fe = "Checkbox", [yr, zr] = lr(fe), [Nr, wr] = yr(fe), Sr = /* @__PURE__ */ g((e, n) => {
|
|
836
|
+
const { __scopeCheckbox: t, name: a, checked: u, defaultChecked: r, required: o, disabled: i, value: c = "on", onCheckedChange: s, ...d } = e, [l, f] = I(null), b = ce(
|
|
828
837
|
n,
|
|
829
838
|
(m) => f(m)
|
|
830
|
-
), _ = $(!1),
|
|
839
|
+
), _ = $(!1), R = l ? !!l.closest("form") : !0, [x = !1, L] = dr({
|
|
831
840
|
prop: u,
|
|
832
841
|
defaultProp: r,
|
|
833
842
|
onChange: s
|
|
834
843
|
}), ve = $(x);
|
|
835
|
-
return
|
|
844
|
+
return A(() => {
|
|
836
845
|
const m = l == null ? void 0 : l.form;
|
|
837
846
|
if (m) {
|
|
838
|
-
const
|
|
839
|
-
return m.addEventListener("reset",
|
|
847
|
+
const P = () => L(ve.current);
|
|
848
|
+
return m.addEventListener("reset", P), () => m.removeEventListener("reset", P);
|
|
840
849
|
}
|
|
841
850
|
}, [
|
|
842
851
|
l,
|
|
843
|
-
|
|
844
|
-
]), /* @__PURE__ */ p(
|
|
852
|
+
L
|
|
853
|
+
]), /* @__PURE__ */ p(Nr, {
|
|
845
854
|
scope: t,
|
|
846
855
|
state: x,
|
|
847
856
|
disabled: i
|
|
848
|
-
}, /* @__PURE__ */ p(de.button,
|
|
857
|
+
}, /* @__PURE__ */ p(de.button, w({
|
|
849
858
|
type: "button",
|
|
850
859
|
role: "checkbox",
|
|
851
860
|
"aria-checked": S(x) ? "mixed" : x,
|
|
@@ -860,11 +869,11 @@ const xr = [
|
|
|
860
869
|
m.key === "Enter" && m.preventDefault();
|
|
861
870
|
}),
|
|
862
871
|
onClick: J(e.onClick, (m) => {
|
|
863
|
-
|
|
864
|
-
(
|
|
865
|
-
),
|
|
872
|
+
L(
|
|
873
|
+
(P) => S(P) ? !0 : !P
|
|
874
|
+
), R && (_.current = m.isPropagationStopped(), _.current || m.stopPropagation());
|
|
866
875
|
})
|
|
867
|
-
})),
|
|
876
|
+
})), R && /* @__PURE__ */ p(kr, {
|
|
868
877
|
control: l,
|
|
869
878
|
bubbles: !_.current,
|
|
870
879
|
name: a,
|
|
@@ -876,11 +885,11 @@ const xr = [
|
|
|
876
885
|
transform: "translateX(-100%)"
|
|
877
886
|
}
|
|
878
887
|
}));
|
|
879
|
-
}),
|
|
880
|
-
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r =
|
|
888
|
+
}), Ar = "CheckboxIndicator", Cr = /* @__PURE__ */ g((e, n) => {
|
|
889
|
+
const { __scopeCheckbox: t, forceMount: a, ...u } = e, r = wr(Ar, t);
|
|
881
890
|
return /* @__PURE__ */ p(le, {
|
|
882
891
|
present: a || S(r.state) || r.state === !0
|
|
883
|
-
}, /* @__PURE__ */ p(de.span,
|
|
892
|
+
}, /* @__PURE__ */ p(de.span, w({
|
|
884
893
|
"data-state": he(r.state),
|
|
885
894
|
"data-disabled": r.disabled ? "" : void 0
|
|
886
895
|
}, u, {
|
|
@@ -890,9 +899,9 @@ const xr = [
|
|
|
890
899
|
...e.style
|
|
891
900
|
}
|
|
892
901
|
})));
|
|
893
|
-
}),
|
|
902
|
+
}), kr = (e) => {
|
|
894
903
|
const { control: n, checked: t, bubbles: a = !0, ...u } = e, r = $(null), o = hr(t), i = mr(n);
|
|
895
|
-
return
|
|
904
|
+
return A(() => {
|
|
896
905
|
const c = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
|
|
897
906
|
if (o !== t && l) {
|
|
898
907
|
const f = new Event("click", {
|
|
@@ -904,7 +913,7 @@ const xr = [
|
|
|
904
913
|
o,
|
|
905
914
|
t,
|
|
906
915
|
a
|
|
907
|
-
]), /* @__PURE__ */ p("input",
|
|
916
|
+
]), /* @__PURE__ */ p("input", w({
|
|
908
917
|
type: "checkbox",
|
|
909
918
|
"aria-hidden": !0,
|
|
910
919
|
defaultChecked: S(t) ? !1 : t
|
|
@@ -927,8 +936,8 @@ function S(e) {
|
|
|
927
936
|
function he(e) {
|
|
928
937
|
return S(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
929
938
|
}
|
|
930
|
-
const
|
|
931
|
-
function
|
|
939
|
+
const Pr = Sr, Or = Cr;
|
|
940
|
+
function Er(e) {
|
|
932
941
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
933
942
|
}
|
|
934
943
|
var me = { exports: {} };
|
|
@@ -967,8 +976,8 @@ var me = { exports: {} };
|
|
|
967
976
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
968
977
|
})();
|
|
969
978
|
})(me);
|
|
970
|
-
var
|
|
971
|
-
const
|
|
979
|
+
var Mr = me.exports;
|
|
980
|
+
const jr = /* @__PURE__ */ Er(Mr), Rr = {
|
|
972
981
|
"purpur-checkbox": "_purpur-checkbox_m4999_1",
|
|
973
982
|
"purpur-checkbox__box": "_purpur-checkbox__box_m4999_7",
|
|
974
983
|
"purpur-checkbox--error": "_purpur-checkbox--error_m4999_16",
|
|
@@ -977,7 +986,7 @@ const Mr = /* @__PURE__ */ jr(Er), qr = {
|
|
|
977
986
|
"purpur-checkbox__label": "_purpur-checkbox__label_m4999_70",
|
|
978
987
|
"purpur-checkbox__wrapper": "_purpur-checkbox__wrapper_m4999_73",
|
|
979
988
|
"purpur-checkbox__container": "_purpur-checkbox__container_m4999_79"
|
|
980
|
-
},
|
|
989
|
+
}, C = jr.bind(Rr), Tr = ["indeterminate", !0, !1], y = "purpur-checkbox", Dr = ({
|
|
981
990
|
["data-testid"]: e,
|
|
982
991
|
checked: n,
|
|
983
992
|
className: t,
|
|
@@ -988,14 +997,14 @@ const Mr = /* @__PURE__ */ jr(Er), qr = {
|
|
|
988
997
|
...i
|
|
989
998
|
}, c) => {
|
|
990
999
|
const s = u && !n, d = a && !n;
|
|
991
|
-
return /* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
1000
|
+
return /* @__PURE__ */ z("div", { className: C([t, `${y}__wrapper`]), children: [
|
|
1001
|
+
/* @__PURE__ */ z("div", { className: C([t, `${y}__container`]), children: [
|
|
993
1002
|
/* @__PURE__ */ h(
|
|
994
|
-
|
|
1003
|
+
Pr,
|
|
995
1004
|
{
|
|
996
1005
|
...i,
|
|
997
1006
|
checked: n,
|
|
998
|
-
className:
|
|
1007
|
+
className: C([
|
|
999
1008
|
y,
|
|
1000
1009
|
{
|
|
1001
1010
|
[`${y}--error`]: s,
|
|
@@ -1005,19 +1014,19 @@ const Mr = /* @__PURE__ */ jr(Er), qr = {
|
|
|
1005
1014
|
"data-testid": e,
|
|
1006
1015
|
onCheckedChange: o,
|
|
1007
1016
|
ref: c,
|
|
1008
|
-
children: /* @__PURE__ */ h("span", { className:
|
|
1017
|
+
children: /* @__PURE__ */ h("span", { className: C(`${y}__box`), children: /* @__PURE__ */ h(Or, { className: C(`${y}__indicator`), children: n === "indeterminate" ? /* @__PURE__ */ h(
|
|
1009
1018
|
T,
|
|
1010
1019
|
{
|
|
1011
1020
|
"data-testid": e && `${e}-checked-icon`,
|
|
1012
1021
|
size: "xs",
|
|
1013
|
-
svg:
|
|
1022
|
+
svg: ze
|
|
1014
1023
|
}
|
|
1015
1024
|
) : /* @__PURE__ */ h(
|
|
1016
1025
|
T,
|
|
1017
1026
|
{
|
|
1018
1027
|
"data-testid": e && `${e}-indeterminate-icon`,
|
|
1019
1028
|
size: "xs",
|
|
1020
|
-
svg:
|
|
1029
|
+
svg: Be
|
|
1021
1030
|
}
|
|
1022
1031
|
) }) })
|
|
1023
1032
|
}
|
|
@@ -1028,17 +1037,17 @@ const Mr = /* @__PURE__ */ jr(Er), qr = {
|
|
|
1028
1037
|
htmlFor: i.id,
|
|
1029
1038
|
"data-testid": e && `${e}-label`,
|
|
1030
1039
|
disabled: i.disabled,
|
|
1031
|
-
className:
|
|
1040
|
+
className: C(`${y}__label`),
|
|
1032
1041
|
children: /* @__PURE__ */ h(ie, { variant: "paragraph-100", disabled: i.disabled, children: `${i.required ? "* " : ""}${r}` })
|
|
1033
1042
|
}
|
|
1034
1043
|
)
|
|
1035
1044
|
] }),
|
|
1036
|
-
s && /* @__PURE__ */ h(
|
|
1045
|
+
s && /* @__PURE__ */ h(Re, { "data-testid": e && `${e}-error-text`, children: u })
|
|
1037
1046
|
] });
|
|
1038
|
-
},
|
|
1039
|
-
|
|
1047
|
+
}, Ir = g(Dr);
|
|
1048
|
+
Ir.displayName = "Checkbox";
|
|
1040
1049
|
export {
|
|
1041
|
-
|
|
1050
|
+
Ir as Checkbox,
|
|
1042
1051
|
Tr as checkedState
|
|
1043
1052
|
};
|
|
1044
1053
|
//# sourceMappingURL=checkbox.es.js.map
|