fui-fancyui
Version:
FancyUI Libary
59 lines (58 loc) • 1.29 kB
JavaScript
"use client";
import { jsxs as d, jsx as a } from "react/jsx-runtime";
import { forwardRef as C, useCallback as b } from "react";
import { SwitchTrack as I, IconContainer as S, IconWrapper as o } from "./Switch.style.js";
const g = C((s, h) => {
const {
checked: e = !1,
onChange: c,
disabled: r = !1,
sizeC: i = "md",
themeType: l = "primary",
layer: p = 0,
icon: t,
checkedIcon: n,
externalStyle: m,
id: k,
name: $,
...f
} = s, y = b(
(x) => {
r || c == null || c(x.target.checked);
},
[c, r]
), u = t || n;
return /* @__PURE__ */ d(
I,
{
$sizeC: i,
$checked: e,
$disabled: r,
$themeType: l,
$externalStyle: m,
$layer: p,
children: [
/* @__PURE__ */ a(
"input",
{
ref: h,
type: "checkbox",
checked: e,
onChange: y,
disabled: r,
id: k,
name: $,
...f
}
),
u && /* @__PURE__ */ d(S, { $sizeC: i, $checked: e, children: [
n && /* @__PURE__ */ a(o, { $checked: e, children: n }),
t && /* @__PURE__ */ a(o, { $checked: e, children: t })
] })
]
}
);
});
export {
g as default
};