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)

34 lines (33 loc) 816 B
import { j as a } from "../_virtual/jsx-runtime.js"; import { createContext as d, useContext as f, useState as s, useEffect as g } from "react"; const u = d({ setEnum: (n) => { }, iterateEnum: () => { }, current: void 0, setCurrent: (n) => { } }), C = () => f(u), O = ({ children: n }) => { const [t, c] = s({}), [r, o] = s(); g(() => { o(Object.keys(t)[0]); }, [t]); const x = (e) => { c(e); }, m = () => { if (t) { const e = Object.keys(t); if (r) { const i = (e.indexOf(r) + 1) % e.length; o(e[i]); } } }; return /* @__PURE__ */ a.jsx(u.Provider, { value: { setEnum: x, iterateEnum: m, current: r, setCurrent: o }, children: n }); }; export { O as ToggleContextProvider, C as useToggle }; //# sourceMappingURL=ToggleContext.js.map