: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
onFilterValueChange = combobox_control_noop,
selected: (0,external_wp_i18n_namespaceObject.__)('Item selected.')
__experimentalRenderItem,
} = useDeprecated36pxDefaultSizeProp(props);
const [value, setValue] = useControlledValue({
const currentOption = options.find(option => option.value === value);
const currentLabel = (_currentOption$label = currentOption?.label) !== null && _currentOption$label !== void 0 ? _currentOption$label : '';
// Use a custom prefix when generating the `instanceId` to avoid having
// duplicate input IDs when rendering this component and `FormTokenField`
// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).
const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ComboboxControl, 'combobox-control');
const [selectedSuggestion, setSelectedSuggestion] = (0,external_wp_element_namespaceObject.useState)(currentOption || null);
const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
const [inputHasFocus, setInputHasFocus] = (0,external_wp_element_namespaceObject.useState)(false);
const [inputValue, setInputValue] = (0,external_wp_element_namespaceObject.useState)('');
const inputContainer = (0,external_wp_element_namespaceObject.useRef)(null);
const matchingSuggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
const startsWithMatch = [];
const containsMatch = [];
const match = normalizeTextString(inputValue);
options.forEach(option => {
const index = normalizeTextString(option.label).indexOf(match);
startsWithMatch.push(option);
containsMatch.push(option);
return startsWithMatch.concat(containsMatch);
}, [inputValue, options]);
const onSuggestionSelected = newSelectedSuggestion => {
if (newSelectedSuggestion.disabled) {
setValue(newSelectedSuggestion.value);
(0,external_wp_a11y_namespaceObject.speak)(messages.selected, 'assertive');
setSelectedSuggestion(newSelectedSuggestion);
const handleArrowNavigation = (offset = 1) => {
const index = getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions);
let nextIndex = index + offset;
nextIndex = matchingSuggestions.length - 1;
} else if (nextIndex >= matchingSuggestions.length) {
setSelectedSuggestion(matchingSuggestions[nextIndex]);
const onKeyDown = withIgnoreIMEEvents(event => {
let preventDefault = false;
if (event.defaultPrevented) {
if (selectedSuggestion) {
onSuggestionSelected(selectedSuggestion);
handleArrowNavigation(-1);
handleArrowNavigation(1);
setSelectedSuggestion(null);
const onFocusOutside = () => {
const onInputChange = event => {
const text = event.value;
onFilterValueChange(text);
const handleOnReset = () => {
inputContainer.current?.focus();
// Update current selections when the filter input changes.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const hasMatchingSuggestions = matchingSuggestions.length > 0;
const hasSelectedMatchingSuggestions = getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions) > 0;
if (hasMatchingSuggestions && !hasSelectedMatchingSuggestions) {
// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.
setSelectedSuggestion(matchingSuggestions[0]);
}, [matchingSuggestions, selectedSuggestion]);
(0,external_wp_element_namespaceObject.useEffect)(() => {
const hasMatchingSuggestions = matchingSuggestions.length > 0;
const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */
(0,external_wp_i18n_namespaceObject._n)('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : (0,external_wp_i18n_namespaceObject.__)('No results.');
(0,external_wp_a11y_namespaceObject.speak)(message, 'polite');
}, [matchingSuggestions, isExpanded]);
// Disable reason: There is no appropriate role which describes the
// input container intended accessible usability.
// TODO: Refactor click detection to use blur to stop propagation.
/* eslint-disable jsx-a11y/no-static-element-interactions */
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(DetectOutside, {
onFocusOutside: onFocusOutside,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(base_control, {
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
className: dist_clsx(className, 'components-combobox-control'),
id: `components-form-token-input-${instanceId}`,
hideLabelFromVision: hideLabelFromVision,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "components-combobox-control__suggestions-container",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(InputWrapperFlex, {
__next40pxDefaultSize: __next40pxDefaultSize,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_block_component, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(token_input, {
className: "components-combobox-control__input",
value: isExpanded ? inputValue : currentLabel,
selectedSuggestionIndex: getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions),
}), allowReset && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(flex_item_component, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_button, {
className: "components-combobox-control__reset",
label: (0,external_wp_i18n_namespaceObject.__)('Reset')
}), isExpanded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(suggestions_list, {
// The empty string for `value` here is not actually used, but is
// just a quick way to satisfy the TypeScript requirements of SuggestionsList.
// See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330
displayTransform: suggestion => suggestion.label,
suggestions: matchingSuggestions,
selectedIndex: getIndexOfMatchingSuggestion(selectedSuggestion, matchingSuggestions),
onHover: setSelectedSuggestion,
onSelect: onSuggestionSelected,
__experimentalRenderItem: __experimentalRenderItem
/* eslint-enable jsx-a11y/no-static-element-interactions */
/* harmony default export */ const combobox_control = (ComboboxControl);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/3X3MDQGM.js
// src/group/group-label-context.ts
var GroupLabelContext = (0,external_React_.createContext)(void 0);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/R2QZ3KXH.js
var useGroup = createHook((props) => {
const [labelId, setLabelId] = (0,external_React_.useState)();
(element) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(GroupLabelContext.Provider, { value: setLabelId, children: element }),
props = _4R3V3JGP_spreadValues({
"aria-labelledby": labelId
var Group = createComponent((props) => {
const htmlProps = useGroup(props);
return _3ORBWXWF_createElement("div", htmlProps);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/636A7WVS.js
// src/composite/composite-group.ts
var useCompositeGroup = createHook(
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
var CompositeGroup = createComponent(
const htmlProps = useCompositeGroup(props);
return _3ORBWXWF_createElement("div", htmlProps);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/composite/legacy/index.js
* Composite is a component that may contain navigable items represented by
* CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements
* all the keyboard navigation mechanisms to ensure that there's only one
* tab stop for the whole Composite element. This means that it can behave as
* a roving tabindex or aria-activedescendant container.
* @see https://ariakit.org/components/composite
// Legacy composite components can either provide state through a
// single `state` prop, or via individual props, usually through
// spreading the state generated by `useCompositeState`.
// That is, `<Composite* { ...state }>`.
function mapLegacyStatePropsToComponentProps(legacyProps) {
// If a `state` prop is provided, we unpack that; otherwise,
// the necessary props are provided directly in `legacyProps`.
} = mapLegacyStatePropsToComponentProps(state);
function proxyComposite(ProxiedComponent, propMap = {}) {
const displayName = ProxiedComponent.displayName;
const Component = legacyProps => {
} = mapLegacyStatePropsToComponentProps(legacyProps);
props.id = (0,external_wp_compose_namespaceObject.useInstanceId)(store, props.baseId, props.id);
Object.entries(propMap).forEach(([from, to]) => {
if (props.hasOwnProperty(from)) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ProxiedComponent, {
Component.displayName = displayName;
// The old `CompositeGroup` used to behave more like the current
// `CompositeRow`, but this has been split into two different
// components. We handle that difference by checking on the
// provided role, and returning the appropriate component.
const unproxiedCompositeGroup = (0,external_wp_element_namespaceObject.forwardRef)(({
const Component = role === 'row' ? CompositeRow : CompositeGroup;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Component, {
unproxiedCompositeGroup.displayName = 'CompositeGroup';
const legacy_Composite = proxyComposite(Composite, {
const legacy_CompositeGroup = proxyComposite(unproxiedCompositeGroup);
const legacy_CompositeItem = proxyComposite(CompositeItem, {
focusable: 'accessibleWhenDisabled'
function useCompositeState(legacyStateOptions = {}) {
currentId: defaultActiveId,
shift: focusShift = false,
// eslint-disable-next-line camelcase
unstable_virtual: virtualFocus
baseId: (0,external_wp_compose_namespaceObject.useInstanceId)(legacy_Composite, 'composite', baseId),
store: useCompositeStore({
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/aria-helper.js
const LIVE_REGION_ARIA_ROLES = new Set(['alert', 'status', 'log', 'marquee', 'timer']);
const hiddenElementsByDepth = [];
* Hides all elements in the body element from screen-readers except
* the provided element and elements that should not be hidden from
* The reason we do this is because `aria-modal="true"` currently is bugged
* in Safari, and support is spotty in other browsers overall. In the future
* we should consider removing these helper functions in favor of
* @param modalElement The element that should not be hidden.
function modalize(modalElement) {
const elements = Array.from(document.body.children);
const hiddenElements = [];
hiddenElementsByDepth.push(hiddenElements);
for (const element of elements) {
if (element === modalElement) {
if (elementShouldBeHidden(element)) {
element.setAttribute('aria-hidden', 'true');
hiddenElements.push(element);
* Determines if the passed element should not be hidden from screen readers.
* @param element The element that should be checked.
* @return Whether the element should not be hidden from screen-readers.
function elementShouldBeHidden(element) {
const role = element.getAttribute('role');
return !(element.tagName === 'SCRIPT' || element.hasAttribute('aria-hidden') || element.hasAttribute('aria-live') || role && LIVE_REGION_ARIA_ROLES.has(role));
* Accessibly reveals the elements hidden by the latest modal.
const hiddenElements = hiddenElementsByDepth.pop();
for (const element of hiddenElements) {
element.removeAttribute('aria-hidden');
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/index.js
// Used to track and dismiss the prior modal when another opens unless nested.
const ModalContext = (0,external_wp_element_namespaceObject.createContext)([]);
// Used to track body class names applied while modals are open.
const bodyOpenClasses = new Map();
function UnforwardedModal(props, forwardedRef) {
bodyOpenClassName = 'modal-open',
shouldCloseOnClickOutside = true,