UNPKG

@wordpress/block-library

Version:
42 lines (41 loc) • 1.27 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let _wordpress_ui = require("@wordpress/ui"); let _wordpress_i18n = require("@wordpress/i18n"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/block-library/src/query/edit/inspector-controls/sticky-control.jsx const stickyOptions = [ { label: (0, _wordpress_i18n.__)("Include"), value: "" }, { label: (0, _wordpress_i18n.__)("Ignore"), value: "ignore" }, { label: (0, _wordpress_i18n.__)("Exclude"), value: "exclude" }, { label: (0, _wordpress_i18n.__)("Only"), value: "only" } ]; function StickyControl({ value, onChange }) { return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_ui.SelectControl, { label: (0, _wordpress_i18n.__)("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: (0, _wordpress_i18n.__)("Sticky posts always appear first, regardless of their publish date.") }); } exports.default = StickyControl; //# sourceMappingURL=sticky-control.cjs.map