@konstructio/ui
Version:
A set of reusable and customizable React components built for konstruct.io
23 lines (22 loc) • 591 B
JavaScript
import { jsx as i } from "react/jsx-runtime";
import { useCallback as u } from "react";
import { DropdownContext as d } from "./dropdown.context.js";
import { useToggle as f } from "../../../hooks/useToggle.js";
const w = ({ children: t, onChange: r, value: e, name: o }) => {
const [l, p] = f(!1), s = u(
(m) => {
r == null || r({ target: { value: m, name: o ?? "" } });
},
[r, o]
);
return /* @__PURE__ */ i(
d.Provider,
{
value: { value: e, isOpen: l, setValue: s, toggleOpen: p },
children: t
}
);
};
export {
w as DropdownProvider
};