: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Convert timezone offset to hours.
const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60);
// System timezone and user timezone match, nothing needed.
// Compare as numbers because it comes over as string.
if (Number(timezone.offset) === userTimezoneOffset) {
const offsetSymbol = Number(timezone.offset) >= 0 ? '+' : '';
const zoneAbbr = '' !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offsetFormatted}`;
// Replace underscore with space in strings like `America/Costa_Rica`.
const prettyTimezoneString = timezone.string.replace('_', ' ');
const timezoneDetail = 'UTC' === timezone.string ? (0,external_wp_i18n_namespaceObject.__)('Coordinated Universal Time') : `(${zoneAbbr}) ${prettyTimezoneString}`;
// When the prettyTimezoneString is empty, there is no additional timezone
// detail information to show in a Tooltip.
const hasNoAdditionalTimezoneDetail = prettyTimezoneString.trim().length === 0;
return hasNoAdditionalTimezoneDetail ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeZone, {
className: "components-datetime__timezone",
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(tooltip, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeZone, {
className: "components-datetime__timezone",
/* harmony default export */ const timezone = (timezone_TimeZone);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time/index.js
function from12hTo24h(hours, isPm) {
return isPm ? (hours % 12 + 12) % 24 : hours % 12;
* Creates an InputControl reducer used to pad an input so that it is always a
* given width. For example, the hours and minutes inputs are padded to 2 so
* that '4' appears as '04'.
* @param pad How many digits the value should be.
function buildPadInputStateReducer(pad) {
return (state, action) => {
if (action.type === COMMIT || action.type === PRESS_UP || action.type === PRESS_DOWN) {
if (nextState.value !== undefined) {
nextState.value = nextState.value.toString().padStart(pad, '0');
* TimePicker is a React component that renders a clock for time selection.
* import { TimePicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
* const MyTimePicker = () => {
* const [ time, setTime ] = useState( new Date() );
* onChange={ ( newTime ) => setTime( newTime ) }
const [date, setDate] = (0,external_wp_element_namespaceObject.useState)(() =>
// Truncate the date at the minutes, see: #15495.
currentTime ? startOfMinute(inputToDate(currentTime)) : new Date());
// Reset the state when currentTime changed.
// TODO: useEffect() shouldn't be used like this, causes an unnecessary render
(0,external_wp_element_namespaceObject.useEffect)(() => {
setDate(currentTime ? startOfMinute(inputToDate(currentTime)) : new Date());
} = (0,external_wp_element_namespaceObject.useMemo)(() => ({
month: format(date, 'MM'),
year: format(date, 'yyyy'),
minutes: format(date, 'mm'),
hours: format(date, is12Hour ? 'hh' : 'HH'),
const buildNumberControlChangeCallback = method => {
const callback = (value, {
var _ownerDocument$defaul;
// `instanceof` checks need to get the instance definition from the
// corresponding window object — therefore, the following logic makes
// the component work correctly even when rendered inside an iframe.
const HTMLInputElementInstance = (_ownerDocument$defaul = event.target?.ownerDocument.defaultView?.HTMLInputElement) !== null && _ownerDocument$defaul !== void 0 ? _ownerDocument$defaul : HTMLInputElement;
if (!(event.target instanceof HTMLInputElementInstance)) {
if (!event.target.validity.valid) {
// We can safely assume value is a number if target is valid.
let numberValue = Number(value);
// If the 12-hour format is being used and the 'PM' period is
// selected, then the incoming value (which ranges 1-12) should be
// increased by 12 to match the expected 24-hour format.
if (method === 'hours' && is12Hour) {
numberValue = from12hTo24h(numberValue, am === 'PM');
const newDate = set_set(date, {
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
function buildAmPmChangeCallback(value) {
const parsedHours = parseInt(hours, 10);
const newDate = setHours(date, from12hTo24h(parsedHours, value === 'PM'));
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
const dayField = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DayInput, {
className: "components-datetime__time-field components-datetime__time-field-day" // Unused, for backwards compatibility.
label: (0,external_wp_i18n_namespaceObject.__)('Day'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
isPressEnterToChange: true,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('date')
const monthField = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MonthSelectWrapper, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(select_control, {
className: "components-datetime__time-field components-datetime__time-field-month" // Unused, for backwards compatibility.
label: (0,external_wp_i18n_namespaceObject.__)('Month'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('January')
label: (0,external_wp_i18n_namespaceObject.__)('February')
label: (0,external_wp_i18n_namespaceObject.__)('March')
label: (0,external_wp_i18n_namespaceObject.__)('April')
label: (0,external_wp_i18n_namespaceObject.__)('May')
label: (0,external_wp_i18n_namespaceObject.__)('June')
label: (0,external_wp_i18n_namespaceObject.__)('July')
label: (0,external_wp_i18n_namespaceObject.__)('August')
label: (0,external_wp_i18n_namespaceObject.__)('September')
label: (0,external_wp_i18n_namespaceObject.__)('October')
label: (0,external_wp_i18n_namespaceObject.__)('November')
label: (0,external_wp_i18n_namespaceObject.__)('December')
const newDate = setMonth_setMonth(date, Number(value) - 1);
onChange?.(format(newDate, TIMEZONELESS_FORMAT));
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(time_styles_Wrapper, {
className: "components-datetime__time" // Unused, for backwards compatibility.
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Fieldset, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, {
className: "components-datetime__time-legend" // Unused, for backwards compatibility.
children: (0,external_wp_i18n_namespaceObject.__)('Time')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, {
className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(TimeWrapper, {
className: "components-datetime__time-field components-datetime__time-field-time" // Unused, for backwards compatibility.
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(HoursInput, {
className: "components-datetime__time-field-hours-input" // Unused, for backwards compatibility.
label: (0,external_wp_i18n_namespaceObject.__)('Hours'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
isPressEnterToChange: true,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('hours'),
__unstableStateReducer: buildPadInputStateReducer(2)
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(TimeSeparator, {
className: "components-datetime__time-separator" // Unused, for backwards compatibility.
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MinutesInput, {
className: "components-datetime__time-field-minutes-input" // Unused, for backwards compatibility.
label: (0,external_wp_i18n_namespaceObject.__)('Minutes'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
isPressEnterToChange: true,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('minutes'),
__unstableStateReducer: buildPadInputStateReducer(2)
}), is12Hour && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(button_group, {
className: "components-datetime__time-field components-datetime__time-field-am-pm" // Unused, for backwards compatibility.
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, {
className: "components-datetime__time-am-button" // Unused, for backwards compatibility.
variant: am === 'AM' ? 'primary' : 'secondary',
__next40pxDefaultSize: true,
onClick: buildAmPmChangeCallback('AM'),
children: (0,external_wp_i18n_namespaceObject.__)('AM')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, {
className: "components-datetime__time-pm-button" // Unused, for backwards compatibility.
variant: am === 'PM' ? 'primary' : 'secondary',
__next40pxDefaultSize: true,
onClick: buildAmPmChangeCallback('PM'),
children: (0,external_wp_i18n_namespaceObject.__)('PM')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(spacer_component, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(timezone, {})]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Fieldset, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control.VisualLabel, {
className: "components-datetime__time-legend" // Unused, for backwards compatibility.
children: (0,external_wp_i18n_namespaceObject.__)('Date')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(h_stack_component, {
className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
children: [is12Hour ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [monthField, dayField]
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [dayField, monthField]
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(YearInput, {
className: "components-datetime__time-field components-datetime__time-field-year" // Unused, for backwards compatibility.
label: (0,external_wp_i18n_namespaceObject.__)('Year'),
hideLabelFromVision: true,
__next40pxDefaultSize: true,
isPressEnterToChange: true,
isShiftStepEnabled: false,
onChange: buildNumberControlChangeCallback('year'),
__unstableStateReducer: buildPadInputStateReducer(4)
/* harmony default export */ const date_time_time = (TimePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date-time/styles.js
function date_time_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 date_time_styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm(v_stack_component, true ? {
styles: "box-sizing:border-box"
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date-time/index.js
const date_time_noop = () => {};
function UnforwardedDateTimePicker({
onMonthPreviewed = date_time_noop,
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(date_time_styles_Wrapper, {
className: "components-datetime",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(date_time_time, {
currentTime: currentDate,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(date, {
currentDate: currentDate,
isInvalidDate: isInvalidDate,
onMonthPreviewed: onMonthPreviewed,
* DateTimePicker is a React component that renders a calendar and clock for
* date and time selection. The calendar and clock components can be accessed
* individually using the `DatePicker` and `TimePicker` components respectively.
* import { DateTimePicker } from '@wordpress/components';
* import { useState } from '@wordpress/element';
* const MyDateTimePicker = () => {
* const [ date, setDate ] = useState( new Date() );
* onChange={ ( newDate ) => setDate( newDate ) }
const DateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedDateTimePicker);
/* harmony default export */ const date_time = (DateTimePicker);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/index.js
/* harmony default export */ const build_module_date_time = (date_time);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/sizes.js
* defines the sizes used in dimension controls
* all hardcoded `size` values are based on the value of
* the Sass variable `$block-padding` from
* `packages/block-editor/src/components/dimension-control/sizes.js`.
* Finds the correct size object from the provided sizes
* table by size slug (eg: `medium`)
* @param sizes containing objects for each size definition.
* @param slug a string representation of the size (eg: `medium`).
const findSizeBySlug = (sizes, slug) => sizes.find(size => slug === size.slug);
/* harmony default export */ const dimension_control_sizes = ([{
name: (0,external_wp_i18n_namespaceObject._x)('None', 'Size of a UI element'),
name: (0,external_wp_i18n_namespaceObject._x)('Small', 'Size of a UI element'),
name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'Size of a UI element'),