@purpurds/toggle 4.1.0 → 4.2.0
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 +281 -278
- package/dist/toggle.es.js.map +1 -1
- package/package.json +5 -5
package/dist/toggle.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as x, jsxs as G } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as w, Children as y, isValidElement as k, createElement as _, cloneElement as
|
|
2
|
+
import { forwardRef as w, Children as y, isValidElement as k, createElement as _, cloneElement as L, useEffect as A, Fragment as ee, useCallback as X, createContext as Z, useMemo as R, useContext as fe, useRef as D, useState as $, useLayoutEffect as te } from "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
function ge(e) {
|
|
5
5
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
6
6
|
}
|
|
7
|
-
var
|
|
7
|
+
var re = { exports: {} };
|
|
8
8
|
/*!
|
|
9
9
|
Copyright (c) 2018 Jed Watson.
|
|
10
10
|
Licensed under the MIT License (MIT), see
|
|
@@ -13,34 +13,34 @@ var te = { exports: {} };
|
|
|
13
13
|
(function(e) {
|
|
14
14
|
(function() {
|
|
15
15
|
var n = {}.hasOwnProperty;
|
|
16
|
-
function
|
|
17
|
-
for (var
|
|
16
|
+
function r() {
|
|
17
|
+
for (var t = "", a = 0; a < arguments.length; a++) {
|
|
18
18
|
var u = arguments[a];
|
|
19
|
-
u && (
|
|
19
|
+
u && (t = c(t, o.call(this, u)));
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return t;
|
|
22
22
|
}
|
|
23
|
-
function o(
|
|
24
|
-
if (typeof
|
|
25
|
-
return this && this[
|
|
26
|
-
if (typeof
|
|
23
|
+
function o(t) {
|
|
24
|
+
if (typeof t == "string" || typeof t == "number")
|
|
25
|
+
return this && this[t] || t;
|
|
26
|
+
if (typeof t != "object")
|
|
27
27
|
return "";
|
|
28
|
-
if (Array.isArray(
|
|
29
|
-
return
|
|
30
|
-
if (
|
|
31
|
-
return
|
|
28
|
+
if (Array.isArray(t))
|
|
29
|
+
return r.apply(this, t);
|
|
30
|
+
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
31
|
+
return t.toString();
|
|
32
32
|
var a = "";
|
|
33
|
-
for (var u in
|
|
34
|
-
n.call(
|
|
33
|
+
for (var u in t)
|
|
34
|
+
n.call(t, u) && t[u] && (a = c(a, this && this[u] || u));
|
|
35
35
|
return a;
|
|
36
36
|
}
|
|
37
|
-
function c(
|
|
38
|
-
return a ?
|
|
37
|
+
function c(t, a) {
|
|
38
|
+
return a ? t ? t + " " + a : t + a : t;
|
|
39
39
|
}
|
|
40
|
-
e.exports ? (
|
|
40
|
+
e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
|
|
41
41
|
})();
|
|
42
|
-
})(
|
|
43
|
-
var he =
|
|
42
|
+
})(re);
|
|
43
|
+
var he = re.exports;
|
|
44
44
|
const be = /* @__PURE__ */ ge(he), _e = {
|
|
45
45
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
46
46
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
@@ -55,83 +55,83 @@ const be = /* @__PURE__ */ ge(he), _e = {
|
|
|
55
55
|
keywords: ["checkmark-bold"],
|
|
56
56
|
category: "utility"
|
|
57
57
|
}, me = be.bind(_e), J = "purpur-icon", $e = "md", ye = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), xe = ({ content: e = "", title: n } = {}) => {
|
|
58
|
-
const
|
|
58
|
+
const r = [
|
|
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 ${ye(
|
|
64
|
+
return `<svg ${ye(r)}>${o}${e}</svg>`;
|
|
65
65
|
}, we = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Se = ({
|
|
66
66
|
["data-testid"]: e,
|
|
67
67
|
svg: n,
|
|
68
|
-
allyTitle:
|
|
68
|
+
allyTitle: r,
|
|
69
69
|
className: o = "",
|
|
70
70
|
size: c = $e,
|
|
71
|
-
...
|
|
71
|
+
...t
|
|
72
72
|
}) => {
|
|
73
73
|
const a = xe({
|
|
74
74
|
content: we(n.svg),
|
|
75
|
-
title:
|
|
75
|
+
title: r
|
|
76
76
|
}), u = me(o, J, `${J}--${c}`);
|
|
77
77
|
return /* @__PURE__ */ x(
|
|
78
78
|
"span",
|
|
79
79
|
{
|
|
80
|
-
"aria-label":
|
|
80
|
+
"aria-label": r,
|
|
81
81
|
className: u,
|
|
82
82
|
"data-testid": e,
|
|
83
83
|
dangerouslySetInnerHTML: { __html: a },
|
|
84
|
-
...
|
|
84
|
+
...t
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
};
|
|
88
88
|
function q() {
|
|
89
89
|
return q = Object.assign ? Object.assign.bind() : function(e) {
|
|
90
90
|
for (var n = 1; n < arguments.length; n++) {
|
|
91
|
-
var
|
|
92
|
-
for (var o in
|
|
93
|
-
Object.prototype.hasOwnProperty.call(
|
|
91
|
+
var r = arguments[n];
|
|
92
|
+
for (var o in r)
|
|
93
|
+
Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
|
|
94
94
|
}
|
|
95
95
|
return e;
|
|
96
96
|
}, q.apply(this, arguments);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return
|
|
98
|
+
function M() {
|
|
99
|
+
return M = Object.assign ? Object.assign.bind() : function(e) {
|
|
100
100
|
for (var n = 1; n < arguments.length; n++) {
|
|
101
|
-
var
|
|
102
|
-
for (var o in
|
|
103
|
-
Object.prototype.hasOwnProperty.call(
|
|
101
|
+
var r = arguments[n];
|
|
102
|
+
for (var o in r)
|
|
103
|
+
Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
|
|
104
104
|
}
|
|
105
105
|
return e;
|
|
106
|
-
},
|
|
106
|
+
}, M.apply(this, arguments);
|
|
107
107
|
}
|
|
108
108
|
function Pe(e, n) {
|
|
109
109
|
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
110
110
|
}
|
|
111
111
|
function ke(...e) {
|
|
112
112
|
return (n) => e.forEach(
|
|
113
|
-
(
|
|
113
|
+
(r) => Pe(r, n)
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
const ne = /* @__PURE__ */ w((e, n) => {
|
|
117
|
-
const { children:
|
|
118
|
-
if (
|
|
119
|
-
const a =
|
|
120
|
-
return /* @__PURE__ */ _(F,
|
|
117
|
+
const { children: r, ...o } = e, c = y.toArray(r), t = c.find(Ae);
|
|
118
|
+
if (t) {
|
|
119
|
+
const a = t.props.children, u = c.map((i) => i === t ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
|
|
120
|
+
return /* @__PURE__ */ _(F, M({}, o, {
|
|
121
121
|
ref: n
|
|
122
|
-
}), /* @__PURE__ */ k(a) ? /* @__PURE__ */
|
|
122
|
+
}), /* @__PURE__ */ k(a) ? /* @__PURE__ */ L(a, void 0, u) : null);
|
|
123
123
|
}
|
|
124
|
-
return /* @__PURE__ */ _(F,
|
|
124
|
+
return /* @__PURE__ */ _(F, M({}, o, {
|
|
125
125
|
ref: n
|
|
126
|
-
}),
|
|
126
|
+
}), r);
|
|
127
127
|
});
|
|
128
128
|
ne.displayName = "Slot";
|
|
129
129
|
const F = /* @__PURE__ */ w((e, n) => {
|
|
130
|
-
const { children:
|
|
131
|
-
return /* @__PURE__ */ k(
|
|
132
|
-
...De(o,
|
|
133
|
-
ref: n ? ke(n,
|
|
134
|
-
}) : y.count(
|
|
130
|
+
const { children: r, ...o } = e;
|
|
131
|
+
return /* @__PURE__ */ k(r) ? /* @__PURE__ */ L(r, {
|
|
132
|
+
...De(o, r.props),
|
|
133
|
+
ref: n ? ke(n, r.ref) : r.ref
|
|
134
|
+
}) : y.count(r) > 1 ? y.only(null) : null;
|
|
135
135
|
});
|
|
136
136
|
F.displayName = "SlotClone";
|
|
137
137
|
const Oe = ({ children: e }) => /* @__PURE__ */ _(ee, null, e);
|
|
@@ -139,24 +139,24 @@ function Ae(e) {
|
|
|
139
139
|
return /* @__PURE__ */ k(e) && e.type === Oe;
|
|
140
140
|
}
|
|
141
141
|
function De(e, n) {
|
|
142
|
-
const
|
|
142
|
+
const r = {
|
|
143
143
|
...n
|
|
144
144
|
};
|
|
145
145
|
for (const o in n) {
|
|
146
|
-
const c = e[o],
|
|
147
|
-
/^on[A-Z]/.test(o) ? c &&
|
|
148
|
-
|
|
149
|
-
} : c && (
|
|
146
|
+
const c = e[o], t = n[o];
|
|
147
|
+
/^on[A-Z]/.test(o) ? c && t ? r[o] = (...a) => {
|
|
148
|
+
t(...a), c(...a);
|
|
149
|
+
} : c && (r[o] = c) : o === "style" ? r[o] = {
|
|
150
150
|
...c,
|
|
151
|
-
...
|
|
152
|
-
} : o === "className" && (
|
|
151
|
+
...t
|
|
152
|
+
} : o === "className" && (r[o] = [
|
|
153
153
|
c,
|
|
154
|
-
|
|
154
|
+
t
|
|
155
155
|
].filter(Boolean).join(" "));
|
|
156
156
|
}
|
|
157
157
|
return {
|
|
158
158
|
...e,
|
|
159
|
-
...
|
|
159
|
+
...r
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
const Ce = [
|
|
@@ -177,23 +177,23 @@ const Ce = [
|
|
|
177
177
|
"svg",
|
|
178
178
|
"ul"
|
|
179
179
|
], Ne = Ce.reduce((e, n) => {
|
|
180
|
-
const
|
|
181
|
-
const { asChild:
|
|
180
|
+
const r = /* @__PURE__ */ w((o, c) => {
|
|
181
|
+
const { asChild: t, ...a } = o, u = t ? ne : n;
|
|
182
182
|
return A(() => {
|
|
183
183
|
window[Symbol.for("radix-ui")] = !0;
|
|
184
|
-
}, []), /* @__PURE__ */ _(u,
|
|
184
|
+
}, []), /* @__PURE__ */ _(u, M({}, a, {
|
|
185
185
|
ref: c
|
|
186
186
|
}));
|
|
187
187
|
});
|
|
188
|
-
return
|
|
188
|
+
return r.displayName = `Primitive.${n}`, {
|
|
189
189
|
...e,
|
|
190
|
-
[n]:
|
|
190
|
+
[n]: r
|
|
191
191
|
};
|
|
192
192
|
}, {}), Ee = /* @__PURE__ */ w((e, n) => /* @__PURE__ */ _(Ne.label, q({}, e, {
|
|
193
193
|
ref: n,
|
|
194
|
-
onMouseDown: (
|
|
194
|
+
onMouseDown: (r) => {
|
|
195
195
|
var o;
|
|
196
|
-
(o = e.onMouseDown) === null || o === void 0 || o.call(e,
|
|
196
|
+
(o = e.onMouseDown) === null || o === void 0 || o.call(e, r), !r.defaultPrevented && r.detail > 1 && r.preventDefault();
|
|
197
197
|
}
|
|
198
198
|
}))), je = Ee;
|
|
199
199
|
function Re(e) {
|
|
@@ -208,31 +208,31 @@ var oe = { exports: {} };
|
|
|
208
208
|
(function(e) {
|
|
209
209
|
(function() {
|
|
210
210
|
var n = {}.hasOwnProperty;
|
|
211
|
-
function
|
|
212
|
-
for (var
|
|
211
|
+
function r() {
|
|
212
|
+
for (var t = "", a = 0; a < arguments.length; a++) {
|
|
213
213
|
var u = arguments[a];
|
|
214
|
-
u && (
|
|
214
|
+
u && (t = c(t, o(u)));
|
|
215
215
|
}
|
|
216
|
-
return
|
|
216
|
+
return t;
|
|
217
217
|
}
|
|
218
|
-
function o(
|
|
219
|
-
if (typeof
|
|
220
|
-
return
|
|
221
|
-
if (typeof
|
|
218
|
+
function o(t) {
|
|
219
|
+
if (typeof t == "string" || typeof t == "number")
|
|
220
|
+
return t;
|
|
221
|
+
if (typeof t != "object")
|
|
222
222
|
return "";
|
|
223
|
-
if (Array.isArray(
|
|
224
|
-
return
|
|
225
|
-
if (
|
|
226
|
-
return
|
|
223
|
+
if (Array.isArray(t))
|
|
224
|
+
return r.apply(null, t);
|
|
225
|
+
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
226
|
+
return t.toString();
|
|
227
227
|
var a = "";
|
|
228
|
-
for (var u in
|
|
229
|
-
n.call(
|
|
228
|
+
for (var u in t)
|
|
229
|
+
n.call(t, u) && t[u] && (a = c(a, u));
|
|
230
230
|
return a;
|
|
231
231
|
}
|
|
232
|
-
function c(
|
|
233
|
-
return a ?
|
|
232
|
+
function c(t, a) {
|
|
233
|
+
return a ? t ? t + " " + a : t + a : t;
|
|
234
234
|
}
|
|
235
|
-
e.exports ? (
|
|
235
|
+
e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
|
|
236
236
|
})();
|
|
237
237
|
})(oe);
|
|
238
238
|
var Me = oe.exports;
|
|
@@ -242,17 +242,17 @@ const ze = /* @__PURE__ */ Re(Me), K = {
|
|
|
242
242
|
}, Q = "purpur-label", He = ({
|
|
243
243
|
children: e,
|
|
244
244
|
className: n,
|
|
245
|
-
htmlFor:
|
|
245
|
+
htmlFor: r,
|
|
246
246
|
"data-testid": o,
|
|
247
247
|
disabled: c,
|
|
248
|
-
...
|
|
248
|
+
...t
|
|
249
249
|
}) => {
|
|
250
250
|
const a = ze([
|
|
251
251
|
n,
|
|
252
252
|
K[Q],
|
|
253
253
|
{ [K[`${Q}--disabled`]]: c }
|
|
254
254
|
]);
|
|
255
|
-
return /* @__PURE__ */ x(je, { className: a, "data-testid": o, htmlFor:
|
|
255
|
+
return /* @__PURE__ */ x(je, { className: a, "data-testid": o, htmlFor: r, ...t, children: e });
|
|
256
256
|
};
|
|
257
257
|
function Le(e) {
|
|
258
258
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -266,48 +266,49 @@ var ae = { exports: {} };
|
|
|
266
266
|
(function(e) {
|
|
267
267
|
(function() {
|
|
268
268
|
var n = {}.hasOwnProperty;
|
|
269
|
-
function
|
|
270
|
-
for (var
|
|
269
|
+
function r() {
|
|
270
|
+
for (var t = "", a = 0; a < arguments.length; a++) {
|
|
271
271
|
var u = arguments[a];
|
|
272
|
-
u && (
|
|
272
|
+
u && (t = c(t, o(u)));
|
|
273
273
|
}
|
|
274
|
-
return
|
|
274
|
+
return t;
|
|
275
275
|
}
|
|
276
|
-
function o(
|
|
277
|
-
if (typeof
|
|
278
|
-
return
|
|
279
|
-
if (typeof
|
|
276
|
+
function o(t) {
|
|
277
|
+
if (typeof t == "string" || typeof t == "number")
|
|
278
|
+
return t;
|
|
279
|
+
if (typeof t != "object")
|
|
280
280
|
return "";
|
|
281
|
-
if (Array.isArray(
|
|
282
|
-
return
|
|
283
|
-
if (
|
|
284
|
-
return
|
|
281
|
+
if (Array.isArray(t))
|
|
282
|
+
return r.apply(null, t);
|
|
283
|
+
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
284
|
+
return t.toString();
|
|
285
285
|
var a = "";
|
|
286
|
-
for (var u in
|
|
287
|
-
n.call(
|
|
286
|
+
for (var u in t)
|
|
287
|
+
n.call(t, u) && t[u] && (a = c(a, u));
|
|
288
288
|
return a;
|
|
289
289
|
}
|
|
290
|
-
function c(
|
|
291
|
-
return a ?
|
|
290
|
+
function c(t, a) {
|
|
291
|
+
return a ? t ? t + " " + a : t + a : t;
|
|
292
292
|
}
|
|
293
|
-
e.exports ? (
|
|
293
|
+
e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
|
|
294
294
|
})();
|
|
295
295
|
})(ae);
|
|
296
296
|
var Xe = ae.exports;
|
|
297
|
-
const Be = /* @__PURE__ */ Le(Xe),
|
|
298
|
-
"purpur-paragraph": "_purpur-
|
|
299
|
-
"purpur-paragraph--disabled": "_purpur-paragraph--
|
|
300
|
-
"purpur-paragraph--hyphens": "_purpur-paragraph--
|
|
301
|
-
"purpur-paragraph--
|
|
302
|
-
"purpur-paragraph--paragraph-100
|
|
303
|
-
"purpur-paragraph--paragraph-100-
|
|
304
|
-
"purpur-paragraph--paragraph-
|
|
305
|
-
"purpur-paragraph--
|
|
306
|
-
"purpur-paragraph--preamble-
|
|
307
|
-
"purpur-paragraph--
|
|
308
|
-
"purpur-paragraph--additional-100
|
|
309
|
-
"purpur-paragraph--
|
|
310
|
-
"purpur-paragraph--overline-
|
|
297
|
+
const Be = /* @__PURE__ */ Le(Xe), E = {
|
|
298
|
+
"purpur-paragraph": "_purpur-paragraph_15yuz_1",
|
|
299
|
+
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_15yuz_7",
|
|
300
|
+
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_15yuz_10",
|
|
301
|
+
"purpur-paragraph--negative": "_purpur-paragraph--negative_15yuz_13",
|
|
302
|
+
"purpur-paragraph--paragraph-100": "_purpur-paragraph--paragraph-100_15yuz_16",
|
|
303
|
+
"purpur-paragraph--paragraph-100-medium": "_purpur-paragraph--paragraph-100-medium_15yuz_22",
|
|
304
|
+
"purpur-paragraph--paragraph-100-bold": "_purpur-paragraph--paragraph-100-bold_15yuz_29",
|
|
305
|
+
"purpur-paragraph--paragraph-200": "_purpur-paragraph--paragraph-200_15yuz_36",
|
|
306
|
+
"purpur-paragraph--preamble-100": "_purpur-paragraph--preamble-100_15yuz_42",
|
|
307
|
+
"purpur-paragraph--preamble-200": "_purpur-paragraph--preamble-200_15yuz_48",
|
|
308
|
+
"purpur-paragraph--additional-100": "_purpur-paragraph--additional-100_15yuz_54",
|
|
309
|
+
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_15yuz_60",
|
|
310
|
+
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_15yuz_67",
|
|
311
|
+
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_15yuz_75"
|
|
311
312
|
}, Te = {
|
|
312
313
|
PARAGRAPH100: "paragraph-100",
|
|
313
314
|
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
@@ -319,39 +320,41 @@ const Be = /* @__PURE__ */ Le(Xe), H = {
|
|
|
319
320
|
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
320
321
|
OVERLINE100: "overline-100",
|
|
321
322
|
OVERLINE200: "overline-200"
|
|
322
|
-
},
|
|
323
|
+
}, j = "purpur-paragraph", Ie = ({
|
|
323
324
|
["data-testid"]: e,
|
|
324
325
|
children: n,
|
|
325
|
-
className:
|
|
326
|
+
className: r = "",
|
|
326
327
|
disabled: o,
|
|
327
328
|
enableHyphenation: c = !1,
|
|
328
|
-
|
|
329
|
-
|
|
329
|
+
negative: t = !1,
|
|
330
|
+
variant: a = Te.PARAGRAPH100,
|
|
331
|
+
...u
|
|
330
332
|
}) => {
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
const i = Be([
|
|
334
|
+
r,
|
|
335
|
+
E[j],
|
|
336
|
+
E[`${j}--${a}`],
|
|
335
337
|
{
|
|
336
|
-
[
|
|
337
|
-
[
|
|
338
|
+
[E[`${j}--hyphens`]]: c,
|
|
339
|
+
[E[`${j}--disabled`]]: o,
|
|
340
|
+
[E[`${j}--negative`]]: t
|
|
338
341
|
}
|
|
339
342
|
]);
|
|
340
|
-
return /* @__PURE__ */ x("p", { ...
|
|
343
|
+
return /* @__PURE__ */ x("p", { ...u, className: i, "data-testid": e, children: n });
|
|
341
344
|
};
|
|
342
|
-
function
|
|
343
|
-
return
|
|
345
|
+
function z() {
|
|
346
|
+
return z = Object.assign ? Object.assign.bind() : function(e) {
|
|
344
347
|
for (var n = 1; n < arguments.length; n++) {
|
|
345
|
-
var
|
|
346
|
-
for (var o in
|
|
347
|
-
Object.prototype.hasOwnProperty.call(
|
|
348
|
+
var r = arguments[n];
|
|
349
|
+
for (var o in r)
|
|
350
|
+
Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
|
|
348
351
|
}
|
|
349
352
|
return e;
|
|
350
|
-
},
|
|
353
|
+
}, z.apply(this, arguments);
|
|
351
354
|
}
|
|
352
|
-
function qe(e, n, { checkForDefaultPrevented:
|
|
355
|
+
function qe(e, n, { checkForDefaultPrevented: r = !0 } = {}) {
|
|
353
356
|
return function(c) {
|
|
354
|
-
if (e == null || e(c),
|
|
357
|
+
if (e == null || e(c), r === !1 || !c.defaultPrevented)
|
|
355
358
|
return n == null ? void 0 : n(c);
|
|
356
359
|
};
|
|
357
360
|
}
|
|
@@ -360,22 +363,22 @@ function Fe(e, n) {
|
|
|
360
363
|
}
|
|
361
364
|
function ce(...e) {
|
|
362
365
|
return (n) => e.forEach(
|
|
363
|
-
(
|
|
366
|
+
(r) => Fe(r, n)
|
|
364
367
|
);
|
|
365
368
|
}
|
|
366
369
|
function Ve(...e) {
|
|
367
370
|
return X(ce(...e), e);
|
|
368
371
|
}
|
|
369
372
|
function Ue(e, n = []) {
|
|
370
|
-
let
|
|
371
|
-
function o(
|
|
372
|
-
const u = /* @__PURE__ */ Z(a), i =
|
|
373
|
-
|
|
374
|
-
...
|
|
373
|
+
let r = [];
|
|
374
|
+
function o(t, a) {
|
|
375
|
+
const u = /* @__PURE__ */ Z(a), i = r.length;
|
|
376
|
+
r = [
|
|
377
|
+
...r,
|
|
375
378
|
a
|
|
376
379
|
];
|
|
377
380
|
function s(l) {
|
|
378
|
-
const { scope: p, children: v, ...f } = l, g = (p == null ? void 0 : p[e][i]) || u, d =
|
|
381
|
+
const { scope: p, children: v, ...f } = l, g = (p == null ? void 0 : p[e][i]) || u, d = R(
|
|
379
382
|
() => f,
|
|
380
383
|
Object.values(f)
|
|
381
384
|
);
|
|
@@ -389,18 +392,18 @@ function Ue(e, n = []) {
|
|
|
389
392
|
return f;
|
|
390
393
|
if (a !== void 0)
|
|
391
394
|
return a;
|
|
392
|
-
throw new Error(`\`${l}\` must be used within \`${
|
|
395
|
+
throw new Error(`\`${l}\` must be used within \`${t}\``);
|
|
393
396
|
}
|
|
394
|
-
return s.displayName =
|
|
397
|
+
return s.displayName = t + "Provider", [
|
|
395
398
|
s,
|
|
396
399
|
h
|
|
397
400
|
];
|
|
398
401
|
}
|
|
399
402
|
const c = () => {
|
|
400
|
-
const
|
|
403
|
+
const t = r.map((a) => /* @__PURE__ */ Z(a));
|
|
401
404
|
return function(u) {
|
|
402
|
-
const i = (u == null ? void 0 : u[e]) ||
|
|
403
|
-
return
|
|
405
|
+
const i = (u == null ? void 0 : u[e]) || t;
|
|
406
|
+
return R(
|
|
404
407
|
() => ({
|
|
405
408
|
[`__scope${e}`]: {
|
|
406
409
|
...u,
|
|
@@ -423,22 +426,22 @@ function We(...e) {
|
|
|
423
426
|
const n = e[0];
|
|
424
427
|
if (e.length === 1)
|
|
425
428
|
return n;
|
|
426
|
-
const
|
|
429
|
+
const r = () => {
|
|
427
430
|
const o = e.map(
|
|
428
431
|
(c) => ({
|
|
429
432
|
useScope: c(),
|
|
430
433
|
scopeName: c.scopeName
|
|
431
434
|
})
|
|
432
435
|
);
|
|
433
|
-
return function(
|
|
436
|
+
return function(t) {
|
|
434
437
|
const a = o.reduce((u, { useScope: i, scopeName: s }) => {
|
|
435
|
-
const l = i(
|
|
438
|
+
const l = i(t)[`__scope${s}`];
|
|
436
439
|
return {
|
|
437
440
|
...u,
|
|
438
441
|
...l
|
|
439
442
|
};
|
|
440
443
|
}, {});
|
|
441
|
-
return
|
|
444
|
+
return R(
|
|
442
445
|
() => ({
|
|
443
446
|
[`__scope${n.scopeName}`]: a
|
|
444
447
|
}),
|
|
@@ -448,33 +451,33 @@ function We(...e) {
|
|
|
448
451
|
);
|
|
449
452
|
};
|
|
450
453
|
};
|
|
451
|
-
return
|
|
454
|
+
return r.scopeName = n.scopeName, r;
|
|
452
455
|
}
|
|
453
456
|
function ue(e) {
|
|
454
457
|
const n = D(e);
|
|
455
458
|
return A(() => {
|
|
456
459
|
n.current = e;
|
|
457
|
-
}),
|
|
458
|
-
() => (...
|
|
460
|
+
}), R(
|
|
461
|
+
() => (...r) => {
|
|
459
462
|
var o;
|
|
460
|
-
return (o = n.current) === null || o === void 0 ? void 0 : o.call(n, ...
|
|
463
|
+
return (o = n.current) === null || o === void 0 ? void 0 : o.call(n, ...r);
|
|
461
464
|
},
|
|
462
465
|
[]
|
|
463
466
|
);
|
|
464
467
|
}
|
|
465
|
-
function Ge({ prop: e, defaultProp: n, onChange:
|
|
468
|
+
function Ge({ prop: e, defaultProp: n, onChange: r = () => {
|
|
466
469
|
} }) {
|
|
467
470
|
const [o, c] = Ze({
|
|
468
471
|
defaultProp: n,
|
|
469
|
-
onChange:
|
|
470
|
-
}),
|
|
471
|
-
if (
|
|
472
|
+
onChange: r
|
|
473
|
+
}), t = e !== void 0, a = t ? e : o, u = ue(r), i = X((s) => {
|
|
474
|
+
if (t) {
|
|
472
475
|
const l = typeof s == "function" ? s(e) : s;
|
|
473
476
|
l !== e && u(l);
|
|
474
477
|
} else
|
|
475
478
|
c(s);
|
|
476
479
|
}, [
|
|
477
|
-
|
|
480
|
+
t,
|
|
478
481
|
e,
|
|
479
482
|
c,
|
|
480
483
|
u
|
|
@@ -485,45 +488,45 @@ function Ge({ prop: e, defaultProp: n, onChange: t = () => {
|
|
|
485
488
|
];
|
|
486
489
|
}
|
|
487
490
|
function Ze({ defaultProp: e, onChange: n }) {
|
|
488
|
-
const
|
|
491
|
+
const r = $(e), [o] = r, c = D(o), t = ue(n);
|
|
489
492
|
return A(() => {
|
|
490
|
-
c.current !== o && (
|
|
493
|
+
c.current !== o && (t(o), c.current = o);
|
|
491
494
|
}, [
|
|
492
495
|
o,
|
|
493
496
|
c,
|
|
494
|
-
|
|
495
|
-
]),
|
|
497
|
+
t
|
|
498
|
+
]), r;
|
|
496
499
|
}
|
|
497
500
|
function Je(e) {
|
|
498
501
|
const n = D({
|
|
499
502
|
value: e,
|
|
500
503
|
previous: e
|
|
501
504
|
});
|
|
502
|
-
return
|
|
505
|
+
return R(() => (n.current.value !== e && (n.current.previous = n.current.value, n.current.value = e), n.current.previous), [
|
|
503
506
|
e
|
|
504
507
|
]);
|
|
505
508
|
}
|
|
506
|
-
const Ke = globalThis != null && globalThis.document ?
|
|
509
|
+
const Ke = globalThis != null && globalThis.document ? te : () => {
|
|
507
510
|
};
|
|
508
511
|
function Qe(e) {
|
|
509
|
-
const [n,
|
|
512
|
+
const [n, r] = $(void 0);
|
|
510
513
|
return Ke(() => {
|
|
511
514
|
if (e) {
|
|
512
|
-
|
|
515
|
+
r({
|
|
513
516
|
width: e.offsetWidth,
|
|
514
517
|
height: e.offsetHeight
|
|
515
518
|
});
|
|
516
519
|
const o = new ResizeObserver((c) => {
|
|
517
520
|
if (!Array.isArray(c) || !c.length)
|
|
518
521
|
return;
|
|
519
|
-
const
|
|
522
|
+
const t = c[0];
|
|
520
523
|
let a, u;
|
|
521
|
-
if ("borderBoxSize" in
|
|
522
|
-
const i =
|
|
524
|
+
if ("borderBoxSize" in t) {
|
|
525
|
+
const i = t.borderBoxSize, s = Array.isArray(i) ? i[0] : i;
|
|
523
526
|
a = s.inlineSize, u = s.blockSize;
|
|
524
527
|
} else
|
|
525
528
|
a = e.offsetWidth, u = e.offsetHeight;
|
|
526
|
-
|
|
529
|
+
r({
|
|
527
530
|
width: a,
|
|
528
531
|
height: u
|
|
529
532
|
});
|
|
@@ -532,68 +535,68 @@ function Qe(e) {
|
|
|
532
535
|
box: "border-box"
|
|
533
536
|
}), () => o.unobserve(e);
|
|
534
537
|
} else
|
|
535
|
-
|
|
538
|
+
r(void 0);
|
|
536
539
|
}, [
|
|
537
540
|
e
|
|
538
541
|
]), n;
|
|
539
542
|
}
|
|
540
|
-
function
|
|
541
|
-
return
|
|
543
|
+
function H() {
|
|
544
|
+
return H = Object.assign ? Object.assign.bind() : function(e) {
|
|
542
545
|
for (var n = 1; n < arguments.length; n++) {
|
|
543
|
-
var
|
|
544
|
-
for (var o in
|
|
545
|
-
Object.prototype.hasOwnProperty.call(
|
|
546
|
+
var r = arguments[n];
|
|
547
|
+
for (var o in r)
|
|
548
|
+
Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
|
|
546
549
|
}
|
|
547
550
|
return e;
|
|
548
|
-
},
|
|
551
|
+
}, H.apply(this, arguments);
|
|
549
552
|
}
|
|
550
553
|
const ie = /* @__PURE__ */ w((e, n) => {
|
|
551
|
-
const { children:
|
|
552
|
-
if (
|
|
553
|
-
const a =
|
|
554
|
-
return /* @__PURE__ */ _(V,
|
|
554
|
+
const { children: r, ...o } = e, c = y.toArray(r), t = c.find(et);
|
|
555
|
+
if (t) {
|
|
556
|
+
const a = t.props.children, u = c.map((i) => i === t ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
|
|
557
|
+
return /* @__PURE__ */ _(V, H({}, o, {
|
|
555
558
|
ref: n
|
|
556
|
-
}), /* @__PURE__ */ k(a) ? /* @__PURE__ */
|
|
559
|
+
}), /* @__PURE__ */ k(a) ? /* @__PURE__ */ L(a, void 0, u) : null);
|
|
557
560
|
}
|
|
558
|
-
return /* @__PURE__ */ _(V,
|
|
561
|
+
return /* @__PURE__ */ _(V, H({}, o, {
|
|
559
562
|
ref: n
|
|
560
|
-
}),
|
|
563
|
+
}), r);
|
|
561
564
|
});
|
|
562
565
|
ie.displayName = "Slot";
|
|
563
566
|
const V = /* @__PURE__ */ w((e, n) => {
|
|
564
|
-
const { children:
|
|
565
|
-
return /* @__PURE__ */ k(
|
|
566
|
-
...
|
|
567
|
-
ref: n ? ce(n,
|
|
568
|
-
}) : y.count(
|
|
567
|
+
const { children: r, ...o } = e;
|
|
568
|
+
return /* @__PURE__ */ k(r) ? /* @__PURE__ */ L(r, {
|
|
569
|
+
...tt(o, r.props),
|
|
570
|
+
ref: n ? ce(n, r.ref) : r.ref
|
|
571
|
+
}) : y.count(r) > 1 ? y.only(null) : null;
|
|
569
572
|
});
|
|
570
573
|
V.displayName = "SlotClone";
|
|
571
574
|
const Ye = ({ children: e }) => /* @__PURE__ */ _(ee, null, e);
|
|
572
|
-
function
|
|
575
|
+
function et(e) {
|
|
573
576
|
return /* @__PURE__ */ k(e) && e.type === Ye;
|
|
574
577
|
}
|
|
575
|
-
function
|
|
576
|
-
const
|
|
578
|
+
function tt(e, n) {
|
|
579
|
+
const r = {
|
|
577
580
|
...n
|
|
578
581
|
};
|
|
579
582
|
for (const o in n) {
|
|
580
|
-
const c = e[o],
|
|
581
|
-
/^on[A-Z]/.test(o) ? c &&
|
|
582
|
-
|
|
583
|
-
} : c && (
|
|
583
|
+
const c = e[o], t = n[o];
|
|
584
|
+
/^on[A-Z]/.test(o) ? c && t ? r[o] = (...u) => {
|
|
585
|
+
t(...u), c(...u);
|
|
586
|
+
} : c && (r[o] = c) : o === "style" ? r[o] = {
|
|
584
587
|
...c,
|
|
585
|
-
...
|
|
586
|
-
} : o === "className" && (
|
|
588
|
+
...t
|
|
589
|
+
} : o === "className" && (r[o] = [
|
|
587
590
|
c,
|
|
588
|
-
|
|
591
|
+
t
|
|
589
592
|
].filter(Boolean).join(" "));
|
|
590
593
|
}
|
|
591
594
|
return {
|
|
592
595
|
...e,
|
|
593
|
-
...
|
|
596
|
+
...r
|
|
594
597
|
};
|
|
595
598
|
}
|
|
596
|
-
const
|
|
599
|
+
const rt = [
|
|
597
600
|
"a",
|
|
598
601
|
"button",
|
|
599
602
|
"div",
|
|
@@ -610,33 +613,33 @@ const tr = [
|
|
|
610
613
|
"span",
|
|
611
614
|
"svg",
|
|
612
615
|
"ul"
|
|
613
|
-
], se =
|
|
614
|
-
const
|
|
615
|
-
const { asChild:
|
|
616
|
+
], se = rt.reduce((e, n) => {
|
|
617
|
+
const r = /* @__PURE__ */ w((o, c) => {
|
|
618
|
+
const { asChild: t, ...a } = o, u = t ? ie : n;
|
|
616
619
|
return A(() => {
|
|
617
620
|
window[Symbol.for("radix-ui")] = !0;
|
|
618
|
-
}, []), /* @__PURE__ */ _(u,
|
|
621
|
+
}, []), /* @__PURE__ */ _(u, H({}, a, {
|
|
619
622
|
ref: c
|
|
620
623
|
}));
|
|
621
624
|
});
|
|
622
|
-
return
|
|
625
|
+
return r.displayName = `Primitive.${n}`, {
|
|
623
626
|
...e,
|
|
624
|
-
[n]:
|
|
627
|
+
[n]: r
|
|
625
628
|
};
|
|
626
|
-
}, {}), le = "Switch", [
|
|
627
|
-
const { __scopeSwitch:
|
|
629
|
+
}, {}), le = "Switch", [nt, yt] = Ue(le), [ot, at] = nt(le), ct = /* @__PURE__ */ w((e, n) => {
|
|
630
|
+
const { __scopeSwitch: r, name: o, checked: c, defaultChecked: t, required: a, disabled: u, value: i = "on", onCheckedChange: s, ...h } = e, [l, p] = $(null), v = Ve(
|
|
628
631
|
n,
|
|
629
632
|
(m) => p(m)
|
|
630
633
|
), f = D(!1), g = l ? !!l.closest("form") : !0, [d = !1, b] = Ge({
|
|
631
634
|
prop: c,
|
|
632
|
-
defaultProp:
|
|
635
|
+
defaultProp: t,
|
|
633
636
|
onChange: s
|
|
634
637
|
});
|
|
635
|
-
return /* @__PURE__ */ _(
|
|
636
|
-
scope:
|
|
638
|
+
return /* @__PURE__ */ _(ot, {
|
|
639
|
+
scope: r,
|
|
637
640
|
checked: d,
|
|
638
641
|
disabled: u
|
|
639
|
-
}, /* @__PURE__ */ _(se.button,
|
|
642
|
+
}, /* @__PURE__ */ _(se.button, z({
|
|
640
643
|
type: "button",
|
|
641
644
|
role: "switch",
|
|
642
645
|
"aria-checked": d,
|
|
@@ -652,7 +655,7 @@ const tr = [
|
|
|
652
655
|
(O) => !O
|
|
653
656
|
), g && (f.current = m.isPropagationStopped(), f.current || m.stopPropagation());
|
|
654
657
|
})
|
|
655
|
-
})), g && /* @__PURE__ */ _(
|
|
658
|
+
})), g && /* @__PURE__ */ _(st, {
|
|
656
659
|
control: l,
|
|
657
660
|
bubbles: !f.current,
|
|
658
661
|
name: o,
|
|
@@ -664,35 +667,35 @@ const tr = [
|
|
|
664
667
|
transform: "translateX(-100%)"
|
|
665
668
|
}
|
|
666
669
|
}));
|
|
667
|
-
}),
|
|
668
|
-
const { __scopeSwitch:
|
|
669
|
-
return /* @__PURE__ */ _(se.span,
|
|
670
|
+
}), ut = "SwitchThumb", it = /* @__PURE__ */ w((e, n) => {
|
|
671
|
+
const { __scopeSwitch: r, ...o } = e, c = at(ut, r);
|
|
672
|
+
return /* @__PURE__ */ _(se.span, z({
|
|
670
673
|
"data-state": pe(c.checked),
|
|
671
674
|
"data-disabled": c.disabled ? "" : void 0
|
|
672
675
|
}, o, {
|
|
673
676
|
ref: n
|
|
674
677
|
}));
|
|
675
|
-
}),
|
|
676
|
-
const { control: n, checked:
|
|
678
|
+
}), st = (e) => {
|
|
679
|
+
const { control: n, checked: r, bubbles: o = !0, ...c } = e, t = D(null), a = Je(r), u = Qe(n);
|
|
677
680
|
return A(() => {
|
|
678
|
-
const i =
|
|
679
|
-
if (a !==
|
|
681
|
+
const i = t.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
|
|
682
|
+
if (a !== r && l) {
|
|
680
683
|
const p = new Event("click", {
|
|
681
684
|
bubbles: o
|
|
682
685
|
});
|
|
683
|
-
l.call(i,
|
|
686
|
+
l.call(i, r), i.dispatchEvent(p);
|
|
684
687
|
}
|
|
685
688
|
}, [
|
|
686
689
|
a,
|
|
687
|
-
|
|
690
|
+
r,
|
|
688
691
|
o
|
|
689
|
-
]), /* @__PURE__ */ _("input",
|
|
692
|
+
]), /* @__PURE__ */ _("input", z({
|
|
690
693
|
type: "checkbox",
|
|
691
694
|
"aria-hidden": !0,
|
|
692
|
-
defaultChecked:
|
|
695
|
+
defaultChecked: r
|
|
693
696
|
}, c, {
|
|
694
697
|
tabIndex: -1,
|
|
695
|
-
ref:
|
|
698
|
+
ref: t,
|
|
696
699
|
style: {
|
|
697
700
|
...e.style,
|
|
698
701
|
...u,
|
|
@@ -706,8 +709,8 @@ const tr = [
|
|
|
706
709
|
function pe(e) {
|
|
707
710
|
return e ? "checked" : "unchecked";
|
|
708
711
|
}
|
|
709
|
-
const
|
|
710
|
-
function
|
|
712
|
+
const lt = ct, pt = it;
|
|
713
|
+
function dt(e) {
|
|
711
714
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
712
715
|
}
|
|
713
716
|
var de = { exports: {} };
|
|
@@ -719,35 +722,35 @@ var de = { exports: {} };
|
|
|
719
722
|
(function(e) {
|
|
720
723
|
(function() {
|
|
721
724
|
var n = {}.hasOwnProperty;
|
|
722
|
-
function
|
|
723
|
-
for (var
|
|
725
|
+
function r() {
|
|
726
|
+
for (var t = "", a = 0; a < arguments.length; a++) {
|
|
724
727
|
var u = arguments[a];
|
|
725
|
-
u && (
|
|
728
|
+
u && (t = c(t, o(u)));
|
|
726
729
|
}
|
|
727
|
-
return
|
|
730
|
+
return t;
|
|
728
731
|
}
|
|
729
|
-
function o(
|
|
730
|
-
if (typeof
|
|
731
|
-
return
|
|
732
|
-
if (typeof
|
|
732
|
+
function o(t) {
|
|
733
|
+
if (typeof t == "string" || typeof t == "number")
|
|
734
|
+
return t;
|
|
735
|
+
if (typeof t != "object")
|
|
733
736
|
return "";
|
|
734
|
-
if (Array.isArray(
|
|
735
|
-
return
|
|
736
|
-
if (
|
|
737
|
-
return
|
|
737
|
+
if (Array.isArray(t))
|
|
738
|
+
return r.apply(null, t);
|
|
739
|
+
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
740
|
+
return t.toString();
|
|
738
741
|
var a = "";
|
|
739
|
-
for (var u in
|
|
740
|
-
n.call(
|
|
742
|
+
for (var u in t)
|
|
743
|
+
n.call(t, u) && t[u] && (a = c(a, u));
|
|
741
744
|
return a;
|
|
742
745
|
}
|
|
743
|
-
function c(
|
|
744
|
-
return a ?
|
|
746
|
+
function c(t, a) {
|
|
747
|
+
return a ? t ? t + " " + a : t + a : t;
|
|
745
748
|
}
|
|
746
|
-
e.exports ? (
|
|
749
|
+
e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
|
|
747
750
|
})();
|
|
748
751
|
})(de);
|
|
749
|
-
var
|
|
750
|
-
const I = /* @__PURE__ */
|
|
752
|
+
var ft = de.exports;
|
|
753
|
+
const I = /* @__PURE__ */ dt(ft), S = {
|
|
751
754
|
"purpur-toggle": "_purpur-toggle_1xng6_1",
|
|
752
755
|
"purpur-toggle__track": "_purpur-toggle__track_1xng6_7",
|
|
753
756
|
"purpur-toggle__checkmark-container": "_purpur-toggle__checkmark-container_1xng6_45",
|
|
@@ -757,13 +760,13 @@ const I = /* @__PURE__ */ dr(fr), S = {
|
|
|
757
760
|
"purpur-toggle__label--right": "_purpur-toggle__label--right_1xng6_100",
|
|
758
761
|
"purpur-toggle__label--left": "_purpur-toggle__label--left_1xng6_103",
|
|
759
762
|
"purpur-toggle__container": "_purpur-toggle__container_1xng6_106"
|
|
760
|
-
}, Y = (e) => e && "touches" in e,
|
|
763
|
+
}, Y = (e) => e && "touches" in e, gt = ({
|
|
761
764
|
children: e,
|
|
762
765
|
disabled: n,
|
|
763
|
-
onStart:
|
|
766
|
+
onStart: r,
|
|
764
767
|
onDrag: o,
|
|
765
768
|
onStop: c,
|
|
766
|
-
bounds:
|
|
769
|
+
bounds: t,
|
|
767
770
|
position: a,
|
|
768
771
|
style: u
|
|
769
772
|
}) => {
|
|
@@ -771,7 +774,7 @@ const I = /* @__PURE__ */ dr(fr), S = {
|
|
|
771
774
|
if (!n) {
|
|
772
775
|
b.preventDefault();
|
|
773
776
|
const m = Y(b.nativeEvent) ? b.nativeEvent.touches[0].clientX : b.nativeEvent.clientX;
|
|
774
|
-
l(m),
|
|
777
|
+
l(m), r == null || r();
|
|
775
778
|
}
|
|
776
779
|
}, g = X(
|
|
777
780
|
(b) => {
|
|
@@ -782,7 +785,7 @@ const I = /* @__PURE__ */ dr(fr), S = {
|
|
|
782
785
|
return;
|
|
783
786
|
const C = a + O;
|
|
784
787
|
!p && Math.abs(C) && v(!0);
|
|
785
|
-
const B = C >
|
|
788
|
+
const B = C > t.right ? t.right : C < t.left ? t.left : C;
|
|
786
789
|
s(B), o == null || o({ x: B });
|
|
787
790
|
},
|
|
788
791
|
[o, s, p, h]
|
|
@@ -793,49 +796,49 @@ const I = /* @__PURE__ */ dr(fr), S = {
|
|
|
793
796
|
window.removeEventListener("mousemove", g), window.removeEventListener("touchmove", g);
|
|
794
797
|
}), [g]), A(() => (window.addEventListener("mouseup", d), window.addEventListener("touchend", d), () => {
|
|
795
798
|
window.removeEventListener("mouseup", d), window.removeEventListener("touchend", d);
|
|
796
|
-
}), [d]), k(e) ?
|
|
799
|
+
}), [d]), k(e) ? L(y.only(e), {
|
|
797
800
|
onMouseDown: f,
|
|
798
801
|
onTouchStart: f,
|
|
799
802
|
style: { ...u, transform: `translateX(${p ? i : a}px)` }
|
|
800
803
|
}) : null;
|
|
801
|
-
},
|
|
804
|
+
}, ht = ({ checked: e, onChange: n }) => {
|
|
802
805
|
var U, W;
|
|
803
|
-
const
|
|
804
|
-
|
|
806
|
+
const r = D(null), o = D(null), [c, t] = $(void 0), [a, u] = $(!1), [i, s] = $(0), [h, l] = $(0), [p, v] = $(0);
|
|
807
|
+
te(() => {
|
|
805
808
|
var N, T;
|
|
806
|
-
l(((N = o.current) == null ? void 0 : N.clientHeight) || 0), v(((T =
|
|
807
|
-
}, [(U = o.current) == null ? void 0 : U.clientHeight, (W =
|
|
809
|
+
l(((N = o.current) == null ? void 0 : N.clientHeight) || 0), v(((T = r.current) == null ? void 0 : T.clientHeight) || 0);
|
|
810
|
+
}, [(U = o.current) == null ? void 0 : U.clientHeight, (W = r.current) == null ? void 0 : W.clientHeight]);
|
|
808
811
|
const f = (p || 0) - h, g = h + f, d = f / 2, b = g / 2, m = typeof c == "number" && (e ? c < b : c > b);
|
|
809
812
|
return {
|
|
810
|
-
trackRef:
|
|
813
|
+
trackRef: r,
|
|
811
814
|
thumbRef: o,
|
|
812
815
|
isDragging: a,
|
|
813
816
|
bounds: { left: d, right: g },
|
|
814
817
|
position: e ? g : d,
|
|
815
818
|
onDrag: ({ x: N }) => {
|
|
816
|
-
|
|
819
|
+
t(N), Math.abs((e ? g : d) - N) > 2 && u(!0);
|
|
817
820
|
},
|
|
818
821
|
onStop: () => {
|
|
819
822
|
u(!1), a && s(Date.now()), m && (n == null || n(!e));
|
|
820
823
|
},
|
|
821
824
|
onChangeWithDrag: () => {
|
|
822
|
-
Date.now() - i > 50 && (n == null || n(!e)),
|
|
825
|
+
Date.now() - i > 50 && (n == null || n(!e)), t(void 0);
|
|
823
826
|
}
|
|
824
827
|
};
|
|
825
|
-
}, P = "purpur-toggle",
|
|
828
|
+
}, P = "purpur-toggle", bt = ({
|
|
826
829
|
["data-testid"]: e,
|
|
827
830
|
className: n,
|
|
828
|
-
label:
|
|
831
|
+
label: r,
|
|
829
832
|
onChange: o,
|
|
830
833
|
labelPosition: c = "right",
|
|
831
|
-
checked:
|
|
834
|
+
checked: t,
|
|
832
835
|
disableDrag: a,
|
|
833
836
|
defaultChecked: u,
|
|
834
837
|
...i
|
|
835
838
|
}, s) => {
|
|
836
839
|
const [h, l] = $(
|
|
837
|
-
typeof
|
|
838
|
-
), p = !!(typeof
|
|
840
|
+
typeof t == "boolean" ? t : !!u
|
|
841
|
+
), p = !!(typeof t == "boolean" ? t : h), { thumbRef: v, trackRef: f, isDragging: g, onChangeWithDrag: d, ...b } = ht({
|
|
839
842
|
checked: p,
|
|
840
843
|
onChange: (O) => {
|
|
841
844
|
i.disabled || (o == null || o(O), l(O));
|
|
@@ -850,13 +853,13 @@ const I = /* @__PURE__ */ dr(fr), S = {
|
|
|
850
853
|
S[`${P}__label`],
|
|
851
854
|
S[`${P}__label--${c}`]
|
|
852
855
|
),
|
|
853
|
-
children: /* @__PURE__ */ x(Ie, { variant: "paragraph-100", disabled: i.disabled, children:
|
|
856
|
+
children: /* @__PURE__ */ x(Ie, { variant: "paragraph-100", disabled: i.disabled, children: r })
|
|
854
857
|
}
|
|
855
858
|
);
|
|
856
859
|
return /* @__PURE__ */ G("div", { className: I([n, S[`${P}__container`]]), children: [
|
|
857
|
-
|
|
860
|
+
r && c === "left" && m(),
|
|
858
861
|
/* @__PURE__ */ x(
|
|
859
|
-
|
|
862
|
+
lt,
|
|
860
863
|
{
|
|
861
864
|
...i,
|
|
862
865
|
ref: s,
|
|
@@ -874,8 +877,8 @@ const I = /* @__PURE__ */ dr(fr), S = {
|
|
|
874
877
|
size: "xxs"
|
|
875
878
|
}
|
|
876
879
|
) }),
|
|
877
|
-
/* @__PURE__ */ x(
|
|
878
|
-
|
|
880
|
+
/* @__PURE__ */ x(gt, { disabled: a, ...b, children: /* @__PURE__ */ x(
|
|
881
|
+
pt,
|
|
879
882
|
{
|
|
880
883
|
ref: v,
|
|
881
884
|
"data-testid": e && `${e}-thumb`,
|
|
@@ -890,11 +893,11 @@ const I = /* @__PURE__ */ dr(fr), S = {
|
|
|
890
893
|
] })
|
|
891
894
|
}
|
|
892
895
|
),
|
|
893
|
-
|
|
896
|
+
r && c === "right" && m()
|
|
894
897
|
] });
|
|
895
|
-
},
|
|
896
|
-
|
|
898
|
+
}, _t = w(bt);
|
|
899
|
+
_t.displayName = "Toggle";
|
|
897
900
|
export {
|
|
898
|
-
|
|
901
|
+
_t as Toggle
|
|
899
902
|
};
|
|
900
903
|
//# sourceMappingURL=toggle.es.js.map
|