@purpurds/toggle 5.30.1 → 5.32.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,5 +1,5 @@
1
1
  import { jsx as w, jsxs as F } from "react/jsx-runtime";
2
- import { forwardRef as S, Children as $, isValidElement as A, createElement as v, cloneElement as B, useEffect as C, Fragment as Y, useCallback as z, createContext as W, useMemo as j, useContext as pe, useRef as x, useState as y, useLayoutEffect as de } from "react";
2
+ import { forwardRef as S, Children as $, isValidElement as A, createElement as _, cloneElement as B, useEffect as C, Fragment as Y, useCallback as z, createContext as W, useMemo as j, useContext as pe, useRef as x, useState as y, useLayoutEffect as de } from "react";
3
3
  import "react-dom";
4
4
  function fe(e) {
5
5
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -15,8 +15,8 @@ var K = { exports: {} };
15
15
  var n = {}.hasOwnProperty;
16
16
  function t() {
17
17
  for (var r = "", o = 0; o < arguments.length; o++) {
18
- var c = arguments[o];
19
- c && (r = i(r, a.call(this, c)));
18
+ var i = arguments[o];
19
+ i && (r = u(r, a.call(this, i)));
20
20
  }
21
21
  return r;
22
22
  }
@@ -30,11 +30,11 @@ var K = { exports: {} };
30
30
  if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
31
31
  return r.toString();
32
32
  var o = "";
33
- for (var c in r)
34
- n.call(r, c) && r[c] && (o = i(o, this && this[c] || c));
33
+ for (var i in r)
34
+ n.call(r, i) && r[i] && (o = u(o, this && this[i] || i));
35
35
  return o;
36
36
  }
37
- function i(r, o) {
37
+ function u(r, o) {
38
38
  return o ? r ? r + " " + o : r + o : r;
39
39
  }
40
40
  e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
@@ -49,12 +49,12 @@ const ge = /* @__PURE__ */ fe(he), be = {
49
49
  "purpur-icon--md": "_purpur-icon--md_8u1lq_16",
50
50
  "purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
51
51
  "purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
52
- }, ve = {
52
+ }, _e = {
53
53
  name: "checkmark-bold",
54
54
  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>',
55
55
  keywords: ["checkmark-bold"],
56
56
  category: "utility"
57
- }, _e = ge.bind(be), U = "purpur-icon", me = "md", $e = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), ye = ({ content: e = "", title: n } = {}) => {
57
+ }, me = ge.bind(be), U = "purpur-icon", ve = "md", $e = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), ye = ({ content: e = "", title: n } = {}) => {
58
58
  const t = [
59
59
  { name: "xmlns", value: "http://www.w3.org/2000/svg" },
60
60
  { name: "fill", value: "currentColor" },
@@ -67,18 +67,18 @@ const ge = /* @__PURE__ */ fe(he), be = {
67
67
  svg: n,
68
68
  allyTitle: t,
69
69
  className: a,
70
- size: i = me,
70
+ size: u = ve,
71
71
  ...r
72
72
  }) => {
73
73
  const o = ye({
74
74
  content: we(n.svg),
75
75
  title: t
76
- }), c = _e(a, U, `${U}--${i}`);
76
+ }), i = me(a, U, `${U}--${u}`);
77
77
  return /* @__PURE__ */ w(
78
78
  "span",
79
79
  {
80
80
  "aria-label": t,
81
- className: c,
81
+ className: i,
82
82
  "data-testid": e,
83
83
  dangerouslySetInnerHTML: { __html: o },
84
84
  ...r
@@ -104,14 +104,14 @@ function Se(...e) {
104
104
  );
105
105
  }
106
106
  const ee = /* @__PURE__ */ S((e, n) => {
107
- const { children: t, ...a } = e, i = $.toArray(t), r = i.find(ke);
107
+ const { children: t, ...a } = e, u = $.toArray(t), r = u.find(ke);
108
108
  if (r) {
109
- const o = r.props.children, c = i.map((u) => u === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : u);
110
- return /* @__PURE__ */ v(T, O({}, a, {
109
+ const o = r.props.children, i = u.map((c) => c === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : c);
110
+ return /* @__PURE__ */ _(T, O({}, a, {
111
111
  ref: n
112
- }), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, c) : null);
112
+ }), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, i) : null);
113
113
  }
114
- return /* @__PURE__ */ v(T, O({}, a, {
114
+ return /* @__PURE__ */ _(T, O({}, a, {
115
115
  ref: n
116
116
  }), t);
117
117
  });
@@ -124,7 +124,7 @@ const T = /* @__PURE__ */ S((e, n) => {
124
124
  }) : $.count(t) > 1 ? $.only(null) : null;
125
125
  });
126
126
  T.displayName = "SlotClone";
127
- const Pe = ({ children: e }) => /* @__PURE__ */ v(Y, null, e);
127
+ const Pe = ({ children: e }) => /* @__PURE__ */ _(Y, null, e);
128
128
  function ke(e) {
129
129
  return /* @__PURE__ */ A(e) && e.type === Pe;
130
130
  }
@@ -133,14 +133,14 @@ function Ae(e, n) {
133
133
  ...n
134
134
  };
135
135
  for (const a in n) {
136
- const i = e[a], r = n[a];
137
- /^on[A-Z]/.test(a) ? i && r ? t[a] = (...o) => {
138
- r(...o), i(...o);
139
- } : i && (t[a] = i) : a === "style" ? t[a] = {
140
- ...i,
136
+ const u = e[a], r = n[a];
137
+ /^on[A-Z]/.test(a) ? u && r ? t[a] = (...o) => {
138
+ r(...o), u(...o);
139
+ } : u && (t[a] = u) : a === "style" ? t[a] = {
140
+ ...u,
141
141
  ...r
142
142
  } : a === "className" && (t[a] = [
143
- i,
143
+ u,
144
144
  r
145
145
  ].filter(Boolean).join(" "));
146
146
  }
@@ -167,19 +167,19 @@ const Ce = [
167
167
  "svg",
168
168
  "ul"
169
169
  ], Ne = Ce.reduce((e, n) => {
170
- const t = /* @__PURE__ */ S((a, i) => {
171
- const { asChild: r, ...o } = a, c = r ? ee : n;
170
+ const t = /* @__PURE__ */ S((a, u) => {
171
+ const { asChild: r, ...o } = a, i = r ? ee : n;
172
172
  return C(() => {
173
173
  window[Symbol.for("radix-ui")] = !0;
174
- }, []), /* @__PURE__ */ v(c, O({}, o, {
175
- ref: i
174
+ }, []), /* @__PURE__ */ _(i, O({}, o, {
175
+ ref: u
176
176
  }));
177
177
  });
178
178
  return t.displayName = `Primitive.${n}`, {
179
179
  ...e,
180
180
  [n]: t
181
181
  };
182
- }, {}), De = /* @__PURE__ */ S((e, n) => /* @__PURE__ */ v(Ne.label, O({}, e, {
182
+ }, {}), De = /* @__PURE__ */ S((e, n) => /* @__PURE__ */ _(Ne.label, O({}, e, {
183
183
  ref: n,
184
184
  onMouseDown: (t) => {
185
185
  var a;
@@ -200,8 +200,8 @@ var re = { exports: {} };
200
200
  var n = {}.hasOwnProperty;
201
201
  function t() {
202
202
  for (var r = "", o = 0; o < arguments.length; o++) {
203
- var c = arguments[o];
204
- c && (r = i(r, a(c)));
203
+ var i = arguments[o];
204
+ i && (r = u(r, a(i)));
205
205
  }
206
206
  return r;
207
207
  }
@@ -215,11 +215,11 @@ var re = { exports: {} };
215
215
  if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
216
216
  return r.toString();
217
217
  var o = "";
218
- for (var c in r)
219
- n.call(r, c) && r[c] && (o = i(o, c));
218
+ for (var i in r)
219
+ n.call(r, i) && r[i] && (o = u(o, i));
220
220
  return o;
221
221
  }
222
- function i(r, o) {
222
+ function u(r, o) {
223
223
  return o ? r ? r + " " + o : r + o : r;
224
224
  }
225
225
  e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
@@ -235,19 +235,19 @@ const Me = /* @__PURE__ */ Oe(Re), X = {
235
235
  className: n,
236
236
  htmlFor: t,
237
237
  "data-testid": a,
238
- disabled: i,
238
+ disabled: u,
239
239
  negative: r = !1,
240
240
  ...o
241
241
  }) => {
242
- const c = Me([
242
+ const i = Me([
243
243
  n,
244
244
  X[H],
245
245
  {
246
- [X[`${H}--disabled`]]: i,
246
+ [X[`${H}--disabled`]]: u,
247
247
  [X[`${H}--negative`]]: r
248
248
  }
249
249
  ]);
250
- return /* @__PURE__ */ w(Ee, { className: c, "data-testid": a, htmlFor: t, ...o, children: e });
250
+ return /* @__PURE__ */ w(Ee, { className: i, "data-testid": a, htmlFor: t, ...o, children: e });
251
251
  };
252
252
  function je(e) {
253
253
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -263,8 +263,8 @@ var te = { exports: {} };
263
263
  var n = {}.hasOwnProperty;
264
264
  function t() {
265
265
  for (var r = "", o = 0; o < arguments.length; o++) {
266
- var c = arguments[o];
267
- c && (r = i(r, a(c)));
266
+ var i = arguments[o];
267
+ i && (r = u(r, a(i)));
268
268
  }
269
269
  return r;
270
270
  }
@@ -278,11 +278,11 @@ var te = { exports: {} };
278
278
  if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
279
279
  return r.toString();
280
280
  var o = "";
281
- for (var c in r)
282
- n.call(r, c) && r[c] && (o = i(o, c));
281
+ for (var i in r)
282
+ n.call(r, i) && r[i] && (o = u(o, i));
283
283
  return o;
284
284
  }
285
- function i(r, o) {
285
+ function u(r, o) {
286
286
  return o ? r ? r + " " + o : r + o : r;
287
287
  }
288
288
  e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
@@ -320,22 +320,22 @@ const Le = /* @__PURE__ */ je(Be), R = {
320
320
  children: n,
321
321
  className: t,
322
322
  disabled: a,
323
- enableHyphenation: i = !1,
323
+ enableHyphenation: u = !1,
324
324
  negative: r = !1,
325
325
  variant: o = Xe.PARAGRAPH100,
326
- ...c
326
+ ...i
327
327
  }) => {
328
- const u = Le([
328
+ const c = Le([
329
329
  t,
330
330
  R[M],
331
331
  R[`${M}--${o}`],
332
332
  {
333
- [R[`${M}--hyphens`]]: i,
333
+ [R[`${M}--hyphens`]]: u,
334
334
  [R[`${M}--disabled`]]: a,
335
335
  [R[`${M}--negative`]]: r
336
336
  }
337
337
  ]);
338
- return /* @__PURE__ */ w("p", { ...c, className: u, "data-testid": e, children: n });
338
+ return /* @__PURE__ */ w("p", { ...i, className: c, "data-testid": e, children: n });
339
339
  };
340
340
  ne.displayName = "Paragraph";
341
341
  function D() {
@@ -348,8 +348,8 @@ function D() {
348
348
  }, D.apply(null, arguments);
349
349
  }
350
350
  function He(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
351
- return function(i) {
352
- if (e == null || e(i), t === !1 || !i.defaultPrevented) return n == null ? void 0 : n(i);
351
+ return function(u) {
352
+ if (e == null || e(u), t === !1 || !u.defaultPrevented) return n == null ? void 0 : n(u);
353
353
  };
354
354
  }
355
355
  function Ie(e, n) {
@@ -366,22 +366,22 @@ function Te(...e) {
366
366
  function qe(e, n = []) {
367
367
  let t = [];
368
368
  function a(r, o) {
369
- const c = /* @__PURE__ */ W(o), u = t.length;
369
+ const i = /* @__PURE__ */ W(o), c = t.length;
370
370
  t = [
371
371
  ...t,
372
372
  o
373
373
  ];
374
374
  function s(l) {
375
- const { scope: p, children: f, ...d } = l, b = (p == null ? void 0 : p[e][u]) || c, h = j(
375
+ const { scope: p, children: f, ...d } = l, b = (p == null ? void 0 : p[e][c]) || i, h = j(
376
376
  () => d,
377
377
  Object.values(d)
378
378
  );
379
- return /* @__PURE__ */ v(b.Provider, {
379
+ return /* @__PURE__ */ _(b.Provider, {
380
380
  value: h
381
381
  }, f);
382
382
  }
383
383
  function g(l, p) {
384
- const f = (p == null ? void 0 : p[e][u]) || c, d = pe(f);
384
+ const f = (p == null ? void 0 : p[e][c]) || i, d = pe(f);
385
385
  if (d) return d;
386
386
  if (o !== void 0) return o;
387
387
  throw new Error(`\`${l}\` must be used within \`${r}\``);
@@ -391,27 +391,27 @@ function qe(e, n = []) {
391
391
  g
392
392
  ];
393
393
  }
394
- const i = () => {
394
+ const u = () => {
395
395
  const r = t.map((o) => /* @__PURE__ */ W(o));
396
- return function(c) {
397
- const u = (c == null ? void 0 : c[e]) || r;
396
+ return function(i) {
397
+ const c = (i == null ? void 0 : i[e]) || r;
398
398
  return j(
399
399
  () => ({
400
400
  [`__scope${e}`]: {
401
- ...c,
402
- [e]: u
401
+ ...i,
402
+ [e]: c
403
403
  }
404
404
  }),
405
405
  [
406
- c,
407
- u
406
+ i,
407
+ c
408
408
  ]
409
409
  );
410
410
  };
411
411
  };
412
- return i.scopeName = e, [
412
+ return u.scopeName = e, [
413
413
  a,
414
- Fe(i, ...n)
414
+ Fe(u, ...n)
415
415
  ];
416
416
  }
417
417
  function Fe(...e) {
@@ -419,16 +419,16 @@ function Fe(...e) {
419
419
  if (e.length === 1) return n;
420
420
  const t = () => {
421
421
  const a = e.map(
422
- (i) => ({
423
- useScope: i(),
424
- scopeName: i.scopeName
422
+ (u) => ({
423
+ useScope: u(),
424
+ scopeName: u.scopeName
425
425
  })
426
426
  );
427
427
  return function(r) {
428
- const o = a.reduce((c, { useScope: u, scopeName: s }) => {
429
- const l = u(r)[`__scope${s}`];
428
+ const o = a.reduce((i, { useScope: c, scopeName: s }) => {
429
+ const l = c(r)[`__scope${s}`];
430
430
  return {
431
- ...c,
431
+ ...i,
432
432
  ...l
433
433
  };
434
434
  }, {});
@@ -458,32 +458,32 @@ function ae(e) {
458
458
  }
459
459
  function We({ prop: e, defaultProp: n, onChange: t = () => {
460
460
  } }) {
461
- const [a, i] = Ue({
461
+ const [a, u] = Ue({
462
462
  defaultProp: n,
463
463
  onChange: t
464
- }), r = e !== void 0, o = r ? e : a, c = ae(t), u = z((s) => {
464
+ }), r = e !== void 0, o = r ? e : a, i = ae(t), c = z((s) => {
465
465
  if (r) {
466
466
  const l = typeof s == "function" ? s(e) : s;
467
- l !== e && c(l);
468
- } else i(s);
467
+ l !== e && i(l);
468
+ } else u(s);
469
469
  }, [
470
470
  r,
471
471
  e,
472
- i,
473
- c
472
+ u,
473
+ i
474
474
  ]);
475
475
  return [
476
476
  o,
477
- u
477
+ c
478
478
  ];
479
479
  }
480
480
  function Ue({ defaultProp: e, onChange: n }) {
481
- const t = y(e), [a] = t, i = x(a), r = ae(n);
481
+ const t = y(e), [a] = t, u = x(a), r = ae(n);
482
482
  return C(() => {
483
- i.current !== a && (r(a), i.current = a);
483
+ u.current !== a && (r(a), u.current = a);
484
484
  }, [
485
485
  a,
486
- i,
486
+ u,
487
487
  r
488
488
  ]), t;
489
489
  }
@@ -506,18 +506,18 @@ function Ze(e) {
506
506
  width: e.offsetWidth,
507
507
  height: e.offsetHeight
508
508
  });
509
- const a = new ResizeObserver((i) => {
510
- if (!Array.isArray(i) || !i.length) return;
511
- const r = i[0];
512
- let o, c;
509
+ const a = new ResizeObserver((u) => {
510
+ if (!Array.isArray(u) || !u.length) return;
511
+ const r = u[0];
512
+ let o, i;
513
513
  if ("borderBoxSize" in r) {
514
- const u = r.borderBoxSize, s = Array.isArray(u) ? u[0] : u;
515
- o = s.inlineSize, c = s.blockSize;
514
+ const c = r.borderBoxSize, s = Array.isArray(c) ? c[0] : c;
515
+ o = s.inlineSize, i = s.blockSize;
516
516
  } else
517
- o = e.offsetWidth, c = e.offsetHeight;
517
+ o = e.offsetWidth, i = e.offsetHeight;
518
518
  t({
519
519
  width: o,
520
- height: c
520
+ height: i
521
521
  });
522
522
  });
523
523
  return a.observe(e, {
@@ -529,19 +529,19 @@ function Ze(e) {
529
529
  e
530
530
  ]), n;
531
531
  }
532
- const ie = /* @__PURE__ */ S((e, n) => {
533
- const { children: t, ...a } = e, i = $.toArray(t), r = i.find(Ye);
532
+ const ue = /* @__PURE__ */ S((e, n) => {
533
+ const { children: t, ...a } = e, u = $.toArray(t), r = u.find(Ye);
534
534
  if (r) {
535
- const o = r.props.children, c = i.map((u) => u === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : u);
536
- return /* @__PURE__ */ v(q, D({}, a, {
535
+ const o = r.props.children, i = u.map((c) => c === r ? $.count(o) > 1 ? $.only(null) : /* @__PURE__ */ A(o) ? o.props.children : null : c);
536
+ return /* @__PURE__ */ _(q, D({}, a, {
537
537
  ref: n
538
- }), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, c) : null);
538
+ }), /* @__PURE__ */ A(o) ? /* @__PURE__ */ B(o, void 0, i) : null);
539
539
  }
540
- return /* @__PURE__ */ v(q, D({}, a, {
540
+ return /* @__PURE__ */ _(q, D({}, a, {
541
541
  ref: n
542
542
  }), t);
543
543
  });
544
- ie.displayName = "Slot";
544
+ ue.displayName = "Slot";
545
545
  const q = /* @__PURE__ */ S((e, n) => {
546
546
  const { children: t, ...a } = e;
547
547
  return /* @__PURE__ */ A(t) ? /* @__PURE__ */ B(t, {
@@ -550,7 +550,7 @@ const q = /* @__PURE__ */ S((e, n) => {
550
550
  }) : $.count(t) > 1 ? $.only(null) : null;
551
551
  });
552
552
  q.displayName = "SlotClone";
553
- const Je = ({ children: e }) => /* @__PURE__ */ v(Y, null, e);
553
+ const Je = ({ children: e }) => /* @__PURE__ */ _(Y, null, e);
554
554
  function Ye(e) {
555
555
  return /* @__PURE__ */ A(e) && e.type === Je;
556
556
  }
@@ -559,14 +559,14 @@ function Ke(e, n) {
559
559
  ...n
560
560
  };
561
561
  for (const a in n) {
562
- const i = e[a], r = n[a];
563
- /^on[A-Z]/.test(a) ? i && r ? t[a] = (...c) => {
564
- r(...c), i(...c);
565
- } : i && (t[a] = i) : a === "style" ? t[a] = {
566
- ...i,
562
+ const u = e[a], r = n[a];
563
+ /^on[A-Z]/.test(a) ? u && r ? t[a] = (...i) => {
564
+ r(...i), u(...i);
565
+ } : u && (t[a] = u) : a === "style" ? t[a] = {
566
+ ...u,
567
567
  ...r
568
568
  } : a === "className" && (t[a] = [
569
- i,
569
+ u,
570
570
  r
571
571
  ].filter(Boolean).join(" "));
572
572
  }
@@ -592,92 +592,92 @@ const Qe = [
592
592
  "span",
593
593
  "svg",
594
594
  "ul"
595
- ], ce = Qe.reduce((e, n) => {
596
- const t = /* @__PURE__ */ S((a, i) => {
597
- const { asChild: r, ...o } = a, c = r ? ie : n;
595
+ ], ie = Qe.reduce((e, n) => {
596
+ const t = /* @__PURE__ */ S((a, u) => {
597
+ const { asChild: r, ...o } = a, i = r ? ue : n;
598
598
  return C(() => {
599
599
  window[Symbol.for("radix-ui")] = !0;
600
- }, []), /* @__PURE__ */ v(c, D({}, o, {
601
- ref: i
600
+ }, []), /* @__PURE__ */ _(i, D({}, o, {
601
+ ref: u
602
602
  }));
603
603
  });
604
604
  return t.displayName = `Primitive.${n}`, {
605
605
  ...e,
606
606
  [n]: t
607
607
  };
608
- }, {}), ue = "Switch", [er, mr] = qe(ue), [rr, tr] = er(ue), nr = /* @__PURE__ */ S((e, n) => {
609
- const { __scopeSwitch: t, name: a, checked: i, defaultChecked: r, required: o, disabled: c, value: u = "on", onCheckedChange: s, ...g } = e, [l, p] = y(null), f = Te(
608
+ }, {}), ce = "Switch", [er, vr] = qe(ce), [rr, tr] = er(ce), nr = /* @__PURE__ */ S((e, n) => {
609
+ const { __scopeSwitch: t, name: a, checked: u, defaultChecked: r, required: o, disabled: i, value: c = "on", onCheckedChange: s, ...g } = e, [l, p] = y(null), f = Te(
610
610
  n,
611
- (m) => p(m)
612
- ), d = x(!1), b = l ? !!l.closest("form") : !0, [h = !1, _] = We({
613
- prop: i,
611
+ (v) => p(v)
612
+ ), d = x(!1), b = l ? !!l.closest("form") : !0, [h = !1, m] = We({
613
+ prop: u,
614
614
  defaultProp: r,
615
615
  onChange: s
616
616
  });
617
- return /* @__PURE__ */ v(rr, {
617
+ return /* @__PURE__ */ _(rr, {
618
618
  scope: t,
619
619
  checked: h,
620
- disabled: c
621
- }, /* @__PURE__ */ v(ce.button, D({
620
+ disabled: i
621
+ }, /* @__PURE__ */ _(ie.button, D({
622
622
  type: "button",
623
623
  role: "switch",
624
624
  "aria-checked": h,
625
625
  "aria-required": o,
626
626
  "data-state": se(h),
627
- "data-disabled": c ? "" : void 0,
628
- disabled: c,
629
- value: u
627
+ "data-disabled": i ? "" : void 0,
628
+ disabled: i,
629
+ value: c
630
630
  }, g, {
631
631
  ref: f,
632
- onClick: He(e.onClick, (m) => {
633
- _(
632
+ onClick: He(e.onClick, (v) => {
633
+ m(
634
634
  (N) => !N
635
- ), b && (d.current = m.isPropagationStopped(), d.current || m.stopPropagation());
635
+ ), b && (d.current = v.isPropagationStopped(), d.current || v.stopPropagation());
636
636
  })
637
- })), b && /* @__PURE__ */ v(ir, {
637
+ })), b && /* @__PURE__ */ _(ur, {
638
638
  control: l,
639
639
  bubbles: !d.current,
640
640
  name: a,
641
- value: u,
641
+ value: c,
642
642
  checked: h,
643
643
  required: o,
644
- disabled: c,
644
+ disabled: i,
645
645
  style: {
646
646
  transform: "translateX(-100%)"
647
647
  }
648
648
  }));
649
649
  }), or = "SwitchThumb", ar = /* @__PURE__ */ S((e, n) => {
650
- const { __scopeSwitch: t, ...a } = e, i = tr(or, t);
651
- return /* @__PURE__ */ v(ce.span, D({
652
- "data-state": se(i.checked),
653
- "data-disabled": i.disabled ? "" : void 0
650
+ const { __scopeSwitch: t, ...a } = e, u = tr(or, t);
651
+ return /* @__PURE__ */ _(ie.span, D({
652
+ "data-state": se(u.checked),
653
+ "data-disabled": u.disabled ? "" : void 0
654
654
  }, a, {
655
655
  ref: n
656
656
  }));
657
- }), ir = (e) => {
658
- const { control: n, checked: t, bubbles: a = !0, ...i } = e, r = x(null), o = Ve(t), c = Ze(n);
657
+ }), ur = (e) => {
658
+ const { control: n, checked: t, bubbles: a = !0, ...u } = e, r = x(null), o = Ve(t), i = Ze(n);
659
659
  return C(() => {
660
- const u = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
660
+ const c = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
661
661
  if (o !== t && l) {
662
662
  const p = new Event("click", {
663
663
  bubbles: a
664
664
  });
665
- l.call(u, t), u.dispatchEvent(p);
665
+ l.call(c, t), c.dispatchEvent(p);
666
666
  }
667
667
  }, [
668
668
  o,
669
669
  t,
670
670
  a
671
- ]), /* @__PURE__ */ v("input", D({
671
+ ]), /* @__PURE__ */ _("input", D({
672
672
  type: "checkbox",
673
673
  "aria-hidden": !0,
674
674
  defaultChecked: t
675
- }, i, {
675
+ }, u, {
676
676
  tabIndex: -1,
677
677
  ref: r,
678
678
  style: {
679
679
  ...e.style,
680
- ...c,
680
+ ...i,
681
681
  position: "absolute",
682
682
  pointerEvents: "none",
683
683
  opacity: 0,
@@ -688,7 +688,7 @@ const Qe = [
688
688
  function se(e) {
689
689
  return e ? "checked" : "unchecked";
690
690
  }
691
- const cr = nr, ur = ar;
691
+ const ir = nr, cr = ar;
692
692
  function sr(e) {
693
693
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
694
694
  }
@@ -703,8 +703,8 @@ var le = { exports: {} };
703
703
  var n = {}.hasOwnProperty;
704
704
  function t() {
705
705
  for (var r = "", o = 0; o < arguments.length; o++) {
706
- var c = arguments[o];
707
- c && (r = i(r, a(c)));
706
+ var i = arguments[o];
707
+ i && (r = u(r, a(i)));
708
708
  }
709
709
  return r;
710
710
  }
@@ -718,11 +718,11 @@ var le = { exports: {} };
718
718
  if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
719
719
  return r.toString();
720
720
  var o = "";
721
- for (var c in r)
722
- n.call(r, c) && r[c] && (o = i(o, c));
721
+ for (var i in r)
722
+ n.call(r, i) && r[i] && (o = u(o, i));
723
723
  return o;
724
724
  }
725
- function i(r, o) {
725
+ function u(r, o) {
726
726
  return o ? r ? r + " " + o : r + o : r;
727
727
  }
728
728
  e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
@@ -734,22 +734,22 @@ const I = /* @__PURE__ */ sr(lr), V = (e) => e && "touches" in e, pr = ({
734
734
  disabled: n,
735
735
  onStart: t,
736
736
  onDrag: a,
737
- onStop: i,
737
+ onStop: u,
738
738
  bounds: r,
739
739
  position: o,
740
- style: c
740
+ style: i
741
741
  }) => {
742
- const [u, s] = y(void 0), [g, l] = y(void 0), [p, f] = y(!1), d = (_) => {
742
+ const [c, s] = y(void 0), [g, l] = y(void 0), [p, f] = y(!1), d = (m) => {
743
743
  if (!n) {
744
- _.preventDefault();
745
- const m = V(_.nativeEvent) ? _.nativeEvent.touches[0].clientX : _.nativeEvent.clientX;
746
- l(m), t == null || t();
744
+ m.preventDefault();
745
+ const v = V(m.nativeEvent) ? m.nativeEvent.touches[0].clientX : m.nativeEvent.clientX;
746
+ l(v), t == null || t();
747
747
  }
748
748
  }, b = z(
749
- (_) => {
749
+ (m) => {
750
750
  if (typeof g != "number")
751
751
  return;
752
- const N = (V(_) ? _.touches[0].clientX : _.clientX) - g;
752
+ const N = (V(m) ? m.touches[0].clientX : m.clientX) - g;
753
753
  if (!N)
754
754
  return;
755
755
  const E = o + N;
@@ -759,8 +759,8 @@ const I = /* @__PURE__ */ sr(lr), V = (e) => e && "touches" in e, pr = ({
759
759
  },
760
760
  [a, s, p, g]
761
761
  ), h = z(() => {
762
- l(void 0), s(void 0), f(!1), i == null || i();
763
- }, [i, l]);
762
+ l(void 0), s(void 0), f(!1), u == null || u();
763
+ }, [u, l]);
764
764
  return C(() => (window.addEventListener("mousemove", b), window.addEventListener("touchmove", b), () => {
765
765
  window.removeEventListener("mousemove", b), window.removeEventListener("touchmove", b);
766
766
  }), [b]), C(() => (window.addEventListener("mouseup", h), window.addEventListener("touchend", h), () => {
@@ -768,14 +768,14 @@ const I = /* @__PURE__ */ sr(lr), V = (e) => e && "touches" in e, pr = ({
768
768
  }), [h]), A(e) ? B($.only(e), {
769
769
  onMouseDown: d,
770
770
  onTouchStart: d,
771
- style: { ...c, transform: `translateX(${p ? u : o}px)` }
771
+ style: { ...i, transform: `translateX(${p ? c : o}px)` }
772
772
  }) : null;
773
773
  }, G = {
774
774
  width: void 0,
775
775
  height: void 0
776
776
  };
777
777
  function Z(e) {
778
- const { ref: n, box: t = "content-box", round: a } = e, [{ width: i, height: r }, o] = y(G), c = dr(), u = x({ ...G }), s = x(void 0);
778
+ const { ref: n, box: t = "content-box", round: a } = e, [{ width: u, height: r }, o] = y(G), i = dr(), c = x({ ...G }), s = x(void 0);
779
779
  return s.current = e.onResize, C(() => {
780
780
  if (!n.current || typeof window > "u" || !("ResizeObserver" in window))
781
781
  return;
@@ -784,18 +784,18 @@ function Z(e) {
784
784
  // eslint-disable-next-line no-nested-ternary
785
785
  t === "border-box" ? "borderBoxSize" : t === "device-pixel-content-box" ? "devicePixelContentBoxSize" : "contentBoxSize"
786
786
  ), f = J(l, p, "inlineSize"), d = J(l, p, "blockSize");
787
- if (u.current.width !== f || u.current.height !== d) {
787
+ if (c.current.width !== f || c.current.height !== d) {
788
788
  const h = {
789
789
  width: f && a ? Math.round(f) : f,
790
790
  height: d && a ? Math.round(d) : d
791
791
  };
792
- u.current.width = f, u.current.height = d, s.current ? s.current(h) : c() && o(h);
792
+ c.current.width = f, c.current.height = d, s.current ? s.current(h) : i() && o(h);
793
793
  }
794
794
  });
795
795
  return g.observe(n.current, { box: t }), () => {
796
796
  g.disconnect();
797
797
  };
798
- }, [t, n, c, a]), { width: i, height: r };
798
+ }, [t, n, i, a]), { width: u, height: r };
799
799
  }
800
800
  function J(e, n, t) {
801
801
  return e[n] ? Array.isArray(e[n]) ? e[n][0][t] : (
@@ -811,7 +811,7 @@ function dr() {
811
811
  }), []), z(() => e.current, []);
812
812
  }
813
813
  const fr = ({ checked: e, onChange: n }) => {
814
- const t = x(null), a = x(null), [i, r] = y(void 0), [o, c] = y(!1), [u, s] = y(0), { height: g = 0 } = Z({ ref: a, round: !0 }), { height: l = 0 } = Z({ ref: t, round: !0 }), p = (l || 0) - g, f = g + p, d = p / 2, b = f / 2, h = typeof i == "number" && (e ? i < b : i > b);
814
+ const t = x(null), a = x(null), [u, r] = y(void 0), [o, i] = y(!1), [c, s] = y(0), { height: g = 0 } = Z({ ref: a, round: !0 }), { height: l = 0 } = Z({ ref: t, round: !0 }), p = (l || 0) - g, f = g + p, d = p / 2, b = f / 2, h = typeof u == "number" && (e ? u < b : u > b);
815
815
  return {
816
816
  trackRef: t,
817
817
  thumbRef: a,
@@ -819,13 +819,13 @@ const fr = ({ checked: e, onChange: n }) => {
819
819
  bounds: { left: d, right: f },
820
820
  position: e ? f : d,
821
821
  onDrag: ({ x: E }) => {
822
- r(E), Math.abs((e ? f : d) - E) > 2 && c(!0);
822
+ r(E), Math.abs((e ? f : d) - E) > 2 && i(!0);
823
823
  },
824
824
  onStop: () => {
825
- c(!1), o && s(Date.now()), h && (n == null || n(!e));
825
+ i(!1), o && s(Date.now()), h && (n == null || n(!e));
826
826
  },
827
827
  onChangeWithDrag: () => {
828
- Date.now() - u > 50 && (n == null || n(!e)), r(void 0);
828
+ Date.now() - c > 50 && (n == null || n(!e)), r(void 0);
829
829
  }
830
830
  };
831
831
  }, P = {
@@ -843,40 +843,40 @@ const fr = ({ checked: e, onChange: n }) => {
843
843
  className: n,
844
844
  label: t,
845
845
  onChange: a,
846
- labelPosition: i = "right",
846
+ labelPosition: u = "right",
847
847
  checked: r,
848
848
  disableDrag: o,
849
- defaultChecked: c,
850
- ...u
849
+ defaultChecked: i,
850
+ ...c
851
851
  }, s) => {
852
852
  const [g, l] = y(
853
- typeof r == "boolean" ? r : !!c
854
- ), p = !!(typeof r == "boolean" ? r : g), { thumbRef: f, trackRef: d, isDragging: b, onChangeWithDrag: h, ..._ } = fr({
853
+ typeof r == "boolean" ? r : !!i
854
+ ), p = !!(typeof r == "boolean" ? r : g), { thumbRef: f, trackRef: d, isDragging: b, onChangeWithDrag: h, ...m } = fr({
855
855
  checked: p,
856
856
  onChange: (N) => {
857
- u.disabled || (a == null || a(N), l(N));
857
+ c.disabled || (a == null || a(N), l(N));
858
858
  }
859
- }), m = () => /* @__PURE__ */ w(
859
+ }), v = () => /* @__PURE__ */ w(
860
860
  ze,
861
861
  {
862
- htmlFor: u.id,
862
+ htmlFor: c.id,
863
863
  "data-testid": e && `${e}-label`,
864
- disabled: u.disabled,
864
+ disabled: c.disabled,
865
865
  className: I(
866
866
  P[`${k}__label`],
867
- P[`${k}__label--${i}`]
867
+ P[`${k}__label--${u}`]
868
868
  ),
869
- children: /* @__PURE__ */ w(ne, { variant: "paragraph-100", disabled: u.disabled, children: t })
869
+ children: /* @__PURE__ */ w(ne, { variant: "paragraph-100", disabled: c.disabled, children: t })
870
870
  }
871
871
  );
872
872
  return /* @__PURE__ */ F("div", { className: I([n, P[`${k}__container`]]), children: [
873
- t && i === "left" && m(),
873
+ t && u === "left" && v(),
874
874
  /* @__PURE__ */ w(
875
- cr,
875
+ ir,
876
876
  {
877
- ...u,
877
+ ...c,
878
878
  ref: s,
879
- id: u.id,
879
+ id: c.id,
880
880
  "data-testid": e,
881
881
  className: P[k],
882
882
  onCheckedChange: h,
@@ -886,12 +886,12 @@ const fr = ({ checked: e, onChange: n }) => {
886
886
  Q,
887
887
  {
888
888
  className: P[`${k}__checkmark`],
889
- svg: ve,
889
+ svg: _e,
890
890
  size: "xxs"
891
891
  }
892
892
  ) }),
893
- /* @__PURE__ */ w(pr, { disabled: o, ..._, children: /* @__PURE__ */ w(
894
- ur,
893
+ /* @__PURE__ */ w(pr, { disabled: o, ...m, children: /* @__PURE__ */ w(
894
+ cr,
895
895
  {
896
896
  ref: f,
897
897
  "data-testid": e && `${e}-thumb`,
@@ -906,7 +906,7 @@ const fr = ({ checked: e, onChange: n }) => {
906
906
  ] })
907
907
  }
908
908
  ),
909
- t && i === "right" && m()
909
+ t && u === "right" && v()
910
910
  ] });
911
911
  }, gr = S(hr);
912
912
  gr.displayName = "Toggle";