UNPKG

@mankindui/core

Version:

- a react component library - you can see how @mankindui/core can be used via examples: [usage examples](https://github.com/clarklindev/mankindui-test)

79 lines (78 loc) 3.05 kB
import { j as e } from "../../_virtual/jsx-runtime.js"; import { useRef as d, useEffect as a } from "react"; import "../index.js"; import { Icon as n } from "../Icon/index.js"; const x = ({ checked: i, name: l, label: h = "", onChange: c, size: s = "XL", indeterminate: o = !1, border: t = !0 }) => { const r = d(null); return a(() => { r != null && r.current && (r.current.indeterminate = o); }, [o]), /* @__PURE__ */ e.jsxs("label", { "data-component": x.name, children: [ /* @__PURE__ */ e.jsx( "input", { type: "checkbox", className: ` hidden h-0 w-0 overflow-hidden absolute top-0 left-0 `, checked: i, ref: r, onChange: c, name: l } ), /* @__PURE__ */ e.jsx( "div", { className: ` cursor-pointer overflow-hidden rounded-md `, children: o ? /* @__PURE__ */ e.jsx(n, { size: s, children: /* @__PURE__ */ e.jsxs( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", className: `${t ? "stroke-current" : "stroke-none"}`, strokeWidth: "0.5", strokeLinecap: "round", strokeLinejoin: "round", children: [ /* @__PURE__ */ e.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "3", ry: "3" }), /* @__PURE__ */ e.jsx("line", { x1: "8", y1: "12", x2: "16", y2: "12", strokeWidth: "1" }) ] } ) }) : i ? /* @__PURE__ */ e.jsx(n, { size: s, children: /* @__PURE__ */ e.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", className: "w-10 h-10 stroke-current", strokeWidth: "0.5", strokeLinecap: "round", strokeLinejoin: "round", children: [ t && /* @__PURE__ */ e.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "3", ry: "3" }), /* @__PURE__ */ e.jsx("line", { x1: "6", y1: "12", x2: "10", y2: "16", strokeWidth: "1" }), /* @__PURE__ */ e.jsx("line", { x1: "10", y1: "16", x2: "18", y2: "8", strokeWidth: "1" }) ] }) }) : /* @__PURE__ */ e.jsx(n, { size: s, children: /* @__PURE__ */ e.jsx( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", className: `${t ? "stroke-current" : "stroke-none"}`, strokeWidth: "0.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "3", ry: "3" }) } ) }) } ), /* @__PURE__ */ e.jsx("span", { children: h }) ] }); }; x.displayName = "Checkbox"; export { x as Checkbox }; //# sourceMappingURL=index.js.map