@purpurds/toggle 5.28.1 → 5.28.3
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/hooks/useResizeObserver.d.ts +15 -0
- package/dist/hooks/useResizeObserver.d.ts.map +1 -0
- package/dist/{useToggleDrag.d.ts → hooks/useToggleDrag.d.ts} +6 -2
- package/dist/hooks/useToggleDrag.d.ts.map +1 -0
- package/dist/toggle.cjs.js +5 -5
- package/dist/toggle.cjs.js.map +1 -1
- package/dist/toggle.es.js +372 -338
- package/dist/toggle.es.js.map +1 -1
- package/package.json +5 -5
- package/src/hooks/useResizeObserver.ts +121 -0
- package/src/{useToggleDrag.ts → hooks/useToggleDrag.ts} +11 -9
- package/src/toggle.tsx +2 -2
- package/dist/useToggleDrag.d.ts.map +0 -1
package/dist/toggle.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as w, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S, Children as $, isValidElement as A, createElement as v, cloneElement as B, useEffect as C, Fragment as Y, 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
|
-
function
|
|
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 K = { exports: {} };
|
|
8
8
|
/*!
|
|
9
9
|
Copyright (c) 2018 Jed Watson.
|
|
10
10
|
Licensed under the MIT License (MIT), see
|
|
@@ -15,8 +15,8 @@ var ee = { 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 = i(r, a.call(this, c)));
|
|
20
20
|
}
|
|
21
21
|
return r;
|
|
22
22
|
}
|
|
@@ -30,18 +30,18 @@ var ee = { 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 = i(o, this && this[c] || c));
|
|
35
35
|
return o;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function i(r, o) {
|
|
38
38
|
return o ? r ? r + " " + o : r + o : r;
|
|
39
39
|
}
|
|
40
40
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
41
41
|
})();
|
|
42
|
-
})(
|
|
43
|
-
var he =
|
|
44
|
-
const
|
|
42
|
+
})(K);
|
|
43
|
+
var he = K.exports;
|
|
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",
|
|
47
47
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -54,93 +54,93 @@ const be = /* @__PURE__ */ ge(he), _e = {
|
|
|
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 = ge.bind(be), U = "purpur-icon", me = "md", $e = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), ye = ({ 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
|
-
}, we = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(),
|
|
64
|
+
return `<svg ${$e(t)}>${a}${e}</svg>`;
|
|
65
|
+
}, we = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Q = ({
|
|
66
66
|
["data-testid"]: e,
|
|
67
67
|
svg: n,
|
|
68
68
|
allyTitle: t,
|
|
69
69
|
className: a,
|
|
70
|
-
size:
|
|
70
|
+
size: i = me,
|
|
71
71
|
...r
|
|
72
72
|
}) => {
|
|
73
|
-
const o =
|
|
73
|
+
const o = ye({
|
|
74
74
|
content: we(n.svg),
|
|
75
75
|
title: t
|
|
76
|
-
}),
|
|
77
|
-
return /* @__PURE__ */
|
|
76
|
+
}), c = _e(a, U, `${U}--${i}`);
|
|
77
|
+
return /* @__PURE__ */ w(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
80
80
|
"aria-label": t,
|
|
81
|
-
className:
|
|
81
|
+
className: c,
|
|
82
82
|
"data-testid": e,
|
|
83
83
|
dangerouslySetInnerHTML: { __html: o },
|
|
84
84
|
...r
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
};
|
|
88
|
-
|
|
89
|
-
function
|
|
90
|
-
return
|
|
88
|
+
Q.displayName = "Icon";
|
|
89
|
+
function O() {
|
|
90
|
+
return O = Object.assign ? Object.assign.bind() : function(e) {
|
|
91
91
|
for (var n = 1; n < arguments.length; n++) {
|
|
92
92
|
var t = arguments[n];
|
|
93
93
|
for (var a in t) ({}).hasOwnProperty.call(t, a) && (e[a] = t[a]);
|
|
94
94
|
}
|
|
95
95
|
return e;
|
|
96
|
-
},
|
|
96
|
+
}, O.apply(null, arguments);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function xe(e, n) {
|
|
99
99
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Se(...e) {
|
|
102
102
|
return (n) => e.forEach(
|
|
103
|
-
(t) =>
|
|
103
|
+
(t) => xe(t, n)
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
const { children: t, ...a } = e,
|
|
106
|
+
const ee = /* @__PURE__ */ S((e, n) => {
|
|
107
|
+
const { children: t, ...a } = e, i = $.toArray(t), r = i.find(ke);
|
|
108
108
|
if (r) {
|
|
109
|
-
const o = r.props.children,
|
|
110
|
-
return /* @__PURE__ */
|
|
109
|
+
const o = r.props.children, c = i.map((u) => u === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : u);
|
|
110
|
+
return /* @__PURE__ */ v(T, O({}, a, {
|
|
111
111
|
ref: n
|
|
112
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, c) : null);
|
|
113
113
|
}
|
|
114
|
-
return /* @__PURE__ */
|
|
114
|
+
return /* @__PURE__ */ v(T, O({}, a, {
|
|
115
115
|
ref: n
|
|
116
116
|
}), t);
|
|
117
117
|
});
|
|
118
|
-
|
|
119
|
-
const
|
|
118
|
+
ee.displayName = "Slot";
|
|
119
|
+
const T = /* @__PURE__ */ S((e, n) => {
|
|
120
120
|
const { children: t, ...a } = e;
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
...
|
|
123
|
-
ref: n ?
|
|
124
|
-
}) :
|
|
121
|
+
return /* @__PURE__ */ A(t) ? /* @__PURE__ */ B(t, {
|
|
122
|
+
...Ae(a, t.props),
|
|
123
|
+
ref: n ? Se(n, t.ref) : t.ref
|
|
124
|
+
}) : $.count(t) > 1 ? $.only(null) : null;
|
|
125
125
|
});
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
function
|
|
129
|
-
return /* @__PURE__ */
|
|
126
|
+
T.displayName = "SlotClone";
|
|
127
|
+
const Pe = ({ children: e }) => /* @__PURE__ */ v(Y, null, e);
|
|
128
|
+
function ke(e) {
|
|
129
|
+
return /* @__PURE__ */ A(e) && e.type === Pe;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Ae(e, n) {
|
|
132
132
|
const t = {
|
|
133
133
|
...n
|
|
134
134
|
};
|
|
135
135
|
for (const a in n) {
|
|
136
|
-
const
|
|
137
|
-
/^on[A-Z]/.test(a) ?
|
|
138
|
-
r(...o),
|
|
139
|
-
} :
|
|
140
|
-
...
|
|
136
|
+
const i = e[a], r = n[a];
|
|
137
|
+
/^on[A-Z]/.test(a) ? i && r ? t[a] = (...o) => {
|
|
138
|
+
r(...o), i(...o);
|
|
139
|
+
} : i && (t[a] = i) : a === "style" ? t[a] = {
|
|
140
|
+
...i,
|
|
141
141
|
...r
|
|
142
142
|
} : a === "className" && (t[a] = [
|
|
143
|
-
|
|
143
|
+
i,
|
|
144
144
|
r
|
|
145
145
|
].filter(Boolean).join(" "));
|
|
146
146
|
}
|
|
@@ -149,7 +149,7 @@ function Ne(e, n) {
|
|
|
149
149
|
...t
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
const
|
|
152
|
+
const Ce = [
|
|
153
153
|
"a",
|
|
154
154
|
"button",
|
|
155
155
|
"div",
|
|
@@ -166,30 +166,30 @@ const De = [
|
|
|
166
166
|
"span",
|
|
167
167
|
"svg",
|
|
168
168
|
"ul"
|
|
169
|
-
],
|
|
170
|
-
const t = /* @__PURE__ */
|
|
171
|
-
const { asChild: r, ...o } = a,
|
|
172
|
-
return
|
|
169
|
+
], Ne = Ce.reduce((e, n) => {
|
|
170
|
+
const t = /* @__PURE__ */ S((a, i) => {
|
|
171
|
+
const { asChild: r, ...o } = a, c = r ? ee : n;
|
|
172
|
+
return C(() => {
|
|
173
173
|
window[Symbol.for("radix-ui")] = !0;
|
|
174
|
-
}, []), /* @__PURE__ */
|
|
175
|
-
ref:
|
|
174
|
+
}, []), /* @__PURE__ */ v(c, O({}, o, {
|
|
175
|
+
ref: i
|
|
176
176
|
}));
|
|
177
177
|
});
|
|
178
178
|
return t.displayName = `Primitive.${n}`, {
|
|
179
179
|
...e,
|
|
180
180
|
[n]: t
|
|
181
181
|
};
|
|
182
|
-
}, {}),
|
|
182
|
+
}, {}), De = /* @__PURE__ */ S((e, n) => /* @__PURE__ */ v(Ne.label, O({}, e, {
|
|
183
183
|
ref: n,
|
|
184
184
|
onMouseDown: (t) => {
|
|
185
185
|
var a;
|
|
186
186
|
(a = e.onMouseDown) === null || a === void 0 || a.call(e, t), !t.defaultPrevented && t.detail > 1 && t.preventDefault();
|
|
187
187
|
}
|
|
188
|
-
}))),
|
|
189
|
-
function
|
|
188
|
+
}))), Ee = De;
|
|
189
|
+
function Oe(e) {
|
|
190
190
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
191
191
|
}
|
|
192
|
-
var
|
|
192
|
+
var re = { exports: {} };
|
|
193
193
|
/*!
|
|
194
194
|
Copyright (c) 2018 Jed Watson.
|
|
195
195
|
Licensed under the MIT License (MIT), see
|
|
@@ -200,8 +200,8 @@ var ne = { exports: {} };
|
|
|
200
200
|
var n = {}.hasOwnProperty;
|
|
201
201
|
function t() {
|
|
202
202
|
for (var r = "", o = 0; o < arguments.length; o++) {
|
|
203
|
-
var
|
|
204
|
-
|
|
203
|
+
var c = arguments[o];
|
|
204
|
+
c && (r = i(r, a(c)));
|
|
205
205
|
}
|
|
206
206
|
return r;
|
|
207
207
|
}
|
|
@@ -215,44 +215,44 @@ var ne = { exports: {} };
|
|
|
215
215
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
216
216
|
return r.toString();
|
|
217
217
|
var o = "";
|
|
218
|
-
for (var
|
|
219
|
-
n.call(r,
|
|
218
|
+
for (var c in r)
|
|
219
|
+
n.call(r, c) && r[c] && (o = i(o, c));
|
|
220
220
|
return o;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function i(r, o) {
|
|
223
223
|
return o ? r ? r + " " + o : r + o : r;
|
|
224
224
|
}
|
|
225
225
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
226
226
|
})();
|
|
227
|
-
})(
|
|
228
|
-
var
|
|
229
|
-
const
|
|
227
|
+
})(re);
|
|
228
|
+
var Re = re.exports;
|
|
229
|
+
const Me = /* @__PURE__ */ Oe(Re), X = {
|
|
230
230
|
"purpur-label": "_purpur-label_12cfi_1",
|
|
231
231
|
"purpur-label--negative": "_purpur-label--negative_12cfi_9",
|
|
232
232
|
"purpur-label--disabled": "_purpur-label--disabled_12cfi_12"
|
|
233
|
-
},
|
|
233
|
+
}, H = "purpur-label", ze = ({
|
|
234
234
|
children: e,
|
|
235
235
|
className: n,
|
|
236
236
|
htmlFor: t,
|
|
237
237
|
"data-testid": a,
|
|
238
|
-
disabled:
|
|
238
|
+
disabled: i,
|
|
239
239
|
negative: r = !1,
|
|
240
240
|
...o
|
|
241
241
|
}) => {
|
|
242
|
-
const
|
|
242
|
+
const c = Me([
|
|
243
243
|
n,
|
|
244
|
-
|
|
244
|
+
X[H],
|
|
245
245
|
{
|
|
246
|
-
[
|
|
247
|
-
[
|
|
246
|
+
[X[`${H}--disabled`]]: i,
|
|
247
|
+
[X[`${H}--negative`]]: r
|
|
248
248
|
}
|
|
249
249
|
]);
|
|
250
|
-
return /* @__PURE__ */
|
|
250
|
+
return /* @__PURE__ */ w(Ee, { className: c, "data-testid": a, htmlFor: t, ...o, children: e });
|
|
251
251
|
};
|
|
252
|
-
function
|
|
252
|
+
function je(e) {
|
|
253
253
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
254
254
|
}
|
|
255
|
-
var
|
|
255
|
+
var te = { exports: {} };
|
|
256
256
|
/*!
|
|
257
257
|
Copyright (c) 2018 Jed Watson.
|
|
258
258
|
Licensed under the MIT License (MIT), see
|
|
@@ -263,8 +263,8 @@ var oe = { exports: {} };
|
|
|
263
263
|
var n = {}.hasOwnProperty;
|
|
264
264
|
function t() {
|
|
265
265
|
for (var r = "", o = 0; o < arguments.length; o++) {
|
|
266
|
-
var
|
|
267
|
-
|
|
266
|
+
var c = arguments[o];
|
|
267
|
+
c && (r = i(r, a(c)));
|
|
268
268
|
}
|
|
269
269
|
return r;
|
|
270
270
|
}
|
|
@@ -278,18 +278,18 @@ var oe = { exports: {} };
|
|
|
278
278
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
279
279
|
return r.toString();
|
|
280
280
|
var o = "";
|
|
281
|
-
for (var
|
|
282
|
-
n.call(r,
|
|
281
|
+
for (var c in r)
|
|
282
|
+
n.call(r, c) && r[c] && (o = i(o, c));
|
|
283
283
|
return o;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function i(r, o) {
|
|
286
286
|
return o ? r ? r + " " + o : r + o : r;
|
|
287
287
|
}
|
|
288
288
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
289
289
|
})();
|
|
290
|
-
})(
|
|
291
|
-
var
|
|
292
|
-
const
|
|
290
|
+
})(te);
|
|
291
|
+
var Be = te.exports;
|
|
292
|
+
const Le = /* @__PURE__ */ je(Be), R = {
|
|
293
293
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
|
294
294
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
|
295
295
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
|
@@ -304,7 +304,7 @@ const Be = /* @__PURE__ */ Le(Xe), M = {
|
|
|
304
304
|
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_1rh57_60",
|
|
305
305
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
|
306
306
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
|
307
|
-
},
|
|
307
|
+
}, Xe = {
|
|
308
308
|
PARAGRAPH100: "paragraph-100",
|
|
309
309
|
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
310
310
|
PARAGRAPH100BOLD: "paragraph-100-bold",
|
|
@@ -315,124 +315,124 @@ const Be = /* @__PURE__ */ Le(Xe), M = {
|
|
|
315
315
|
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
316
316
|
OVERLINE100: "overline-100",
|
|
317
317
|
OVERLINE200: "overline-200"
|
|
318
|
-
},
|
|
318
|
+
}, M = "purpur-paragraph", ne = ({
|
|
319
319
|
["data-testid"]: e,
|
|
320
320
|
children: n,
|
|
321
321
|
className: t,
|
|
322
322
|
disabled: a,
|
|
323
|
-
enableHyphenation:
|
|
323
|
+
enableHyphenation: i = !1,
|
|
324
324
|
negative: r = !1,
|
|
325
|
-
variant: o =
|
|
326
|
-
...
|
|
325
|
+
variant: o = Xe.PARAGRAPH100,
|
|
326
|
+
...c
|
|
327
327
|
}) => {
|
|
328
|
-
const
|
|
328
|
+
const u = Le([
|
|
329
329
|
t,
|
|
330
|
-
M
|
|
331
|
-
|
|
330
|
+
R[M],
|
|
331
|
+
R[`${M}--${o}`],
|
|
332
332
|
{
|
|
333
|
-
[
|
|
334
|
-
[
|
|
335
|
-
[
|
|
333
|
+
[R[`${M}--hyphens`]]: i,
|
|
334
|
+
[R[`${M}--disabled`]]: a,
|
|
335
|
+
[R[`${M}--negative`]]: r
|
|
336
336
|
}
|
|
337
337
|
]);
|
|
338
|
-
return /* @__PURE__ */
|
|
338
|
+
return /* @__PURE__ */ w("p", { ...c, className: u, "data-testid": e, children: n });
|
|
339
339
|
};
|
|
340
|
-
|
|
341
|
-
function
|
|
342
|
-
return
|
|
340
|
+
ne.displayName = "Paragraph";
|
|
341
|
+
function D() {
|
|
342
|
+
return D = Object.assign ? Object.assign.bind() : function(e) {
|
|
343
343
|
for (var n = 1; n < arguments.length; n++) {
|
|
344
344
|
var t = arguments[n];
|
|
345
345
|
for (var a in t) ({}).hasOwnProperty.call(t, a) && (e[a] = t[a]);
|
|
346
346
|
}
|
|
347
347
|
return e;
|
|
348
|
-
},
|
|
348
|
+
}, D.apply(null, arguments);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
return function(
|
|
352
|
-
if (e == null || e(
|
|
350
|
+
function He(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
351
|
+
return function(i) {
|
|
352
|
+
if (e == null || e(i), t === !1 || !i.defaultPrevented) return n == null ? void 0 : n(i);
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
355
|
function Ie(e, n) {
|
|
356
356
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function oe(...e) {
|
|
359
359
|
return (n) => e.forEach(
|
|
360
360
|
(t) => Ie(t, n)
|
|
361
361
|
);
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
return
|
|
363
|
+
function Te(...e) {
|
|
364
|
+
return z(oe(...e), e);
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function qe(e, n = []) {
|
|
367
367
|
let t = [];
|
|
368
368
|
function a(r, o) {
|
|
369
|
-
const
|
|
369
|
+
const c = /* @__PURE__ */ W(o), u = t.length;
|
|
370
370
|
t = [
|
|
371
371
|
...t,
|
|
372
372
|
o
|
|
373
373
|
];
|
|
374
374
|
function s(l) {
|
|
375
|
-
const { scope: p, children:
|
|
376
|
-
() =>
|
|
377
|
-
Object.values(
|
|
375
|
+
const { scope: p, children: f, ...d } = l, b = (p == null ? void 0 : p[e][u]) || c, h = j(
|
|
376
|
+
() => d,
|
|
377
|
+
Object.values(d)
|
|
378
378
|
);
|
|
379
|
-
return /* @__PURE__ */
|
|
380
|
-
value:
|
|
381
|
-
},
|
|
379
|
+
return /* @__PURE__ */ v(b.Provider, {
|
|
380
|
+
value: h
|
|
381
|
+
}, f);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
383
|
+
function g(l, p) {
|
|
384
|
+
const f = (p == null ? void 0 : p[e][u]) || c, d = pe(f);
|
|
385
|
+
if (d) return d;
|
|
386
386
|
if (o !== void 0) return o;
|
|
387
387
|
throw new Error(`\`${l}\` must be used within \`${r}\``);
|
|
388
388
|
}
|
|
389
389
|
return s.displayName = r + "Provider", [
|
|
390
390
|
s,
|
|
391
|
-
|
|
391
|
+
g
|
|
392
392
|
];
|
|
393
393
|
}
|
|
394
|
-
const
|
|
395
|
-
const r = t.map((o) => /* @__PURE__ */
|
|
396
|
-
return function(
|
|
397
|
-
const
|
|
398
|
-
return
|
|
394
|
+
const i = () => {
|
|
395
|
+
const r = t.map((o) => /* @__PURE__ */ W(o));
|
|
396
|
+
return function(c) {
|
|
397
|
+
const u = (c == null ? void 0 : c[e]) || r;
|
|
398
|
+
return j(
|
|
399
399
|
() => ({
|
|
400
400
|
[`__scope${e}`]: {
|
|
401
|
-
...
|
|
402
|
-
[e]:
|
|
401
|
+
...c,
|
|
402
|
+
[e]: u
|
|
403
403
|
}
|
|
404
404
|
}),
|
|
405
405
|
[
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
c,
|
|
407
|
+
u
|
|
408
408
|
]
|
|
409
409
|
);
|
|
410
410
|
};
|
|
411
411
|
};
|
|
412
|
-
return
|
|
412
|
+
return i.scopeName = e, [
|
|
413
413
|
a,
|
|
414
|
-
|
|
414
|
+
Fe(i, ...n)
|
|
415
415
|
];
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Fe(...e) {
|
|
418
418
|
const n = e[0];
|
|
419
419
|
if (e.length === 1) return n;
|
|
420
420
|
const t = () => {
|
|
421
421
|
const a = e.map(
|
|
422
|
-
(
|
|
423
|
-
useScope:
|
|
424
|
-
scopeName:
|
|
422
|
+
(i) => ({
|
|
423
|
+
useScope: i(),
|
|
424
|
+
scopeName: i.scopeName
|
|
425
425
|
})
|
|
426
426
|
);
|
|
427
427
|
return function(r) {
|
|
428
|
-
const o = a.reduce((
|
|
429
|
-
const l =
|
|
428
|
+
const o = a.reduce((c, { useScope: u, scopeName: s }) => {
|
|
429
|
+
const l = u(r)[`__scope${s}`];
|
|
430
430
|
return {
|
|
431
|
-
...
|
|
431
|
+
...c,
|
|
432
432
|
...l
|
|
433
433
|
};
|
|
434
434
|
}, {});
|
|
435
|
-
return
|
|
435
|
+
return j(
|
|
436
436
|
() => ({
|
|
437
437
|
[`__scope${n.scopeName}`]: o
|
|
438
438
|
}),
|
|
@@ -444,11 +444,11 @@ function Ue(...e) {
|
|
|
444
444
|
};
|
|
445
445
|
return t.scopeName = n.scopeName, t;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
const n =
|
|
449
|
-
return
|
|
447
|
+
function ae(e) {
|
|
448
|
+
const n = x(e);
|
|
449
|
+
return C(() => {
|
|
450
450
|
n.current = e;
|
|
451
|
-
}),
|
|
451
|
+
}), j(
|
|
452
452
|
() => (...t) => {
|
|
453
453
|
var a;
|
|
454
454
|
return (a = n.current) === null || a === void 0 ? void 0 : a.call(n, ...t);
|
|
@@ -456,68 +456,68 @@ function ue(e) {
|
|
|
456
456
|
[]
|
|
457
457
|
);
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function We({ prop: e, defaultProp: n, onChange: t = () => {
|
|
460
460
|
} }) {
|
|
461
|
-
const [a,
|
|
461
|
+
const [a, i] = Ue({
|
|
462
462
|
defaultProp: n,
|
|
463
463
|
onChange: t
|
|
464
|
-
}), r = e !== void 0, o = r ? e : a,
|
|
464
|
+
}), r = e !== void 0, o = r ? e : a, c = ae(t), u = z((s) => {
|
|
465
465
|
if (r) {
|
|
466
466
|
const l = typeof s == "function" ? s(e) : s;
|
|
467
|
-
l !== e &&
|
|
468
|
-
} else
|
|
467
|
+
l !== e && c(l);
|
|
468
|
+
} else i(s);
|
|
469
469
|
}, [
|
|
470
470
|
r,
|
|
471
471
|
e,
|
|
472
|
-
|
|
473
|
-
|
|
472
|
+
i,
|
|
473
|
+
c
|
|
474
474
|
]);
|
|
475
475
|
return [
|
|
476
476
|
o,
|
|
477
|
-
|
|
477
|
+
u
|
|
478
478
|
];
|
|
479
479
|
}
|
|
480
|
-
function
|
|
481
|
-
const t =
|
|
482
|
-
return
|
|
483
|
-
|
|
480
|
+
function Ue({ defaultProp: e, onChange: n }) {
|
|
481
|
+
const t = y(e), [a] = t, i = x(a), r = ae(n);
|
|
482
|
+
return C(() => {
|
|
483
|
+
i.current !== a && (r(a), i.current = a);
|
|
484
484
|
}, [
|
|
485
485
|
a,
|
|
486
|
-
|
|
486
|
+
i,
|
|
487
487
|
r
|
|
488
488
|
]), t;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
491
|
-
const n =
|
|
490
|
+
function Ve(e) {
|
|
491
|
+
const n = x({
|
|
492
492
|
value: e,
|
|
493
493
|
previous: e
|
|
494
494
|
});
|
|
495
|
-
return
|
|
495
|
+
return j(() => (n.current.value !== e && (n.current.previous = n.current.value, n.current.value = e), n.current.previous), [
|
|
496
496
|
e
|
|
497
497
|
]);
|
|
498
498
|
}
|
|
499
|
-
const
|
|
499
|
+
const Ge = globalThis != null && globalThis.document ? de : () => {
|
|
500
500
|
};
|
|
501
|
-
function
|
|
502
|
-
const [n, t] =
|
|
503
|
-
return
|
|
501
|
+
function Ze(e) {
|
|
502
|
+
const [n, t] = y(void 0);
|
|
503
|
+
return Ge(() => {
|
|
504
504
|
if (e) {
|
|
505
505
|
t({
|
|
506
506
|
width: e.offsetWidth,
|
|
507
507
|
height: e.offsetHeight
|
|
508
508
|
});
|
|
509
|
-
const a = new ResizeObserver((
|
|
510
|
-
if (!Array.isArray(
|
|
511
|
-
const r =
|
|
512
|
-
let o,
|
|
509
|
+
const a = new ResizeObserver((i) => {
|
|
510
|
+
if (!Array.isArray(i) || !i.length) return;
|
|
511
|
+
const r = i[0];
|
|
512
|
+
let o, c;
|
|
513
513
|
if ("borderBoxSize" in r) {
|
|
514
|
-
const
|
|
515
|
-
o = s.inlineSize,
|
|
514
|
+
const u = r.borderBoxSize, s = Array.isArray(u) ? u[0] : u;
|
|
515
|
+
o = s.inlineSize, c = s.blockSize;
|
|
516
516
|
} else
|
|
517
|
-
o = e.offsetWidth,
|
|
517
|
+
o = e.offsetWidth, c = e.offsetHeight;
|
|
518
518
|
t({
|
|
519
519
|
width: o,
|
|
520
|
-
height:
|
|
520
|
+
height: c
|
|
521
521
|
});
|
|
522
522
|
});
|
|
523
523
|
return a.observe(e, {
|
|
@@ -529,44 +529,44 @@ function Je(e) {
|
|
|
529
529
|
e
|
|
530
530
|
]), n;
|
|
531
531
|
}
|
|
532
|
-
const ie = /* @__PURE__ */
|
|
533
|
-
const { children: t, ...a } = e,
|
|
532
|
+
const ie = /* @__PURE__ */ S((e, n) => {
|
|
533
|
+
const { children: t, ...a } = e, i = $.toArray(t), r = i.find(Ye);
|
|
534
534
|
if (r) {
|
|
535
|
-
const o = r.props.children,
|
|
536
|
-
return /* @__PURE__ */
|
|
535
|
+
const o = r.props.children, c = i.map((u) => u === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : u);
|
|
536
|
+
return /* @__PURE__ */ v(q, D({}, a, {
|
|
537
537
|
ref: n
|
|
538
|
-
}), /* @__PURE__ */
|
|
538
|
+
}), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, c) : null);
|
|
539
539
|
}
|
|
540
|
-
return /* @__PURE__ */
|
|
540
|
+
return /* @__PURE__ */ v(q, D({}, a, {
|
|
541
541
|
ref: n
|
|
542
542
|
}), t);
|
|
543
543
|
});
|
|
544
544
|
ie.displayName = "Slot";
|
|
545
|
-
const
|
|
545
|
+
const q = /* @__PURE__ */ S((e, n) => {
|
|
546
546
|
const { children: t, ...a } = e;
|
|
547
|
-
return /* @__PURE__ */
|
|
548
|
-
...
|
|
549
|
-
ref: n ?
|
|
550
|
-
}) :
|
|
547
|
+
return /* @__PURE__ */ A(t) ? /* @__PURE__ */ B(t, {
|
|
548
|
+
...Ke(a, t.props),
|
|
549
|
+
ref: n ? oe(n, t.ref) : t.ref
|
|
550
|
+
}) : $.count(t) > 1 ? $.only(null) : null;
|
|
551
551
|
});
|
|
552
|
-
|
|
553
|
-
const
|
|
554
|
-
function
|
|
555
|
-
return /* @__PURE__ */
|
|
552
|
+
q.displayName = "SlotClone";
|
|
553
|
+
const Je = ({ children: e }) => /* @__PURE__ */ v(Y, null, e);
|
|
554
|
+
function Ye(e) {
|
|
555
|
+
return /* @__PURE__ */ A(e) && e.type === Je;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Ke(e, n) {
|
|
558
558
|
const t = {
|
|
559
559
|
...n
|
|
560
560
|
};
|
|
561
561
|
for (const a in n) {
|
|
562
|
-
const
|
|
563
|
-
/^on[A-Z]/.test(a) ?
|
|
564
|
-
r(...
|
|
565
|
-
} :
|
|
566
|
-
...
|
|
562
|
+
const i = e[a], r = n[a];
|
|
563
|
+
/^on[A-Z]/.test(a) ? i && r ? t[a] = (...c) => {
|
|
564
|
+
r(...c), i(...c);
|
|
565
|
+
} : i && (t[a] = i) : a === "style" ? t[a] = {
|
|
566
|
+
...i,
|
|
567
567
|
...r
|
|
568
568
|
} : a === "className" && (t[a] = [
|
|
569
|
-
|
|
569
|
+
i,
|
|
570
570
|
r
|
|
571
571
|
].filter(Boolean).join(" "));
|
|
572
572
|
}
|
|
@@ -575,7 +575,7 @@ function Qe(e, n) {
|
|
|
575
575
|
...t
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
|
-
const
|
|
578
|
+
const Qe = [
|
|
579
579
|
"a",
|
|
580
580
|
"button",
|
|
581
581
|
"div",
|
|
@@ -592,92 +592,92 @@ const er = [
|
|
|
592
592
|
"span",
|
|
593
593
|
"svg",
|
|
594
594
|
"ul"
|
|
595
|
-
],
|
|
596
|
-
const t = /* @__PURE__ */
|
|
597
|
-
const { asChild: r, ...o } = a,
|
|
598
|
-
return
|
|
595
|
+
], ce = Qe.reduce((e, n) => {
|
|
596
|
+
const t = /* @__PURE__ */ S((a, i) => {
|
|
597
|
+
const { asChild: r, ...o } = a, c = r ? ie : n;
|
|
598
|
+
return C(() => {
|
|
599
599
|
window[Symbol.for("radix-ui")] = !0;
|
|
600
|
-
}, []), /* @__PURE__ */
|
|
601
|
-
ref:
|
|
600
|
+
}, []), /* @__PURE__ */ v(c, D({}, o, {
|
|
601
|
+
ref: i
|
|
602
602
|
}));
|
|
603
603
|
});
|
|
604
604
|
return t.displayName = `Primitive.${n}`, {
|
|
605
605
|
...e,
|
|
606
606
|
[n]: t
|
|
607
607
|
};
|
|
608
|
-
}, {}),
|
|
609
|
-
const { __scopeSwitch: t, name: a, checked:
|
|
608
|
+
}, {}), ue = "Switch", [er, mr] = qe(ue), [rr, tr] = er(ue), nr = /* @__PURE__ */ S((e, n) => {
|
|
609
|
+
const { __scopeSwitch: t, name: a, checked: i, defaultChecked: r, required: o, disabled: c, value: u = "on", onCheckedChange: s, ...g } = e, [l, p] = y(null), f = Te(
|
|
610
610
|
n,
|
|
611
611
|
(m) => p(m)
|
|
612
|
-
),
|
|
613
|
-
prop:
|
|
612
|
+
), d = x(!1), b = l ? !!l.closest("form") : !0, [h = !1, _] = We({
|
|
613
|
+
prop: i,
|
|
614
614
|
defaultProp: r,
|
|
615
615
|
onChange: s
|
|
616
616
|
});
|
|
617
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ v(rr, {
|
|
618
618
|
scope: t,
|
|
619
|
-
checked:
|
|
620
|
-
disabled:
|
|
621
|
-
}, /* @__PURE__ */
|
|
619
|
+
checked: h,
|
|
620
|
+
disabled: c
|
|
621
|
+
}, /* @__PURE__ */ v(ce.button, D({
|
|
622
622
|
type: "button",
|
|
623
623
|
role: "switch",
|
|
624
|
-
"aria-checked":
|
|
624
|
+
"aria-checked": h,
|
|
625
625
|
"aria-required": o,
|
|
626
|
-
"data-state":
|
|
627
|
-
"data-disabled":
|
|
628
|
-
disabled:
|
|
629
|
-
value:
|
|
630
|
-
},
|
|
631
|
-
ref:
|
|
632
|
-
onClick:
|
|
633
|
-
|
|
634
|
-
(
|
|
635
|
-
),
|
|
626
|
+
"data-state": se(h),
|
|
627
|
+
"data-disabled": c ? "" : void 0,
|
|
628
|
+
disabled: c,
|
|
629
|
+
value: u
|
|
630
|
+
}, g, {
|
|
631
|
+
ref: f,
|
|
632
|
+
onClick: He(e.onClick, (m) => {
|
|
633
|
+
_(
|
|
634
|
+
(N) => !N
|
|
635
|
+
), b && (d.current = m.isPropagationStopped(), d.current || m.stopPropagation());
|
|
636
636
|
})
|
|
637
|
-
})),
|
|
637
|
+
})), b && /* @__PURE__ */ v(ir, {
|
|
638
638
|
control: l,
|
|
639
|
-
bubbles: !
|
|
639
|
+
bubbles: !d.current,
|
|
640
640
|
name: a,
|
|
641
|
-
value:
|
|
642
|
-
checked:
|
|
641
|
+
value: u,
|
|
642
|
+
checked: h,
|
|
643
643
|
required: o,
|
|
644
|
-
disabled:
|
|
644
|
+
disabled: c,
|
|
645
645
|
style: {
|
|
646
646
|
transform: "translateX(-100%)"
|
|
647
647
|
}
|
|
648
648
|
}));
|
|
649
|
-
}),
|
|
650
|
-
const { __scopeSwitch: t, ...a } = e,
|
|
651
|
-
return /* @__PURE__ */
|
|
652
|
-
"data-state":
|
|
653
|
-
"data-disabled":
|
|
649
|
+
}), or = "SwitchThumb", ar = /* @__PURE__ */ S((e, n) => {
|
|
650
|
+
const { __scopeSwitch: t, ...a } = e, i = tr(or, t);
|
|
651
|
+
return /* @__PURE__ */ v(ce.span, D({
|
|
652
|
+
"data-state": se(i.checked),
|
|
653
|
+
"data-disabled": i.disabled ? "" : void 0
|
|
654
654
|
}, a, {
|
|
655
655
|
ref: n
|
|
656
656
|
}));
|
|
657
|
-
}),
|
|
658
|
-
const { control: n, checked: t, bubbles: a = !0, ...
|
|
659
|
-
return
|
|
660
|
-
const
|
|
657
|
+
}), ir = (e) => {
|
|
658
|
+
const { control: n, checked: t, bubbles: a = !0, ...i } = e, r = x(null), o = Ve(t), c = Ze(n);
|
|
659
|
+
return C(() => {
|
|
660
|
+
const u = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
|
|
661
661
|
if (o !== t && l) {
|
|
662
662
|
const p = new Event("click", {
|
|
663
663
|
bubbles: a
|
|
664
664
|
});
|
|
665
|
-
l.call(
|
|
665
|
+
l.call(u, t), u.dispatchEvent(p);
|
|
666
666
|
}
|
|
667
667
|
}, [
|
|
668
668
|
o,
|
|
669
669
|
t,
|
|
670
670
|
a
|
|
671
|
-
]), /* @__PURE__ */
|
|
671
|
+
]), /* @__PURE__ */ v("input", D({
|
|
672
672
|
type: "checkbox",
|
|
673
673
|
"aria-hidden": !0,
|
|
674
674
|
defaultChecked: t
|
|
675
|
-
},
|
|
675
|
+
}, i, {
|
|
676
676
|
tabIndex: -1,
|
|
677
677
|
ref: r,
|
|
678
678
|
style: {
|
|
679
679
|
...e.style,
|
|
680
|
-
...
|
|
680
|
+
...c,
|
|
681
681
|
position: "absolute",
|
|
682
682
|
pointerEvents: "none",
|
|
683
683
|
opacity: 0,
|
|
@@ -685,14 +685,14 @@ const er = [
|
|
|
685
685
|
}
|
|
686
686
|
}));
|
|
687
687
|
};
|
|
688
|
-
function
|
|
688
|
+
function se(e) {
|
|
689
689
|
return e ? "checked" : "unchecked";
|
|
690
690
|
}
|
|
691
|
-
const
|
|
692
|
-
function
|
|
691
|
+
const cr = nr, ur = ar;
|
|
692
|
+
function sr(e) {
|
|
693
693
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
694
694
|
}
|
|
695
|
-
var
|
|
695
|
+
var le = { exports: {} };
|
|
696
696
|
/*!
|
|
697
697
|
Copyright (c) 2018 Jed Watson.
|
|
698
698
|
Licensed under the MIT License (MIT), see
|
|
@@ -703,8 +703,8 @@ var de = { exports: {} };
|
|
|
703
703
|
var n = {}.hasOwnProperty;
|
|
704
704
|
function t() {
|
|
705
705
|
for (var r = "", o = 0; o < arguments.length; o++) {
|
|
706
|
-
var
|
|
707
|
-
|
|
706
|
+
var c = arguments[o];
|
|
707
|
+
c && (r = i(r, a(c)));
|
|
708
708
|
}
|
|
709
709
|
return r;
|
|
710
710
|
}
|
|
@@ -718,153 +718,187 @@ var de = { exports: {} };
|
|
|
718
718
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
719
719
|
return r.toString();
|
|
720
720
|
var o = "";
|
|
721
|
-
for (var
|
|
722
|
-
n.call(r,
|
|
721
|
+
for (var c in r)
|
|
722
|
+
n.call(r, c) && r[c] && (o = i(o, c));
|
|
723
723
|
return o;
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function i(r, o) {
|
|
726
726
|
return o ? r ? r + " " + o : r + o : r;
|
|
727
727
|
}
|
|
728
728
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
729
729
|
})();
|
|
730
|
-
})(
|
|
731
|
-
var
|
|
732
|
-
const
|
|
733
|
-
"purpur-toggle": "_purpur-toggle_1xng6_1",
|
|
734
|
-
"purpur-toggle__track": "_purpur-toggle__track_1xng6_7",
|
|
735
|
-
"purpur-toggle__checkmark-container": "_purpur-toggle__checkmark-container_1xng6_45",
|
|
736
|
-
"purpur-toggle__thumb": "_purpur-toggle__thumb_1xng6_60",
|
|
737
|
-
"purpur-toggle__thumb--dragging": "_purpur-toggle__thumb--dragging_1xng6_80",
|
|
738
|
-
"purpur-toggle__checkmark": "_purpur-toggle__checkmark_1xng6_45",
|
|
739
|
-
"purpur-toggle__label--right": "_purpur-toggle__label--right_1xng6_100",
|
|
740
|
-
"purpur-toggle__label--left": "_purpur-toggle__label--left_1xng6_103",
|
|
741
|
-
"purpur-toggle__container": "_purpur-toggle__container_1xng6_106"
|
|
742
|
-
}, Y = (e) => e && "touches" in e, dr = ({
|
|
730
|
+
})(le);
|
|
731
|
+
var lr = le.exports;
|
|
732
|
+
const I = /* @__PURE__ */ sr(lr), V = (e) => e && "touches" in e, pr = ({
|
|
743
733
|
children: e,
|
|
744
734
|
disabled: n,
|
|
745
735
|
onStart: t,
|
|
746
736
|
onDrag: a,
|
|
747
|
-
onStop:
|
|
737
|
+
onStop: i,
|
|
748
738
|
bounds: r,
|
|
749
739
|
position: o,
|
|
750
|
-
style:
|
|
740
|
+
style: c
|
|
751
741
|
}) => {
|
|
752
|
-
const [
|
|
742
|
+
const [u, s] = y(void 0), [g, l] = y(void 0), [p, f] = y(!1), d = (_) => {
|
|
753
743
|
if (!n) {
|
|
754
|
-
|
|
755
|
-
const m =
|
|
744
|
+
_.preventDefault();
|
|
745
|
+
const m = V(_.nativeEvent) ? _.nativeEvent.touches[0].clientX : _.nativeEvent.clientX;
|
|
756
746
|
l(m), t == null || t();
|
|
757
747
|
}
|
|
758
|
-
},
|
|
759
|
-
(
|
|
760
|
-
if (typeof
|
|
748
|
+
}, b = z(
|
|
749
|
+
(_) => {
|
|
750
|
+
if (typeof g != "number")
|
|
761
751
|
return;
|
|
762
|
-
const
|
|
763
|
-
if (!
|
|
752
|
+
const N = (V(_) ? _.touches[0].clientX : _.clientX) - g;
|
|
753
|
+
if (!N)
|
|
764
754
|
return;
|
|
765
|
-
const
|
|
766
|
-
!p && Math.abs(
|
|
767
|
-
const
|
|
768
|
-
s(
|
|
755
|
+
const E = o + N;
|
|
756
|
+
!p && Math.abs(E) && f(!0);
|
|
757
|
+
const L = E > r.right ? r.right : E < r.left ? r.left : E;
|
|
758
|
+
s(L), a == null || a({ x: L });
|
|
769
759
|
},
|
|
770
|
-
[a, s, p,
|
|
771
|
-
),
|
|
772
|
-
l(void 0), s(void 0),
|
|
773
|
-
}, [
|
|
774
|
-
return
|
|
775
|
-
window.removeEventListener("mousemove",
|
|
776
|
-
}), [
|
|
777
|
-
window.removeEventListener("mouseup",
|
|
778
|
-
}), [
|
|
779
|
-
onMouseDown:
|
|
780
|
-
onTouchStart:
|
|
781
|
-
style: { ...
|
|
760
|
+
[a, s, p, g]
|
|
761
|
+
), h = z(() => {
|
|
762
|
+
l(void 0), s(void 0), f(!1), i == null || i();
|
|
763
|
+
}, [i, l]);
|
|
764
|
+
return C(() => (window.addEventListener("mousemove", b), window.addEventListener("touchmove", b), () => {
|
|
765
|
+
window.removeEventListener("mousemove", b), window.removeEventListener("touchmove", b);
|
|
766
|
+
}), [b]), C(() => (window.addEventListener("mouseup", h), window.addEventListener("touchend", h), () => {
|
|
767
|
+
window.removeEventListener("mouseup", h), window.removeEventListener("touchend", h);
|
|
768
|
+
}), [h]), A(e) ? B($.only(e), {
|
|
769
|
+
onMouseDown: d,
|
|
770
|
+
onTouchStart: d,
|
|
771
|
+
style: { ...c, transform: `translateX(${p ? u : o}px)` }
|
|
782
772
|
}) : null;
|
|
783
|
-
},
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
773
|
+
}, G = {
|
|
774
|
+
width: void 0,
|
|
775
|
+
height: void 0
|
|
776
|
+
};
|
|
777
|
+
function Z(e) {
|
|
778
|
+
const { ref: n, box: t = "content-box", round: a } = e, [{ width: i, height: r }, o] = y(G), c = dr(), u = x({ ...G }), s = x(void 0);
|
|
779
|
+
return s.current = e.onResize, C(() => {
|
|
780
|
+
if (!n.current || typeof window > "u" || !("ResizeObserver" in window))
|
|
781
|
+
return;
|
|
782
|
+
const g = new ResizeObserver(([l]) => {
|
|
783
|
+
const p = (
|
|
784
|
+
// eslint-disable-next-line no-nested-ternary
|
|
785
|
+
t === "border-box" ? "borderBoxSize" : t === "device-pixel-content-box" ? "devicePixelContentBoxSize" : "contentBoxSize"
|
|
786
|
+
), f = J(l, p, "inlineSize"), d = J(l, p, "blockSize");
|
|
787
|
+
if (u.current.width !== f || u.current.height !== d) {
|
|
788
|
+
const h = {
|
|
789
|
+
width: f && a ? Math.round(f) : f,
|
|
790
|
+
height: d && a ? Math.round(d) : d
|
|
791
|
+
};
|
|
792
|
+
u.current.width = f, u.current.height = d, s.current ? s.current(h) : c() && o(h);
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
return g.observe(n.current, { box: t }), () => {
|
|
796
|
+
g.disconnect();
|
|
797
|
+
};
|
|
798
|
+
}, [t, n, c, a]), { width: i, height: r };
|
|
799
|
+
}
|
|
800
|
+
function J(e, n, t) {
|
|
801
|
+
return e[n] ? Array.isArray(e[n]) ? e[n][0][t] : (
|
|
802
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
803
|
+
// @ts-ignore Support Firefox's non-standard behavior
|
|
804
|
+
e[n][t]
|
|
805
|
+
) : n === "contentBoxSize" ? e.contentRect[t === "inlineSize" ? "width" : "height"] : void 0;
|
|
806
|
+
}
|
|
807
|
+
function dr() {
|
|
808
|
+
const e = x(!1);
|
|
809
|
+
return C(() => (e.current = !0, () => {
|
|
810
|
+
e.current = !1;
|
|
811
|
+
}), []), z(() => e.current, []);
|
|
812
|
+
}
|
|
813
|
+
const fr = ({ checked: e, onChange: n }) => {
|
|
814
|
+
const t = x(null), a = x(null), [i, r] = y(void 0), [o, c] = y(!1), [u, 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 i == "number" && (e ? i < b : i > b);
|
|
791
815
|
return {
|
|
792
816
|
trackRef: t,
|
|
793
817
|
thumbRef: a,
|
|
794
818
|
isDragging: o,
|
|
795
|
-
bounds: { left: d, right:
|
|
796
|
-
position: e ?
|
|
797
|
-
onDrag: ({ x:
|
|
798
|
-
r(
|
|
819
|
+
bounds: { left: d, right: f },
|
|
820
|
+
position: e ? f : d,
|
|
821
|
+
onDrag: ({ x: E }) => {
|
|
822
|
+
r(E), Math.abs((e ? f : d) - E) > 2 && c(!0);
|
|
799
823
|
},
|
|
800
824
|
onStop: () => {
|
|
801
|
-
|
|
825
|
+
c(!1), o && s(Date.now()), h && (n == null || n(!e));
|
|
802
826
|
},
|
|
803
827
|
onChangeWithDrag: () => {
|
|
804
|
-
Date.now() -
|
|
828
|
+
Date.now() - u > 50 && (n == null || n(!e)), r(void 0);
|
|
805
829
|
}
|
|
806
830
|
};
|
|
807
|
-
}, P =
|
|
831
|
+
}, P = {
|
|
832
|
+
"purpur-toggle": "_purpur-toggle_1xng6_1",
|
|
833
|
+
"purpur-toggle__track": "_purpur-toggle__track_1xng6_7",
|
|
834
|
+
"purpur-toggle__checkmark-container": "_purpur-toggle__checkmark-container_1xng6_45",
|
|
835
|
+
"purpur-toggle__thumb": "_purpur-toggle__thumb_1xng6_60",
|
|
836
|
+
"purpur-toggle__thumb--dragging": "_purpur-toggle__thumb--dragging_1xng6_80",
|
|
837
|
+
"purpur-toggle__checkmark": "_purpur-toggle__checkmark_1xng6_45",
|
|
838
|
+
"purpur-toggle__label--right": "_purpur-toggle__label--right_1xng6_100",
|
|
839
|
+
"purpur-toggle__label--left": "_purpur-toggle__label--left_1xng6_103",
|
|
840
|
+
"purpur-toggle__container": "_purpur-toggle__container_1xng6_106"
|
|
841
|
+
}, k = "purpur-toggle", hr = ({
|
|
808
842
|
["data-testid"]: e,
|
|
809
843
|
className: n,
|
|
810
844
|
label: t,
|
|
811
845
|
onChange: a,
|
|
812
|
-
labelPosition:
|
|
846
|
+
labelPosition: i = "right",
|
|
813
847
|
checked: r,
|
|
814
848
|
disableDrag: o,
|
|
815
|
-
defaultChecked:
|
|
816
|
-
...
|
|
849
|
+
defaultChecked: c,
|
|
850
|
+
...u
|
|
817
851
|
}, s) => {
|
|
818
|
-
const [
|
|
819
|
-
typeof r == "boolean" ? r : !!
|
|
820
|
-
), p = !!(typeof r == "boolean" ? r :
|
|
852
|
+
const [g, l] = y(
|
|
853
|
+
typeof r == "boolean" ? r : !!c
|
|
854
|
+
), p = !!(typeof r == "boolean" ? r : g), { thumbRef: f, trackRef: d, isDragging: b, onChangeWithDrag: h, ..._ } = fr({
|
|
821
855
|
checked: p,
|
|
822
|
-
onChange: (
|
|
823
|
-
|
|
856
|
+
onChange: (N) => {
|
|
857
|
+
u.disabled || (a == null || a(N), l(N));
|
|
824
858
|
}
|
|
825
|
-
}), m = () => /* @__PURE__ */
|
|
826
|
-
|
|
859
|
+
}), m = () => /* @__PURE__ */ w(
|
|
860
|
+
ze,
|
|
827
861
|
{
|
|
828
|
-
htmlFor:
|
|
862
|
+
htmlFor: u.id,
|
|
829
863
|
"data-testid": e && `${e}-label`,
|
|
830
|
-
disabled:
|
|
831
|
-
className:
|
|
832
|
-
|
|
833
|
-
|
|
864
|
+
disabled: u.disabled,
|
|
865
|
+
className: I(
|
|
866
|
+
P[`${k}__label`],
|
|
867
|
+
P[`${k}__label--${i}`]
|
|
834
868
|
),
|
|
835
|
-
children: /* @__PURE__ */
|
|
869
|
+
children: /* @__PURE__ */ w(ne, { variant: "paragraph-100", disabled: u.disabled, children: t })
|
|
836
870
|
}
|
|
837
871
|
);
|
|
838
|
-
return /* @__PURE__ */
|
|
839
|
-
t &&
|
|
840
|
-
/* @__PURE__ */
|
|
841
|
-
|
|
872
|
+
return /* @__PURE__ */ F("div", { className: I([n, P[`${k}__container`]]), children: [
|
|
873
|
+
t && i === "left" && m(),
|
|
874
|
+
/* @__PURE__ */ w(
|
|
875
|
+
cr,
|
|
842
876
|
{
|
|
843
|
-
...
|
|
877
|
+
...u,
|
|
844
878
|
ref: s,
|
|
845
|
-
id:
|
|
879
|
+
id: u.id,
|
|
846
880
|
"data-testid": e,
|
|
847
|
-
className:
|
|
848
|
-
onCheckedChange:
|
|
881
|
+
className: P[k],
|
|
882
|
+
onCheckedChange: h,
|
|
849
883
|
checked: p,
|
|
850
|
-
children: /* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
852
|
-
|
|
884
|
+
children: /* @__PURE__ */ F("span", { ref: d, className: P[`${k}__track`], children: [
|
|
885
|
+
/* @__PURE__ */ w("span", { className: P[`${k}__checkmark-container`], children: /* @__PURE__ */ w(
|
|
886
|
+
Q,
|
|
853
887
|
{
|
|
854
|
-
className:
|
|
888
|
+
className: P[`${k}__checkmark`],
|
|
855
889
|
svg: ve,
|
|
856
890
|
size: "xxs"
|
|
857
891
|
}
|
|
858
892
|
) }),
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
|
|
893
|
+
/* @__PURE__ */ w(pr, { disabled: o, ..._, children: /* @__PURE__ */ w(
|
|
894
|
+
ur,
|
|
861
895
|
{
|
|
862
|
-
ref:
|
|
896
|
+
ref: f,
|
|
863
897
|
"data-testid": e && `${e}-thumb`,
|
|
864
|
-
className:
|
|
865
|
-
|
|
898
|
+
className: I([
|
|
899
|
+
P[`${k}__thumb`],
|
|
866
900
|
{
|
|
867
|
-
[
|
|
901
|
+
[P[`${k}__thumb--dragging`]]: b
|
|
868
902
|
}
|
|
869
903
|
])
|
|
870
904
|
}
|
|
@@ -872,11 +906,11 @@ const q = /* @__PURE__ */ lr(pr), S = {
|
|
|
872
906
|
] })
|
|
873
907
|
}
|
|
874
908
|
),
|
|
875
|
-
t &&
|
|
909
|
+
t && i === "right" && m()
|
|
876
910
|
] });
|
|
877
|
-
},
|
|
878
|
-
|
|
911
|
+
}, gr = S(hr);
|
|
912
|
+
gr.displayName = "Toggle";
|
|
879
913
|
export {
|
|
880
|
-
|
|
914
|
+
gr as Toggle
|
|
881
915
|
};
|
|
882
916
|
//# sourceMappingURL=toggle.es.js.map
|