@purpurds/toggle 8.2.2 → 8.2.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/DraggableX.d.ts.map +1 -1
- package/dist/LICENSE.txt +14 -14
- package/dist/hooks/useToggleDrag.d.ts.map +1 -1
- package/dist/toggle.cjs.js +5 -5
- package/dist/toggle.cjs.js.map +1 -1
- package/dist/toggle.es.js +319 -305
- package/dist/toggle.es.js.map +1 -1
- package/package.json +6 -6
package/dist/toggle.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as g, jsxs as D } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import { useState as $, useCallback as O, useEffect as k, cloneElement as
|
|
3
|
+
import { useState as $, useCallback as O, useEffect as k, cloneElement as ie, isValidElement as ue, useRef as P, forwardRef as ae } from "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
function
|
|
5
|
+
function se(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var
|
|
8
|
+
var M = { exports: {} };
|
|
9
9
|
/*!
|
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
|
11
11
|
Licensed under the MIT License (MIT), see
|
|
12
12
|
http://jedwatson.github.io/classnames
|
|
13
13
|
*/
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
return
|
|
14
|
+
var j;
|
|
15
|
+
function ce() {
|
|
16
|
+
return j || (j = 1, (function(e) {
|
|
17
17
|
(function() {
|
|
18
18
|
var n = {}.hasOwnProperty;
|
|
19
19
|
function t() {
|
|
20
|
-
for (var r = "",
|
|
21
|
-
var
|
|
22
|
-
|
|
20
|
+
for (var r = "", u = 0; u < arguments.length; u++) {
|
|
21
|
+
var a = arguments[u];
|
|
22
|
+
a && (r = o(r, i.call(this, a)));
|
|
23
23
|
}
|
|
24
24
|
return r;
|
|
25
25
|
}
|
|
@@ -32,20 +32,20 @@ function he() {
|
|
|
32
32
|
return t.apply(this, r);
|
|
33
33
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
34
34
|
return r.toString();
|
|
35
|
-
var
|
|
36
|
-
for (var
|
|
37
|
-
n.call(r,
|
|
38
|
-
return
|
|
35
|
+
var u = "";
|
|
36
|
+
for (var a in r)
|
|
37
|
+
n.call(r, a) && r[a] && (u = o(u, this && this[a] || a));
|
|
38
|
+
return u;
|
|
39
39
|
}
|
|
40
|
-
function o(r,
|
|
41
|
-
return
|
|
40
|
+
function o(r, u) {
|
|
41
|
+
return u ? r ? r + " " + u : r + u : r;
|
|
42
42
|
}
|
|
43
43
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
44
44
|
})();
|
|
45
|
-
}(
|
|
45
|
+
})(M)), M.exports;
|
|
46
46
|
}
|
|
47
|
-
var
|
|
48
|
-
const
|
|
47
|
+
var le = ce();
|
|
48
|
+
const pe = /* @__PURE__ */ se(le), de = {
|
|
49
49
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
50
50
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
51
51
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -53,87 +53,94 @@ const me = /* @__PURE__ */ fe(ge), ve = {
|
|
|
53
53
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
54
54
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
55
55
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
56
|
-
},
|
|
56
|
+
}, fe = pe.bind(de), q = "purpur-icon", he = "md", ge = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), _e = ({ content: e = "", title: n } = {}) => {
|
|
57
57
|
const t = [
|
|
58
58
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
59
59
|
{ name: "fill", value: "currentColor" },
|
|
60
60
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
61
61
|
n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
62
62
|
], i = n ? `<title>${n}</title>` : "";
|
|
63
|
-
return `<svg ${
|
|
64
|
-
},
|
|
65
|
-
const r =
|
|
66
|
-
content:
|
|
63
|
+
return `<svg ${ge(t)}>${i}${e}</svg>`;
|
|
64
|
+
}, me = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), G = ({ svg: e, allyTitle: n, className: t, size: i = he, ...o }) => {
|
|
65
|
+
const r = _e({
|
|
66
|
+
content: me(e.svg),
|
|
67
67
|
title: n
|
|
68
|
-
}),
|
|
69
|
-
return /* @__PURE__ */
|
|
68
|
+
}), u = fe(t, q, `${q}--${i}`);
|
|
69
|
+
return /* @__PURE__ */ g("span", { className: u, dangerouslySetInnerHTML: { __html: r }, ...o });
|
|
70
70
|
};
|
|
71
|
-
|
|
72
|
-
const
|
|
71
|
+
G.displayName = "Icon";
|
|
72
|
+
const ve = {
|
|
73
73
|
name: "checkmark-bold",
|
|
74
74
|
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>',
|
|
75
75
|
keywords: ["checkmark-bold"],
|
|
76
76
|
category: "utility"
|
|
77
77
|
};
|
|
78
|
-
function
|
|
78
|
+
function B(e, n) {
|
|
79
79
|
if (typeof e == "function")
|
|
80
80
|
return e(n);
|
|
81
81
|
e != null && (e.current = n);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function be(...e) {
|
|
84
84
|
return (n) => {
|
|
85
85
|
let t = !1;
|
|
86
86
|
const i = e.map((o) => {
|
|
87
|
-
const r =
|
|
87
|
+
const r = B(o, n);
|
|
88
88
|
return !t && typeof r == "function" && (t = !0), r;
|
|
89
89
|
});
|
|
90
90
|
if (t)
|
|
91
91
|
return () => {
|
|
92
92
|
for (let o = 0; o < i.length; o++) {
|
|
93
93
|
const r = i[o];
|
|
94
|
-
typeof r == "function" ? r() :
|
|
94
|
+
typeof r == "function" ? r() : B(e[o], null);
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
99
|
+
// @__NO_SIDE_EFFECTS__
|
|
100
|
+
function ye(e) {
|
|
101
|
+
const n = /* @__PURE__ */ we(e), t = s.forwardRef((i, o) => {
|
|
102
|
+
const { children: r, ...u } = i, a = s.Children.toArray(r), c = a.find(xe);
|
|
103
|
+
if (c) {
|
|
104
|
+
const l = c.props.children, f = a.map((p) => p === c ? s.Children.count(l) > 1 ? s.Children.only(null) : s.isValidElement(l) ? l.props.children : null : p);
|
|
105
|
+
return /* @__PURE__ */ g(n, { ...u, ref: o, children: s.isValidElement(l) ? s.cloneElement(l, void 0, f) : null });
|
|
106
|
+
}
|
|
107
|
+
return /* @__PURE__ */ g(n, { ...u, ref: o, children: r });
|
|
108
|
+
});
|
|
109
|
+
return t.displayName = `${e}.Slot`, t;
|
|
110
|
+
}
|
|
111
|
+
// @__NO_SIDE_EFFECTS__
|
|
112
|
+
function we(e) {
|
|
113
|
+
const n = s.forwardRef((t, i) => {
|
|
114
|
+
const { children: o, ...r } = t;
|
|
115
|
+
if (s.isValidElement(o)) {
|
|
116
|
+
const u = Ce(o), a = $e(r, o.props);
|
|
117
|
+
return o.type !== s.Fragment && (a.ref = i ? be(i, u) : u), s.cloneElement(o, a);
|
|
118
|
+
}
|
|
119
|
+
return s.Children.count(o) > 1 ? s.Children.only(null) : null;
|
|
120
|
+
});
|
|
121
|
+
return n.displayName = `${e}.SlotClone`, n;
|
|
122
|
+
}
|
|
123
|
+
var Se = Symbol("radix.slottable");
|
|
124
|
+
function xe(e) {
|
|
125
|
+
return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Se;
|
|
126
|
+
}
|
|
127
|
+
function $e(e, n) {
|
|
122
128
|
const t = { ...n };
|
|
123
129
|
for (const i in n) {
|
|
124
130
|
const o = e[i], r = n[i];
|
|
125
|
-
/^on[A-Z]/.test(i) ? o && r ? t[i] = (...
|
|
126
|
-
|
|
131
|
+
/^on[A-Z]/.test(i) ? o && r ? t[i] = (...u) => {
|
|
132
|
+
const a = r(...u);
|
|
133
|
+
return o(...u), a;
|
|
127
134
|
} : o && (t[i] = o) : i === "style" ? t[i] = { ...o, ...r } : i === "className" && (t[i] = [o, r].filter(Boolean).join(" "));
|
|
128
135
|
}
|
|
129
136
|
return { ...e, ...t };
|
|
130
137
|
}
|
|
131
|
-
function
|
|
138
|
+
function Ce(e) {
|
|
132
139
|
var n, t;
|
|
133
140
|
let i = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, o = i && "isReactWarning" in i && i.isReactWarning;
|
|
134
141
|
return o ? e.ref : (i = (t = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : t.get, o = i && "isReactWarning" in i && i.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
|
|
135
142
|
}
|
|
136
|
-
var
|
|
143
|
+
var Re = [
|
|
137
144
|
"a",
|
|
138
145
|
"button",
|
|
139
146
|
"div",
|
|
@@ -147,17 +154,18 @@ var Ee = [
|
|
|
147
154
|
"nav",
|
|
148
155
|
"ol",
|
|
149
156
|
"p",
|
|
157
|
+
"select",
|
|
150
158
|
"span",
|
|
151
159
|
"svg",
|
|
152
160
|
"ul"
|
|
153
|
-
],
|
|
154
|
-
const t = s.forwardRef((
|
|
155
|
-
const { asChild:
|
|
156
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */
|
|
161
|
+
], Pe = Re.reduce((e, n) => {
|
|
162
|
+
const t = /* @__PURE__ */ ye(`Primitive.${n}`), i = s.forwardRef((o, r) => {
|
|
163
|
+
const { asChild: u, ...a } = o, c = u ? t : n;
|
|
164
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ g(c, { ...a, ref: r });
|
|
157
165
|
});
|
|
158
|
-
return
|
|
159
|
-
}, {}),
|
|
160
|
-
|
|
166
|
+
return i.displayName = `Primitive.${n}`, { ...e, [n]: i };
|
|
167
|
+
}, {}), ke = "Label", J = s.forwardRef((e, n) => /* @__PURE__ */ g(
|
|
168
|
+
Pe.label,
|
|
161
169
|
{
|
|
162
170
|
...e,
|
|
163
171
|
ref: n,
|
|
@@ -167,26 +175,26 @@ var Ee = [
|
|
|
167
175
|
}
|
|
168
176
|
}
|
|
169
177
|
));
|
|
170
|
-
|
|
171
|
-
var
|
|
172
|
-
function
|
|
178
|
+
J.displayName = ke;
|
|
179
|
+
var Ee = J;
|
|
180
|
+
function Ne(e) {
|
|
173
181
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
174
182
|
}
|
|
175
|
-
var
|
|
183
|
+
var X = { exports: {} };
|
|
176
184
|
/*!
|
|
177
185
|
Copyright (c) 2018 Jed Watson.
|
|
178
186
|
Licensed under the MIT License (MIT), see
|
|
179
187
|
http://jedwatson.github.io/classnames
|
|
180
188
|
*/
|
|
181
|
-
var
|
|
182
|
-
function
|
|
183
|
-
return
|
|
189
|
+
var L;
|
|
190
|
+
function ze() {
|
|
191
|
+
return L || (L = 1, (function(e) {
|
|
184
192
|
(function() {
|
|
185
193
|
var n = {}.hasOwnProperty;
|
|
186
194
|
function t() {
|
|
187
|
-
for (var r = "",
|
|
188
|
-
var
|
|
189
|
-
|
|
195
|
+
for (var r = "", u = 0; u < arguments.length; u++) {
|
|
196
|
+
var a = arguments[u];
|
|
197
|
+
a && (r = o(r, i.call(this, a)));
|
|
190
198
|
}
|
|
191
199
|
return r;
|
|
192
200
|
}
|
|
@@ -199,54 +207,54 @@ function Ae() {
|
|
|
199
207
|
return t.apply(this, r);
|
|
200
208
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
201
209
|
return r.toString();
|
|
202
|
-
var
|
|
203
|
-
for (var
|
|
204
|
-
n.call(r,
|
|
205
|
-
return
|
|
210
|
+
var u = "";
|
|
211
|
+
for (var a in r)
|
|
212
|
+
n.call(r, a) && r[a] && (u = o(u, this && this[a] || a));
|
|
213
|
+
return u;
|
|
206
214
|
}
|
|
207
|
-
function o(r,
|
|
208
|
-
return
|
|
215
|
+
function o(r, u) {
|
|
216
|
+
return u ? r ? r + " " + u : r + u : r;
|
|
209
217
|
}
|
|
210
218
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
211
219
|
})();
|
|
212
|
-
}(
|
|
220
|
+
})(X)), X.exports;
|
|
213
221
|
}
|
|
214
|
-
var
|
|
215
|
-
const
|
|
222
|
+
var De = ze();
|
|
223
|
+
const Oe = /* @__PURE__ */ Ne(De), Ae = {
|
|
216
224
|
"purpur-label": "_purpur-label_1x80u_1",
|
|
217
225
|
"purpur-label--negative": "_purpur-label--negative_1x80u_8",
|
|
218
226
|
"purpur-label--disabled": "_purpur-label--disabled_1x80u_11"
|
|
219
|
-
},
|
|
227
|
+
}, Me = Oe.bind(Ae), N = "purpur-label", je = ({
|
|
220
228
|
children: e,
|
|
221
229
|
className: n,
|
|
222
230
|
disabled: t,
|
|
223
231
|
negative: i = !1,
|
|
224
232
|
...o
|
|
225
233
|
}) => {
|
|
226
|
-
const r =
|
|
234
|
+
const r = Me(n, N, {
|
|
227
235
|
[`${N}--disabled`]: t,
|
|
228
236
|
[`${N}--negative`]: i
|
|
229
237
|
});
|
|
230
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ g(Ee, { className: r, ...o, children: e });
|
|
231
239
|
};
|
|
232
|
-
function
|
|
240
|
+
function qe(e) {
|
|
233
241
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
234
242
|
}
|
|
235
|
-
var
|
|
243
|
+
var W = { exports: {} };
|
|
236
244
|
/*!
|
|
237
245
|
Copyright (c) 2018 Jed Watson.
|
|
238
246
|
Licensed under the MIT License (MIT), see
|
|
239
247
|
http://jedwatson.github.io/classnames
|
|
240
248
|
*/
|
|
241
|
-
var
|
|
242
|
-
function
|
|
243
|
-
return
|
|
249
|
+
var I;
|
|
250
|
+
function Be() {
|
|
251
|
+
return I || (I = 1, (function(e) {
|
|
244
252
|
(function() {
|
|
245
253
|
var n = {}.hasOwnProperty;
|
|
246
254
|
function t() {
|
|
247
|
-
for (var r = "",
|
|
248
|
-
var
|
|
249
|
-
|
|
255
|
+
for (var r = "", u = 0; u < arguments.length; u++) {
|
|
256
|
+
var a = arguments[u];
|
|
257
|
+
a && (r = o(r, i.call(this, a)));
|
|
250
258
|
}
|
|
251
259
|
return r;
|
|
252
260
|
}
|
|
@@ -259,20 +267,20 @@ function Le() {
|
|
|
259
267
|
return t.apply(this, r);
|
|
260
268
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
261
269
|
return r.toString();
|
|
262
|
-
var
|
|
263
|
-
for (var
|
|
264
|
-
n.call(r,
|
|
265
|
-
return
|
|
270
|
+
var u = "";
|
|
271
|
+
for (var a in r)
|
|
272
|
+
n.call(r, a) && r[a] && (u = o(u, this && this[a] || a));
|
|
273
|
+
return u;
|
|
266
274
|
}
|
|
267
|
-
function o(r,
|
|
268
|
-
return
|
|
275
|
+
function o(r, u) {
|
|
276
|
+
return u ? r ? r + " " + u : r + u : r;
|
|
269
277
|
}
|
|
270
278
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
271
279
|
})();
|
|
272
|
-
}(
|
|
280
|
+
})(W)), W.exports;
|
|
273
281
|
}
|
|
274
|
-
var
|
|
275
|
-
const
|
|
282
|
+
var Xe = Be();
|
|
283
|
+
const Le = /* @__PURE__ */ qe(Xe), We = {
|
|
276
284
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
|
277
285
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
|
278
286
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
|
@@ -287,88 +295,88 @@ const He = /* @__PURE__ */ We(Ve), Te = {
|
|
|
287
295
|
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_1rh57_60",
|
|
288
296
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
|
289
297
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
|
290
|
-
},
|
|
298
|
+
}, Ie = Le.bind(We), Te = {
|
|
291
299
|
PARAGRAPH100: "paragraph-100"
|
|
292
|
-
}, R = "purpur-paragraph",
|
|
300
|
+
}, R = "purpur-paragraph", K = ({
|
|
293
301
|
children: e,
|
|
294
302
|
className: n,
|
|
295
303
|
disabled: t,
|
|
296
304
|
enableHyphenation: i = !1,
|
|
297
305
|
negative: o = !1,
|
|
298
|
-
variant: r =
|
|
299
|
-
...
|
|
306
|
+
variant: r = Te.PARAGRAPH100,
|
|
307
|
+
...u
|
|
300
308
|
}) => {
|
|
301
|
-
const
|
|
309
|
+
const a = Ie(n, R, `${R}--${r}`, {
|
|
302
310
|
[`${R}--hyphens`]: i,
|
|
303
311
|
[`${R}--disabled`]: t,
|
|
304
312
|
[`${R}--negative`]: o
|
|
305
313
|
});
|
|
306
|
-
return /* @__PURE__ */
|
|
314
|
+
return /* @__PURE__ */ g("p", { ...u, className: a, children: e });
|
|
307
315
|
};
|
|
308
|
-
|
|
309
|
-
function
|
|
316
|
+
K.displayName = "Paragraph";
|
|
317
|
+
function Ve(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
|
|
310
318
|
return function(o) {
|
|
311
319
|
if (e == null || e(o), t === !1 || !o.defaultPrevented)
|
|
312
320
|
return n == null ? void 0 : n(o);
|
|
313
321
|
};
|
|
314
322
|
}
|
|
315
|
-
function
|
|
323
|
+
function T(e, n) {
|
|
316
324
|
if (typeof e == "function")
|
|
317
325
|
return e(n);
|
|
318
326
|
e != null && (e.current = n);
|
|
319
327
|
}
|
|
320
|
-
function
|
|
328
|
+
function Q(...e) {
|
|
321
329
|
return (n) => {
|
|
322
330
|
let t = !1;
|
|
323
331
|
const i = e.map((o) => {
|
|
324
|
-
const r =
|
|
332
|
+
const r = T(o, n);
|
|
325
333
|
return !t && typeof r == "function" && (t = !0), r;
|
|
326
334
|
});
|
|
327
335
|
if (t)
|
|
328
336
|
return () => {
|
|
329
337
|
for (let o = 0; o < i.length; o++) {
|
|
330
338
|
const r = i[o];
|
|
331
|
-
typeof r == "function" ? r() :
|
|
339
|
+
typeof r == "function" ? r() : T(e[o], null);
|
|
332
340
|
}
|
|
333
341
|
};
|
|
334
342
|
};
|
|
335
343
|
}
|
|
336
|
-
function
|
|
337
|
-
return s.useCallback(
|
|
344
|
+
function He(...e) {
|
|
345
|
+
return s.useCallback(Q(...e), e);
|
|
338
346
|
}
|
|
339
|
-
function
|
|
347
|
+
function Fe(e, n = []) {
|
|
340
348
|
let t = [];
|
|
341
|
-
function i(r,
|
|
342
|
-
const
|
|
343
|
-
t = [...t,
|
|
344
|
-
const l = (
|
|
345
|
-
var
|
|
346
|
-
const { scope:
|
|
347
|
-
return /* @__PURE__ */
|
|
349
|
+
function i(r, u) {
|
|
350
|
+
const a = s.createContext(u), c = t.length;
|
|
351
|
+
t = [...t, u];
|
|
352
|
+
const l = (p) => {
|
|
353
|
+
var v;
|
|
354
|
+
const { scope: d, children: _, ...h } = p, m = ((v = d == null ? void 0 : d[e]) == null ? void 0 : v[c]) || a, b = s.useMemo(() => h, Object.values(h));
|
|
355
|
+
return /* @__PURE__ */ g(m.Provider, { value: b, children: _ });
|
|
348
356
|
};
|
|
349
357
|
l.displayName = r + "Provider";
|
|
350
|
-
function
|
|
358
|
+
function f(p, d) {
|
|
351
359
|
var m;
|
|
352
|
-
const
|
|
360
|
+
const _ = ((m = d == null ? void 0 : d[e]) == null ? void 0 : m[c]) || a, h = s.useContext(_);
|
|
353
361
|
if (h) return h;
|
|
354
|
-
if (
|
|
355
|
-
throw new Error(`\`${
|
|
362
|
+
if (u !== void 0) return u;
|
|
363
|
+
throw new Error(`\`${p}\` must be used within \`${r}\``);
|
|
356
364
|
}
|
|
357
|
-
return [l,
|
|
365
|
+
return [l, f];
|
|
358
366
|
}
|
|
359
367
|
const o = () => {
|
|
360
|
-
const r = t.map((
|
|
361
|
-
return function(
|
|
362
|
-
const c = (
|
|
368
|
+
const r = t.map((u) => s.createContext(u));
|
|
369
|
+
return function(a) {
|
|
370
|
+
const c = (a == null ? void 0 : a[e]) || r;
|
|
363
371
|
return s.useMemo(
|
|
364
|
-
() => ({ [`__scope${e}`]: { ...
|
|
365
|
-
[
|
|
372
|
+
() => ({ [`__scope${e}`]: { ...a, [e]: c } }),
|
|
373
|
+
[a, c]
|
|
366
374
|
);
|
|
367
375
|
};
|
|
368
376
|
};
|
|
369
|
-
return o.scopeName = e, [i,
|
|
377
|
+
return o.scopeName = e, [i, Ue(o, ...n)];
|
|
370
378
|
}
|
|
371
|
-
function
|
|
379
|
+
function Ue(...e) {
|
|
372
380
|
const n = e[0];
|
|
373
381
|
if (e.length === 1) return n;
|
|
374
382
|
const t = () => {
|
|
@@ -377,16 +385,16 @@ function Je(...e) {
|
|
|
377
385
|
scopeName: o.scopeName
|
|
378
386
|
}));
|
|
379
387
|
return function(r) {
|
|
380
|
-
const
|
|
381
|
-
const
|
|
382
|
-
return { ...
|
|
388
|
+
const u = i.reduce((a, { useScope: c, scopeName: l }) => {
|
|
389
|
+
const p = c(r)[`__scope${l}`];
|
|
390
|
+
return { ...a, ...p };
|
|
383
391
|
}, {});
|
|
384
|
-
return s.useMemo(() => ({ [`__scope${n.scopeName}`]:
|
|
392
|
+
return s.useMemo(() => ({ [`__scope${n.scopeName}`]: u }), [u]);
|
|
385
393
|
};
|
|
386
394
|
};
|
|
387
395
|
return t.scopeName = n.scopeName, t;
|
|
388
396
|
}
|
|
389
|
-
function
|
|
397
|
+
function Y(e) {
|
|
390
398
|
const n = s.useRef(e);
|
|
391
399
|
return s.useEffect(() => {
|
|
392
400
|
n.current = e;
|
|
@@ -395,99 +403,105 @@ function ne(e) {
|
|
|
395
403
|
return (i = n.current) == null ? void 0 : i.call(n, ...t);
|
|
396
404
|
}, []);
|
|
397
405
|
}
|
|
398
|
-
function
|
|
406
|
+
function Ze({
|
|
399
407
|
prop: e,
|
|
400
408
|
defaultProp: n,
|
|
401
409
|
onChange: t = () => {
|
|
402
410
|
}
|
|
403
411
|
}) {
|
|
404
|
-
const [i, o] =
|
|
412
|
+
const [i, o] = Ge({ defaultProp: n, onChange: t }), r = e !== void 0, u = r ? e : i, a = Y(t), c = s.useCallback(
|
|
405
413
|
(l) => {
|
|
406
414
|
if (r) {
|
|
407
|
-
const
|
|
408
|
-
|
|
415
|
+
const p = typeof l == "function" ? l(e) : l;
|
|
416
|
+
p !== e && a(p);
|
|
409
417
|
} else
|
|
410
418
|
o(l);
|
|
411
419
|
},
|
|
412
|
-
[r, e, o,
|
|
420
|
+
[r, e, o, a]
|
|
413
421
|
);
|
|
414
|
-
return [
|
|
422
|
+
return [u, c];
|
|
415
423
|
}
|
|
416
|
-
function
|
|
424
|
+
function Ge({
|
|
417
425
|
defaultProp: e,
|
|
418
426
|
onChange: n
|
|
419
427
|
}) {
|
|
420
|
-
const t = s.useState(e), [i] = t, o = s.useRef(i), r =
|
|
428
|
+
const t = s.useState(e), [i] = t, o = s.useRef(i), r = Y(n);
|
|
421
429
|
return s.useEffect(() => {
|
|
422
430
|
o.current !== i && (r(i), o.current = i);
|
|
423
431
|
}, [i, o, r]), t;
|
|
424
432
|
}
|
|
425
|
-
function
|
|
433
|
+
function Je(e) {
|
|
426
434
|
const n = s.useRef({ value: e, previous: e });
|
|
427
435
|
return s.useMemo(() => (n.current.value !== e && (n.current.previous = n.current.value, n.current.value = e), n.current.previous), [e]);
|
|
428
436
|
}
|
|
429
|
-
var
|
|
437
|
+
var Ke = globalThis != null && globalThis.document ? s.useLayoutEffect : () => {
|
|
430
438
|
};
|
|
431
|
-
function
|
|
439
|
+
function Qe(e) {
|
|
432
440
|
const [n, t] = s.useState(void 0);
|
|
433
|
-
return
|
|
441
|
+
return Ke(() => {
|
|
434
442
|
if (e) {
|
|
435
443
|
t({ width: e.offsetWidth, height: e.offsetHeight });
|
|
436
444
|
const i = new ResizeObserver((o) => {
|
|
437
445
|
if (!Array.isArray(o) || !o.length)
|
|
438
446
|
return;
|
|
439
447
|
const r = o[0];
|
|
440
|
-
let
|
|
448
|
+
let u, a;
|
|
441
449
|
if ("borderBoxSize" in r) {
|
|
442
450
|
const c = r.borderBoxSize, l = Array.isArray(c) ? c[0] : c;
|
|
443
|
-
|
|
451
|
+
u = l.inlineSize, a = l.blockSize;
|
|
444
452
|
} else
|
|
445
|
-
|
|
446
|
-
t({ width:
|
|
453
|
+
u = e.offsetWidth, a = e.offsetHeight;
|
|
454
|
+
t({ width: u, height: a });
|
|
447
455
|
});
|
|
448
456
|
return i.observe(e, { box: "border-box" }), () => i.unobserve(e);
|
|
449
457
|
} else
|
|
450
458
|
t(void 0);
|
|
451
459
|
}, [e]), n;
|
|
452
460
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
461
|
+
// @__NO_SIDE_EFFECTS__
|
|
462
|
+
function Ye(e) {
|
|
463
|
+
const n = /* @__PURE__ */ er(e), t = s.forwardRef((i, o) => {
|
|
464
|
+
const { children: r, ...u } = i, a = s.Children.toArray(r), c = a.find(tr);
|
|
465
|
+
if (c) {
|
|
466
|
+
const l = c.props.children, f = a.map((p) => p === c ? s.Children.count(l) > 1 ? s.Children.only(null) : s.isValidElement(l) ? l.props.children : null : p);
|
|
467
|
+
return /* @__PURE__ */ g(n, { ...u, ref: o, children: s.isValidElement(l) ? s.cloneElement(l, void 0, f) : null });
|
|
468
|
+
}
|
|
469
|
+
return /* @__PURE__ */ g(n, { ...u, ref: o, children: r });
|
|
470
|
+
});
|
|
471
|
+
return t.displayName = `${e}.Slot`, t;
|
|
472
|
+
}
|
|
473
|
+
// @__NO_SIDE_EFFECTS__
|
|
474
|
+
function er(e) {
|
|
475
|
+
const n = s.forwardRef((t, i) => {
|
|
476
|
+
const { children: o, ...r } = t;
|
|
477
|
+
if (s.isValidElement(o)) {
|
|
478
|
+
const u = or(o), a = nr(r, o.props);
|
|
479
|
+
return o.type !== s.Fragment && (a.ref = i ? Q(i, u) : u), s.cloneElement(o, a);
|
|
480
|
+
}
|
|
481
|
+
return s.Children.count(o) > 1 ? s.Children.only(null) : null;
|
|
482
|
+
});
|
|
483
|
+
return n.displayName = `${e}.SlotClone`, n;
|
|
484
|
+
}
|
|
485
|
+
var rr = Symbol("radix.slottable");
|
|
486
|
+
function tr(e) {
|
|
487
|
+
return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === rr;
|
|
488
|
+
}
|
|
489
|
+
function nr(e, n) {
|
|
476
490
|
const t = { ...n };
|
|
477
491
|
for (const i in n) {
|
|
478
492
|
const o = e[i], r = n[i];
|
|
479
|
-
/^on[A-Z]/.test(i) ? o && r ? t[i] = (...
|
|
480
|
-
r(...
|
|
493
|
+
/^on[A-Z]/.test(i) ? o && r ? t[i] = (...a) => {
|
|
494
|
+
r(...a), o(...a);
|
|
481
495
|
} : o && (t[i] = o) : i === "style" ? t[i] = { ...o, ...r } : i === "className" && (t[i] = [o, r].filter(Boolean).join(" "));
|
|
482
496
|
}
|
|
483
497
|
return { ...e, ...t };
|
|
484
498
|
}
|
|
485
|
-
function
|
|
499
|
+
function or(e) {
|
|
486
500
|
var i, o;
|
|
487
501
|
let n = (i = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : i.get, t = n && "isReactWarning" in n && n.isReactWarning;
|
|
488
502
|
return t ? e.ref : (n = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, t = n && "isReactWarning" in n && n.isReactWarning, t ? e.props.ref : e.props.ref || e.ref);
|
|
489
503
|
}
|
|
490
|
-
var
|
|
504
|
+
var ir = [
|
|
491
505
|
"a",
|
|
492
506
|
"button",
|
|
493
507
|
"div",
|
|
@@ -504,74 +518,74 @@ var ar = [
|
|
|
504
518
|
"span",
|
|
505
519
|
"svg",
|
|
506
520
|
"ul"
|
|
507
|
-
],
|
|
508
|
-
const t = s.forwardRef((
|
|
509
|
-
const { asChild:
|
|
510
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */
|
|
521
|
+
], ee = ir.reduce((e, n) => {
|
|
522
|
+
const t = /* @__PURE__ */ Ye(`Primitive.${n}`), i = s.forwardRef((o, r) => {
|
|
523
|
+
const { asChild: u, ...a } = o, c = u ? t : n;
|
|
524
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ g(c, { ...a, ref: r });
|
|
511
525
|
});
|
|
512
|
-
return
|
|
513
|
-
}, {}),
|
|
526
|
+
return i.displayName = `Primitive.${n}`, { ...e, [n]: i };
|
|
527
|
+
}, {}), A = "Switch", [ur] = Fe(A), [ar, sr] = ur(A), re = s.forwardRef(
|
|
514
528
|
(e, n) => {
|
|
515
529
|
const {
|
|
516
530
|
__scopeSwitch: t,
|
|
517
531
|
name: i,
|
|
518
532
|
checked: o,
|
|
519
533
|
defaultChecked: r,
|
|
520
|
-
required:
|
|
521
|
-
disabled:
|
|
534
|
+
required: u,
|
|
535
|
+
disabled: a,
|
|
522
536
|
value: c = "on",
|
|
523
537
|
onCheckedChange: l,
|
|
524
|
-
form:
|
|
525
|
-
...
|
|
526
|
-
} = e, [
|
|
538
|
+
form: f,
|
|
539
|
+
...p
|
|
540
|
+
} = e, [d, _] = s.useState(null), h = He(n, (y) => _(y)), m = s.useRef(!1), b = d ? f || !!d.closest("form") : !0, [v = !1, x] = Ze({
|
|
527
541
|
prop: o,
|
|
528
542
|
defaultProp: r,
|
|
529
543
|
onChange: l
|
|
530
544
|
});
|
|
531
|
-
return /* @__PURE__ */ D(
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
|
|
545
|
+
return /* @__PURE__ */ D(ar, { scope: t, checked: v, disabled: a, children: [
|
|
546
|
+
/* @__PURE__ */ g(
|
|
547
|
+
ee.button,
|
|
534
548
|
{
|
|
535
549
|
type: "button",
|
|
536
550
|
role: "switch",
|
|
537
|
-
"aria-checked":
|
|
538
|
-
"aria-required":
|
|
539
|
-
"data-state":
|
|
540
|
-
"data-disabled":
|
|
541
|
-
disabled:
|
|
551
|
+
"aria-checked": v,
|
|
552
|
+
"aria-required": u,
|
|
553
|
+
"data-state": oe(v),
|
|
554
|
+
"data-disabled": a ? "" : void 0,
|
|
555
|
+
disabled: a,
|
|
542
556
|
value: c,
|
|
543
|
-
...
|
|
557
|
+
...p,
|
|
544
558
|
ref: h,
|
|
545
|
-
onClick:
|
|
559
|
+
onClick: Ve(e.onClick, (y) => {
|
|
546
560
|
x((w) => !w), b && (m.current = y.isPropagationStopped(), m.current || y.stopPropagation());
|
|
547
561
|
})
|
|
548
562
|
}
|
|
549
563
|
),
|
|
550
|
-
b && /* @__PURE__ */
|
|
551
|
-
|
|
564
|
+
b && /* @__PURE__ */ g(
|
|
565
|
+
cr,
|
|
552
566
|
{
|
|
553
|
-
control:
|
|
567
|
+
control: d,
|
|
554
568
|
bubbles: !m.current,
|
|
555
569
|
name: i,
|
|
556
570
|
value: c,
|
|
557
|
-
checked:
|
|
558
|
-
required:
|
|
559
|
-
disabled:
|
|
560
|
-
form:
|
|
571
|
+
checked: v,
|
|
572
|
+
required: u,
|
|
573
|
+
disabled: a,
|
|
574
|
+
form: f,
|
|
561
575
|
style: { transform: "translateX(-100%)" }
|
|
562
576
|
}
|
|
563
577
|
)
|
|
564
578
|
] });
|
|
565
579
|
}
|
|
566
580
|
);
|
|
567
|
-
|
|
568
|
-
var
|
|
581
|
+
re.displayName = A;
|
|
582
|
+
var te = "SwitchThumb", ne = s.forwardRef(
|
|
569
583
|
(e, n) => {
|
|
570
|
-
const { __scopeSwitch: t, ...i } = e, o =
|
|
571
|
-
return /* @__PURE__ */
|
|
572
|
-
|
|
584
|
+
const { __scopeSwitch: t, ...i } = e, o = sr(te, t);
|
|
585
|
+
return /* @__PURE__ */ g(
|
|
586
|
+
ee.span,
|
|
573
587
|
{
|
|
574
|
-
"data-state":
|
|
588
|
+
"data-state": oe(o.checked),
|
|
575
589
|
"data-disabled": o.disabled ? "" : void 0,
|
|
576
590
|
...i,
|
|
577
591
|
ref: n
|
|
@@ -579,16 +593,16 @@ var ue = "SwitchThumb", se = s.forwardRef(
|
|
|
579
593
|
);
|
|
580
594
|
}
|
|
581
595
|
);
|
|
582
|
-
|
|
583
|
-
var
|
|
584
|
-
const { control: n, checked: t, bubbles: i = !0, ...o } = e, r = s.useRef(null),
|
|
596
|
+
ne.displayName = te;
|
|
597
|
+
var cr = (e) => {
|
|
598
|
+
const { control: n, checked: t, bubbles: i = !0, ...o } = e, r = s.useRef(null), u = Je(t), a = Qe(n);
|
|
585
599
|
return s.useEffect(() => {
|
|
586
|
-
const c = r.current, l = window.HTMLInputElement.prototype,
|
|
587
|
-
if (
|
|
588
|
-
const
|
|
589
|
-
|
|
600
|
+
const c = r.current, l = window.HTMLInputElement.prototype, p = Object.getOwnPropertyDescriptor(l, "checked").set;
|
|
601
|
+
if (u !== t && p) {
|
|
602
|
+
const d = new Event("click", { bubbles: i });
|
|
603
|
+
p.call(c, t), c.dispatchEvent(d);
|
|
590
604
|
}
|
|
591
|
-
}, [
|
|
605
|
+
}, [u, t, i]), /* @__PURE__ */ g(
|
|
592
606
|
"input",
|
|
593
607
|
{
|
|
594
608
|
type: "checkbox",
|
|
@@ -599,7 +613,7 @@ var lr = (e) => {
|
|
|
599
613
|
ref: r,
|
|
600
614
|
style: {
|
|
601
615
|
...e.style,
|
|
602
|
-
...
|
|
616
|
+
...a,
|
|
603
617
|
position: "absolute",
|
|
604
618
|
pointerEvents: "none",
|
|
605
619
|
opacity: 0,
|
|
@@ -608,11 +622,11 @@ var lr = (e) => {
|
|
|
608
622
|
}
|
|
609
623
|
);
|
|
610
624
|
};
|
|
611
|
-
function
|
|
625
|
+
function oe(e) {
|
|
612
626
|
return e ? "checked" : "unchecked";
|
|
613
627
|
}
|
|
614
|
-
var
|
|
615
|
-
function
|
|
628
|
+
var lr = re, pr = ne;
|
|
629
|
+
function dr(e) {
|
|
616
630
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
617
631
|
}
|
|
618
632
|
var z = { exports: {} };
|
|
@@ -621,15 +635,15 @@ var z = { exports: {} };
|
|
|
621
635
|
Licensed under the MIT License (MIT), see
|
|
622
636
|
http://jedwatson.github.io/classnames
|
|
623
637
|
*/
|
|
624
|
-
var
|
|
625
|
-
function
|
|
626
|
-
return
|
|
638
|
+
var V;
|
|
639
|
+
function fr() {
|
|
640
|
+
return V || (V = 1, (function(e) {
|
|
627
641
|
(function() {
|
|
628
642
|
var n = {}.hasOwnProperty;
|
|
629
643
|
function t() {
|
|
630
|
-
for (var r = "",
|
|
631
|
-
var
|
|
632
|
-
|
|
644
|
+
for (var r = "", u = 0; u < arguments.length; u++) {
|
|
645
|
+
var a = arguments[u];
|
|
646
|
+
a && (r = o(r, i.call(this, a)));
|
|
633
647
|
}
|
|
634
648
|
return r;
|
|
635
649
|
}
|
|
@@ -642,117 +656,117 @@ function hr() {
|
|
|
642
656
|
return t.apply(this, r);
|
|
643
657
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
644
658
|
return r.toString();
|
|
645
|
-
var
|
|
646
|
-
for (var
|
|
647
|
-
n.call(r,
|
|
648
|
-
return
|
|
659
|
+
var u = "";
|
|
660
|
+
for (var a in r)
|
|
661
|
+
n.call(r, a) && r[a] && (u = o(u, this && this[a] || a));
|
|
662
|
+
return u;
|
|
649
663
|
}
|
|
650
|
-
function o(r,
|
|
651
|
-
return
|
|
664
|
+
function o(r, u) {
|
|
665
|
+
return u ? r ? r + " " + u : r + u : r;
|
|
652
666
|
}
|
|
653
667
|
e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
|
|
654
668
|
})();
|
|
655
|
-
}(z)), z.exports;
|
|
669
|
+
})(z)), z.exports;
|
|
656
670
|
}
|
|
657
|
-
var
|
|
658
|
-
const
|
|
671
|
+
var hr = fr();
|
|
672
|
+
const gr = /* @__PURE__ */ dr(hr), H = (e) => e && "touches" in e, _r = ({
|
|
659
673
|
children: e,
|
|
660
674
|
disabled: n,
|
|
661
675
|
onStart: t,
|
|
662
676
|
onDrag: i,
|
|
663
677
|
onStop: o,
|
|
664
678
|
bounds: r,
|
|
665
|
-
position:
|
|
666
|
-
style:
|
|
679
|
+
position: u,
|
|
680
|
+
style: a
|
|
667
681
|
}) => {
|
|
668
|
-
const [c, l] = $(void 0), [
|
|
682
|
+
const [c, l] = $(void 0), [f, p] = $(void 0), [d, _] = $(!1), h = (v) => {
|
|
669
683
|
if (!n) {
|
|
670
|
-
|
|
671
|
-
const x =
|
|
672
|
-
|
|
684
|
+
v.preventDefault();
|
|
685
|
+
const x = H(v.nativeEvent) ? v.nativeEvent.touches[0].clientX : v.nativeEvent.clientX;
|
|
686
|
+
p(x), t == null || t();
|
|
673
687
|
}
|
|
674
688
|
}, m = O(
|
|
675
|
-
(
|
|
676
|
-
if (typeof
|
|
689
|
+
(v) => {
|
|
690
|
+
if (typeof f != "number")
|
|
677
691
|
return;
|
|
678
|
-
const y = (
|
|
692
|
+
const y = (H(v) ? v.touches[0].clientX : v.clientX) - f;
|
|
679
693
|
if (!y)
|
|
680
694
|
return;
|
|
681
|
-
const w =
|
|
682
|
-
!
|
|
695
|
+
const w = u + y;
|
|
696
|
+
!d && Math.abs(w) && _(!0);
|
|
683
697
|
const E = w > r.right ? r.right : w < r.left ? r.left : w;
|
|
684
698
|
l(E), i == null || i({ x: E });
|
|
685
699
|
},
|
|
686
700
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
687
|
-
[i, l,
|
|
701
|
+
[i, l, d, f]
|
|
688
702
|
), b = O(() => {
|
|
689
|
-
|
|
690
|
-
}, [o,
|
|
703
|
+
p(void 0), l(void 0), _(!1), o == null || o();
|
|
704
|
+
}, [o, p]);
|
|
691
705
|
return k(() => (window.addEventListener("mousemove", m), window.addEventListener("touchmove", m), () => {
|
|
692
706
|
window.removeEventListener("mousemove", m), window.removeEventListener("touchmove", m);
|
|
693
707
|
}), [m]), k(() => (window.addEventListener("mouseup", b), window.addEventListener("touchend", b), () => {
|
|
694
708
|
window.removeEventListener("mouseup", b), window.removeEventListener("touchend", b);
|
|
695
|
-
}), [b]),
|
|
709
|
+
}), [b]), ue(e) ? ie(e, {
|
|
696
710
|
onMouseDown: h,
|
|
697
711
|
onTouchStart: h,
|
|
698
|
-
style: { ...
|
|
712
|
+
style: { ...a, transform: `translateX(${d ? c : u}px)` }
|
|
699
713
|
}) : null;
|
|
700
|
-
},
|
|
714
|
+
}, F = {
|
|
701
715
|
width: void 0,
|
|
702
716
|
height: void 0
|
|
703
717
|
};
|
|
704
|
-
function
|
|
705
|
-
const { ref: n, box: t = "content-box", round: i } = e, [{ width: o, height: r },
|
|
718
|
+
function U(e) {
|
|
719
|
+
const { ref: n, box: t = "content-box", round: i } = e, [{ width: o, height: r }, u] = $(F), a = mr(), c = P({ ...F }), l = P(void 0);
|
|
706
720
|
return l.current = e.onResize, k(() => {
|
|
707
721
|
if (!n.current || typeof window > "u" || !("ResizeObserver" in window))
|
|
708
722
|
return;
|
|
709
|
-
const
|
|
710
|
-
const
|
|
711
|
-
if (c.current.width !==
|
|
723
|
+
const f = new ResizeObserver(([p]) => {
|
|
724
|
+
const d = t === "border-box" ? "borderBoxSize" : t === "device-pixel-content-box" ? "devicePixelContentBoxSize" : "contentBoxSize", _ = Z(p, d, "inlineSize"), h = Z(p, d, "blockSize");
|
|
725
|
+
if (c.current.width !== _ || c.current.height !== h) {
|
|
712
726
|
const b = {
|
|
713
|
-
width:
|
|
727
|
+
width: _ && i ? Math.round(_) : _,
|
|
714
728
|
height: h && i ? Math.round(h) : h
|
|
715
729
|
};
|
|
716
|
-
c.current.width =
|
|
730
|
+
c.current.width = _, c.current.height = h, l.current ? l.current(b) : a() && u(b);
|
|
717
731
|
}
|
|
718
732
|
});
|
|
719
|
-
return
|
|
720
|
-
|
|
733
|
+
return f.observe(n.current, { box: t }), () => {
|
|
734
|
+
f.disconnect();
|
|
721
735
|
};
|
|
722
|
-
}, [t, n,
|
|
736
|
+
}, [t, n, a, i]), { width: o, height: r };
|
|
723
737
|
}
|
|
724
|
-
function
|
|
738
|
+
function Z(e, n, t) {
|
|
725
739
|
return e[n] ? Array.isArray(e[n]) ? e[n][0][t] : (
|
|
726
740
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
727
741
|
// @ts-ignore Support Firefox's non-standard behavior
|
|
728
742
|
e[n][t]
|
|
729
743
|
) : n === "contentBoxSize" ? e.contentRect[t === "inlineSize" ? "width" : "height"] : void 0;
|
|
730
744
|
}
|
|
731
|
-
function
|
|
745
|
+
function mr() {
|
|
732
746
|
const e = P(!1);
|
|
733
747
|
return k(() => (e.current = !0, () => {
|
|
734
748
|
e.current = !1;
|
|
735
749
|
}), []), O(() => e.current, []);
|
|
736
750
|
}
|
|
737
|
-
const
|
|
738
|
-
const t = P(null), i = P(null), [o, r] = $(void 0), [
|
|
751
|
+
const vr = ({ checked: e, onChange: n }) => {
|
|
752
|
+
const t = P(null), i = P(null), [o, r] = $(void 0), [u, a] = $(!1), [c, l] = $(0), { height: f = 0 } = U({ ref: i, round: !0 }), { height: p = 0 } = U({ ref: t, round: !0 }), d = (p || 0) - f, _ = f + d, h = d / 2, m = _ / 2, b = typeof o == "number" && (e ? o < m : o > m);
|
|
739
753
|
return {
|
|
740
754
|
trackRef: t,
|
|
741
755
|
thumbRef: i,
|
|
742
|
-
isDragging:
|
|
743
|
-
bounds: { left: h, right:
|
|
744
|
-
position: e ?
|
|
756
|
+
isDragging: u,
|
|
757
|
+
bounds: { left: h, right: _ },
|
|
758
|
+
position: e ? _ : h,
|
|
745
759
|
onDrag: ({ x: w }) => {
|
|
746
|
-
r(w), Math.abs((e ?
|
|
760
|
+
r(w), Math.abs((e ? _ : h) - w) > 2 && a(!0);
|
|
747
761
|
},
|
|
748
762
|
onStop: () => {
|
|
749
|
-
|
|
763
|
+
a(!1), u && l(Date.now()), b && (n == null || n(!e));
|
|
750
764
|
},
|
|
751
765
|
onChangeWithDrag: () => {
|
|
752
766
|
Date.now() - c > 50 && (n == null || n(!e)), r(void 0);
|
|
753
767
|
}
|
|
754
768
|
};
|
|
755
|
-
},
|
|
769
|
+
}, br = {
|
|
756
770
|
"purpur-toggle": "_purpur-toggle_zqs8u_1",
|
|
757
771
|
"purpur-toggle__track": "_purpur-toggle__track_zqs8u_7",
|
|
758
772
|
"purpur-toggle__checkmark-container": "_purpur-toggle__checkmark-container_zqs8u_45",
|
|
@@ -762,7 +776,7 @@ const br = ({ checked: e, onChange: n }) => {
|
|
|
762
776
|
"purpur-toggle__label--right": "_purpur-toggle__label--right_zqs8u_110",
|
|
763
777
|
"purpur-toggle__label--left": "_purpur-toggle__label--left_zqs8u_113",
|
|
764
778
|
"purpur-toggle__container": "_purpur-toggle__container_zqs8u_116"
|
|
765
|
-
}, C =
|
|
779
|
+
}, C = gr.bind(br), S = "purpur-toggle", yr = ae(
|
|
766
780
|
({
|
|
767
781
|
["data-testid"]: e,
|
|
768
782
|
className: n,
|
|
@@ -770,31 +784,31 @@ const br = ({ checked: e, onChange: n }) => {
|
|
|
770
784
|
onChange: i,
|
|
771
785
|
labelPosition: o = "right",
|
|
772
786
|
checked: r,
|
|
773
|
-
disableDrag:
|
|
774
|
-
defaultChecked:
|
|
787
|
+
disableDrag: u,
|
|
788
|
+
defaultChecked: a,
|
|
775
789
|
...c
|
|
776
790
|
}, l) => {
|
|
777
|
-
const [
|
|
778
|
-
typeof r == "boolean" ? r : !!
|
|
779
|
-
),
|
|
780
|
-
checked:
|
|
791
|
+
const [f, p] = $(
|
|
792
|
+
typeof r == "boolean" ? r : !!a
|
|
793
|
+
), d = !!(typeof r == "boolean" ? r : f), { thumbRef: _, trackRef: h, isDragging: m, onChangeWithDrag: b, ...v } = vr({
|
|
794
|
+
checked: d,
|
|
781
795
|
onChange: (y) => {
|
|
782
|
-
c.disabled || (i == null || i(y),
|
|
796
|
+
c.disabled || (i == null || i(y), p(y));
|
|
783
797
|
}
|
|
784
|
-
}), x = () => /* @__PURE__ */
|
|
785
|
-
|
|
798
|
+
}), x = () => /* @__PURE__ */ g(
|
|
799
|
+
je,
|
|
786
800
|
{
|
|
787
801
|
htmlFor: c.id,
|
|
788
802
|
"data-testid": e && `${e}-label`,
|
|
789
803
|
disabled: c.disabled,
|
|
790
804
|
className: C(`${S}__label`, `${S}__label--${o}`),
|
|
791
|
-
children: /* @__PURE__ */
|
|
805
|
+
children: /* @__PURE__ */ g(K, { disabled: c.disabled, children: t })
|
|
792
806
|
}
|
|
793
807
|
);
|
|
794
808
|
return /* @__PURE__ */ D("div", { className: C(n, `${S}__container`), children: [
|
|
795
809
|
t && o === "left" && x(),
|
|
796
|
-
/* @__PURE__ */
|
|
797
|
-
|
|
810
|
+
/* @__PURE__ */ g(
|
|
811
|
+
lr,
|
|
798
812
|
{
|
|
799
813
|
...c,
|
|
800
814
|
ref: l,
|
|
@@ -802,13 +816,13 @@ const br = ({ checked: e, onChange: n }) => {
|
|
|
802
816
|
"data-testid": e,
|
|
803
817
|
className: C(S),
|
|
804
818
|
onCheckedChange: b,
|
|
805
|
-
checked:
|
|
819
|
+
checked: d,
|
|
806
820
|
children: /* @__PURE__ */ D("span", { ref: h, className: C(`${S}__track`), children: [
|
|
807
|
-
/* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
|
|
821
|
+
/* @__PURE__ */ g("span", { className: C(`${S}__checkmark-container`), children: /* @__PURE__ */ g(G, { className: C(`${S}__checkmark`), svg: ve, size: "xxs" }) }),
|
|
822
|
+
/* @__PURE__ */ g(_r, { disabled: u, ...v, children: /* @__PURE__ */ g(
|
|
823
|
+
pr,
|
|
810
824
|
{
|
|
811
|
-
ref:
|
|
825
|
+
ref: _,
|
|
812
826
|
"data-testid": e && `${e}-thumb`,
|
|
813
827
|
className: C(`${S}__thumb`, {
|
|
814
828
|
[`${S}__thumb--dragging`]: m
|
|
@@ -822,8 +836,8 @@ const br = ({ checked: e, onChange: n }) => {
|
|
|
822
836
|
] });
|
|
823
837
|
}
|
|
824
838
|
);
|
|
825
|
-
|
|
839
|
+
yr.displayName = "Toggle";
|
|
826
840
|
export {
|
|
827
|
-
|
|
841
|
+
yr as Toggle
|
|
828
842
|
};
|
|
829
843
|
//# sourceMappingURL=toggle.es.js.map
|