@wordpress/block-library
Version:
Block library for the WordPress editor.
57 lines (56 loc) • 2.45 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_components = require("@wordpress/components");
let _wordpress_block_editor = require("@wordpress/block-editor");
let _wordpress_compose = require("@wordpress/compose");
let _wordpress_i18n = require("@wordpress/i18n");
let react_jsx_runtime = require("react/jsx-runtime");
// packages/block-library/src/post-featured-image/overlay-controls.jsx
const Overlay = ({ clientId, attributes, setAttributes, overlayColor, setOverlayColor }) => {
const { dimRatio } = attributes;
const { gradientValue, setGradient } = (0, _wordpress_block_editor.__experimentalUseGradient)();
const colorGradientSettings = (0, _wordpress_block_editor.__experimentalUseMultipleOriginColorsAndGradients)();
if (!colorGradientSettings.hasColorsOrGradients) return null;
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_block_editor.__experimentalColorGradientSettingsDropdown, {
__experimentalIsRenderedInSidebar: true,
settings: [{
colorValue: overlayColor.color,
gradientValue,
label: (0, _wordpress_i18n.__)("Overlay"),
onColorChange: setOverlayColor,
onGradientChange: setGradient,
isShownByDefault: true,
resetAllFilter: () => ({
overlayColor: void 0,
customOverlayColor: void 0,
gradient: void 0,
customGradient: void 0
}),
clearable: true
}],
panelId: clientId,
...colorGradientSettings
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalToolsPanelItem, {
hasValue: () => dimRatio !== void 0,
label: (0, _wordpress_i18n.__)("Overlay opacity"),
onDeselect: () => setAttributes({ dimRatio: 0 }),
resetAllFilter: () => ({ dimRatio: 0 }),
isShownByDefault: true,
panelId: clientId,
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.RangeControl, {
label: (0, _wordpress_i18n.__)("Overlay opacity"),
value: dimRatio,
onChange: (newDimRatio) => setAttributes({ dimRatio: newDimRatio }),
min: 0,
max: 100,
step: 10,
required: true
})
})] });
};
var overlay_controls_default = (0, _wordpress_compose.compose)([(0, _wordpress_block_editor.withColors)({ overlayColor: "background-color" })])(Overlay);
exports.default = overlay_controls_default;
//# sourceMappingURL=overlay-controls.cjs.map