fui-fancyui
Version:
FancyUI Libary
32 lines (31 loc) • 950 B
JavaScript
"use client";
import { jsxs as m, jsx as t } from "react/jsx-runtime";
import { forwardRef as C, useState as p, useEffect as u } from "react";
import { InputContainer as x, FakeCheckbox as y, HidenCheckBox as g } from "./RawCheckbox.style.js";
import b from "../../icons/SVGCheckMark/SVGCheckMark.js";
const S = C((e, r) => {
const { onChange: h, defaultChecked: a, themeType: d = "primary", layer: k = 3, id: i, ...l } = e, [o, c] = p(!1), s = () => {
c(!o);
}, f = (n) => {
c(n.target.checked), h && h(n);
};
return u(() => {
c(e.checked ?? !1);
}, [e.checked]), /* @__PURE__ */ m(x, { children: [
/* @__PURE__ */ t(
y,
{
$checked: o,
defaultChecked: a,
$themeType: d,
$layer: k,
onClick: s,
children: /* @__PURE__ */ t(b, {})
}
),
/* @__PURE__ */ t(g, { id: i, ref: r, type: "checkbox", onChange: f, ...l })
] });
});
export {
S as default
};