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