prometeo-design-system 1.8.5 → 1.8.6
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/Switch.es.js +22 -23
- package/package.json +1 -1
package/dist/Switch.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { c as
|
|
1
|
+
import { j as n } from "./jsx-runtime-ByW6EXIE.js";
|
|
2
|
+
import { c as r } from "./cn-B6yFEsav.js";
|
|
3
3
|
import { useRef as p } from "react";
|
|
4
4
|
import { motion as u } from "framer-motion";
|
|
5
|
-
const
|
|
5
|
+
const x = ({ name: l, value: o, onChange: c, disabled: e = !1 }) => {
|
|
6
6
|
const a = p(null), d = () => {
|
|
7
|
-
if (!a.current ||
|
|
7
|
+
if (!a.current || e) return;
|
|
8
8
|
const m = !a.current.checked;
|
|
9
9
|
c(l, m);
|
|
10
10
|
}, i = {
|
|
@@ -45,50 +45,49 @@ const k = ({ name: l, value: r, onChange: c, disabled: t = !1 }) => {
|
|
|
45
45
|
off: {
|
|
46
46
|
width: 16
|
|
47
47
|
}
|
|
48
|
-
},
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
48
|
+
}, t = o ? "on" : "off", s = e ? "disabled" : "default";
|
|
49
|
+
return /* @__PURE__ */ n.jsxs("div", { children: [
|
|
50
|
+
/* @__PURE__ */ n.jsx("input", { type: "checkbox", hidden: !0, ref: a, checked: o, disabled: e }),
|
|
51
|
+
/* @__PURE__ */ n.jsx(
|
|
52
52
|
"div",
|
|
53
53
|
{
|
|
54
|
-
className:
|
|
54
|
+
className: r(
|
|
55
55
|
"w-14 h-8 rounded-full relative px-2",
|
|
56
|
-
i[
|
|
56
|
+
i[t][s].container
|
|
57
57
|
),
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ n.jsx(
|
|
59
59
|
u.span,
|
|
60
60
|
{
|
|
61
61
|
onClick: d,
|
|
62
|
-
animate: f[
|
|
63
|
-
whileHover:
|
|
64
|
-
background:
|
|
62
|
+
animate: f[t],
|
|
63
|
+
whileHover: e ? {} : {
|
|
64
|
+
background: t === "off" ? "rgba(29, 27, 32, 0.08)" : "rgba(101, 85, 143, 0.12)"
|
|
65
65
|
},
|
|
66
|
-
className:
|
|
66
|
+
className: r(
|
|
67
67
|
"absolute top-1/2 -translate-y-1/2 grid place-items-center ",
|
|
68
68
|
"size-10 aspect-square rounded-full absolute top-1/2 -translate-y-1/2",
|
|
69
69
|
"cursor-pointer"
|
|
70
70
|
),
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ n.jsx(
|
|
72
72
|
u.span,
|
|
73
73
|
{
|
|
74
|
-
animate: h[
|
|
75
|
-
whileTap:
|
|
74
|
+
animate: h[t],
|
|
75
|
+
whileTap: e ? {} : {
|
|
76
76
|
width: 28,
|
|
77
77
|
height: 28
|
|
78
78
|
},
|
|
79
|
-
className:
|
|
79
|
+
className: r(
|
|
80
80
|
"size-4 aspect-square rounded-full z-10",
|
|
81
|
-
i[
|
|
81
|
+
i[t][s].dot
|
|
82
82
|
)
|
|
83
83
|
}
|
|
84
84
|
)
|
|
85
85
|
}
|
|
86
86
|
)
|
|
87
87
|
}
|
|
88
|
-
)
|
|
89
|
-
/* @__PURE__ */ e.jsx("p", { children: r ? "on" : "off" })
|
|
88
|
+
)
|
|
90
89
|
] });
|
|
91
90
|
};
|
|
92
91
|
export {
|
|
93
|
-
|
|
92
|
+
x as Switch
|
|
94
93
|
};
|