: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
const CUSTOM_VALUE_SETTINGS = {
function SpacingInputControl({
var _CUSTOM_VALUE_SETTING, _CUSTOM_VALUE_SETTING2;
// Treat value as a preset value if the passed in value matches the value of one of the spacingSizes.
value = getPresetValueFromCustomValue(value, spacingSizes);
let selectListSizes = spacingSizes;
const showRangeControl = spacingSizes.length <= RANGE_CONTROL_MAX_SIZE;
const disableCustomSpacingSizes = (0,external_wp_data_namespaceObject.useSelect)(select => {
const editorSettings = select(store).getSettings();
return editorSettings?.disableCustomSpacingSizes;
const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!disableCustomSpacingSizes && value !== undefined && !isValueSpacingPreset(value));
const [minValue, setMinValue] = (0,external_wp_element_namespaceObject.useState)(minimumCustomValue);
const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value);
if (!!value && previousValue !== value && !isValueSpacingPreset(value) && showCustomValueControl !== true) {
setShowCustomValueControl(true);
const [availableUnits] = use_settings_useSettings('spacing.units');
const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
availableUnits: availableUnits || ['px', 'em', 'rem']
const showCustomValueInSelectList = !showRangeControl && !showCustomValueControl && value !== undefined && (!isValueSpacingPreset(value) || isValueSpacingPreset(value) && isMixed);
if (showCustomValueInSelectList) {
selectListSizes = [...spacingSizes, {
// translators: A custom measurement, eg. a number followed by a unit like 12px.
(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Custom (%s)'), value) : (0,external_wp_i18n_namespaceObject.__)('Mixed'),
currentValue = selectListSizes.length - 1;
currentValue = !showCustomValueControl ? getSliderValueFromPreset(value, spacingSizes) : getCustomValueFromPreset(value, spacingSizes);
const selectedUnit = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_components_namespaceObject.__experimentalParseQuantityAndUnitFromRawValue)(currentValue), [currentValue])[1] || units[0]?.value;
const setInitialValue = () => {
if (value === undefined) {
const customTooltipContent = newValue => value === undefined ? undefined : spacingSizes[newValue]?.name;
const customRangeValue = parseFloat(currentValue, 10);
const getNewCustomValue = newSize => {
const isNumeric = !isNaN(parseFloat(newSize));
const nextValue = isNumeric ? newSize : undefined;
const getNewPresetValue = (newSize, controlType) => {
const size = parseInt(newSize, 10);
if (controlType === 'selectList') {
return `var:preset|spacing|${spacingSizes[newSize]?.slug}`;
const handleCustomValueSliderChange = next => {
onChange([next, selectedUnit].join(''));
const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : null;
const options = selectListSizes.map((size, index) => ({
const marks = spacingSizes.map((_newValue, index) => ({
const sideLabel = ALL_SIDES.includes(side) && showSideInLabel ? LABELS[side] : '';
const typeLabel = showSideInLabel ? type?.toLowerCase() : type;
const ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: 1: The side of the block being modified (top, bottom, left, All sides etc.). 2. Type of spacing being modified (Padding, margin, etc)
(0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), sideLabel, typeLabel).trim();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
className: "spacing-sizes-control__wrapper",
children: [icon && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {
className: "spacing-sizes-control__icon",
}), showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalUnitControl, {
onMouseOver: onMouseOver,
onChange: newSize => onChange(getNewCustomValue(newSize)),
placeholder: allPlaceholder,
hideLabelFromVision: true,
className: "spacing-sizes-control__custom-value-input",
size: "__unstable-large",
if (value?.charAt(0) === '-') {
if (value?.charAt(0) === '-') {
setMinValue(minimumCustomValue);
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, {
onMouseOver: onMouseOver,
max: (_CUSTOM_VALUE_SETTING = CUSTOM_VALUE_SETTINGS[selectedUnit]?.max) !== null && _CUSTOM_VALUE_SETTING !== void 0 ? _CUSTOM_VALUE_SETTING : 10,
step: (_CUSTOM_VALUE_SETTING2 = CUSTOM_VALUE_SETTINGS[selectedUnit]?.steps) !== null && _CUSTOM_VALUE_SETTING2 !== void 0 ? _CUSTOM_VALUE_SETTING2 : 0.1,
onChange: handleCustomValueSliderChange,
className: "spacing-sizes-control__custom-value-range",
__nextHasNoMarginBottom: true
}), showRangeControl && !showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.RangeControl, {
onMouseOver: onMouseOver,
className: "spacing-sizes-control__range-control",
onChange: newSize => onChange(getNewPresetValue(newSize)),
// If mouse down is near start of range set initial value to 0, which
// prevents the user have to drag right then left to get 0 setting.
if (event?.nativeEvent?.offsetX < 35) {
"aria-valuenow": currentValue,
"aria-valuetext": spacingSizes[currentValue]?.name,
renderTooltipContent: customTooltipContent,
max: spacingSizes.length - 1,
hideLabelFromVision: true,
__nextHasNoMarginBottom: true,
}), !showRangeControl && !showCustomValueControl && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.CustomSelectControl, {
className: "spacing-sizes-control__custom-select-control",
value: options.find(option => option.key === currentValue) || '' // passing undefined here causes a downshift controlled/uncontrolled warning
onChange(getNewPresetValue(selection.selectedItem.key, 'selectList'));
hideLabelFromVision: true,
size: "__unstable-large",
onMouseOver: onMouseOver,
}), !disableCustomSpacingSizes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'),
setShowCustomValueControl(!showCustomValueControl);
isPressed: showCustomValueControl,
className: "spacing-sizes-control__custom-toggle",
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/axial.js
const groupedSides = ['vertical', 'horizontal'];
function AxialInputControls({
const createHandleOnChange = side => next => {
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
...Object.keys(values).reduce((acc, key) => {
acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes);
if (side === 'vertical') {
nextValues.bottom = next;
if (side === 'horizontal') {
// Filter sides if custom configuration provided, maintaining default order.
const filteredSides = sides?.length ? groupedSides.filter(side => hasAxisSupport(sides, side)) : groupedSides;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: filteredSides.map(side => {
const axisValue = side === 'vertical' ? values.top : values.left;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, {
minimumCustomValue: minimumCustomValue,
onChange: createHandleOnChange(side),
onMouseOver: onMouseOver,
spacingSizes: spacingSizes,
}, `spacing-sizes-control-${side}`);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/separated.js
function SeparatedInputControls({
// Filter sides if custom configuration provided, maintaining default order.
const filteredSides = sides?.length ? ALL_SIDES.filter(side => sides.includes(side)) : ALL_SIDES;
const createHandleOnChange = side => next => {
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
...Object.keys(values).reduce((acc, key) => {
acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: filteredSides.map(side => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, {
minimumCustomValue: minimumCustomValue,
onChange: createHandleOnChange(side),
onMouseOver: onMouseOver,
spacingSizes: spacingSizes,
}, `spacing-sizes-control-${side}`);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/input-controls/single.js
function SingleInputControl({
const createHandleOnChange = currentSide => next => {
// Encode the existing value into the preset value if the passed in value matches the value of one of the spacingSizes.
...Object.keys(values).reduce((acc, key) => {
acc[key] = getPresetValueFromCustomValue(values[key], spacingSizes);
nextValues[currentSide] = next;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(SpacingInputControl, {
minimumCustomValue: minimumCustomValue,
onChange: createHandleOnChange(side),
onMouseOver: onMouseOver,
showSideInLabel: showSideInLabel,
spacingSizes: spacingSizes,
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/spacing-sizes-control/sides-dropdown/index.js
const checkIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, {