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)

47 lines (46 loc) 1.35 kB
import { j as t } from "../../_virtual/jsx-runtime.js"; import { ToggleContextProvider as i, useToggle as l } from "../../context/ToggleContext.js"; import { useEffect as p } from "react"; var s = /* @__PURE__ */ ((e) => (e.ON = "true", e.OFF = "false", e))(s || {}); const n = ({ render: e, enumObj: r }) => /* @__PURE__ */ t.jsx(i, { children: /* @__PURE__ */ t.jsx(m, { render: e, enumObj: r }) }), m = ({ render: e, enumObj: r }) => { const { iterateEnum: a, setEnum: c, current: o } = l(); return p(() => { c(r || s); }, []), /* @__PURE__ */ t.jsx("div", { "data-component": n.name, className: n.name, children: /* @__PURE__ */ t.jsxs( "label", { className: ` inline-flex cursor-pointer `, children: [ /* @__PURE__ */ t.jsx( "input", { type: "checkbox", checked: o === "true", onChange: a, className: ` border-0 clip-rect-0 clip-path-inset-1/2 h-0 m-(-1) overflow-hidden hidden p-0 absolute whitespace-nowrap w-1` } ), o && e(o) ] } ) }); }; n.displayName = "ToggleButton"; export { n as ToggleButton }; //# sourceMappingURL=index.js.map