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