@wordpress/block-library
Version:
Block library for the WordPress editor.
42 lines (41 loc) • 1.36 kB
JavaScript
// packages/block-library/src/terms-query/edit/inspector-controls/inherit-control.js
import {
__experimentalToggleGroupControl as ToggleGroupControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption
} from "@wordpress/components";
import { __ } from "@wordpress/i18n";
import { jsx, jsxs } from "react/jsx-runtime";
function InheritControl({ value, onChange, label }) {
return /* @__PURE__ */ jsxs(
ToggleGroupControl,
{
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label,
isBlock: true,
onChange: (newValue) => {
onChange({
inherit: newValue === "default"
});
},
help: value ? __(
"Display terms based on the current taxonomy archive. For hierarchical taxonomies, shows children of the current term. For non-hierarchical taxonomies, shows all terms."
) : __("Display terms based on specific criteria."),
value: value ? "default" : "custom",
children: [
/* @__PURE__ */ jsx(
ToggleGroupControlOption,
{
value: "default",
label: __("Default")
}
),
/* @__PURE__ */ jsx(ToggleGroupControlOption, { value: "custom", label: __("Custom") })
]
}
);
}
export {
InheritControl as default
};
//# sourceMappingURL=inherit-control.js.map