@konstructio/ui
Version:
A set of reusable and customizable React components built for konstruct.io
25 lines (24 loc) • 529 B
JavaScript
import { CommandContext as s } from "./Command.context.js";
import { jsx as a } from "react/jsx-runtime";
import { useCallback as e } from "react";
import { useToggle as p } from "../../../hooks/useToggle.js";
const f = ({ children: t }) => {
const [r, o] = p(!1), n = e(
(l) => o(l),
[o]
), m = e(() => o(), [o]);
return /* @__PURE__ */ a(
s.Provider,
{
value: {
isOpen: r,
setOpen: n,
toggleOpen: m
},
children: t
}
);
};
export {
f as CommandProvider
};