: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", {
className: "components-focal-point-picker__media components-focal-point-picker__media--image",
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/index.js
const GRID_OVERLAY_TIMEOUT = 600;
* Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image.
* This component addresses a specific problem: with large background images it is common to see undesirable crops,
* especially when viewing on smaller viewports such as mobile phones. This component allows the selection of
* the point with the most important visual information and returns it as a pair of numbers between 0 and 1.
* This value can be easily converted into the CSS `background-position` attribute, and will ensure that the
* focal point is never cropped out, regardless of viewport.
* - Example focal point picker value: `{ x: 0.5, y: 0.1 }`
* - Corresponding CSS: `background-position: 50% 10%;`
* import { FocalPointPicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
* const Example = () => {
* const [ focalPoint, setFocalPoint ] = useState( {
* const url = '/path/to/image';
* // Example function to render the CSS styles based on Focal Point Picker value
* backgroundImage: `url(${ url })`,
* backgroundPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`,
* onDragStart={ setFocalPoint }
* onDrag={ setFocalPoint }
* onChange={ setFocalPoint }
* <div style={ style } />
function FocalPointPicker({
__next40pxDefaultSize = false,
const [point, setPoint] = (0,external_wp_element_namespaceObject.useState)(valueProp);
const [showGridOverlay, setShowGridOverlay] = (0,external_wp_element_namespaceObject.useState)(false);
} = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({
dragAreaRef.current?.focus();
const value = getValueWithinDragArea(event);
// `value` can technically be undefined if getValueWithinDragArea() is
// called before dragAreaRef is set, but this shouldn't happen in reality.
onDragStart?.(value, event);
// Prevents text-selection when dragging.
const value = getValueWithinDragArea(event);
// Uses the internal point while dragging or else the value from props.
} = isDragging ? point : valueProp;
const dragAreaRef = (0,external_wp_element_namespaceObject.useRef)(null);
const [bounds, setBounds] = (0,external_wp_element_namespaceObject.useState)(INITIAL_BOUNDS);
const refUpdateBounds = (0,external_wp_element_namespaceObject.useRef)(() => {
if (!dragAreaRef.current) {
// Falls back to initial bounds if the ref has no size. Since styles
// give the drag area dimensions even when the media has not loaded
// this should only happen in unit tests (jsdom).
setBounds(width > 0 && height > 0 ? {
(0,external_wp_element_namespaceObject.useEffect)(() => {
const updateBounds = refUpdateBounds.current;
if (!dragAreaRef.current) {
} = dragAreaRef.current.ownerDocument;
defaultView?.addEventListener('resize', updateBounds);
return () => defaultView?.removeEventListener('resize', updateBounds);
// Updates the bounds to cover cases of unspecified media or load failures.
(0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => void refUpdateBounds.current(), []);
// TODO: Consider refactoring getValueWithinDragArea() into a pure function.
// https://github.com/WordPress/gutenberg/pull/43872#discussion_r963455173
const getValueWithinDragArea = ({
if (!dragAreaRef.current) {
} = dragAreaRef.current.getBoundingClientRect();
let nextX = (clientX - left) / bounds.width;
let nextY = (clientY - top) / bounds.height;
// Enables holding shift to jump values by 10%.
nextX = Math.round(nextX / 0.1) * 0.1;
nextY = Math.round(nextY / 0.1) * 0.1;
const getFinalValue = value => {
const resolvedValue = (_resolvePoint = resolvePoint?.(value)) !== null && _resolvePoint !== void 0 ? _resolvePoint : value;
resolvedValue.x = Math.max(0, Math.min(resolvedValue.x, 1));
resolvedValue.y = Math.max(0, Math.min(resolvedValue.y, 1));
const roundToTwoDecimalPlaces = n => Math.round(n * 1e2) / 1e2;
x: roundToTwoDecimalPlaces(resolvedValue.x),
y: roundToTwoDecimalPlaces(resolvedValue.y)
const arrowKeyStep = event => {
if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(code)) {
const step = shiftKey ? 0.1 : 0.01;
const delta = code === 'ArrowUp' || code === 'ArrowLeft' ? -1 * step : step;
const axis = code === 'ArrowUp' || code === 'ArrowDown' ? 'y' : 'x';
value[axis] = value[axis] + delta;
onChange?.(getFinalValue(value));
const focalPointPosition = {
left: x !== undefined ? x * bounds.width : 0.5 * bounds.width,
top: y !== undefined ? y * bounds.height : 0.5 * bounds.height
const classes = dist_clsx('components-focal-point-picker-control', className);
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(FocalPointPicker);
const id = `inspector-focal-point-picker-control-${instanceId}`;
use_update_effect(() => {
setShowGridOverlay(true);
const timeout = window.setTimeout(() => {
setShowGridOverlay(false);
}, GRID_OVERLAY_TIMEOUT);
return () => window.clearTimeout(timeout);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(base_control, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MediaWrapper, {
className: "components-focal-point-picker-wrapper",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(MediaContainer, {
className: "components-focal-point-picker",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPointPickerGrid, {
showOverlay: showGridOverlay
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(media_Media, {
alt: (0,external_wp_i18n_namespaceObject.__)('Media preview'),
onLoad: refUpdateBounds.current,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPoint, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FocalPointPickerControls, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
__next40pxDefaultSize: __next40pxDefaultSize,
onChange?.(getFinalValue(value));
/* harmony default export */ const focal_point_picker = (FocalPointPicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focusable-iframe/index.js
function FocusableIframe({
const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]);
external_wp_deprecated_default()('wp.components.FocusableIframe', {
alternative: 'wp.compose.useFocusableIframe'
// Disable reason: The rendered iframe is a pass-through component,
// assigning props inherited from the rendering parent. It's the
// responsibility of the parent to assign a title.
// eslint-disable-next-line jsx-a11y/iframe-has-title
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", {
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
const settings = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
d: "m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"
/* harmony default export */ const library_settings = (settings);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/utils.js
* Some themes use css vars for their font sizes, so until we
* have the way of calculating them don't display them.
* @param value The value that is checked.
* @return Whether the value is a simple css value.
function isSimpleCssValue(value) {
const sizeRegex = /^[\d\.]+(px|em|rem|vw|vh|%|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)?$/i;
return sizeRegex.test(String(value));
* If all of the given font sizes have the same unit (e.g. 'px'), return that
* unit. Otherwise return null.
* @param fontSizes List of font sizes.
* @return The common unit, or null.
function getCommonSizeUnit(fontSizes) {
const [firstFontSize, ...otherFontSizes] = fontSizes;
const [, firstUnit] = parseQuantityAndUnitFromRawValue(firstFontSize.size);
const areAllSizesSameUnit = otherFontSizes.every(fontSize => {
const [, unit] = parseQuantityAndUnitFromRawValue(fontSize.size);
return unit === firstUnit;
return areAllSizesSameUnit ? firstUnit : null;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/styles.js
function font_size_picker_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_Container = /*#__PURE__*/emotion_styled_base_browser_esm("fieldset", true ? {
styles: "border:0;margin:0;padding:0"
const styles_Header = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
} : 0)("height:", space(4), ";" + ( true ? "" : 0));
const HeaderToggle = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
} : 0)("margin-top:", space(-1), ";" + ( true ? "" : 0));
const HeaderLabel = /*#__PURE__*/emotion_styled_base_browser_esm(base_control.VisualLabel, true ? {
} : 0)("display:flex;gap:", space(1), ";justify-content:flex-start;margin-bottom:0;" + ( true ? "" : 0));
const HeaderHint = /*#__PURE__*/emotion_styled_base_browser_esm("span", true ? {
} : 0)("color:", COLORS.gray[700], ";" + ( true ? "" : 0));
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/font-size-picker-select.js
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
name: (0,external_wp_i18n_namespaceObject.__)('Custom')
const FontSizePickerSelect = props => {
const areAllSizesSameUnit = !!getCommonSizeUnit(fontSizes);
const options = [DEFAULT_OPTION, ...fontSizes.map(fontSize => {
if (areAllSizesSameUnit) {
const [quantity] = parseQuantityAndUnitFromRawValue(fontSize.size);
if (quantity !== undefined) {
} else if (isSimpleCssValue(fontSize.size)) {
hint = String(fontSize.size);
name: fontSize.name || fontSize.slug,
}), ...(disableCustomFontSizes ? [] : [CUSTOM_OPTION])];
const selectedOption = value ? (_options$find = options.find(option => option.value === value)) !== null && _options$find !== void 0 ? _options$find : CUSTOM_OPTION : DEFAULT_OPTION;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomSelectControl, {
__next40pxDefaultSize: __next40pxDefaultSize,
className: "components-font-size-picker__select",
label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
hideLabelFromVision: true,
describedBy: (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Currently selected font size.
(0,external_wp_i18n_namespaceObject.__)('Currently selected font size: %s'), selectedOption.name),
__experimentalShowSelectedHint: true,
if (selectedItem === CUSTOM_OPTION) {
onChange(selectedItem.value);
/* harmony default export */ const font_size_picker_select = (FontSizePickerSelect);