UNPKG

@wordpress/block-editor

Version:
82 lines (80 loc) 2.69 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // packages/block-editor/src/components/resolution-tool/index.js var resolution_tool_exports = {}; __export(resolution_tool_exports, { default: () => ResolutionTool }); module.exports = __toCommonJS(resolution_tool_exports); var import_components = require("@wordpress/components"); var import_i18n = require("@wordpress/i18n"); var import_jsx_runtime = require("react/jsx-runtime"); var DEFAULT_SIZE_OPTIONS = [ { label: (0, import_i18n._x)("Thumbnail", "Image size option for resolution control"), value: "thumbnail" }, { label: (0, import_i18n._x)("Medium", "Image size option for resolution control"), value: "medium" }, { label: (0, import_i18n._x)("Large", "Image size option for resolution control"), value: "large" }, { label: (0, import_i18n._x)("Full Size", "Image size option for resolution control"), value: "full" } ]; function ResolutionTool({ panelId, value, onChange, options = DEFAULT_SIZE_OPTIONS, defaultValue = DEFAULT_SIZE_OPTIONS[0].value, isShownByDefault = true, resetAllFilter }) { const displayValue = value ?? defaultValue; return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_components.__experimentalToolsPanelItem, { hasValue: () => displayValue !== defaultValue, label: (0, import_i18n.__)("Resolution"), onDeselect: () => onChange(defaultValue), isShownByDefault, panelId, resetAllFilter, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_components.SelectControl, { __nextHasNoMarginBottom: true, label: (0, import_i18n.__)("Resolution"), value: displayValue, options, onChange, help: (0, import_i18n.__)("Select the size of the source image."), size: "__unstable-large" } ) } ); } //# sourceMappingURL=index.js.map