@purpurds/toggle 5.35.0 → 6.0.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 +3 -3
- package/dist/toggle.cjs.js +4 -4
- package/dist/toggle.cjs.js.map +1 -1
- package/dist/toggle.d.ts.map +1 -1
- package/dist/toggle.es.js +132 -131
- package/dist/toggle.es.js.map +1 -1
- package/package.json +5 -5
- package/src/toggle.tsx +2 -1
package/dist/toggle.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as w, jsxs as F } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as S, Children as $, isValidElement as A, createElement as _, cloneElement as B, useEffect as C, Fragment as
|
|
2
|
+
import { forwardRef as S, Children as $, isValidElement as A, createElement as _, cloneElement as B, useEffect as C, Fragment as K, useCallback as z, createContext as W, useMemo as j, useContext as pe, useRef as x, useState as y, useLayoutEffect as de } from "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
function fe(e) {
|
|
5
5
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
6
6
|
}
|
|
7
|
-
var
|
|
7
|
+
var Q = { exports: {} };
|
|
8
8
|
/*!
|
|
9
9
|
Copyright (c) 2018 Jed Watson.
|
|
10
10
|
Licensed under the MIT License (MIT), see
|
|
@@ -15,8 +15,8 @@ var K = { exports: {} };
|
|
|
15
15
|
var n = {}.hasOwnProperty;
|
|
16
16
|
function t() {
|
|
17
17
|
for (var r = "", o = 0; o < arguments.length; o++) {
|
|
18
|
-
var
|
|
19
|
-
|
|
18
|
+
var c = arguments[o];
|
|
19
|
+
c && (r = u(r, a.call(this, c)));
|
|
20
20
|
}
|
|
21
21
|
return r;
|
|
22
22
|
}
|
|
@@ -30,8 +30,8 @@ var K = { exports: {} };
|
|
|
30
30
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
31
31
|
return r.toString();
|
|
32
32
|
var o = "";
|
|
33
|
-
for (var
|
|
34
|
-
n.call(r,
|
|
33
|
+
for (var c in r)
|
|
34
|
+
n.call(r, c) && r[c] && (o = u(o, this && this[c] || c));
|
|
35
35
|
return o;
|
|
36
36
|
}
|
|
37
37
|
function u(r, o) {
|
|
@@ -39,8 +39,8 @@ var K = { exports: {} };
|
|
|
39
39
|
}
|
|
40
40
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
41
41
|
})();
|
|
42
|
-
})(
|
|
43
|
-
var he =
|
|
42
|
+
})(Q);
|
|
43
|
+
var he = Q.exports;
|
|
44
44
|
const ge = /* @__PURE__ */ fe(he), be = {
|
|
45
45
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
46
46
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
@@ -49,43 +49,44 @@ const ge = /* @__PURE__ */ fe(he), be = {
|
|
|
49
49
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
50
50
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
51
51
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
52
|
-
}, _e = {
|
|
53
|
-
name: "checkmark-bold",
|
|
54
|
-
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>',
|
|
55
|
-
keywords: ["checkmark-bold"],
|
|
56
|
-
category: "utility"
|
|
57
|
-
}, me = ge.bind(be), U = "purpur-icon", ve = "md", $e = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), ye = ({ content: e = "", title: n } = {}) => {
|
|
52
|
+
}, _e = ge.bind(be), U = "purpur-icon", me = "md", ve = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), $e = ({ content: e = "", title: n } = {}) => {
|
|
58
53
|
const t = [
|
|
59
54
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
60
55
|
{ name: "fill", value: "currentColor" },
|
|
61
56
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
62
57
|
n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
63
58
|
], a = n ? `<title>${n}</title>` : "";
|
|
64
|
-
return `<svg ${
|
|
65
|
-
},
|
|
59
|
+
return `<svg ${ve(t)}>${a}${e}</svg>`;
|
|
60
|
+
}, ye = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Y = ({
|
|
66
61
|
["data-testid"]: e,
|
|
67
62
|
svg: n,
|
|
68
63
|
allyTitle: t,
|
|
69
64
|
className: a,
|
|
70
|
-
size: u =
|
|
65
|
+
size: u = me,
|
|
71
66
|
...r
|
|
72
67
|
}) => {
|
|
73
|
-
const o =
|
|
74
|
-
content:
|
|
68
|
+
const o = $e({
|
|
69
|
+
content: ye(n.svg),
|
|
75
70
|
title: t
|
|
76
|
-
}),
|
|
71
|
+
}), c = _e(a, U, `${U}--${u}`);
|
|
77
72
|
return /* @__PURE__ */ w(
|
|
78
73
|
"span",
|
|
79
74
|
{
|
|
80
75
|
"aria-label": t,
|
|
81
|
-
className:
|
|
76
|
+
className: c,
|
|
82
77
|
"data-testid": e,
|
|
83
78
|
dangerouslySetInnerHTML: { __html: o },
|
|
84
79
|
...r
|
|
85
80
|
}
|
|
86
81
|
);
|
|
87
82
|
};
|
|
88
|
-
|
|
83
|
+
Y.displayName = "Icon";
|
|
84
|
+
const we = {
|
|
85
|
+
name: "checkmark-bold",
|
|
86
|
+
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>',
|
|
87
|
+
keywords: ["checkmark-bold"],
|
|
88
|
+
category: "utility"
|
|
89
|
+
};
|
|
89
90
|
function O() {
|
|
90
91
|
return O = Object.assign ? Object.assign.bind() : function(e) {
|
|
91
92
|
for (var n = 1; n < arguments.length; n++) {
|
|
@@ -106,10 +107,10 @@ function Se(...e) {
|
|
|
106
107
|
const ee = /* @__PURE__ */ S((e, n) => {
|
|
107
108
|
const { children: t, ...a } = e, u = $.toArray(t), r = u.find(ke);
|
|
108
109
|
if (r) {
|
|
109
|
-
const o = r.props.children,
|
|
110
|
+
const o = r.props.children, c = u.map((i) => i === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : i);
|
|
110
111
|
return /* @__PURE__ */ _(T, O({}, a, {
|
|
111
112
|
ref: n
|
|
112
|
-
}), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0,
|
|
113
|
+
}), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, c) : null);
|
|
113
114
|
}
|
|
114
115
|
return /* @__PURE__ */ _(T, O({}, a, {
|
|
115
116
|
ref: n
|
|
@@ -124,7 +125,7 @@ const T = /* @__PURE__ */ S((e, n) => {
|
|
|
124
125
|
}) : $.count(t) > 1 ? $.only(null) : null;
|
|
125
126
|
});
|
|
126
127
|
T.displayName = "SlotClone";
|
|
127
|
-
const Pe = ({ children: e }) => /* @__PURE__ */ _(
|
|
128
|
+
const Pe = ({ children: e }) => /* @__PURE__ */ _(K, null, e);
|
|
128
129
|
function ke(e) {
|
|
129
130
|
return /* @__PURE__ */ A(e) && e.type === Pe;
|
|
130
131
|
}
|
|
@@ -166,12 +167,12 @@ const Ce = [
|
|
|
166
167
|
"span",
|
|
167
168
|
"svg",
|
|
168
169
|
"ul"
|
|
169
|
-
],
|
|
170
|
+
], De = Ce.reduce((e, n) => {
|
|
170
171
|
const t = /* @__PURE__ */ S((a, u) => {
|
|
171
|
-
const { asChild: r, ...o } = a,
|
|
172
|
+
const { asChild: r, ...o } = a, c = r ? ee : n;
|
|
172
173
|
return C(() => {
|
|
173
174
|
window[Symbol.for("radix-ui")] = !0;
|
|
174
|
-
}, []), /* @__PURE__ */ _(
|
|
175
|
+
}, []), /* @__PURE__ */ _(c, O({}, o, {
|
|
175
176
|
ref: u
|
|
176
177
|
}));
|
|
177
178
|
});
|
|
@@ -179,13 +180,13 @@ const Ce = [
|
|
|
179
180
|
...e,
|
|
180
181
|
[n]: t
|
|
181
182
|
};
|
|
182
|
-
}, {}),
|
|
183
|
+
}, {}), Ne = /* @__PURE__ */ S((e, n) => /* @__PURE__ */ _(De.label, O({}, e, {
|
|
183
184
|
ref: n,
|
|
184
185
|
onMouseDown: (t) => {
|
|
185
186
|
var a;
|
|
186
187
|
(a = e.onMouseDown) === null || a === void 0 || a.call(e, t), !t.defaultPrevented && t.detail > 1 && t.preventDefault();
|
|
187
188
|
}
|
|
188
|
-
}))), Ee =
|
|
189
|
+
}))), Ee = Ne;
|
|
189
190
|
function Oe(e) {
|
|
190
191
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
191
192
|
}
|
|
@@ -200,8 +201,8 @@ var re = { exports: {} };
|
|
|
200
201
|
var n = {}.hasOwnProperty;
|
|
201
202
|
function t() {
|
|
202
203
|
for (var r = "", o = 0; o < arguments.length; o++) {
|
|
203
|
-
var
|
|
204
|
-
|
|
204
|
+
var c = arguments[o];
|
|
205
|
+
c && (r = u(r, a(c)));
|
|
205
206
|
}
|
|
206
207
|
return r;
|
|
207
208
|
}
|
|
@@ -215,8 +216,8 @@ var re = { exports: {} };
|
|
|
215
216
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
216
217
|
return r.toString();
|
|
217
218
|
var o = "";
|
|
218
|
-
for (var
|
|
219
|
-
n.call(r,
|
|
219
|
+
for (var c in r)
|
|
220
|
+
n.call(r, c) && r[c] && (o = u(o, c));
|
|
220
221
|
return o;
|
|
221
222
|
}
|
|
222
223
|
function u(r, o) {
|
|
@@ -239,7 +240,7 @@ const Me = /* @__PURE__ */ Oe(Re), X = {
|
|
|
239
240
|
negative: r = !1,
|
|
240
241
|
...o
|
|
241
242
|
}) => {
|
|
242
|
-
const
|
|
243
|
+
const c = Me([
|
|
243
244
|
n,
|
|
244
245
|
X[H],
|
|
245
246
|
{
|
|
@@ -247,7 +248,7 @@ const Me = /* @__PURE__ */ Oe(Re), X = {
|
|
|
247
248
|
[X[`${H}--negative`]]: r
|
|
248
249
|
}
|
|
249
250
|
]);
|
|
250
|
-
return /* @__PURE__ */ w(Ee, { className:
|
|
251
|
+
return /* @__PURE__ */ w(Ee, { className: c, "data-testid": a, htmlFor: t, ...o, children: e });
|
|
251
252
|
};
|
|
252
253
|
function je(e) {
|
|
253
254
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -263,8 +264,8 @@ var te = { exports: {} };
|
|
|
263
264
|
var n = {}.hasOwnProperty;
|
|
264
265
|
function t() {
|
|
265
266
|
for (var r = "", o = 0; o < arguments.length; o++) {
|
|
266
|
-
var
|
|
267
|
-
|
|
267
|
+
var c = arguments[o];
|
|
268
|
+
c && (r = u(r, a(c)));
|
|
268
269
|
}
|
|
269
270
|
return r;
|
|
270
271
|
}
|
|
@@ -278,8 +279,8 @@ var te = { exports: {} };
|
|
|
278
279
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
279
280
|
return r.toString();
|
|
280
281
|
var o = "";
|
|
281
|
-
for (var
|
|
282
|
-
n.call(r,
|
|
282
|
+
for (var c in r)
|
|
283
|
+
n.call(r, c) && r[c] && (o = u(o, c));
|
|
283
284
|
return o;
|
|
284
285
|
}
|
|
285
286
|
function u(r, o) {
|
|
@@ -323,9 +324,9 @@ const Le = /* @__PURE__ */ je(Be), R = {
|
|
|
323
324
|
enableHyphenation: u = !1,
|
|
324
325
|
negative: r = !1,
|
|
325
326
|
variant: o = Xe.PARAGRAPH100,
|
|
326
|
-
...
|
|
327
|
+
...c
|
|
327
328
|
}) => {
|
|
328
|
-
const
|
|
329
|
+
const i = Le([
|
|
329
330
|
t,
|
|
330
331
|
R[M],
|
|
331
332
|
R[`${M}--${o}`],
|
|
@@ -335,17 +336,17 @@ const Le = /* @__PURE__ */ je(Be), R = {
|
|
|
335
336
|
[R[`${M}--negative`]]: r
|
|
336
337
|
}
|
|
337
338
|
]);
|
|
338
|
-
return /* @__PURE__ */ w("p", { ...
|
|
339
|
+
return /* @__PURE__ */ w("p", { ...c, className: i, "data-testid": e, children: n });
|
|
339
340
|
};
|
|
340
341
|
ne.displayName = "Paragraph";
|
|
341
|
-
function
|
|
342
|
-
return
|
|
342
|
+
function N() {
|
|
343
|
+
return N = Object.assign ? Object.assign.bind() : function(e) {
|
|
343
344
|
for (var n = 1; n < arguments.length; n++) {
|
|
344
345
|
var t = arguments[n];
|
|
345
346
|
for (var a in t) ({}).hasOwnProperty.call(t, a) && (e[a] = t[a]);
|
|
346
347
|
}
|
|
347
348
|
return e;
|
|
348
|
-
},
|
|
349
|
+
}, N.apply(null, arguments);
|
|
349
350
|
}
|
|
350
351
|
function He(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
351
352
|
return function(u) {
|
|
@@ -366,13 +367,13 @@ function Te(...e) {
|
|
|
366
367
|
function qe(e, n = []) {
|
|
367
368
|
let t = [];
|
|
368
369
|
function a(r, o) {
|
|
369
|
-
const
|
|
370
|
+
const c = /* @__PURE__ */ W(o), i = t.length;
|
|
370
371
|
t = [
|
|
371
372
|
...t,
|
|
372
373
|
o
|
|
373
374
|
];
|
|
374
375
|
function s(l) {
|
|
375
|
-
const { scope: p, children: f, ...d } = l, b = (p == null ? void 0 : p[e][
|
|
376
|
+
const { scope: p, children: f, ...d } = l, b = (p == null ? void 0 : p[e][i]) || c, h = j(
|
|
376
377
|
() => d,
|
|
377
378
|
Object.values(d)
|
|
378
379
|
);
|
|
@@ -381,7 +382,7 @@ function qe(e, n = []) {
|
|
|
381
382
|
}, f);
|
|
382
383
|
}
|
|
383
384
|
function g(l, p) {
|
|
384
|
-
const f = (p == null ? void 0 : p[e][
|
|
385
|
+
const f = (p == null ? void 0 : p[e][i]) || c, d = pe(f);
|
|
385
386
|
if (d) return d;
|
|
386
387
|
if (o !== void 0) return o;
|
|
387
388
|
throw new Error(`\`${l}\` must be used within \`${r}\``);
|
|
@@ -393,18 +394,18 @@ function qe(e, n = []) {
|
|
|
393
394
|
}
|
|
394
395
|
const u = () => {
|
|
395
396
|
const r = t.map((o) => /* @__PURE__ */ W(o));
|
|
396
|
-
return function(
|
|
397
|
-
const
|
|
397
|
+
return function(c) {
|
|
398
|
+
const i = (c == null ? void 0 : c[e]) || r;
|
|
398
399
|
return j(
|
|
399
400
|
() => ({
|
|
400
401
|
[`__scope${e}`]: {
|
|
401
|
-
...
|
|
402
|
-
[e]:
|
|
402
|
+
...c,
|
|
403
|
+
[e]: i
|
|
403
404
|
}
|
|
404
405
|
}),
|
|
405
406
|
[
|
|
406
|
-
|
|
407
|
-
|
|
407
|
+
c,
|
|
408
|
+
i
|
|
408
409
|
]
|
|
409
410
|
);
|
|
410
411
|
};
|
|
@@ -425,10 +426,10 @@ function Fe(...e) {
|
|
|
425
426
|
})
|
|
426
427
|
);
|
|
427
428
|
return function(r) {
|
|
428
|
-
const o = a.reduce((
|
|
429
|
-
const l =
|
|
429
|
+
const o = a.reduce((c, { useScope: i, scopeName: s }) => {
|
|
430
|
+
const l = i(r)[`__scope${s}`];
|
|
430
431
|
return {
|
|
431
|
-
...
|
|
432
|
+
...c,
|
|
432
433
|
...l
|
|
433
434
|
};
|
|
434
435
|
}, {});
|
|
@@ -461,20 +462,20 @@ function We({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
461
462
|
const [a, u] = Ue({
|
|
462
463
|
defaultProp: n,
|
|
463
464
|
onChange: t
|
|
464
|
-
}), r = e !== void 0, o = r ? e : a,
|
|
465
|
+
}), r = e !== void 0, o = r ? e : a, c = ae(t), i = z((s) => {
|
|
465
466
|
if (r) {
|
|
466
467
|
const l = typeof s == "function" ? s(e) : s;
|
|
467
|
-
l !== e &&
|
|
468
|
+
l !== e && c(l);
|
|
468
469
|
} else u(s);
|
|
469
470
|
}, [
|
|
470
471
|
r,
|
|
471
472
|
e,
|
|
472
473
|
u,
|
|
473
|
-
|
|
474
|
+
c
|
|
474
475
|
]);
|
|
475
476
|
return [
|
|
476
477
|
o,
|
|
477
|
-
|
|
478
|
+
i
|
|
478
479
|
];
|
|
479
480
|
}
|
|
480
481
|
function Ue({ defaultProp: e, onChange: n }) {
|
|
@@ -509,15 +510,15 @@ function Ze(e) {
|
|
|
509
510
|
const a = new ResizeObserver((u) => {
|
|
510
511
|
if (!Array.isArray(u) || !u.length) return;
|
|
511
512
|
const r = u[0];
|
|
512
|
-
let o,
|
|
513
|
+
let o, c;
|
|
513
514
|
if ("borderBoxSize" in r) {
|
|
514
|
-
const
|
|
515
|
-
o = s.inlineSize,
|
|
515
|
+
const i = r.borderBoxSize, s = Array.isArray(i) ? i[0] : i;
|
|
516
|
+
o = s.inlineSize, c = s.blockSize;
|
|
516
517
|
} else
|
|
517
|
-
o = e.offsetWidth,
|
|
518
|
+
o = e.offsetWidth, c = e.offsetHeight;
|
|
518
519
|
t({
|
|
519
520
|
width: o,
|
|
520
|
-
height:
|
|
521
|
+
height: c
|
|
521
522
|
});
|
|
522
523
|
});
|
|
523
524
|
return a.observe(e, {
|
|
@@ -530,14 +531,14 @@ function Ze(e) {
|
|
|
530
531
|
]), n;
|
|
531
532
|
}
|
|
532
533
|
const ue = /* @__PURE__ */ S((e, n) => {
|
|
533
|
-
const { children: t, ...a } = e, u = $.toArray(t), r = u.find(
|
|
534
|
+
const { children: t, ...a } = e, u = $.toArray(t), r = u.find(Ke);
|
|
534
535
|
if (r) {
|
|
535
|
-
const o = r.props.children,
|
|
536
|
-
return /* @__PURE__ */ _(q,
|
|
536
|
+
const o = r.props.children, c = u.map((i) => i === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : i);
|
|
537
|
+
return /* @__PURE__ */ _(q, N({}, a, {
|
|
537
538
|
ref: n
|
|
538
|
-
}), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0,
|
|
539
|
+
}), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, c) : null);
|
|
539
540
|
}
|
|
540
|
-
return /* @__PURE__ */ _(q,
|
|
541
|
+
return /* @__PURE__ */ _(q, N({}, a, {
|
|
541
542
|
ref: n
|
|
542
543
|
}), t);
|
|
543
544
|
});
|
|
@@ -545,23 +546,23 @@ ue.displayName = "Slot";
|
|
|
545
546
|
const q = /* @__PURE__ */ S((e, n) => {
|
|
546
547
|
const { children: t, ...a } = e;
|
|
547
548
|
return /* @__PURE__ */ A(t) ? /* @__PURE__ */ B(t, {
|
|
548
|
-
...
|
|
549
|
+
...Qe(a, t.props),
|
|
549
550
|
ref: n ? oe(n, t.ref) : t.ref
|
|
550
551
|
}) : $.count(t) > 1 ? $.only(null) : null;
|
|
551
552
|
});
|
|
552
553
|
q.displayName = "SlotClone";
|
|
553
|
-
const Je = ({ children: e }) => /* @__PURE__ */ _(
|
|
554
|
-
function
|
|
554
|
+
const Je = ({ children: e }) => /* @__PURE__ */ _(K, null, e);
|
|
555
|
+
function Ke(e) {
|
|
555
556
|
return /* @__PURE__ */ A(e) && e.type === Je;
|
|
556
557
|
}
|
|
557
|
-
function
|
|
558
|
+
function Qe(e, n) {
|
|
558
559
|
const t = {
|
|
559
560
|
...n
|
|
560
561
|
};
|
|
561
562
|
for (const a in n) {
|
|
562
563
|
const u = e[a], r = n[a];
|
|
563
|
-
/^on[A-Z]/.test(a) ? u && r ? t[a] = (...
|
|
564
|
-
r(...
|
|
564
|
+
/^on[A-Z]/.test(a) ? u && r ? t[a] = (...c) => {
|
|
565
|
+
r(...c), u(...c);
|
|
565
566
|
} : u && (t[a] = u) : a === "style" ? t[a] = {
|
|
566
567
|
...u,
|
|
567
568
|
...r
|
|
@@ -575,7 +576,7 @@ function Ke(e, n) {
|
|
|
575
576
|
...t
|
|
576
577
|
};
|
|
577
578
|
}
|
|
578
|
-
const
|
|
579
|
+
const Ye = [
|
|
579
580
|
"a",
|
|
580
581
|
"button",
|
|
581
582
|
"div",
|
|
@@ -592,12 +593,12 @@ const Qe = [
|
|
|
592
593
|
"span",
|
|
593
594
|
"svg",
|
|
594
595
|
"ul"
|
|
595
|
-
],
|
|
596
|
+
], ce = Ye.reduce((e, n) => {
|
|
596
597
|
const t = /* @__PURE__ */ S((a, u) => {
|
|
597
|
-
const { asChild: r, ...o } = a,
|
|
598
|
+
const { asChild: r, ...o } = a, c = r ? ue : n;
|
|
598
599
|
return C(() => {
|
|
599
600
|
window[Symbol.for("radix-ui")] = !0;
|
|
600
|
-
}, []), /* @__PURE__ */ _(
|
|
601
|
+
}, []), /* @__PURE__ */ _(c, N({}, o, {
|
|
601
602
|
ref: u
|
|
602
603
|
}));
|
|
603
604
|
});
|
|
@@ -605,8 +606,8 @@ const Qe = [
|
|
|
605
606
|
...e,
|
|
606
607
|
[n]: t
|
|
607
608
|
};
|
|
608
|
-
}, {}),
|
|
609
|
-
const { __scopeSwitch: t, name: a, checked: u, defaultChecked: r, required: o, disabled:
|
|
609
|
+
}, {}), ie = "Switch", [er, vr] = qe(ie), [rr, tr] = er(ie), nr = /* @__PURE__ */ S((e, n) => {
|
|
610
|
+
const { __scopeSwitch: t, name: a, checked: u, defaultChecked: r, required: o, disabled: c, value: i = "on", onCheckedChange: s, ...g } = e, [l, p] = y(null), f = Te(
|
|
610
611
|
n,
|
|
611
612
|
(v) => p(v)
|
|
612
613
|
), d = x(!1), b = l ? !!l.closest("form") : !0, [h = !1, m] = We({
|
|
@@ -617,58 +618,58 @@ const Qe = [
|
|
|
617
618
|
return /* @__PURE__ */ _(rr, {
|
|
618
619
|
scope: t,
|
|
619
620
|
checked: h,
|
|
620
|
-
disabled:
|
|
621
|
-
}, /* @__PURE__ */ _(
|
|
621
|
+
disabled: c
|
|
622
|
+
}, /* @__PURE__ */ _(ce.button, N({
|
|
622
623
|
type: "button",
|
|
623
624
|
role: "switch",
|
|
624
625
|
"aria-checked": h,
|
|
625
626
|
"aria-required": o,
|
|
626
627
|
"data-state": se(h),
|
|
627
|
-
"data-disabled":
|
|
628
|
-
disabled:
|
|
629
|
-
value:
|
|
628
|
+
"data-disabled": c ? "" : void 0,
|
|
629
|
+
disabled: c,
|
|
630
|
+
value: i
|
|
630
631
|
}, g, {
|
|
631
632
|
ref: f,
|
|
632
633
|
onClick: He(e.onClick, (v) => {
|
|
633
634
|
m(
|
|
634
|
-
(
|
|
635
|
+
(D) => !D
|
|
635
636
|
), b && (d.current = v.isPropagationStopped(), d.current || v.stopPropagation());
|
|
636
637
|
})
|
|
637
638
|
})), b && /* @__PURE__ */ _(ur, {
|
|
638
639
|
control: l,
|
|
639
640
|
bubbles: !d.current,
|
|
640
641
|
name: a,
|
|
641
|
-
value:
|
|
642
|
+
value: i,
|
|
642
643
|
checked: h,
|
|
643
644
|
required: o,
|
|
644
|
-
disabled:
|
|
645
|
+
disabled: c,
|
|
645
646
|
style: {
|
|
646
647
|
transform: "translateX(-100%)"
|
|
647
648
|
}
|
|
648
649
|
}));
|
|
649
650
|
}), or = "SwitchThumb", ar = /* @__PURE__ */ S((e, n) => {
|
|
650
651
|
const { __scopeSwitch: t, ...a } = e, u = tr(or, t);
|
|
651
|
-
return /* @__PURE__ */ _(
|
|
652
|
+
return /* @__PURE__ */ _(ce.span, N({
|
|
652
653
|
"data-state": se(u.checked),
|
|
653
654
|
"data-disabled": u.disabled ? "" : void 0
|
|
654
655
|
}, a, {
|
|
655
656
|
ref: n
|
|
656
657
|
}));
|
|
657
658
|
}), ur = (e) => {
|
|
658
|
-
const { control: n, checked: t, bubbles: a = !0, ...u } = e, r = x(null), o = Ve(t),
|
|
659
|
+
const { control: n, checked: t, bubbles: a = !0, ...u } = e, r = x(null), o = Ve(t), c = Ze(n);
|
|
659
660
|
return C(() => {
|
|
660
|
-
const
|
|
661
|
+
const i = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
|
|
661
662
|
if (o !== t && l) {
|
|
662
663
|
const p = new Event("click", {
|
|
663
664
|
bubbles: a
|
|
664
665
|
});
|
|
665
|
-
l.call(
|
|
666
|
+
l.call(i, t), i.dispatchEvent(p);
|
|
666
667
|
}
|
|
667
668
|
}, [
|
|
668
669
|
o,
|
|
669
670
|
t,
|
|
670
671
|
a
|
|
671
|
-
]), /* @__PURE__ */ _("input",
|
|
672
|
+
]), /* @__PURE__ */ _("input", N({
|
|
672
673
|
type: "checkbox",
|
|
673
674
|
"aria-hidden": !0,
|
|
674
675
|
defaultChecked: t
|
|
@@ -677,7 +678,7 @@ const Qe = [
|
|
|
677
678
|
ref: r,
|
|
678
679
|
style: {
|
|
679
680
|
...e.style,
|
|
680
|
-
...
|
|
681
|
+
...c,
|
|
681
682
|
position: "absolute",
|
|
682
683
|
pointerEvents: "none",
|
|
683
684
|
opacity: 0,
|
|
@@ -688,7 +689,7 @@ const Qe = [
|
|
|
688
689
|
function se(e) {
|
|
689
690
|
return e ? "checked" : "unchecked";
|
|
690
691
|
}
|
|
691
|
-
const
|
|
692
|
+
const cr = nr, ir = ar;
|
|
692
693
|
function sr(e) {
|
|
693
694
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
694
695
|
}
|
|
@@ -703,8 +704,8 @@ var le = { exports: {} };
|
|
|
703
704
|
var n = {}.hasOwnProperty;
|
|
704
705
|
function t() {
|
|
705
706
|
for (var r = "", o = 0; o < arguments.length; o++) {
|
|
706
|
-
var
|
|
707
|
-
|
|
707
|
+
var c = arguments[o];
|
|
708
|
+
c && (r = u(r, a(c)));
|
|
708
709
|
}
|
|
709
710
|
return r;
|
|
710
711
|
}
|
|
@@ -718,8 +719,8 @@ var le = { exports: {} };
|
|
|
718
719
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
719
720
|
return r.toString();
|
|
720
721
|
var o = "";
|
|
721
|
-
for (var
|
|
722
|
-
n.call(r,
|
|
722
|
+
for (var c in r)
|
|
723
|
+
n.call(r, c) && r[c] && (o = u(o, c));
|
|
723
724
|
return o;
|
|
724
725
|
}
|
|
725
726
|
function u(r, o) {
|
|
@@ -737,9 +738,9 @@ const I = /* @__PURE__ */ sr(lr), V = (e) => e && "touches" in e, pr = ({
|
|
|
737
738
|
onStop: u,
|
|
738
739
|
bounds: r,
|
|
739
740
|
position: o,
|
|
740
|
-
style:
|
|
741
|
+
style: c
|
|
741
742
|
}) => {
|
|
742
|
-
const [
|
|
743
|
+
const [i, s] = y(void 0), [g, l] = y(void 0), [p, f] = y(!1), d = (m) => {
|
|
743
744
|
if (!n) {
|
|
744
745
|
m.preventDefault();
|
|
745
746
|
const v = V(m.nativeEvent) ? m.nativeEvent.touches[0].clientX : m.nativeEvent.clientX;
|
|
@@ -749,10 +750,10 @@ const I = /* @__PURE__ */ sr(lr), V = (e) => e && "touches" in e, pr = ({
|
|
|
749
750
|
(m) => {
|
|
750
751
|
if (typeof g != "number")
|
|
751
752
|
return;
|
|
752
|
-
const
|
|
753
|
-
if (!
|
|
753
|
+
const D = (V(m) ? m.touches[0].clientX : m.clientX) - g;
|
|
754
|
+
if (!D)
|
|
754
755
|
return;
|
|
755
|
-
const E = o +
|
|
756
|
+
const E = o + D;
|
|
756
757
|
!p && Math.abs(E) && f(!0);
|
|
757
758
|
const L = E > r.right ? r.right : E < r.left ? r.left : E;
|
|
758
759
|
s(L), a == null || a({ x: L });
|
|
@@ -768,14 +769,14 @@ const I = /* @__PURE__ */ sr(lr), V = (e) => e && "touches" in e, pr = ({
|
|
|
768
769
|
}), [h]), A(e) ? B($.only(e), {
|
|
769
770
|
onMouseDown: d,
|
|
770
771
|
onTouchStart: d,
|
|
771
|
-
style: { ...
|
|
772
|
+
style: { ...c, transform: `translateX(${p ? i : o}px)` }
|
|
772
773
|
}) : null;
|
|
773
774
|
}, G = {
|
|
774
775
|
width: void 0,
|
|
775
776
|
height: void 0
|
|
776
777
|
};
|
|
777
778
|
function Z(e) {
|
|
778
|
-
const { ref: n, box: t = "content-box", round: a } = e, [{ width: u, height: r }, o] = y(G),
|
|
779
|
+
const { ref: n, box: t = "content-box", round: a } = e, [{ width: u, height: r }, o] = y(G), c = dr(), i = x({ ...G }), s = x(void 0);
|
|
779
780
|
return s.current = e.onResize, C(() => {
|
|
780
781
|
if (!n.current || typeof window > "u" || !("ResizeObserver" in window))
|
|
781
782
|
return;
|
|
@@ -784,18 +785,18 @@ function Z(e) {
|
|
|
784
785
|
// eslint-disable-next-line no-nested-ternary
|
|
785
786
|
t === "border-box" ? "borderBoxSize" : t === "device-pixel-content-box" ? "devicePixelContentBoxSize" : "contentBoxSize"
|
|
786
787
|
), f = J(l, p, "inlineSize"), d = J(l, p, "blockSize");
|
|
787
|
-
if (
|
|
788
|
+
if (i.current.width !== f || i.current.height !== d) {
|
|
788
789
|
const h = {
|
|
789
790
|
width: f && a ? Math.round(f) : f,
|
|
790
791
|
height: d && a ? Math.round(d) : d
|
|
791
792
|
};
|
|
792
|
-
|
|
793
|
+
i.current.width = f, i.current.height = d, s.current ? s.current(h) : c() && o(h);
|
|
793
794
|
}
|
|
794
795
|
});
|
|
795
796
|
return g.observe(n.current, { box: t }), () => {
|
|
796
797
|
g.disconnect();
|
|
797
798
|
};
|
|
798
|
-
}, [t, n,
|
|
799
|
+
}, [t, n, c, a]), { width: u, height: r };
|
|
799
800
|
}
|
|
800
801
|
function J(e, n, t) {
|
|
801
802
|
return e[n] ? Array.isArray(e[n]) ? e[n][0][t] : (
|
|
@@ -811,7 +812,7 @@ function dr() {
|
|
|
811
812
|
}), []), z(() => e.current, []);
|
|
812
813
|
}
|
|
813
814
|
const fr = ({ checked: e, onChange: n }) => {
|
|
814
|
-
const t = x(null), a = x(null), [u, r] = y(void 0), [o,
|
|
815
|
+
const t = x(null), a = x(null), [u, r] = y(void 0), [o, c] = y(!1), [i, s] = y(0), { height: g = 0 } = Z({ ref: a, round: !0 }), { height: l = 0 } = Z({ ref: t, round: !0 }), p = (l || 0) - g, f = g + p, d = p / 2, b = f / 2, h = typeof u == "number" && (e ? u < b : u > b);
|
|
815
816
|
return {
|
|
816
817
|
trackRef: t,
|
|
817
818
|
thumbRef: a,
|
|
@@ -819,13 +820,13 @@ const fr = ({ checked: e, onChange: n }) => {
|
|
|
819
820
|
bounds: { left: d, right: f },
|
|
820
821
|
position: e ? f : d,
|
|
821
822
|
onDrag: ({ x: E }) => {
|
|
822
|
-
r(E), Math.abs((e ? f : d) - E) > 2 &&
|
|
823
|
+
r(E), Math.abs((e ? f : d) - E) > 2 && c(!0);
|
|
823
824
|
},
|
|
824
825
|
onStop: () => {
|
|
825
|
-
|
|
826
|
+
c(!1), o && s(Date.now()), h && (n == null || n(!e));
|
|
826
827
|
},
|
|
827
828
|
onChangeWithDrag: () => {
|
|
828
|
-
Date.now() -
|
|
829
|
+
Date.now() - i > 50 && (n == null || n(!e)), r(void 0);
|
|
829
830
|
}
|
|
830
831
|
};
|
|
831
832
|
}, P = {
|
|
@@ -846,52 +847,52 @@ const fr = ({ checked: e, onChange: n }) => {
|
|
|
846
847
|
labelPosition: u = "right",
|
|
847
848
|
checked: r,
|
|
848
849
|
disableDrag: o,
|
|
849
|
-
defaultChecked:
|
|
850
|
-
...
|
|
850
|
+
defaultChecked: c,
|
|
851
|
+
...i
|
|
851
852
|
}, s) => {
|
|
852
853
|
const [g, l] = y(
|
|
853
|
-
typeof r == "boolean" ? r : !!
|
|
854
|
+
typeof r == "boolean" ? r : !!c
|
|
854
855
|
), p = !!(typeof r == "boolean" ? r : g), { thumbRef: f, trackRef: d, isDragging: b, onChangeWithDrag: h, ...m } = fr({
|
|
855
856
|
checked: p,
|
|
856
|
-
onChange: (
|
|
857
|
-
|
|
857
|
+
onChange: (D) => {
|
|
858
|
+
i.disabled || (a == null || a(D), l(D));
|
|
858
859
|
}
|
|
859
860
|
}), v = () => /* @__PURE__ */ w(
|
|
860
861
|
ze,
|
|
861
862
|
{
|
|
862
|
-
htmlFor:
|
|
863
|
+
htmlFor: i.id,
|
|
863
864
|
"data-testid": e && `${e}-label`,
|
|
864
|
-
disabled:
|
|
865
|
+
disabled: i.disabled,
|
|
865
866
|
className: I(
|
|
866
867
|
P[`${k}__label`],
|
|
867
868
|
P[`${k}__label--${u}`]
|
|
868
869
|
),
|
|
869
|
-
children: /* @__PURE__ */ w(ne, { variant: "paragraph-100", disabled:
|
|
870
|
+
children: /* @__PURE__ */ w(ne, { variant: "paragraph-100", disabled: i.disabled, children: t })
|
|
870
871
|
}
|
|
871
872
|
);
|
|
872
873
|
return /* @__PURE__ */ F("div", { className: I([n, P[`${k}__container`]]), children: [
|
|
873
874
|
t && u === "left" && v(),
|
|
874
875
|
/* @__PURE__ */ w(
|
|
875
|
-
|
|
876
|
+
cr,
|
|
876
877
|
{
|
|
877
|
-
...
|
|
878
|
+
...i,
|
|
878
879
|
ref: s,
|
|
879
|
-
id:
|
|
880
|
+
id: i.id,
|
|
880
881
|
"data-testid": e,
|
|
881
882
|
className: P[k],
|
|
882
883
|
onCheckedChange: h,
|
|
883
884
|
checked: p,
|
|
884
885
|
children: /* @__PURE__ */ F("span", { ref: d, className: P[`${k}__track`], children: [
|
|
885
886
|
/* @__PURE__ */ w("span", { className: P[`${k}__checkmark-container`], children: /* @__PURE__ */ w(
|
|
886
|
-
|
|
887
|
+
Y,
|
|
887
888
|
{
|
|
888
889
|
className: P[`${k}__checkmark`],
|
|
889
|
-
svg:
|
|
890
|
+
svg: we,
|
|
890
891
|
size: "xxs"
|
|
891
892
|
}
|
|
892
893
|
) }),
|
|
893
894
|
/* @__PURE__ */ w(pr, { disabled: o, ...m, children: /* @__PURE__ */ w(
|
|
894
|
-
|
|
895
|
+
ir,
|
|
895
896
|
{
|
|
896
897
|
ref: f,
|
|
897
898
|
"data-testid": e && `${e}-thumb`,
|