@purpurds/toggle 4.4.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/toggle.es.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx as x, jsxs as G } from "react/jsx-runtime";
2
- import { forwardRef as w, Children as y, isValidElement as k, createElement as _, cloneElement as L, useEffect as A, Fragment as ee, useCallback as X, createContext as Z, useMemo as R, useContext as fe, useRef as D, useState as $, useLayoutEffect as te } from "react";
2
+ import { forwardRef as w, Children as y, isValidElement as k, createElement as _, cloneElement as X, useEffect as A, Fragment as ee, useCallback as B, createContext as Z, useMemo as R, useContext as fe, useRef as D, useState as $, useLayoutEffect as re } from "react";
3
3
  import "react-dom";
4
4
  function ge(e) {
5
5
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
6
6
  }
7
- var re = { exports: {} };
7
+ var te = { exports: {} };
8
8
  /*!
9
9
  Copyright (c) 2018 Jed Watson.
10
10
  Licensed under the MIT License (MIT), see
@@ -13,34 +13,34 @@ var re = { exports: {} };
13
13
  (function(e) {
14
14
  (function() {
15
15
  var n = {}.hasOwnProperty;
16
- function r() {
17
- for (var t = "", a = 0; a < arguments.length; a++) {
16
+ function t() {
17
+ for (var r = "", a = 0; a < arguments.length; a++) {
18
18
  var u = arguments[a];
19
- u && (t = c(t, o.call(this, u)));
19
+ u && (r = c(r, o.call(this, u)));
20
20
  }
21
- return t;
21
+ return r;
22
22
  }
23
- function o(t) {
24
- if (typeof t == "string" || typeof t == "number")
25
- return this && this[t] || t;
26
- if (typeof t != "object")
23
+ function o(r) {
24
+ if (typeof r == "string" || typeof r == "number")
25
+ return this && this[r] || r;
26
+ if (typeof r != "object")
27
27
  return "";
28
- if (Array.isArray(t))
29
- return r.apply(this, t);
30
- if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
31
- return t.toString();
28
+ if (Array.isArray(r))
29
+ return t.apply(this, r);
30
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
31
+ return r.toString();
32
32
  var a = "";
33
- for (var u in t)
34
- n.call(t, u) && t[u] && (a = c(a, this && this[u] || u));
33
+ for (var u in r)
34
+ n.call(r, u) && r[u] && (a = c(a, this && this[u] || u));
35
35
  return a;
36
36
  }
37
- function c(t, a) {
38
- return a ? t ? t + " " + a : t + a : t;
37
+ function c(r, a) {
38
+ return a ? r ? r + " " + a : r + a : r;
39
39
  }
40
- e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
40
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
41
41
  })();
42
- })(re);
43
- var he = re.exports;
42
+ })(te);
43
+ var he = te.exports;
44
44
  const be = /* @__PURE__ */ ge(he), _e = {
45
45
  "purpur-icon": "_purpur-icon_8u1lq_1",
46
46
  "purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
@@ -55,83 +55,83 @@ const be = /* @__PURE__ */ ge(he), _e = {
55
55
  keywords: ["checkmark-bold"],
56
56
  category: "utility"
57
57
  }, me = be.bind(_e), J = "purpur-icon", $e = "md", ye = (e) => e.filter((n) => Object.keys(n).length >= 1).map((n) => `${n.name}="${n.value}"`).join(" "), xe = ({ content: e = "", title: n } = {}) => {
58
- const r = [
58
+ const t = [
59
59
  { name: "xmlns", value: "http://www.w3.org/2000/svg" },
60
60
  { name: "fill", value: "currentColor" },
61
61
  { name: "viewBox", value: "0 0 24 24" },
62
62
  n ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
63
63
  ], o = n ? `<title>${n}</title>` : "";
64
- return `<svg ${ye(r)}>${o}${e}</svg>`;
64
+ return `<svg ${ye(t)}>${o}${e}</svg>`;
65
65
  }, we = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Se = ({
66
66
  ["data-testid"]: e,
67
67
  svg: n,
68
- allyTitle: r,
68
+ allyTitle: t,
69
69
  className: o = "",
70
70
  size: c = $e,
71
- ...t
71
+ ...r
72
72
  }) => {
73
73
  const a = xe({
74
74
  content: we(n.svg),
75
- title: r
75
+ title: t
76
76
  }), u = me(o, J, `${J}--${c}`);
77
77
  return /* @__PURE__ */ x(
78
78
  "span",
79
79
  {
80
- "aria-label": r,
80
+ "aria-label": t,
81
81
  className: u,
82
82
  "data-testid": e,
83
83
  dangerouslySetInnerHTML: { __html: a },
84
- ...t
84
+ ...r
85
85
  }
86
86
  );
87
87
  };
88
88
  function q() {
89
89
  return q = Object.assign ? Object.assign.bind() : function(e) {
90
90
  for (var n = 1; n < arguments.length; n++) {
91
- var r = arguments[n];
92
- for (var o in r)
93
- Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
91
+ var t = arguments[n];
92
+ for (var o in t)
93
+ Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
94
94
  }
95
95
  return e;
96
96
  }, q.apply(this, arguments);
97
97
  }
98
- function z() {
99
- return z = Object.assign ? Object.assign.bind() : function(e) {
98
+ function M() {
99
+ return M = Object.assign ? Object.assign.bind() : function(e) {
100
100
  for (var n = 1; n < arguments.length; n++) {
101
- var r = arguments[n];
102
- for (var o in r)
103
- Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
101
+ var t = arguments[n];
102
+ for (var o in t)
103
+ Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
104
104
  }
105
105
  return e;
106
- }, z.apply(this, arguments);
106
+ }, M.apply(this, arguments);
107
107
  }
108
108
  function Pe(e, n) {
109
109
  typeof e == "function" ? e(n) : e != null && (e.current = n);
110
110
  }
111
111
  function ke(...e) {
112
112
  return (n) => e.forEach(
113
- (r) => Pe(r, n)
113
+ (t) => Pe(t, n)
114
114
  );
115
115
  }
116
116
  const ne = /* @__PURE__ */ w((e, n) => {
117
- const { children: r, ...o } = e, c = y.toArray(r), t = c.find(Ae);
118
- if (t) {
119
- const a = t.props.children, u = c.map((i) => i === t ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
120
- return /* @__PURE__ */ _(F, z({}, o, {
117
+ const { children: t, ...o } = e, c = y.toArray(t), r = c.find(Ae);
118
+ if (r) {
119
+ const a = r.props.children, u = c.map((i) => i === r ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
120
+ return /* @__PURE__ */ _(F, M({}, o, {
121
121
  ref: n
122
- }), /* @__PURE__ */ k(a) ? /* @__PURE__ */ L(a, void 0, u) : null);
122
+ }), /* @__PURE__ */ k(a) ? /* @__PURE__ */ X(a, void 0, u) : null);
123
123
  }
124
- return /* @__PURE__ */ _(F, z({}, o, {
124
+ return /* @__PURE__ */ _(F, M({}, o, {
125
125
  ref: n
126
- }), r);
126
+ }), t);
127
127
  });
128
128
  ne.displayName = "Slot";
129
129
  const F = /* @__PURE__ */ w((e, n) => {
130
- const { children: r, ...o } = e;
131
- return /* @__PURE__ */ k(r) ? /* @__PURE__ */ L(r, {
132
- ...De(o, r.props),
133
- ref: n ? ke(n, r.ref) : r.ref
134
- }) : y.count(r) > 1 ? y.only(null) : null;
130
+ const { children: t, ...o } = e;
131
+ return /* @__PURE__ */ k(t) ? /* @__PURE__ */ X(t, {
132
+ ...De(o, t.props),
133
+ ref: n ? ke(n, t.ref) : t.ref
134
+ }) : y.count(t) > 1 ? y.only(null) : null;
135
135
  });
136
136
  F.displayName = "SlotClone";
137
137
  const Oe = ({ children: e }) => /* @__PURE__ */ _(ee, null, e);
@@ -139,24 +139,24 @@ function Ae(e) {
139
139
  return /* @__PURE__ */ k(e) && e.type === Oe;
140
140
  }
141
141
  function De(e, n) {
142
- const r = {
142
+ const t = {
143
143
  ...n
144
144
  };
145
145
  for (const o in n) {
146
- const c = e[o], t = n[o];
147
- /^on[A-Z]/.test(o) ? c && t ? r[o] = (...a) => {
148
- t(...a), c(...a);
149
- } : c && (r[o] = c) : o === "style" ? r[o] = {
146
+ const c = e[o], r = n[o];
147
+ /^on[A-Z]/.test(o) ? c && r ? t[o] = (...a) => {
148
+ r(...a), c(...a);
149
+ } : c && (t[o] = c) : o === "style" ? t[o] = {
150
150
  ...c,
151
- ...t
152
- } : o === "className" && (r[o] = [
151
+ ...r
152
+ } : o === "className" && (t[o] = [
153
153
  c,
154
- t
154
+ r
155
155
  ].filter(Boolean).join(" "));
156
156
  }
157
157
  return {
158
158
  ...e,
159
- ...r
159
+ ...t
160
160
  };
161
161
  }
162
162
  const Ce = [
@@ -177,23 +177,23 @@ const Ce = [
177
177
  "svg",
178
178
  "ul"
179
179
  ], Ee = Ce.reduce((e, n) => {
180
- const r = /* @__PURE__ */ w((o, c) => {
181
- const { asChild: t, ...a } = o, u = t ? ne : n;
180
+ const t = /* @__PURE__ */ w((o, c) => {
181
+ const { asChild: r, ...a } = o, u = r ? ne : n;
182
182
  return A(() => {
183
183
  window[Symbol.for("radix-ui")] = !0;
184
- }, []), /* @__PURE__ */ _(u, z({}, a, {
184
+ }, []), /* @__PURE__ */ _(u, M({}, a, {
185
185
  ref: c
186
186
  }));
187
187
  });
188
- return r.displayName = `Primitive.${n}`, {
188
+ return t.displayName = `Primitive.${n}`, {
189
189
  ...e,
190
- [n]: r
190
+ [n]: t
191
191
  };
192
192
  }, {}), Ne = /* @__PURE__ */ w((e, n) => /* @__PURE__ */ _(Ee.label, q({}, e, {
193
193
  ref: n,
194
- onMouseDown: (r) => {
194
+ onMouseDown: (t) => {
195
195
  var o;
196
- (o = e.onMouseDown) === null || o === void 0 || o.call(e, r), !r.defaultPrevented && r.detail > 1 && r.preventDefault();
196
+ (o = e.onMouseDown) === null || o === void 0 || o.call(e, t), !t.defaultPrevented && t.detail > 1 && t.preventDefault();
197
197
  }
198
198
  }))), je = Ne;
199
199
  function Re(e) {
@@ -208,53 +208,53 @@ var oe = { exports: {} };
208
208
  (function(e) {
209
209
  (function() {
210
210
  var n = {}.hasOwnProperty;
211
- function r() {
212
- for (var t = "", a = 0; a < arguments.length; a++) {
211
+ function t() {
212
+ for (var r = "", a = 0; a < arguments.length; a++) {
213
213
  var u = arguments[a];
214
- u && (t = c(t, o(u)));
214
+ u && (r = c(r, o(u)));
215
215
  }
216
- return t;
216
+ return r;
217
217
  }
218
- function o(t) {
219
- if (typeof t == "string" || typeof t == "number")
220
- return t;
221
- if (typeof t != "object")
218
+ function o(r) {
219
+ if (typeof r == "string" || typeof r == "number")
220
+ return r;
221
+ if (typeof r != "object")
222
222
  return "";
223
- if (Array.isArray(t))
224
- return r.apply(null, t);
225
- if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
226
- return t.toString();
223
+ if (Array.isArray(r))
224
+ return t.apply(null, r);
225
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
226
+ return r.toString();
227
227
  var a = "";
228
- for (var u in t)
229
- n.call(t, u) && t[u] && (a = c(a, u));
228
+ for (var u in r)
229
+ n.call(r, u) && r[u] && (a = c(a, u));
230
230
  return a;
231
231
  }
232
- function c(t, a) {
233
- return a ? t ? t + " " + a : t + a : t;
232
+ function c(r, a) {
233
+ return a ? r ? r + " " + a : r + a : r;
234
234
  }
235
- e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
235
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
236
236
  })();
237
237
  })(oe);
238
- var ze = oe.exports;
239
- const Me = /* @__PURE__ */ Re(ze), K = {
240
- "purpur-label": "_purpur-label_1jub8_1",
241
- "purpur-label--disabled": "_purpur-label--disabled_1jub8_9"
242
- }, Q = "purpur-label", He = ({
238
+ var Me = oe.exports;
239
+ const He = /* @__PURE__ */ Re(Me), K = {
240
+ "purpur-label": "_purpur-label_1tkut_1",
241
+ "purpur-label--disabled": "_purpur-label--disabled_1tkut_9"
242
+ }, Q = "purpur-label", Le = ({
243
243
  children: e,
244
244
  className: n,
245
- htmlFor: r,
245
+ htmlFor: t,
246
246
  "data-testid": o,
247
247
  disabled: c,
248
- ...t
248
+ ...r
249
249
  }) => {
250
- const a = Me([
250
+ const a = He([
251
251
  n,
252
252
  K[Q],
253
253
  { [K[`${Q}--disabled`]]: c }
254
254
  ]);
255
- return /* @__PURE__ */ x(je, { className: a, "data-testid": o, htmlFor: r, ...t, children: e });
255
+ return /* @__PURE__ */ x(je, { className: a, "data-testid": o, htmlFor: t, ...r, children: e });
256
256
  };
257
- function Le(e) {
257
+ function Xe(e) {
258
258
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
259
259
  }
260
260
  var ae = { exports: {} };
@@ -266,50 +266,50 @@ var ae = { exports: {} };
266
266
  (function(e) {
267
267
  (function() {
268
268
  var n = {}.hasOwnProperty;
269
- function r() {
270
- for (var t = "", a = 0; a < arguments.length; a++) {
269
+ function t() {
270
+ for (var r = "", a = 0; a < arguments.length; a++) {
271
271
  var u = arguments[a];
272
- u && (t = c(t, o(u)));
272
+ u && (r = c(r, o(u)));
273
273
  }
274
- return t;
274
+ return r;
275
275
  }
276
- function o(t) {
277
- if (typeof t == "string" || typeof t == "number")
278
- return t;
279
- if (typeof t != "object")
276
+ function o(r) {
277
+ if (typeof r == "string" || typeof r == "number")
278
+ return r;
279
+ if (typeof r != "object")
280
280
  return "";
281
- if (Array.isArray(t))
282
- return r.apply(null, t);
283
- if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
284
- return t.toString();
281
+ if (Array.isArray(r))
282
+ return t.apply(null, r);
283
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
284
+ return r.toString();
285
285
  var a = "";
286
- for (var u in t)
287
- n.call(t, u) && t[u] && (a = c(a, u));
286
+ for (var u in r)
287
+ n.call(r, u) && r[u] && (a = c(a, u));
288
288
  return a;
289
289
  }
290
- function c(t, a) {
291
- return a ? t ? t + " " + a : t + a : t;
290
+ function c(r, a) {
291
+ return a ? r ? r + " " + a : r + a : r;
292
292
  }
293
- e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
293
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
294
294
  })();
295
295
  })(ae);
296
- var Xe = ae.exports;
297
- const Be = /* @__PURE__ */ Le(Xe), N = {
298
- "purpur-paragraph": "_purpur-paragraph_15yuz_1",
299
- "purpur-paragraph--disabled": "_purpur-paragraph--disabled_15yuz_7",
300
- "purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_15yuz_10",
301
- "purpur-paragraph--negative": "_purpur-paragraph--negative_15yuz_13",
302
- "purpur-paragraph--paragraph-100": "_purpur-paragraph--paragraph-100_15yuz_16",
303
- "purpur-paragraph--paragraph-100-medium": "_purpur-paragraph--paragraph-100-medium_15yuz_22",
304
- "purpur-paragraph--paragraph-100-bold": "_purpur-paragraph--paragraph-100-bold_15yuz_29",
305
- "purpur-paragraph--paragraph-200": "_purpur-paragraph--paragraph-200_15yuz_36",
306
- "purpur-paragraph--preamble-100": "_purpur-paragraph--preamble-100_15yuz_42",
307
- "purpur-paragraph--preamble-200": "_purpur-paragraph--preamble-200_15yuz_48",
308
- "purpur-paragraph--additional-100": "_purpur-paragraph--additional-100_15yuz_54",
309
- "purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_15yuz_60",
310
- "purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_15yuz_67",
311
- "purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_15yuz_75"
312
- }, Te = {
296
+ var Be = ae.exports;
297
+ const Te = /* @__PURE__ */ Xe(Be), N = {
298
+ "purpur-paragraph": "_purpur-paragraph_1rh57_1",
299
+ "purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
300
+ "purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
301
+ "purpur-paragraph--negative": "_purpur-paragraph--negative_1rh57_13",
302
+ "purpur-paragraph--paragraph-100": "_purpur-paragraph--paragraph-100_1rh57_16",
303
+ "purpur-paragraph--paragraph-100-medium": "_purpur-paragraph--paragraph-100-medium_1rh57_22",
304
+ "purpur-paragraph--paragraph-100-bold": "_purpur-paragraph--paragraph-100-bold_1rh57_29",
305
+ "purpur-paragraph--paragraph-200": "_purpur-paragraph--paragraph-200_1rh57_36",
306
+ "purpur-paragraph--preamble-100": "_purpur-paragraph--preamble-100_1rh57_42",
307
+ "purpur-paragraph--preamble-200": "_purpur-paragraph--preamble-200_1rh57_48",
308
+ "purpur-paragraph--additional-100": "_purpur-paragraph--additional-100_1rh57_54",
309
+ "purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_1rh57_60",
310
+ "purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
311
+ "purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
312
+ }, ze = {
313
313
  PARAGRAPH100: "paragraph-100",
314
314
  PARAGRAPH100MEDIUM: "paragraph-100-medium",
315
315
  PARAGRAPH100BOLD: "paragraph-100-bold",
@@ -323,38 +323,38 @@ const Be = /* @__PURE__ */ Le(Xe), N = {
323
323
  }, j = "purpur-paragraph", Ie = ({
324
324
  ["data-testid"]: e,
325
325
  children: n,
326
- className: r = "",
326
+ className: t = "",
327
327
  disabled: o,
328
328
  enableHyphenation: c = !1,
329
- negative: t = !1,
330
- variant: a = Te.PARAGRAPH100,
329
+ negative: r = !1,
330
+ variant: a = ze.PARAGRAPH100,
331
331
  ...u
332
332
  }) => {
333
- const i = Be([
334
- r,
333
+ const i = Te([
334
+ t,
335
335
  N[j],
336
336
  N[`${j}--${a}`],
337
337
  {
338
338
  [N[`${j}--hyphens`]]: c,
339
339
  [N[`${j}--disabled`]]: o,
340
- [N[`${j}--negative`]]: t
340
+ [N[`${j}--negative`]]: r
341
341
  }
342
342
  ]);
343
343
  return /* @__PURE__ */ x("p", { ...u, className: i, "data-testid": e, children: n });
344
344
  };
345
- function M() {
346
- return M = Object.assign ? Object.assign.bind() : function(e) {
345
+ function H() {
346
+ return H = Object.assign ? Object.assign.bind() : function(e) {
347
347
  for (var n = 1; n < arguments.length; n++) {
348
- var r = arguments[n];
349
- for (var o in r)
350
- Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
348
+ var t = arguments[n];
349
+ for (var o in t)
350
+ Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
351
351
  }
352
352
  return e;
353
- }, M.apply(this, arguments);
353
+ }, H.apply(this, arguments);
354
354
  }
355
- function qe(e, n, { checkForDefaultPrevented: r = !0 } = {}) {
355
+ function qe(e, n, { checkForDefaultPrevented: t = !0 } = {}) {
356
356
  return function(c) {
357
- if (e == null || e(c), r === !1 || !c.defaultPrevented)
357
+ if (e == null || e(c), t === !1 || !c.defaultPrevented)
358
358
  return n == null ? void 0 : n(c);
359
359
  };
360
360
  }
@@ -363,18 +363,18 @@ function Fe(e, n) {
363
363
  }
364
364
  function ce(...e) {
365
365
  return (n) => e.forEach(
366
- (r) => Fe(r, n)
366
+ (t) => Fe(t, n)
367
367
  );
368
368
  }
369
369
  function Ve(...e) {
370
- return X(ce(...e), e);
370
+ return B(ce(...e), e);
371
371
  }
372
372
  function Ue(e, n = []) {
373
- let r = [];
374
- function o(t, a) {
375
- const u = /* @__PURE__ */ Z(a), i = r.length;
376
- r = [
377
- ...r,
373
+ let t = [];
374
+ function o(r, a) {
375
+ const u = /* @__PURE__ */ Z(a), i = t.length;
376
+ t = [
377
+ ...t,
378
378
  a
379
379
  ];
380
380
  function s(l) {
@@ -392,17 +392,17 @@ function Ue(e, n = []) {
392
392
  return f;
393
393
  if (a !== void 0)
394
394
  return a;
395
- throw new Error(`\`${l}\` must be used within \`${t}\``);
395
+ throw new Error(`\`${l}\` must be used within \`${r}\``);
396
396
  }
397
- return s.displayName = t + "Provider", [
397
+ return s.displayName = r + "Provider", [
398
398
  s,
399
399
  h
400
400
  ];
401
401
  }
402
402
  const c = () => {
403
- const t = r.map((a) => /* @__PURE__ */ Z(a));
403
+ const r = t.map((a) => /* @__PURE__ */ Z(a));
404
404
  return function(u) {
405
- const i = (u == null ? void 0 : u[e]) || t;
405
+ const i = (u == null ? void 0 : u[e]) || r;
406
406
  return R(
407
407
  () => ({
408
408
  [`__scope${e}`]: {
@@ -426,16 +426,16 @@ function We(...e) {
426
426
  const n = e[0];
427
427
  if (e.length === 1)
428
428
  return n;
429
- const r = () => {
429
+ const t = () => {
430
430
  const o = e.map(
431
431
  (c) => ({
432
432
  useScope: c(),
433
433
  scopeName: c.scopeName
434
434
  })
435
435
  );
436
- return function(t) {
436
+ return function(r) {
437
437
  const a = o.reduce((u, { useScope: i, scopeName: s }) => {
438
- const l = i(t)[`__scope${s}`];
438
+ const l = i(r)[`__scope${s}`];
439
439
  return {
440
440
  ...u,
441
441
  ...l
@@ -451,33 +451,33 @@ function We(...e) {
451
451
  );
452
452
  };
453
453
  };
454
- return r.scopeName = n.scopeName, r;
454
+ return t.scopeName = n.scopeName, t;
455
455
  }
456
456
  function ue(e) {
457
457
  const n = D(e);
458
458
  return A(() => {
459
459
  n.current = e;
460
460
  }), R(
461
- () => (...r) => {
461
+ () => (...t) => {
462
462
  var o;
463
- return (o = n.current) === null || o === void 0 ? void 0 : o.call(n, ...r);
463
+ return (o = n.current) === null || o === void 0 ? void 0 : o.call(n, ...t);
464
464
  },
465
465
  []
466
466
  );
467
467
  }
468
- function Ge({ prop: e, defaultProp: n, onChange: r = () => {
468
+ function Ge({ prop: e, defaultProp: n, onChange: t = () => {
469
469
  } }) {
470
470
  const [o, c] = Ze({
471
471
  defaultProp: n,
472
- onChange: r
473
- }), t = e !== void 0, a = t ? e : o, u = ue(r), i = X((s) => {
474
- if (t) {
472
+ onChange: t
473
+ }), r = e !== void 0, a = r ? e : o, u = ue(t), i = B((s) => {
474
+ if (r) {
475
475
  const l = typeof s == "function" ? s(e) : s;
476
476
  l !== e && u(l);
477
477
  } else
478
478
  c(s);
479
479
  }, [
480
- t,
480
+ r,
481
481
  e,
482
482
  c,
483
483
  u
@@ -488,14 +488,14 @@ function Ge({ prop: e, defaultProp: n, onChange: r = () => {
488
488
  ];
489
489
  }
490
490
  function Ze({ defaultProp: e, onChange: n }) {
491
- const r = $(e), [o] = r, c = D(o), t = ue(n);
491
+ const t = $(e), [o] = t, c = D(o), r = ue(n);
492
492
  return A(() => {
493
- c.current !== o && (t(o), c.current = o);
493
+ c.current !== o && (r(o), c.current = o);
494
494
  }, [
495
495
  o,
496
496
  c,
497
- t
498
- ]), r;
497
+ r
498
+ ]), t;
499
499
  }
500
500
  function Je(e) {
501
501
  const n = D({
@@ -506,27 +506,27 @@ function Je(e) {
506
506
  e
507
507
  ]);
508
508
  }
509
- const Ke = globalThis != null && globalThis.document ? te : () => {
509
+ const Ke = globalThis != null && globalThis.document ? re : () => {
510
510
  };
511
511
  function Qe(e) {
512
- const [n, r] = $(void 0);
512
+ const [n, t] = $(void 0);
513
513
  return Ke(() => {
514
514
  if (e) {
515
- r({
515
+ t({
516
516
  width: e.offsetWidth,
517
517
  height: e.offsetHeight
518
518
  });
519
519
  const o = new ResizeObserver((c) => {
520
520
  if (!Array.isArray(c) || !c.length)
521
521
  return;
522
- const t = c[0];
522
+ const r = c[0];
523
523
  let a, u;
524
- if ("borderBoxSize" in t) {
525
- const i = t.borderBoxSize, s = Array.isArray(i) ? i[0] : i;
524
+ if ("borderBoxSize" in r) {
525
+ const i = r.borderBoxSize, s = Array.isArray(i) ? i[0] : i;
526
526
  a = s.inlineSize, u = s.blockSize;
527
527
  } else
528
528
  a = e.offsetWidth, u = e.offsetHeight;
529
- r({
529
+ t({
530
530
  width: a,
531
531
  height: u
532
532
  });
@@ -535,68 +535,68 @@ function Qe(e) {
535
535
  box: "border-box"
536
536
  }), () => o.unobserve(e);
537
537
  } else
538
- r(void 0);
538
+ t(void 0);
539
539
  }, [
540
540
  e
541
541
  ]), n;
542
542
  }
543
- function H() {
544
- return H = Object.assign ? Object.assign.bind() : function(e) {
543
+ function L() {
544
+ return L = Object.assign ? Object.assign.bind() : function(e) {
545
545
  for (var n = 1; n < arguments.length; n++) {
546
- var r = arguments[n];
547
- for (var o in r)
548
- Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
546
+ var t = arguments[n];
547
+ for (var o in t)
548
+ Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
549
549
  }
550
550
  return e;
551
- }, H.apply(this, arguments);
551
+ }, L.apply(this, arguments);
552
552
  }
553
553
  const ie = /* @__PURE__ */ w((e, n) => {
554
- const { children: r, ...o } = e, c = y.toArray(r), t = c.find(et);
555
- if (t) {
556
- const a = t.props.children, u = c.map((i) => i === t ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
557
- return /* @__PURE__ */ _(V, H({}, o, {
554
+ const { children: t, ...o } = e, c = y.toArray(t), r = c.find(er);
555
+ if (r) {
556
+ const a = r.props.children, u = c.map((i) => i === r ? y.count(a) > 1 ? y.only(null) : /* @__PURE__ */ k(a) ? a.props.children : null : i);
557
+ return /* @__PURE__ */ _(V, L({}, o, {
558
558
  ref: n
559
- }), /* @__PURE__ */ k(a) ? /* @__PURE__ */ L(a, void 0, u) : null);
559
+ }), /* @__PURE__ */ k(a) ? /* @__PURE__ */ X(a, void 0, u) : null);
560
560
  }
561
- return /* @__PURE__ */ _(V, H({}, o, {
561
+ return /* @__PURE__ */ _(V, L({}, o, {
562
562
  ref: n
563
- }), r);
563
+ }), t);
564
564
  });
565
565
  ie.displayName = "Slot";
566
566
  const V = /* @__PURE__ */ w((e, n) => {
567
- const { children: r, ...o } = e;
568
- return /* @__PURE__ */ k(r) ? /* @__PURE__ */ L(r, {
569
- ...tt(o, r.props),
570
- ref: n ? ce(n, r.ref) : r.ref
571
- }) : y.count(r) > 1 ? y.only(null) : null;
567
+ const { children: t, ...o } = e;
568
+ return /* @__PURE__ */ k(t) ? /* @__PURE__ */ X(t, {
569
+ ...rr(o, t.props),
570
+ ref: n ? ce(n, t.ref) : t.ref
571
+ }) : y.count(t) > 1 ? y.only(null) : null;
572
572
  });
573
573
  V.displayName = "SlotClone";
574
574
  const Ye = ({ children: e }) => /* @__PURE__ */ _(ee, null, e);
575
- function et(e) {
575
+ function er(e) {
576
576
  return /* @__PURE__ */ k(e) && e.type === Ye;
577
577
  }
578
- function tt(e, n) {
579
- const r = {
578
+ function rr(e, n) {
579
+ const t = {
580
580
  ...n
581
581
  };
582
582
  for (const o in n) {
583
- const c = e[o], t = n[o];
584
- /^on[A-Z]/.test(o) ? c && t ? r[o] = (...u) => {
585
- t(...u), c(...u);
586
- } : c && (r[o] = c) : o === "style" ? r[o] = {
583
+ const c = e[o], r = n[o];
584
+ /^on[A-Z]/.test(o) ? c && r ? t[o] = (...u) => {
585
+ r(...u), c(...u);
586
+ } : c && (t[o] = c) : o === "style" ? t[o] = {
587
587
  ...c,
588
- ...t
589
- } : o === "className" && (r[o] = [
588
+ ...r
589
+ } : o === "className" && (t[o] = [
590
590
  c,
591
- t
591
+ r
592
592
  ].filter(Boolean).join(" "));
593
593
  }
594
594
  return {
595
595
  ...e,
596
- ...r
596
+ ...t
597
597
  };
598
598
  }
599
- const rt = [
599
+ const tr = [
600
600
  "a",
601
601
  "button",
602
602
  "div",
@@ -613,33 +613,33 @@ const rt = [
613
613
  "span",
614
614
  "svg",
615
615
  "ul"
616
- ], se = rt.reduce((e, n) => {
617
- const r = /* @__PURE__ */ w((o, c) => {
618
- const { asChild: t, ...a } = o, u = t ? ie : n;
616
+ ], se = tr.reduce((e, n) => {
617
+ const t = /* @__PURE__ */ w((o, c) => {
618
+ const { asChild: r, ...a } = o, u = r ? ie : n;
619
619
  return A(() => {
620
620
  window[Symbol.for("radix-ui")] = !0;
621
- }, []), /* @__PURE__ */ _(u, H({}, a, {
621
+ }, []), /* @__PURE__ */ _(u, L({}, a, {
622
622
  ref: c
623
623
  }));
624
624
  });
625
- return r.displayName = `Primitive.${n}`, {
625
+ return t.displayName = `Primitive.${n}`, {
626
626
  ...e,
627
- [n]: r
627
+ [n]: t
628
628
  };
629
- }, {}), le = "Switch", [nt, yt] = Ue(le), [ot, at] = nt(le), ct = /* @__PURE__ */ w((e, n) => {
630
- const { __scopeSwitch: r, name: o, checked: c, defaultChecked: t, required: a, disabled: u, value: i = "on", onCheckedChange: s, ...h } = e, [l, p] = $(null), v = Ve(
629
+ }, {}), le = "Switch", [nr, yr] = Ue(le), [or, ar] = nr(le), cr = /* @__PURE__ */ w((e, n) => {
630
+ const { __scopeSwitch: t, name: o, checked: c, defaultChecked: r, required: a, disabled: u, value: i = "on", onCheckedChange: s, ...h } = e, [l, p] = $(null), v = Ve(
631
631
  n,
632
632
  (m) => p(m)
633
633
  ), f = D(!1), g = l ? !!l.closest("form") : !0, [d = !1, b] = Ge({
634
634
  prop: c,
635
- defaultProp: t,
635
+ defaultProp: r,
636
636
  onChange: s
637
637
  });
638
- return /* @__PURE__ */ _(ot, {
639
- scope: r,
638
+ return /* @__PURE__ */ _(or, {
639
+ scope: t,
640
640
  checked: d,
641
641
  disabled: u
642
- }, /* @__PURE__ */ _(se.button, M({
642
+ }, /* @__PURE__ */ _(se.button, H({
643
643
  type: "button",
644
644
  role: "switch",
645
645
  "aria-checked": d,
@@ -655,7 +655,7 @@ const rt = [
655
655
  (O) => !O
656
656
  ), g && (f.current = m.isPropagationStopped(), f.current || m.stopPropagation());
657
657
  })
658
- })), g && /* @__PURE__ */ _(st, {
658
+ })), g && /* @__PURE__ */ _(sr, {
659
659
  control: l,
660
660
  bubbles: !f.current,
661
661
  name: o,
@@ -667,35 +667,35 @@ const rt = [
667
667
  transform: "translateX(-100%)"
668
668
  }
669
669
  }));
670
- }), ut = "SwitchThumb", it = /* @__PURE__ */ w((e, n) => {
671
- const { __scopeSwitch: r, ...o } = e, c = at(ut, r);
672
- return /* @__PURE__ */ _(se.span, M({
670
+ }), ur = "SwitchThumb", ir = /* @__PURE__ */ w((e, n) => {
671
+ const { __scopeSwitch: t, ...o } = e, c = ar(ur, t);
672
+ return /* @__PURE__ */ _(se.span, H({
673
673
  "data-state": pe(c.checked),
674
674
  "data-disabled": c.disabled ? "" : void 0
675
675
  }, o, {
676
676
  ref: n
677
677
  }));
678
- }), st = (e) => {
679
- const { control: n, checked: r, bubbles: o = !0, ...c } = e, t = D(null), a = Je(r), u = Qe(n);
678
+ }), sr = (e) => {
679
+ const { control: n, checked: t, bubbles: o = !0, ...c } = e, r = D(null), a = Je(t), u = Qe(n);
680
680
  return A(() => {
681
- const i = t.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
682
- if (a !== r && l) {
681
+ const i = r.current, s = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(s, "checked").set;
682
+ if (a !== t && l) {
683
683
  const p = new Event("click", {
684
684
  bubbles: o
685
685
  });
686
- l.call(i, r), i.dispatchEvent(p);
686
+ l.call(i, t), i.dispatchEvent(p);
687
687
  }
688
688
  }, [
689
689
  a,
690
- r,
690
+ t,
691
691
  o
692
- ]), /* @__PURE__ */ _("input", M({
692
+ ]), /* @__PURE__ */ _("input", H({
693
693
  type: "checkbox",
694
694
  "aria-hidden": !0,
695
- defaultChecked: r
695
+ defaultChecked: t
696
696
  }, c, {
697
697
  tabIndex: -1,
698
- ref: t,
698
+ ref: r,
699
699
  style: {
700
700
  ...e.style,
701
701
  ...u,
@@ -709,8 +709,8 @@ const rt = [
709
709
  function pe(e) {
710
710
  return e ? "checked" : "unchecked";
711
711
  }
712
- const lt = ct, pt = it;
713
- function dt(e) {
712
+ const lr = cr, pr = ir;
713
+ function dr(e) {
714
714
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
715
715
  }
716
716
  var de = { exports: {} };
@@ -722,35 +722,35 @@ var de = { exports: {} };
722
722
  (function(e) {
723
723
  (function() {
724
724
  var n = {}.hasOwnProperty;
725
- function r() {
726
- for (var t = "", a = 0; a < arguments.length; a++) {
725
+ function t() {
726
+ for (var r = "", a = 0; a < arguments.length; a++) {
727
727
  var u = arguments[a];
728
- u && (t = c(t, o(u)));
728
+ u && (r = c(r, o(u)));
729
729
  }
730
- return t;
730
+ return r;
731
731
  }
732
- function o(t) {
733
- if (typeof t == "string" || typeof t == "number")
734
- return t;
735
- if (typeof t != "object")
732
+ function o(r) {
733
+ if (typeof r == "string" || typeof r == "number")
734
+ return r;
735
+ if (typeof r != "object")
736
736
  return "";
737
- if (Array.isArray(t))
738
- return r.apply(null, t);
739
- if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
740
- return t.toString();
737
+ if (Array.isArray(r))
738
+ return t.apply(null, r);
739
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
740
+ return r.toString();
741
741
  var a = "";
742
- for (var u in t)
743
- n.call(t, u) && t[u] && (a = c(a, u));
742
+ for (var u in r)
743
+ n.call(r, u) && r[u] && (a = c(a, u));
744
744
  return a;
745
745
  }
746
- function c(t, a) {
747
- return a ? t ? t + " " + a : t + a : t;
746
+ function c(r, a) {
747
+ return a ? r ? r + " " + a : r + a : r;
748
748
  }
749
- e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
749
+ e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
750
750
  })();
751
751
  })(de);
752
- var ft = de.exports;
753
- const I = /* @__PURE__ */ dt(ft), S = {
752
+ var fr = de.exports;
753
+ const I = /* @__PURE__ */ dr(fr), S = {
754
754
  "purpur-toggle": "_purpur-toggle_1xng6_1",
755
755
  "purpur-toggle__track": "_purpur-toggle__track_1xng6_7",
756
756
  "purpur-toggle__checkmark-container": "_purpur-toggle__checkmark-container_1xng6_45",
@@ -760,13 +760,13 @@ const I = /* @__PURE__ */ dt(ft), S = {
760
760
  "purpur-toggle__label--right": "_purpur-toggle__label--right_1xng6_100",
761
761
  "purpur-toggle__label--left": "_purpur-toggle__label--left_1xng6_103",
762
762
  "purpur-toggle__container": "_purpur-toggle__container_1xng6_106"
763
- }, Y = (e) => e && "touches" in e, gt = ({
763
+ }, Y = (e) => e && "touches" in e, gr = ({
764
764
  children: e,
765
765
  disabled: n,
766
- onStart: r,
766
+ onStart: t,
767
767
  onDrag: o,
768
768
  onStop: c,
769
- bounds: t,
769
+ bounds: r,
770
770
  position: a,
771
771
  style: u
772
772
  }) => {
@@ -774,9 +774,9 @@ const I = /* @__PURE__ */ dt(ft), S = {
774
774
  if (!n) {
775
775
  b.preventDefault();
776
776
  const m = Y(b.nativeEvent) ? b.nativeEvent.touches[0].clientX : b.nativeEvent.clientX;
777
- l(m), r == null || r();
777
+ l(m), t == null || t();
778
778
  }
779
- }, g = X(
779
+ }, g = B(
780
780
  (b) => {
781
781
  if (typeof h != "number")
782
782
  return;
@@ -785,66 +785,66 @@ const I = /* @__PURE__ */ dt(ft), S = {
785
785
  return;
786
786
  const C = a + O;
787
787
  !p && Math.abs(C) && v(!0);
788
- const B = C > t.right ? t.right : C < t.left ? t.left : C;
789
- s(B), o == null || o({ x: B });
788
+ const T = C > r.right ? r.right : C < r.left ? r.left : C;
789
+ s(T), o == null || o({ x: T });
790
790
  },
791
791
  [o, s, p, h]
792
- ), d = X(() => {
792
+ ), d = B(() => {
793
793
  l(void 0), s(void 0), v(!1), c == null || c();
794
794
  }, [c, l]);
795
795
  return A(() => (window.addEventListener("mousemove", g), window.addEventListener("touchmove", g), () => {
796
796
  window.removeEventListener("mousemove", g), window.removeEventListener("touchmove", g);
797
797
  }), [g]), A(() => (window.addEventListener("mouseup", d), window.addEventListener("touchend", d), () => {
798
798
  window.removeEventListener("mouseup", d), window.removeEventListener("touchend", d);
799
- }), [d]), k(e) ? L(y.only(e), {
799
+ }), [d]), k(e) ? X(y.only(e), {
800
800
  onMouseDown: f,
801
801
  onTouchStart: f,
802
802
  style: { ...u, transform: `translateX(${p ? i : a}px)` }
803
803
  }) : null;
804
- }, ht = ({ checked: e, onChange: n }) => {
804
+ }, hr = ({ checked: e, onChange: n }) => {
805
805
  var U, W;
806
- const r = D(null), o = D(null), [c, t] = $(void 0), [a, u] = $(!1), [i, s] = $(0), [h, l] = $(0), [p, v] = $(0);
807
- te(() => {
808
- var E, T;
809
- l(((E = o.current) == null ? void 0 : E.clientHeight) || 0), v(((T = r.current) == null ? void 0 : T.clientHeight) || 0);
810
- }, [(U = o.current) == null ? void 0 : U.clientHeight, (W = r.current) == null ? void 0 : W.clientHeight]);
806
+ const t = D(null), o = D(null), [c, r] = $(void 0), [a, u] = $(!1), [i, s] = $(0), [h, l] = $(0), [p, v] = $(0);
807
+ re(() => {
808
+ var E, z;
809
+ l(((E = o.current) == null ? void 0 : E.clientHeight) || 0), v(((z = t.current) == null ? void 0 : z.clientHeight) || 0);
810
+ }, [(U = o.current) == null ? void 0 : U.clientHeight, (W = t.current) == null ? void 0 : W.clientHeight]);
811
811
  const f = (p || 0) - h, g = h + f, d = f / 2, b = g / 2, m = typeof c == "number" && (e ? c < b : c > b);
812
812
  return {
813
- trackRef: r,
813
+ trackRef: t,
814
814
  thumbRef: o,
815
815
  isDragging: a,
816
816
  bounds: { left: d, right: g },
817
817
  position: e ? g : d,
818
818
  onDrag: ({ x: E }) => {
819
- t(E), Math.abs((e ? g : d) - E) > 2 && u(!0);
819
+ r(E), Math.abs((e ? g : d) - E) > 2 && u(!0);
820
820
  },
821
821
  onStop: () => {
822
822
  u(!1), a && s(Date.now()), m && (n == null || n(!e));
823
823
  },
824
824
  onChangeWithDrag: () => {
825
- Date.now() - i > 50 && (n == null || n(!e)), t(void 0);
825
+ Date.now() - i > 50 && (n == null || n(!e)), r(void 0);
826
826
  }
827
827
  };
828
- }, P = "purpur-toggle", bt = ({
828
+ }, P = "purpur-toggle", br = ({
829
829
  ["data-testid"]: e,
830
830
  className: n,
831
- label: r,
831
+ label: t,
832
832
  onChange: o,
833
833
  labelPosition: c = "right",
834
- checked: t,
834
+ checked: r,
835
835
  disableDrag: a,
836
836
  defaultChecked: u,
837
837
  ...i
838
838
  }, s) => {
839
839
  const [h, l] = $(
840
- typeof t == "boolean" ? t : !!u
841
- ), p = !!(typeof t == "boolean" ? t : h), { thumbRef: v, trackRef: f, isDragging: g, onChangeWithDrag: d, ...b } = ht({
840
+ typeof r == "boolean" ? r : !!u
841
+ ), p = !!(typeof r == "boolean" ? r : h), { thumbRef: v, trackRef: f, isDragging: g, onChangeWithDrag: d, ...b } = hr({
842
842
  checked: p,
843
843
  onChange: (O) => {
844
844
  i.disabled || (o == null || o(O), l(O));
845
845
  }
846
846
  }), m = () => /* @__PURE__ */ x(
847
- He,
847
+ Le,
848
848
  {
849
849
  htmlFor: i.id,
850
850
  "data-testid": e && `${e}-label`,
@@ -853,13 +853,13 @@ const I = /* @__PURE__ */ dt(ft), S = {
853
853
  S[`${P}__label`],
854
854
  S[`${P}__label--${c}`]
855
855
  ),
856
- children: /* @__PURE__ */ x(Ie, { variant: "paragraph-100", disabled: i.disabled, children: r })
856
+ children: /* @__PURE__ */ x(Ie, { variant: "paragraph-100", disabled: i.disabled, children: t })
857
857
  }
858
858
  );
859
859
  return /* @__PURE__ */ G("div", { className: I([n, S[`${P}__container`]]), children: [
860
- r && c === "left" && m(),
860
+ t && c === "left" && m(),
861
861
  /* @__PURE__ */ x(
862
- lt,
862
+ lr,
863
863
  {
864
864
  ...i,
865
865
  ref: s,
@@ -877,8 +877,8 @@ const I = /* @__PURE__ */ dt(ft), S = {
877
877
  size: "xxs"
878
878
  }
879
879
  ) }),
880
- /* @__PURE__ */ x(gt, { disabled: a, ...b, children: /* @__PURE__ */ x(
881
- pt,
880
+ /* @__PURE__ */ x(gr, { disabled: a, ...b, children: /* @__PURE__ */ x(
881
+ pr,
882
882
  {
883
883
  ref: v,
884
884
  "data-testid": e && `${e}-thumb`,
@@ -893,11 +893,11 @@ const I = /* @__PURE__ */ dt(ft), S = {
893
893
  ] })
894
894
  }
895
895
  ),
896
- r && c === "right" && m()
896
+ t && c === "right" && m()
897
897
  ] });
898
- }, _t = w(bt);
899
- _t.displayName = "Toggle";
898
+ }, _r = w(br);
899
+ _r.displayName = "Toggle";
900
900
  export {
901
- _t as Toggle
901
+ _r as Toggle
902
902
  };
903
903
  //# sourceMappingURL=toggle.es.js.map