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