@wordpress/components
Version:
UI components for WordPress.
21 lines (20 loc) • 764 B
JavaScript
import { useMemo } from "@wordpress/element";
import { buildTermsTree } from "./terms.mjs";
import TreeSelect from "../tree-select/index.mjs";
import { jsx } from "react/jsx-runtime";
// packages/components/src/query-controls/category-select.tsx
function CategorySelect({ label, noOptionLabel, categoriesList, selectedCategoryId, onChange: onChangeProp, ...props }) {
const termsTree = useMemo(() => {
return buildTermsTree(categoriesList);
}, [categoriesList]);
return /* @__PURE__ */ jsx(TreeSelect, {
label,
noOptionLabel,
onChange: onChangeProp,
tree: termsTree,
selectedId: selectedCategoryId !== void 0 ? String(selectedCategoryId) : void 0,
...props
});
}
export { CategorySelect as default };
//# sourceMappingURL=category-select.mjs.map