@purpurds/toggle 4.3.0 → 4.4.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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import React from "react";
1
+ import { default as React } from 'react';
2
+
2
3
  export type ToggleProps = {
3
4
  /**
4
5
  * To use when no label is given.
package/dist/toggle.es.js CHANGED
@@ -95,15 +95,15 @@ function q() {
95
95
  return e;
96
96
  }, q.apply(this, arguments);
97
97
  }
98
- function M() {
99
- return M = Object.assign ? Object.assign.bind() : function(e) {
98
+ function z() {
99
+ return z = Object.assign ? Object.assign.bind() : function(e) {
100
100
  for (var n = 1; n < arguments.length; n++) {
101
101
  var r = arguments[n];
102
102
  for (var o in r)
103
103
  Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
104
104
  }
105
105
  return e;
106
- }, M.apply(this, arguments);
106
+ }, z.apply(this, arguments);
107
107
  }
108
108
  function Pe(e, n) {
109
109
  typeof e == "function" ? e(n) : e != null && (e.current = n);
@@ -117,11 +117,11 @@ const ne = /* @__PURE__ */ w((e, n) => {
117
117
  const { children: r, ...o } = e, c = y.toArray(r), t = c.find(Ae);
118
118
  if (t) {
119
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, M({}, o, {
120
+ return /* @__PURE__ */ _(F, z({}, o, {
121
121
  ref: n
122
122
  }), /* @__PURE__ */ k(a) ? /* @__PURE__ */ L(a, void 0, u) : null);
123
123
  }
124
- return /* @__PURE__ */ _(F, M({}, o, {
124
+ return /* @__PURE__ */ _(F, z({}, o, {
125
125
  ref: n
126
126
  }), r);
127
127
  });
@@ -176,12 +176,12 @@ const Ce = [
176
176
  "span",
177
177
  "svg",
178
178
  "ul"
179
- ], Ne = Ce.reduce((e, n) => {
179
+ ], Ee = Ce.reduce((e, n) => {
180
180
  const r = /* @__PURE__ */ w((o, c) => {
181
181
  const { asChild: t, ...a } = o, u = t ? ne : n;
182
182
  return A(() => {
183
183
  window[Symbol.for("radix-ui")] = !0;
184
- }, []), /* @__PURE__ */ _(u, M({}, a, {
184
+ }, []), /* @__PURE__ */ _(u, z({}, a, {
185
185
  ref: c
186
186
  }));
187
187
  });
@@ -189,13 +189,13 @@ const Ce = [
189
189
  ...e,
190
190
  [n]: r
191
191
  };
192
- }, {}), Ee = /* @__PURE__ */ w((e, n) => /* @__PURE__ */ _(Ne.label, q({}, e, {
192
+ }, {}), Ne = /* @__PURE__ */ w((e, n) => /* @__PURE__ */ _(Ee.label, q({}, e, {
193
193
  ref: n,
194
194
  onMouseDown: (r) => {
195
195
  var o;
196
196
  (o = e.onMouseDown) === null || o === void 0 || o.call(e, r), !r.defaultPrevented && r.detail > 1 && r.preventDefault();
197
197
  }
198
- }))), je = Ee;
198
+ }))), je = Ne;
199
199
  function Re(e) {
200
200
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
201
201
  }
@@ -235,8 +235,8 @@ var oe = { exports: {} };
235
235
  e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
236
236
  })();
237
237
  })(oe);
238
- var Me = oe.exports;
239
- const ze = /* @__PURE__ */ Re(Me), K = {
238
+ var ze = oe.exports;
239
+ const Me = /* @__PURE__ */ Re(ze), K = {
240
240
  "purpur-label": "_purpur-label_1jub8_1",
241
241
  "purpur-label--disabled": "_purpur-label--disabled_1jub8_9"
242
242
  }, Q = "purpur-label", He = ({
@@ -247,7 +247,7 @@ const ze = /* @__PURE__ */ Re(Me), K = {
247
247
  disabled: c,
248
248
  ...t
249
249
  }) => {
250
- const a = ze([
250
+ const a = Me([
251
251
  n,
252
252
  K[Q],
253
253
  { [K[`${Q}--disabled`]]: c }
@@ -294,7 +294,7 @@ var ae = { exports: {} };
294
294
  })();
295
295
  })(ae);
296
296
  var Xe = ae.exports;
297
- const Be = /* @__PURE__ */ Le(Xe), E = {
297
+ const Be = /* @__PURE__ */ Le(Xe), N = {
298
298
  "purpur-paragraph": "_purpur-paragraph_15yuz_1",
299
299
  "purpur-paragraph--disabled": "_purpur-paragraph--disabled_15yuz_7",
300
300
  "purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_15yuz_10",
@@ -332,25 +332,25 @@ const Be = /* @__PURE__ */ Le(Xe), E = {
332
332
  }) => {
333
333
  const i = Be([
334
334
  r,
335
- E[j],
336
- E[`${j}--${a}`],
335
+ N[j],
336
+ N[`${j}--${a}`],
337
337
  {
338
- [E[`${j}--hyphens`]]: c,
339
- [E[`${j}--disabled`]]: o,
340
- [E[`${j}--negative`]]: t
338
+ [N[`${j}--hyphens`]]: c,
339
+ [N[`${j}--disabled`]]: o,
340
+ [N[`${j}--negative`]]: t
341
341
  }
342
342
  ]);
343
343
  return /* @__PURE__ */ x("p", { ...u, className: i, "data-testid": e, children: n });
344
344
  };
345
- function z() {
346
- return z = Object.assign ? Object.assign.bind() : function(e) {
345
+ function M() {
346
+ return M = Object.assign ? Object.assign.bind() : function(e) {
347
347
  for (var n = 1; n < arguments.length; n++) {
348
348
  var r = arguments[n];
349
349
  for (var o in r)
350
350
  Object.prototype.hasOwnProperty.call(r, o) && (e[o] = r[o]);
351
351
  }
352
352
  return e;
353
- }, z.apply(this, arguments);
353
+ }, M.apply(this, arguments);
354
354
  }
355
355
  function qe(e, n, { checkForDefaultPrevented: r = !0 } = {}) {
356
356
  return function(c) {
@@ -639,7 +639,7 @@ const rt = [
639
639
  scope: r,
640
640
  checked: d,
641
641
  disabled: u
642
- }, /* @__PURE__ */ _(se.button, z({
642
+ }, /* @__PURE__ */ _(se.button, M({
643
643
  type: "button",
644
644
  role: "switch",
645
645
  "aria-checked": d,
@@ -669,7 +669,7 @@ const rt = [
669
669
  }));
670
670
  }), ut = "SwitchThumb", it = /* @__PURE__ */ w((e, n) => {
671
671
  const { __scopeSwitch: r, ...o } = e, c = at(ut, r);
672
- return /* @__PURE__ */ _(se.span, z({
672
+ return /* @__PURE__ */ _(se.span, M({
673
673
  "data-state": pe(c.checked),
674
674
  "data-disabled": c.disabled ? "" : void 0
675
675
  }, o, {
@@ -689,7 +689,7 @@ const rt = [
689
689
  a,
690
690
  r,
691
691
  o
692
- ]), /* @__PURE__ */ _("input", z({
692
+ ]), /* @__PURE__ */ _("input", M({
693
693
  type: "checkbox",
694
694
  "aria-hidden": !0,
695
695
  defaultChecked: r
@@ -805,8 +805,8 @@ const I = /* @__PURE__ */ dt(ft), S = {
805
805
  var U, W;
806
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
807
  te(() => {
808
- var N, T;
809
- l(((N = o.current) == null ? void 0 : N.clientHeight) || 0), v(((T = r.current) == null ? void 0 : T.clientHeight) || 0);
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
810
  }, [(U = o.current) == null ? void 0 : U.clientHeight, (W = r.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 {
@@ -815,8 +815,8 @@ const I = /* @__PURE__ */ dt(ft), S = {
815
815
  isDragging: a,
816
816
  bounds: { left: d, right: g },
817
817
  position: e ? g : d,
818
- onDrag: ({ x: N }) => {
819
- t(N), Math.abs((e ? g : d) - N) > 2 && u(!0);
818
+ onDrag: ({ x: E }) => {
819
+ t(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));