UNPKG

mui-autocomplete-select-all

Version:
42 lines (41 loc) 1.09 kB
import { jsx as e, Fragment as a, jsxs as o } from "react/jsx-runtime"; import { createContext as f, forwardRef as x, useRef as A, useImperativeHandle as p, useContext as h } from "react"; import S from "@mui/material/Divider"; import v from "@mui/material/Checkbox"; const C = { onSelectAll: (r) => { }, selectedAll: !1, indeterminate: !1 }, n = f(C), B = x(function(c, i) { const { children: s, ...d } = c, t = A(null); p( i, () => t.current ); const { onSelectAll: m, selectedAll: l, indeterminate: u } = h( n ); return /* @__PURE__ */ e(a, { children: /* @__PURE__ */ o("ul", { ...d, ref: t, role: "list-box", children: [ /* @__PURE__ */ o("li", { style: { display: "flex", alignItems: "center" }, children: [ /* @__PURE__ */ e( v, { indeterminate: u, checked: l, onChange: (g) => m(l), sx: { ml: 2 } } ), "Select All" ] }), /* @__PURE__ */ e(S, {}), s ] }) }); }), j = { Provider: n.Provider, ListBox: B }; export { j as MuiAutocompleteSelectAll };