: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* A convenience wrapper for the `renderContent` when you want to apply
* different padding. (Default is `paddingSize="small"`).
* __experimentalDropdownContentWrapper as DropdownContentWrapper,
* } from '@wordpress/components';
* renderContent={ () => (
* <DropdownContentWrapper paddingSize="medium">
* </DropdownContentWrapper>
const DropdownContentWrapper = contextConnect(UnconnectedDropdownContentWrapper, 'DropdownContentWrapper');
/* harmony default export */ const dropdown_content_wrapper = (DropdownContentWrapper);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/utils.js
const extractColorNameFromCurrentValue = (currentValue, colors = [], showMultiplePalettes = false) => {
const currentValueIsCssVariable = /^var\(/.test(currentValue);
const normalizedCurrentValue = currentValueIsCssVariable ? currentValue : w(currentValue).toHex();
// Normalize format of `colors` to simplify the following loop
const colorPalettes = showMultiplePalettes ? colors : [{
const normalizedColorValue = currentValueIsCssVariable ? colorValue : w(colorValue).toHex();
if (normalizedCurrentValue === normalizedColorValue) {
// translators: shown when the user has picked a custom color (i.e not in the palette of colors).
return (0,external_wp_i18n_namespaceObject.__)('Custom');
// The PaletteObject type has a `colors` property (an array of ColorObject),
// while the ColorObject type has a `color` property (the CSS color value).
const isMultiplePaletteObject = obj => Array.isArray(obj.colors) && !('color' in obj);
const isMultiplePaletteArray = arr => {
return arr.length > 0 && arr.every(colorObj => isMultiplePaletteObject(colorObj));
* Transform a CSS variable used as background color into the color value itself.
* @param value The color value that may be a CSS variable.
* @param element The element for which to get the computed style.
* @return The background color value computed from a element.
const normalizeColorValue = (value, element) => {
const currentValueIsCssVariable = /^var\(/.test(value !== null && value !== void 0 ? value : '');
if (!currentValueIsCssVariable || element === null) {
const computedBackgroundColor = defaultView?.getComputedStyle(element).backgroundColor;
return computedBackgroundColor ? w(computedBackgroundColor).toHex() : value;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/index.js
const colorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
const colordColor = w(color);
const isSelected = value === color;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.Option, {
selectedIconProps: isSelected ? {
fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'
// translators: %s: color hex code e.g: "#f00".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color),
onClick: isSelected ? clearColor : () => onChange(color, index),
// translators: %s: The name of the color e.g: "vivid red".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color: %s'), name) :
// translators: %s: color hex code e.g: "#f00".
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color)
}, [colors, value, onChange, clearColor]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.OptionGroup, {
function MultiplePalettes({
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MultiplePalettes, 'color-palette');
if (colors.length === 0) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(v_stack_component, {
const id = `${instanceId}-${index}`;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorHeading, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SinglePalette, {
onChange: newColor => onChange(newColor, index),
function CustomColorPickerDropdown({
popoverProps: receivedPopoverProps,
const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
// Disabling resize as it would otherwise cause the popover to show
// scrollbars while dragging the color picker's handle close to the
...(isRenderedInSidebar ? {
// When in the sidebar: open to the left (stacking),
// leaving the same gap as the parent popover.
// Default behavior: open below the anchor
}), [isRenderedInSidebar, receivedPopoverProps]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown, {
contentClassName: "components-color-palette__custom-color-dropdown-content",
popoverProps: popoverProps,
function UnforwardedColorPalette(props, forwardedRef) {
disableCustomColors = false,
__experimentalIsRenderedInSidebar = false,
'aria-labelledby': ariaLabelledby,
const [normalizedColorValue, setNormalizedColorValue] = (0,external_wp_element_namespaceObject.useState)(value);
const clearColor = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]);
const customColorPaletteCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => {
setNormalizedColorValue(normalizeColorValue(value, node));
const hasMultipleColorOrigins = isMultiplePaletteArray(colors);
const buttonLabelName = (0,external_wp_element_namespaceObject.useMemo)(() => extractColorNameFromCurrentValue(value, colors, hasMultipleColorOrigins), [value, colors, hasMultipleColorOrigins]);
const renderCustomColorPicker = () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_content_wrapper, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LegacyAdapter, {
color: normalizedColorValue,
onChange: color => onChange(color),
const isHex = value?.startsWith('#');
// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.
const displayValue = value?.replace(/^var\((.+)\)$/, '$1');
const customColorAccessibleLabel = !!displayValue ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The name of the color e.g: "vivid red". %2$s: The color's hex code e.g: "#f00".
(0,external_wp_i18n_namespaceObject.__)('Custom color picker. The currently selected color is called "%1$s" and has a value of "%2$s".'), buttonLabelName, displayValue) : (0,external_wp_i18n_namespaceObject.__)('Custom color picker.');
const paletteCommonProps = {
const actions = !!clearable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker.ButtonAction, {
children: (0,external_wp_i18n_namespaceObject.__)('Clear')
} else if (ariaLabelledby) {
'aria-labelledby': ariaLabelledby
'aria-label': (0,external_wp_i18n_namespaceObject.__)('Custom color picker.')
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, {
children: [!disableCustomColors && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomColorPickerDropdown, {
isRenderedInSidebar: __experimentalIsRenderedInSidebar,
renderContent: renderCustomColorPicker,
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, {
className: "components-color-palette__custom-color-wrapper",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", {
ref: customColorPaletteCallbackRef,
className: "components-color-palette__custom-color-button",
"aria-label": customColorAccessibleLabel,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, {
className: "components-color-palette__custom-color-text-wrapper",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(truncate_component, {
className: "components-color-palette__custom-color-name",
children: value ? buttonLabelName : (0,external_wp_i18n_namespaceObject.__)('No color selected')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(truncate_component, {
className: dist_clsx('components-color-palette__custom-color-value', {
'components-color-palette__custom-color-value--is-hex': isHex
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_circular_option_picker, {
options: hasMultipleColorOrigins ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MultiplePalettes, {
headingLevel: headingLevel,
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SinglePalette, {
* Allows the user to pick a color from a list of pre-defined color entries.
* import { ColorPalette } from '@wordpress/components';
* import { useState } from '@wordpress/element';
* const MyColorPalette = () => {
* const [ color, setColor ] = useState ( '#f00' )
* { name: 'red', color: '#f00' },
* { name: 'white', color: '#fff' },
* { name: 'blue', color: '#00f' },
* onChange={ ( color ) => setColor( color ) }
const ColorPalette = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorPalette);
/* harmony default export */ const color_palette = (ColorPalette);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js
// Using `selectSize` instead of `size` to avoid a type conflict with the
// `size` HTML attribute of the `select` element.
// TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const ValueInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
} : 0)("&&&{input{display:block;width:100%;}", BackdropUI, "{transition:box-shadow 0.1s linear;}}" + ( true ? "" : 0));
const baseUnitLabelStyles = ({
small: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;padding:2px 1px;width:20px;color:", COLORS.gray[800], ";font-size:8px;line-height:1;letter-spacing:-0.5px;text-transform:uppercase;text-align-last:center;" + ( true ? "" : 0), true ? "" : 0),
default: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;min-width:24px;max-width:48px;height:24px;margin-inline-end:", space(2), ";padding:", space(1), ";color:", COLORS.theme.accent, ";font-size:13px;line-height:1;text-align-last:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" + ( true ? "" : 0), true ? "" : 0)
return sizes[selectSize];
const UnitLabel = /*#__PURE__*/emotion_styled_base_browser_esm("div", true ? {
} : 0)("&&&{pointer-events:none;", baseUnitLabelStyles, ";color:", COLORS.gray[900], ";}" + ( true ? "" : 0));
const unitSelectSizes = ({
small: /*#__PURE__*/emotion_react_browser_esm_css("height:100%;border:1px solid transparent;transition:box-shadow 0.1s linear,border 0.1s linear;", rtl({
borderBottomLeftRadius: 0
})(), " &:not(:disabled):hover{background-color:", COLORS.gray[100], ";}&:focus{border:1px solid ", COLORS.ui.borderFocus, ";box-shadow:inset 0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline-offset:0;outline:2px solid transparent;z-index:1;}" + ( true ? "" : 0), true ? "" : 0),
default: /*#__PURE__*/emotion_react_browser_esm_css("display:flex;justify-content:center;align-items:center;&:hover{color:", COLORS.ui.borderFocus, ";box-shadow:inset 0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidth, " solid transparent;}&:focus{box-shadow:0 0 0 ", config_values.borderWidthFocus + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidthFocus, " solid transparent;}" + ( true ? "" : 0), true ? "" : 0)
return sizes[selectSize];
const UnitSelect = /*#__PURE__*/emotion_styled_base_browser_esm("select", true ? {
} : 0)("&&&{appearance:none;background:transparent;border-radius:2px;border:none;display:block;outline:none;margin:0;min-height:auto;font-family:inherit;", baseUnitLabelStyles, ";", unitSelectSizes, ";&:not( :disabled ){cursor:pointer;}}" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/styles.js
function border_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const styles_labelStyles = true ? {
styles: "font-weight:500"
const focusBoxShadow = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:inset ", config_values.controlBoxShadowFocus, ";" + ( true ? "" : 0), true ? "" : 0);
const borderControl = /*#__PURE__*/emotion_react_browser_esm_css("border:0;padding:0;margin:0;", boxSizingReset, ";" + ( true ? "" : 0), true ? "" : 0);
const innerWrapper = () => /*#__PURE__*/emotion_react_browser_esm_css(ValueInput, "{flex:1 1 40%;}&& ", UnitSelect, "{min-height:0;}" + ( true ? "" : 0), true ? "" : 0);
* This style is only applied to the UnitControl wrapper when the border width
* field should be a set width. Omitting this allows the UnitControl &
* RangeControl to share the available width in a 40/60 split respectively.
const styles_wrapperWidth = /*#__PURE__*/emotion_react_browser_esm_css(ValueInput, "{flex:0 0 auto;}" + ( true ? "" : 0), true ? "" : 0);
const wrapperHeight = size => {
return /*#__PURE__*/emotion_react_browser_esm_css("height:", size === '__unstable-large' ? '40px' : '30px', ";" + ( true ? "" : 0), true ? "" : 0);
const borderControlDropdown = /*#__PURE__*/emotion_react_browser_esm_css("background:#fff;&&>button{aspect-ratio:1;padding:0;display:flex;align-items:center;justify-content:center;", rtl({
borderRadius: `2px 0 0 2px`
borderRadius: `0 2px 2px 0`
})(), " border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";&:focus,&:hover:not( :disabled ){", focusBoxShadow, " border-color:", COLORS.ui.borderFocus, ";z-index:1;position:relative;}}" + ( true ? "" : 0), true ? "" : 0);
const colorIndicatorBorder = border => {
const fallbackColor = !!style && style !== 'none' ? COLORS.gray[300] : undefined;
return /*#__PURE__*/emotion_react_browser_esm_css("border-style:", style === 'none' ? 'solid' : style, ";border-color:", color || fallbackColor, ";" + ( true ? "" : 0), true ? "" : 0);
const colorIndicatorWrapper = (border, size) => {
return /*#__PURE__*/emotion_react_browser_esm_css("border-radius:9999px;border:2px solid transparent;", style ? colorIndicatorBorder(border) : undefined, " width:", size === '__unstable-large' ? '24px' : '22px', ";height:", size === '__unstable-large' ? '24px' : '22px', ";padding:", size === '__unstable-large' ? '2px' : '1px', ";&>span{height:", space(4), ";width:", space(4), ";background:linear-gradient(\n\t\t\t\t-45deg,\n\t\t\t\ttransparent 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 48%,\n\t\t\t\trgb( 0 0 0 / 20% ) 52%,\n\t\t\t\ttransparent 52%\n\t\t\t);}" + ( true ? "" : 0), true ? "" : 0);