: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/component.js
const getAriaLabelColorValue = colorValue => {
// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.
return colorValue.replace(/^var\((.+)\)$/, '$1');
const getColorObject = (colorValue, colors) => {
if (!colorValue || !colors) {
if (isMultiplePaletteArray(colors)) {
colors.some(origin => origin.colors.some(color => {
if (color.color === colorValue) {
return colors.find(color => color.color === colorValue);
const getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {
const ariaLabelValue = getAriaLabelColorValue(colorObject.color);
return style ? (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:". %3$s: The current border style selection e.g. "solid".
'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s". The currently selected style is "%3$s".', colorObject.name, ariaLabelValue, style) : (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:".
'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, ariaLabelValue);
const ariaLabelValue = getAriaLabelColorValue(colorValue);
return style ? (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The color's hex code e.g.: "#f00:". %2$s: The current border style selection e.g. "solid".
'Border color and style picker. The currently selected color has a value of "%1$s". The currently selected style is "%2$s".', ariaLabelValue, style) : (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The color's hex code e.g: "#f00".
'Border color and style picker. The currently selected color has a value of "%1$s".', ariaLabelValue);
return (0,external_wp_i18n_namespaceObject.__)('Border color and style picker.');
return (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".
'Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, getAriaLabelColorValue(colorObject.color));
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %1$s: The color's hex code e.g: "#f00".
'Border color picker. The currently selected color has a value of "%1$s".', getAriaLabelColorValue(colorValue));
return (0,external_wp_i18n_namespaceObject.__)('Border color picker.');
const BorderControlDropdown = (props, forwardedRef) => {
__experimentalIsRenderedInSidebar,
indicatorWrapperClassName,
popoverControlsClassName,
} = useBorderControlDropdown(props);
const colorObject = getColorObject(color, colors);
const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);
const showResetButton = color || style && style !== 'none';
const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, {
"aria-label": toggleAriaLabel,
tooltipPosition: dropdownPosition,
label: (0,external_wp_i18n_namespaceObject.__)('Border color and style picker'),
__next40pxDefaultSize: size === '__unstable-large' ? true : false,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: indicatorWrapperClassName,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_indicator, {
className: indicatorClassName,
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_content_wrapper, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(v_stack_component, {
className: popoverControlsClassName,
children: [showDropdownHeader ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(StyledLabel, {
children: (0,external_wp_i18n_namespaceObject.__)('Border color')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, {
label: (0,external_wp_i18n_namespaceObject.__)('Close border color'),
}) : undefined, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_palette, {
className: popoverContentClassName,
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
}), enableStyle && isStyleSettable && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(border_control_style_picker_component, {
label: (0,external_wp_i18n_namespaceObject.__)('Style'),
}), showResetButton && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown_content_wrapper, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, {
className: resetButtonClassName,
children: (0,external_wp_i18n_namespaceObject.__)('Reset')
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(dropdown, {
renderToggle: renderToggle,
renderContent: renderContent,
...__unstablePopoverProps
const ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');
/* harmony default export */ const border_control_dropdown_component = (ConnectedBorderControlDropdown);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/unit-select-control.js
function UnitSelectControl({
isUnitSelectTabbable: isTabbable = true,
if (!hasUnits(units) || units?.length === 1) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnitLabel, {
className: "components-unit-control__unit-label",
const handleOnChange = event => {
const data = units.find(option => option.value === unitValue);
const classes = dist_clsx('components-unit-control__select', className);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(UnitSelect, {
onChange: handleOnChange,
tabIndex: isTabbable ? undefined : -1,
children: units.map(option => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("option", {
/* harmony default export */ const unit_select_control = ((0,external_wp_element_namespaceObject.forwardRef)(UnitSelectControl));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/index.js
function UnforwardedUnitControl(unitControlProps, forwardedRef) {
// @ts-expect-error Ensure that children is omitted from restProps
isPressEnterToChange = false,
isResetValueOnUnitChange = false,
isUnitSelectTabbable = true,
units: unitsProp = CSS_UNITS,
} = useDeprecated36pxDefaultSizeProp(unitControlProps);
if ('unit' in unitControlProps) {
external_wp_deprecated_default()('UnitControl unit prop', {
hint: 'The unit should be provided within the `value` prop.',
// The `value` prop, in theory, should not be `null`, but the following line
// ensures it fallback to `undefined` in case a consumer of `UnitControl`
// still passes `null` as a `value`.
const nonNullValueProp = valueProp !== null && valueProp !== void 0 ? valueProp : undefined;
const [units, reFirstCharacterOfUnits] = (0,external_wp_element_namespaceObject.useMemo)(() => {
const list = getUnitsWithCurrentUnit(nonNullValueProp, unitProp, unitsProp);
value: firstUnitValue = ''
const firstCharacters = rest.reduce((carry, {
const first = escapeRegExp(value?.substring(0, 1) || '');
return carry.includes(first) ? carry : `${carry}|${first}`;
}, escapeRegExp(firstUnitValue.substring(0, 1)));
return [list, new RegExp(`^(?:${firstCharacters})$`, 'i')];
}, [nonNullValueProp, unitProp, unitsProp]);
const [parsedQuantity, parsedUnit] = getParsedQuantityAndUnit(nonNullValueProp, unitProp, units);
const [unit, setUnit] = use_controlled_state(units.length === 1 ? units[0].value : unitProp, {
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (parsedUnit !== undefined) {
}, [parsedUnit, setUnit]);
const classes = dist_clsx('components-unit-control',
// This class is added for legacy purposes to maintain it on the outer
// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139
'components-unit-control-wrapper', className);
const handleOnQuantityChange = (nextQuantityValue, changeProps) => {
if (nextQuantityValue === '' || typeof nextQuantityValue === 'undefined' || nextQuantityValue === null) {
onChangeProp?.('', changeProps);
* Customizing the onChange callback.
* This allows as to broadcast a combined value+unit to onChange.
const onChangeValue = getValidParsedQuantityAndUnit(nextQuantityValue, units, parsedQuantity, unit).join('');
onChangeProp?.(onChangeValue, changeProps);
const handleOnUnitChange = (nextUnitValue, changeProps) => {
let nextValue = `${parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : ''}${nextUnitValue}`;
if (isResetValueOnUnitChange && data?.default !== undefined) {
nextValue = `${data.default}${nextUnitValue}`;
onChangeProp?.(nextValue, changeProps);
onUnitChange?.(nextUnitValue, changeProps);
if (!disableUnits && isUnitSelectTabbable && units.length) {
handleOnKeyDown = event => {
props.onKeyDown?.(event);
// Unless the meta key was pressed (to avoid interfering with
// shortcuts, e.g. pastes), moves focus to the unit select if a key
// matches the first character of a unit.
if (!event.metaKey && reFirstCharacterOfUnits.test(event.key)) {
refInputSuffix.current?.focus();
const refInputSuffix = (0,external_wp_element_namespaceObject.useRef)(null);
const inputSuffix = !disableUnits ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(unit_select_control, {
"aria-label": (0,external_wp_i18n_namespaceObject.__)('Select unit'),
isUnitSelectTabbable: isUnitSelectTabbable,
onChange: handleOnUnitChange,
size: ['small', 'compact'].includes(size) || size === 'default' && !props.__next40pxDefaultSize ? 'small' : 'default',
onBlur: unitControlProps.onBlur
* If no step prop has been passed, lookup the active unit and
* try to get step from `units`, or default to a value of `1`
const activeUnit = units.find(option => option.value === unit);
step = (_activeUnit$step = activeUnit?.step) !== null && _activeUnit$step !== void 0 ? _activeUnit$step : 1;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ValueInput, {
autoComplete: autoComplete,
isPressEnterToChange: isPressEnterToChange,
onKeyDown: handleOnKeyDown,
onChange: handleOnQuantityChange,
type: isPressEnterToChange ? 'text' : 'number',
value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : '',
__unstableStateReducer: __unstableStateReducer
* `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).
* import { __experimentalUnitControl as UnitControl } from '@wordpress/components';
* import { useState } from '@wordpress/element';
* const Example = () => {
* const [ value, setValue ] = useState( '10px' );
* return <UnitControl onChange={ setValue } value={ value } />;
const UnitControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedUnitControl);
/* harmony default export */ const unit_control = (UnitControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control/hook.js
// If either width or color are defined, the border is considered valid
// and a border style can be set as well.
const isValidBorder = border => {
const hasWidth = border?.width !== undefined && border.width !== '';
const hasColor = border?.color !== undefined;
return hasWidth || hasColor;
function useBorderControl(props) {
shouldSanitizeBorder = true,
__experimentalIsRenderedInSidebar = false,
} = useContextSystem(props, 'BorderControl');
const computedSize = size === 'default' && __next40pxDefaultSize ? '__unstable-large' : size;
const [widthValue, originalWidthUnit] = parseQuantityAndUnitFromRawValue(border?.width);
const widthUnit = originalWidthUnit || 'px';
const hadPreviousZeroWidth = widthValue === 0;
const [colorSelection, setColorSelection] = (0,external_wp_element_namespaceObject.useState)();
const [styleSelection, setStyleSelection] = (0,external_wp_element_namespaceObject.useState)();
const isStyleSettable = shouldSanitizeBorder ? isValidBorder(border) : true;
const onBorderChange = (0,external_wp_element_namespaceObject.useCallback)(newBorder => {
if (shouldSanitizeBorder && !isValidBorder(newBorder)) {
}, [onChange, shouldSanitizeBorder]);
const onWidthChange = (0,external_wp_element_namespaceObject.useCallback)(newWidth => {
const newWidthValue = newWidth === '' ? undefined : newWidth;
const [parsedValue] = parseQuantityAndUnitFromRawValue(newWidth);
const hasZeroWidth = parsedValue === 0;
// Setting the border width explicitly to zero will also set the