@purpurds/toggle 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 +3 -3
- package/dist/toggle.cjs.js +5 -5
- package/dist/toggle.cjs.js.map +1 -1
- package/dist/toggle.es.js +78 -83
- package/dist/toggle.es.js.map +1 -1
- package/dist/useToggleDrag.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/toggle.stories.tsx +50 -17
- package/readme.mdx +0 -124
package/dist/toggle.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as x, jsxs as K } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as w, Children as y, isValidElement as k, createElement as _, cloneElement as X, useEffect as A, Fragment as ee, useCallback as B, createContext as J, useMemo as R, useContext as
|
|
2
|
+
import { forwardRef as w, Children as y, isValidElement as k, createElement as _, cloneElement as X, useEffect as A, Fragment as ee, useCallback as B, createContext as J, useMemo as R, useContext as ge, useRef as D, useState as $, useLayoutEffect as re } from "react";
|
|
3
3
|
import "react-dom";
|
|
4
|
-
function
|
|
4
|
+
function he(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 be = te.exports;
|
|
44
|
+
const _e = /* @__PURE__ */ he(be), ve = {
|
|
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",
|
|
@@ -49,31 +49,31 @@ const be = /* @__PURE__ */ ge(he), _e = {
|
|
|
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
|
-
},
|
|
52
|
+
}, me = {
|
|
53
53
|
name: "checkmark-bold",
|
|
54
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
55
|
keywords: ["checkmark-bold"],
|
|
56
56
|
category: "utility"
|
|
57
|
-
},
|
|
57
|
+
}, $e = _e.bind(ve), Q = "purpur-icon", ye = "md", xe = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), we = ({ 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
|
], o = n ? `<title>${n}</title>` : "";
|
|
64
|
-
return `<svg ${
|
|
65
|
-
},
|
|
64
|
+
return `<svg ${xe(t)}>${o}${e}</svg>`;
|
|
65
|
+
}, Se = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Pe = ({
|
|
66
66
|
["data-testid"]: e,
|
|
67
67
|
svg: n,
|
|
68
68
|
allyTitle: t,
|
|
69
|
-
className: o
|
|
70
|
-
size: c =
|
|
69
|
+
className: o,
|
|
70
|
+
size: c = ye,
|
|
71
71
|
...r
|
|
72
72
|
}) => {
|
|
73
|
-
const a =
|
|
74
|
-
content:
|
|
73
|
+
const a = we({
|
|
74
|
+
content: Se(n.svg),
|
|
75
75
|
title: t
|
|
76
|
-
}), u =
|
|
76
|
+
}), u = $e(o, Q, `${Q}--${c}`);
|
|
77
77
|
return /* @__PURE__ */ x(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
@@ -105,16 +105,16 @@ function M() {
|
|
|
105
105
|
return e;
|
|
106
106
|
}, M.apply(this, arguments);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function ke(e, n) {
|
|
109
109
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function Oe(...e) {
|
|
112
112
|
return (n) => e.forEach(
|
|
113
|
-
(t) =>
|
|
113
|
+
(t) => ke(t, n)
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
const ne = /* @__PURE__ */ w((e, n) => {
|
|
117
|
-
const { children: t, ...o } = e, c = y.toArray(t), r = c.find(
|
|
117
|
+
const { children: t, ...o } = e, c = y.toArray(t), r = c.find(De);
|
|
118
118
|
if (r) {
|
|
119
119
|
const a = r.props.children, u = c.map((i) => i === r ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
|
|
120
120
|
return /* @__PURE__ */ _(G, M({}, o, {
|
|
@@ -129,16 +129,16 @@ ne.displayName = "Slot";
|
|
|
129
129
|
const G = /* @__PURE__ */ w((e, n) => {
|
|
130
130
|
const { children: t, ...o } = e;
|
|
131
131
|
return /* @__PURE__ */ k(t) ? /* @__PURE__ */ X(t, {
|
|
132
|
-
...
|
|
133
|
-
ref: n ?
|
|
132
|
+
...Ne(o, t.props),
|
|
133
|
+
ref: n ? Oe(n, t.ref) : t.ref
|
|
134
134
|
}) : y.count(t) > 1 ? y.only(null) : null;
|
|
135
135
|
});
|
|
136
136
|
G.displayName = "SlotClone";
|
|
137
|
-
const
|
|
138
|
-
function
|
|
139
|
-
return /* @__PURE__ */ k(e) && e.type ===
|
|
137
|
+
const Ae = ({ children: e }) => /* @__PURE__ */ _(ee, null, e);
|
|
138
|
+
function De(e) {
|
|
139
|
+
return /* @__PURE__ */ k(e) && e.type === Ae;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function Ne(e, n) {
|
|
142
142
|
const t = {
|
|
143
143
|
...n
|
|
144
144
|
};
|
|
@@ -176,7 +176,7 @@ const Ce = [
|
|
|
176
176
|
"span",
|
|
177
177
|
"svg",
|
|
178
178
|
"ul"
|
|
179
|
-
],
|
|
179
|
+
], Ee = Ce.reduce((e, n) => {
|
|
180
180
|
const t = /* @__PURE__ */ w((o, c) => {
|
|
181
181
|
const { asChild: r, ...a } = o, u = r ? ne : n;
|
|
182
182
|
return A(() => {
|
|
@@ -189,14 +189,14 @@ const Ce = [
|
|
|
189
189
|
...e,
|
|
190
190
|
[n]: t
|
|
191
191
|
};
|
|
192
|
-
}, {}),
|
|
192
|
+
}, {}), je = /* @__PURE__ */ w((e, n) => /* @__PURE__ */ _(Ee.label, W({}, e, {
|
|
193
193
|
ref: n,
|
|
194
194
|
onMouseDown: (t) => {
|
|
195
195
|
var o;
|
|
196
196
|
(o = e.onMouseDown) === null || o === void 0 || o.call(e, t), !t.defaultPrevented && t.detail > 1 && t.preventDefault();
|
|
197
197
|
}
|
|
198
|
-
}))),
|
|
199
|
-
function
|
|
198
|
+
}))), Re = je;
|
|
199
|
+
function Me(e) {
|
|
200
200
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
201
201
|
}
|
|
202
202
|
var oe = { exports: {} };
|
|
@@ -235,12 +235,12 @@ var oe = { exports: {} };
|
|
|
235
235
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
236
236
|
})();
|
|
237
237
|
})(oe);
|
|
238
|
-
var
|
|
239
|
-
const
|
|
238
|
+
var He = oe.exports;
|
|
239
|
+
const Le = /* @__PURE__ */ Me(He), I = {
|
|
240
240
|
"purpur-label": "_purpur-label_12cfi_1",
|
|
241
241
|
"purpur-label--negative": "_purpur-label--negative_12cfi_9",
|
|
242
242
|
"purpur-label--disabled": "_purpur-label--disabled_12cfi_12"
|
|
243
|
-
}, q = "purpur-label",
|
|
243
|
+
}, q = "purpur-label", Xe = ({
|
|
244
244
|
children: e,
|
|
245
245
|
className: n,
|
|
246
246
|
htmlFor: t,
|
|
@@ -249,7 +249,7 @@ const He = /* @__PURE__ */ Re(Me), I = {
|
|
|
249
249
|
negative: r = !1,
|
|
250
250
|
...a
|
|
251
251
|
}) => {
|
|
252
|
-
const u =
|
|
252
|
+
const u = Le([
|
|
253
253
|
n,
|
|
254
254
|
I[q],
|
|
255
255
|
{
|
|
@@ -257,9 +257,9 @@ const He = /* @__PURE__ */ Re(Me), I = {
|
|
|
257
257
|
[I[`${q}--negative`]]: r
|
|
258
258
|
}
|
|
259
259
|
]);
|
|
260
|
-
return /* @__PURE__ */ x(
|
|
260
|
+
return /* @__PURE__ */ x(Re, { className: u, "data-testid": o, htmlFor: t, ...a, children: e });
|
|
261
261
|
};
|
|
262
|
-
function
|
|
262
|
+
function Be(e) {
|
|
263
263
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
264
264
|
}
|
|
265
265
|
var ae = { exports: {} };
|
|
@@ -298,8 +298,8 @@ var ae = { exports: {} };
|
|
|
298
298
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
299
299
|
})();
|
|
300
300
|
})(ae);
|
|
301
|
-
var
|
|
302
|
-
const
|
|
301
|
+
var Te = ae.exports;
|
|
302
|
+
const ze = /* @__PURE__ */ Be(Te), E = {
|
|
303
303
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
|
304
304
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
|
305
305
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
|
@@ -314,7 +314,7 @@ const Te = /* @__PURE__ */ Xe(Be), E = {
|
|
|
314
314
|
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_1rh57_60",
|
|
315
315
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
|
316
316
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
|
317
|
-
},
|
|
317
|
+
}, Ie = {
|
|
318
318
|
PARAGRAPH100: "paragraph-100",
|
|
319
319
|
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
320
320
|
PARAGRAPH100BOLD: "paragraph-100-bold",
|
|
@@ -325,17 +325,17 @@ const Te = /* @__PURE__ */ Xe(Be), E = {
|
|
|
325
325
|
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
326
326
|
OVERLINE100: "overline-100",
|
|
327
327
|
OVERLINE200: "overline-200"
|
|
328
|
-
}, j = "purpur-paragraph",
|
|
328
|
+
}, j = "purpur-paragraph", ce = ({
|
|
329
329
|
["data-testid"]: e,
|
|
330
330
|
children: n,
|
|
331
|
-
className: t
|
|
331
|
+
className: t,
|
|
332
332
|
disabled: o,
|
|
333
333
|
enableHyphenation: c = !1,
|
|
334
334
|
negative: r = !1,
|
|
335
|
-
variant: a =
|
|
335
|
+
variant: a = Ie.PARAGRAPH100,
|
|
336
336
|
...u
|
|
337
337
|
}) => {
|
|
338
|
-
const i =
|
|
338
|
+
const i = ze([
|
|
339
339
|
t,
|
|
340
340
|
E[j],
|
|
341
341
|
E[`${j}--${a}`],
|
|
@@ -347,6 +347,7 @@ const Te = /* @__PURE__ */ Xe(Be), E = {
|
|
|
347
347
|
]);
|
|
348
348
|
return /* @__PURE__ */ x("p", { ...u, className: i, "data-testid": e, children: n });
|
|
349
349
|
};
|
|
350
|
+
ce.displayName = "Paragraph";
|
|
350
351
|
function H() {
|
|
351
352
|
return H = Object.assign ? Object.assign.bind() : function(e) {
|
|
352
353
|
for (var n = 1; n < arguments.length; n++) {
|
|
@@ -359,20 +360,19 @@ function H() {
|
|
|
359
360
|
}
|
|
360
361
|
function qe(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
361
362
|
return function(c) {
|
|
362
|
-
if (e == null || e(c), t === !1 || !c.defaultPrevented)
|
|
363
|
-
return n == null ? void 0 : n(c);
|
|
363
|
+
if (e == null || e(c), t === !1 || !c.defaultPrevented) return n == null ? void 0 : n(c);
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
function Fe(e, n) {
|
|
367
367
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function ue(...e) {
|
|
370
370
|
return (n) => e.forEach(
|
|
371
371
|
(t) => Fe(t, n)
|
|
372
372
|
);
|
|
373
373
|
}
|
|
374
374
|
function We(...e) {
|
|
375
|
-
return B(
|
|
375
|
+
return B(ue(...e), e);
|
|
376
376
|
}
|
|
377
377
|
function Ge(e, n = []) {
|
|
378
378
|
let t = [];
|
|
@@ -392,11 +392,9 @@ function Ge(e, n = []) {
|
|
|
392
392
|
}, v);
|
|
393
393
|
}
|
|
394
394
|
function h(l, p) {
|
|
395
|
-
const v = (p == null ? void 0 : p[e][i]) || u, f =
|
|
396
|
-
if (f)
|
|
397
|
-
|
|
398
|
-
if (a !== void 0)
|
|
399
|
-
return a;
|
|
395
|
+
const v = (p == null ? void 0 : p[e][i]) || u, f = ge(v);
|
|
396
|
+
if (f) return f;
|
|
397
|
+
if (a !== void 0) return a;
|
|
400
398
|
throw new Error(`\`${l}\` must be used within \`${r}\``);
|
|
401
399
|
}
|
|
402
400
|
return s.displayName = r + "Provider", [
|
|
@@ -429,8 +427,7 @@ function Ge(e, n = []) {
|
|
|
429
427
|
}
|
|
430
428
|
function Ue(...e) {
|
|
431
429
|
const n = e[0];
|
|
432
|
-
if (e.length === 1)
|
|
433
|
-
return n;
|
|
430
|
+
if (e.length === 1) return n;
|
|
434
431
|
const t = () => {
|
|
435
432
|
const o = e.map(
|
|
436
433
|
(c) => ({
|
|
@@ -458,7 +455,7 @@ function Ue(...e) {
|
|
|
458
455
|
};
|
|
459
456
|
return t.scopeName = n.scopeName, t;
|
|
460
457
|
}
|
|
461
|
-
function
|
|
458
|
+
function ie(e) {
|
|
462
459
|
const n = D(e);
|
|
463
460
|
return A(() => {
|
|
464
461
|
n.current = e;
|
|
@@ -475,12 +472,11 @@ function Ve({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
475
472
|
const [o, c] = Ze({
|
|
476
473
|
defaultProp: n,
|
|
477
474
|
onChange: t
|
|
478
|
-
}), r = e !== void 0, a = r ? e : o, u =
|
|
475
|
+
}), r = e !== void 0, a = r ? e : o, u = ie(t), i = B((s) => {
|
|
479
476
|
if (r) {
|
|
480
477
|
const l = typeof s == "function" ? s(e) : s;
|
|
481
478
|
l !== e && u(l);
|
|
482
|
-
} else
|
|
483
|
-
c(s);
|
|
479
|
+
} else c(s);
|
|
484
480
|
}, [
|
|
485
481
|
r,
|
|
486
482
|
e,
|
|
@@ -493,7 +489,7 @@ function Ve({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
493
489
|
];
|
|
494
490
|
}
|
|
495
491
|
function Ze({ defaultProp: e, onChange: n }) {
|
|
496
|
-
const t = $(e), [o] = t, c = D(o), r =
|
|
492
|
+
const t = $(e), [o] = t, c = D(o), r = ie(n);
|
|
497
493
|
return A(() => {
|
|
498
494
|
c.current !== o && (r(o), c.current = o);
|
|
499
495
|
}, [
|
|
@@ -522,8 +518,7 @@ function Qe(e) {
|
|
|
522
518
|
height: e.offsetHeight
|
|
523
519
|
});
|
|
524
520
|
const o = new ResizeObserver((c) => {
|
|
525
|
-
if (!Array.isArray(c) || !c.length)
|
|
526
|
-
return;
|
|
521
|
+
if (!Array.isArray(c) || !c.length) return;
|
|
527
522
|
const r = c[0];
|
|
528
523
|
let a, u;
|
|
529
524
|
if ("borderBoxSize" in r) {
|
|
@@ -555,7 +550,7 @@ function L() {
|
|
|
555
550
|
return e;
|
|
556
551
|
}, L.apply(this, arguments);
|
|
557
552
|
}
|
|
558
|
-
const
|
|
553
|
+
const se = /* @__PURE__ */ w((e, n) => {
|
|
559
554
|
const { children: t, ...o } = e, c = y.toArray(t), r = c.find(er);
|
|
560
555
|
if (r) {
|
|
561
556
|
const a = r.props.children, u = c.map((i) => i === r ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
|
|
@@ -567,12 +562,12 @@ const ie = /* @__PURE__ */ w((e, n) => {
|
|
|
567
562
|
ref: n
|
|
568
563
|
}), t);
|
|
569
564
|
});
|
|
570
|
-
|
|
565
|
+
se.displayName = "Slot";
|
|
571
566
|
const U = /* @__PURE__ */ w((e, n) => {
|
|
572
567
|
const { children: t, ...o } = e;
|
|
573
568
|
return /* @__PURE__ */ k(t) ? /* @__PURE__ */ X(t, {
|
|
574
569
|
...rr(o, t.props),
|
|
575
|
-
ref: n ?
|
|
570
|
+
ref: n ? ue(n, t.ref) : t.ref
|
|
576
571
|
}) : y.count(t) > 1 ? y.only(null) : null;
|
|
577
572
|
});
|
|
578
573
|
U.displayName = "SlotClone";
|
|
@@ -618,9 +613,9 @@ const tr = [
|
|
|
618
613
|
"span",
|
|
619
614
|
"svg",
|
|
620
615
|
"ul"
|
|
621
|
-
],
|
|
616
|
+
], le = tr.reduce((e, n) => {
|
|
622
617
|
const t = /* @__PURE__ */ w((o, c) => {
|
|
623
|
-
const { asChild: r, ...a } = o, u = r ?
|
|
618
|
+
const { asChild: r, ...a } = o, u = r ? se : n;
|
|
624
619
|
return A(() => {
|
|
625
620
|
window[Symbol.for("radix-ui")] = !0;
|
|
626
621
|
}, []), /* @__PURE__ */ _(u, L({}, a, {
|
|
@@ -631,7 +626,7 @@ const tr = [
|
|
|
631
626
|
...e,
|
|
632
627
|
[n]: t
|
|
633
628
|
};
|
|
634
|
-
}, {}),
|
|
629
|
+
}, {}), pe = "Switch", [nr, yr] = Ge(pe), [or, ar] = nr(pe), cr = /* @__PURE__ */ w((e, n) => {
|
|
635
630
|
const { __scopeSwitch: t, name: o, checked: c, defaultChecked: r, required: a, disabled: u, value: i = "on", onCheckedChange: s, ...h } = e, [l, p] = $(null), v = We(
|
|
636
631
|
n,
|
|
637
632
|
(m) => p(m)
|
|
@@ -644,12 +639,12 @@ const tr = [
|
|
|
644
639
|
scope: t,
|
|
645
640
|
checked: d,
|
|
646
641
|
disabled: u
|
|
647
|
-
}, /* @__PURE__ */ _(
|
|
642
|
+
}, /* @__PURE__ */ _(le.button, H({
|
|
648
643
|
type: "button",
|
|
649
644
|
role: "switch",
|
|
650
645
|
"aria-checked": d,
|
|
651
646
|
"aria-required": a,
|
|
652
|
-
"data-state":
|
|
647
|
+
"data-state": de(d),
|
|
653
648
|
"data-disabled": u ? "" : void 0,
|
|
654
649
|
disabled: u,
|
|
655
650
|
value: i
|
|
@@ -674,8 +669,8 @@ const tr = [
|
|
|
674
669
|
}));
|
|
675
670
|
}), ur = "SwitchThumb", ir = /* @__PURE__ */ w((e, n) => {
|
|
676
671
|
const { __scopeSwitch: t, ...o } = e, c = ar(ur, t);
|
|
677
|
-
return /* @__PURE__ */ _(
|
|
678
|
-
"data-state":
|
|
672
|
+
return /* @__PURE__ */ _(le.span, H({
|
|
673
|
+
"data-state": de(c.checked),
|
|
679
674
|
"data-disabled": c.disabled ? "" : void 0
|
|
680
675
|
}, o, {
|
|
681
676
|
ref: n
|
|
@@ -711,14 +706,14 @@ const tr = [
|
|
|
711
706
|
}
|
|
712
707
|
}));
|
|
713
708
|
};
|
|
714
|
-
function
|
|
709
|
+
function de(e) {
|
|
715
710
|
return e ? "checked" : "unchecked";
|
|
716
711
|
}
|
|
717
712
|
const lr = cr, pr = ir;
|
|
718
713
|
function dr(e) {
|
|
719
714
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
720
715
|
}
|
|
721
|
-
var
|
|
716
|
+
var fe = { exports: {} };
|
|
722
717
|
/*!
|
|
723
718
|
Copyright (c) 2018 Jed Watson.
|
|
724
719
|
Licensed under the MIT License (MIT), see
|
|
@@ -753,8 +748,8 @@ var de = { exports: {} };
|
|
|
753
748
|
}
|
|
754
749
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
755
750
|
})();
|
|
756
|
-
})(
|
|
757
|
-
var fr =
|
|
751
|
+
})(fe);
|
|
752
|
+
var fr = fe.exports;
|
|
758
753
|
const F = /* @__PURE__ */ dr(fr), S = {
|
|
759
754
|
"purpur-toggle": "_purpur-toggle_1xng6_1",
|
|
760
755
|
"purpur-toggle__track": "_purpur-toggle__track_1xng6_7",
|
|
@@ -788,9 +783,9 @@ const F = /* @__PURE__ */ dr(fr), S = {
|
|
|
788
783
|
const O = (Y(b) ? b.touches[0].clientX : b.clientX) - h;
|
|
789
784
|
if (!O)
|
|
790
785
|
return;
|
|
791
|
-
const
|
|
792
|
-
!p && Math.abs(
|
|
793
|
-
const T =
|
|
786
|
+
const N = a + O;
|
|
787
|
+
!p && Math.abs(N) && v(!0);
|
|
788
|
+
const T = N > r.right ? r.right : N < r.left ? r.left : N;
|
|
794
789
|
s(T), o == null || o({ x: T });
|
|
795
790
|
},
|
|
796
791
|
[o, s, p, h]
|
|
@@ -810,8 +805,8 @@ const F = /* @__PURE__ */ dr(fr), S = {
|
|
|
810
805
|
var V, Z;
|
|
811
806
|
const t = D(null), o = D(null), [c, r] = $(void 0), [a, u] = $(!1), [i, s] = $(0), [h, l] = $(0), [p, v] = $(0);
|
|
812
807
|
re(() => {
|
|
813
|
-
var
|
|
814
|
-
l(((
|
|
808
|
+
var C, z;
|
|
809
|
+
l(((C = o.current) == null ? void 0 : C.clientHeight) || 0), v(((z = t.current) == null ? void 0 : z.clientHeight) || 0);
|
|
815
810
|
}, [(V = o.current) == null ? void 0 : V.clientHeight, (Z = t.current) == null ? void 0 : Z.clientHeight]);
|
|
816
811
|
const f = (p || 0) - h, g = h + f, d = f / 2, b = g / 2, m = typeof c == "number" && (e ? c < b : c > b);
|
|
817
812
|
return {
|
|
@@ -820,8 +815,8 @@ const F = /* @__PURE__ */ dr(fr), S = {
|
|
|
820
815
|
isDragging: a,
|
|
821
816
|
bounds: { left: d, right: g },
|
|
822
817
|
position: e ? g : d,
|
|
823
|
-
onDrag: ({ x:
|
|
824
|
-
r(
|
|
818
|
+
onDrag: ({ x: C }) => {
|
|
819
|
+
r(C), Math.abs((e ? g : d) - C) > 2 && u(!0);
|
|
825
820
|
},
|
|
826
821
|
onStop: () => {
|
|
827
822
|
u(!1), a && s(Date.now()), m && (n == null || n(!e));
|
|
@@ -849,7 +844,7 @@ const F = /* @__PURE__ */ dr(fr), S = {
|
|
|
849
844
|
i.disabled || (o == null || o(O), l(O));
|
|
850
845
|
}
|
|
851
846
|
}), m = () => /* @__PURE__ */ x(
|
|
852
|
-
|
|
847
|
+
Xe,
|
|
853
848
|
{
|
|
854
849
|
htmlFor: i.id,
|
|
855
850
|
"data-testid": e && `${e}-label`,
|
|
@@ -858,7 +853,7 @@ const F = /* @__PURE__ */ dr(fr), S = {
|
|
|
858
853
|
S[`${P}__label`],
|
|
859
854
|
S[`${P}__label--${c}`]
|
|
860
855
|
),
|
|
861
|
-
children: /* @__PURE__ */ x(
|
|
856
|
+
children: /* @__PURE__ */ x(ce, { variant: "paragraph-100", disabled: i.disabled, children: t })
|
|
862
857
|
}
|
|
863
858
|
);
|
|
864
859
|
return /* @__PURE__ */ K("div", { className: F([n, S[`${P}__container`]]), children: [
|
|
@@ -875,10 +870,10 @@ const F = /* @__PURE__ */ dr(fr), S = {
|
|
|
875
870
|
checked: p,
|
|
876
871
|
children: /* @__PURE__ */ K("span", { ref: f, className: S[`${P}__track`], children: [
|
|
877
872
|
/* @__PURE__ */ x("span", { className: S[`${P}__checkmark-container`], children: /* @__PURE__ */ x(
|
|
878
|
-
|
|
873
|
+
Pe,
|
|
879
874
|
{
|
|
880
875
|
className: S[`${P}__checkmark`],
|
|
881
|
-
svg:
|
|
876
|
+
svg: me,
|
|
882
877
|
size: "xxs"
|
|
883
878
|
}
|
|
884
879
|
) }),
|