@wordpress/block-library
Version:
Block library for the WordPress editor.
20 lines (19 loc) • 743 B
JavaScript
import { __experimentalNumberControl } from "@wordpress/components";
import { _x } from "@wordpress/i18n";
import { jsx } from "react/jsx-runtime";
// packages/block-library/src/query/edit/inspector-controls/offset-controls.jsx
const MIN_OFFSET = 0;
const MAX_OFFSET = 100;
const OffsetControl = ({ offset = 0, onChange }) => {
return /* @__PURE__ */ jsx(__experimentalNumberControl, {
label: _x("Offset", "Number of posts to skip in a query"),
value: offset,
min: MIN_OFFSET,
onChange: (newOffset) => {
if (isNaN(newOffset) || newOffset < MIN_OFFSET || newOffset > MAX_OFFSET) return;
onChange({ offset: newOffset });
}
});
};
export { OffsetControl, OffsetControl as default };
//# sourceMappingURL=offset-controls.mjs.map