UNPKG

@wordpress/block-library

Version:
37 lines (36 loc) • 966 B
import { SelectControl } from "@wordpress/ui"; import { __ } from "@wordpress/i18n"; import { jsx } from "react/jsx-runtime"; // packages/block-library/src/query/edit/inspector-controls/sticky-control.jsx const stickyOptions = [ { label: __("Include"), value: "" }, { label: __("Ignore"), value: "ignore" }, { label: __("Exclude"), value: "exclude" }, { label: __("Only"), value: "only" } ]; function StickyControl({ value, onChange }) { return /* @__PURE__ */ jsx(SelectControl, { label: __("Sticky posts"), items: stickyOptions, value: stickyOptions.find((item) => item.value === value) ?? stickyOptions[0], itemToStringValue: (item) => `sticky:${item.value}`, onValueChange: (item) => { if (item && item.value !== value) onChange(item.value); }, description: __("Sticky posts always appear first, regardless of their publish date.") }); } export { StickyControl as default }; //# sourceMappingURL=sticky-control.mjs.map