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