Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
}), _extends3.role = 'option', _extends3['aria-selected'] = "" + (itemIndex === latestState.highlightedIndex), _extends3.id = elementIds.getItemId(itemIndex), _extends3), !rest.disabled && (_ref4 = {
[28000] Fix | Delete
onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove)
[28001] Fix | Delete
}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), rest);
[28002] Fix | Delete
}, [dispatch, latest, shouldScrollRef, elementIds]);
[28003] Fix | Delete
var getToggleButtonProps = Object(external_React_["useCallback"])(function (_temp4) {
[28004] Fix | Delete
var _extends4;
[28005] Fix | Delete
[28006] Fix | Delete
var _ref5 = _temp4 === void 0 ? {} : _temp4,
[28007] Fix | Delete
onClick = _ref5.onClick;
[28008] Fix | Delete
_ref5.onPress;
[28009] Fix | Delete
var _ref5$refKey = _ref5.refKey,
[28010] Fix | Delete
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
[28011] Fix | Delete
ref = _ref5.ref,
[28012] Fix | Delete
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref5, _excluded3);
[28013] Fix | Delete
[28014] Fix | Delete
var toggleButtonHandleClick = function toggleButtonHandleClick() {
[28015] Fix | Delete
dispatch({
[28016] Fix | Delete
type: ToggleButtonClick
[28017] Fix | Delete
});
[28018] Fix | Delete
[28019] Fix | Delete
if (!latest.current.state.isOpen && inputRef.current) {
[28020] Fix | Delete
inputRef.current.focus();
[28021] Fix | Delete
}
[28022] Fix | Delete
};
[28023] Fix | Delete
[28024] Fix | Delete
return extends_extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {
[28025] Fix | Delete
toggleButtonRef.current = toggleButtonNode;
[28026] Fix | Delete
}), _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && extends_extends({}, {
[28027] Fix | Delete
onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
[28028] Fix | Delete
}), rest);
[28029] Fix | Delete
}, [dispatch, latest, elementIds]);
[28030] Fix | Delete
var getInputProps = Object(external_React_["useCallback"])(function (_temp5, _temp6) {
[28031] Fix | Delete
var _extends5;
[28032] Fix | Delete
[28033] Fix | Delete
var _ref6 = _temp5 === void 0 ? {} : _temp5,
[28034] Fix | Delete
onKeyDown = _ref6.onKeyDown,
[28035] Fix | Delete
onChange = _ref6.onChange,
[28036] Fix | Delete
onInput = _ref6.onInput,
[28037] Fix | Delete
onBlur = _ref6.onBlur;
[28038] Fix | Delete
_ref6.onChangeText;
[28039] Fix | Delete
var _ref6$refKey = _ref6.refKey,
[28040] Fix | Delete
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
[28041] Fix | Delete
ref = _ref6.ref,
[28042] Fix | Delete
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref6, _excluded4);
[28043] Fix | Delete
[28044] Fix | Delete
var _ref7 = _temp6 === void 0 ? {} : _temp6,
[28045] Fix | Delete
_ref7$suppressRefErro = _ref7.suppressRefError,
[28046] Fix | Delete
suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;
[28047] Fix | Delete
[28048] Fix | Delete
setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);
[28049] Fix | Delete
var latestState = latest.current.state;
[28050] Fix | Delete
[28051] Fix | Delete
var inputHandleKeyDown = function inputHandleKeyDown(event) {
[28052] Fix | Delete
var key = normalizeArrowKey(event);
[28053] Fix | Delete
[28054] Fix | Delete
if (key && inputKeyDownHandlers[key]) {
[28055] Fix | Delete
inputKeyDownHandlers[key](event);
[28056] Fix | Delete
}
[28057] Fix | Delete
};
[28058] Fix | Delete
[28059] Fix | Delete
var inputHandleChange = function inputHandleChange(event) {
[28060] Fix | Delete
dispatch({
[28061] Fix | Delete
type: InputChange,
[28062] Fix | Delete
inputValue: event.target.value
[28063] Fix | Delete
});
[28064] Fix | Delete
};
[28065] Fix | Delete
[28066] Fix | Delete
var inputHandleBlur = function inputHandleBlur() {
[28067] Fix | Delete
/* istanbul ignore else */
[28068] Fix | Delete
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
[28069] Fix | Delete
dispatch({
[28070] Fix | Delete
type: InputBlur,
[28071] Fix | Delete
selectItem: true
[28072] Fix | Delete
});
[28073] Fix | Delete
}
[28074] Fix | Delete
};
[28075] Fix | Delete
/* istanbul ignore next (preact) */
[28076] Fix | Delete
[28077] Fix | Delete
[28078] Fix | Delete
var onChangeKey = 'onChange';
[28079] Fix | Delete
var eventHandlers = {};
[28080] Fix | Delete
[28081] Fix | Delete
if (!rest.disabled) {
[28082] Fix | Delete
var _eventHandlers;
[28083] Fix | Delete
[28084] Fix | Delete
eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers);
[28085] Fix | Delete
}
[28086] Fix | Delete
[28087] Fix | Delete
return extends_extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
[28088] Fix | Delete
inputRef.current = inputNode;
[28089] Fix | Delete
}), _extends5.id = elementIds.inputId, _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5), latestState.isOpen && latestState.highlightedIndex > -1 && {
[28090] Fix | Delete
'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
[28091] Fix | Delete
}, {
[28092] Fix | Delete
'aria-labelledby': elementIds.labelId,
[28093] Fix | Delete
// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
[28094] Fix | Delete
// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
[28095] Fix | Delete
autoComplete: 'off',
[28096] Fix | Delete
value: latestState.inputValue
[28097] Fix | Delete
}, eventHandlers, rest);
[28098] Fix | Delete
}, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
[28099] Fix | Delete
var getComboboxProps = Object(external_React_["useCallback"])(function (_temp7, _temp8) {
[28100] Fix | Delete
var _extends6;
[28101] Fix | Delete
[28102] Fix | Delete
var _ref8 = _temp7 === void 0 ? {} : _temp7,
[28103] Fix | Delete
_ref8$refKey = _ref8.refKey,
[28104] Fix | Delete
refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
[28105] Fix | Delete
ref = _ref8.ref,
[28106] Fix | Delete
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref8, _excluded5);
[28107] Fix | Delete
[28108] Fix | Delete
var _ref9 = _temp8 === void 0 ? {} : _temp8,
[28109] Fix | Delete
_ref9$suppressRefErro = _ref9.suppressRefError,
[28110] Fix | Delete
suppressRefError = _ref9$suppressRefErro === void 0 ? false : _ref9$suppressRefErro;
[28111] Fix | Delete
[28112] Fix | Delete
setGetterPropCallInfo('getComboboxProps', suppressRefError, refKey, comboboxRef);
[28113] Fix | Delete
return extends_extends((_extends6 = {}, _extends6[refKey] = handleRefs(ref, function (comboboxNode) {
[28114] Fix | Delete
comboboxRef.current = comboboxNode;
[28115] Fix | Delete
}), _extends6.role = 'combobox', _extends6['aria-haspopup'] = 'listbox', _extends6['aria-owns'] = elementIds.menuId, _extends6['aria-expanded'] = latest.current.state.isOpen, _extends6), rest);
[28116] Fix | Delete
}, [latest, setGetterPropCallInfo, elementIds]); // returns
[28117] Fix | Delete
[28118] Fix | Delete
var toggleMenu = Object(external_React_["useCallback"])(function () {
[28119] Fix | Delete
dispatch({
[28120] Fix | Delete
type: FunctionToggleMenu
[28121] Fix | Delete
});
[28122] Fix | Delete
}, [dispatch]);
[28123] Fix | Delete
var closeMenu = Object(external_React_["useCallback"])(function () {
[28124] Fix | Delete
dispatch({
[28125] Fix | Delete
type: FunctionCloseMenu
[28126] Fix | Delete
});
[28127] Fix | Delete
}, [dispatch]);
[28128] Fix | Delete
var openMenu = Object(external_React_["useCallback"])(function () {
[28129] Fix | Delete
dispatch({
[28130] Fix | Delete
type: FunctionOpenMenu
[28131] Fix | Delete
});
[28132] Fix | Delete
}, [dispatch]);
[28133] Fix | Delete
var setHighlightedIndex = Object(external_React_["useCallback"])(function (newHighlightedIndex) {
[28134] Fix | Delete
dispatch({
[28135] Fix | Delete
type: FunctionSetHighlightedIndex,
[28136] Fix | Delete
highlightedIndex: newHighlightedIndex
[28137] Fix | Delete
});
[28138] Fix | Delete
}, [dispatch]);
[28139] Fix | Delete
var selectItem = Object(external_React_["useCallback"])(function (newSelectedItem) {
[28140] Fix | Delete
dispatch({
[28141] Fix | Delete
type: FunctionSelectItem,
[28142] Fix | Delete
selectedItem: newSelectedItem
[28143] Fix | Delete
});
[28144] Fix | Delete
}, [dispatch]);
[28145] Fix | Delete
var setInputValue = Object(external_React_["useCallback"])(function (newInputValue) {
[28146] Fix | Delete
dispatch({
[28147] Fix | Delete
type: FunctionSetInputValue,
[28148] Fix | Delete
inputValue: newInputValue
[28149] Fix | Delete
});
[28150] Fix | Delete
}, [dispatch]);
[28151] Fix | Delete
var reset = Object(external_React_["useCallback"])(function () {
[28152] Fix | Delete
dispatch({
[28153] Fix | Delete
type: FunctionReset$1
[28154] Fix | Delete
});
[28155] Fix | Delete
}, [dispatch]);
[28156] Fix | Delete
return {
[28157] Fix | Delete
// prop getters.
[28158] Fix | Delete
getItemProps: getItemProps,
[28159] Fix | Delete
getLabelProps: getLabelProps,
[28160] Fix | Delete
getMenuProps: getMenuProps,
[28161] Fix | Delete
getInputProps: getInputProps,
[28162] Fix | Delete
getComboboxProps: getComboboxProps,
[28163] Fix | Delete
getToggleButtonProps: getToggleButtonProps,
[28164] Fix | Delete
// actions.
[28165] Fix | Delete
toggleMenu: toggleMenu,
[28166] Fix | Delete
openMenu: openMenu,
[28167] Fix | Delete
closeMenu: closeMenu,
[28168] Fix | Delete
setHighlightedIndex: setHighlightedIndex,
[28169] Fix | Delete
setInputValue: setInputValue,
[28170] Fix | Delete
selectItem: selectItem,
[28171] Fix | Delete
reset: reset,
[28172] Fix | Delete
// state.
[28173] Fix | Delete
highlightedIndex: highlightedIndex,
[28174] Fix | Delete
isOpen: isOpen,
[28175] Fix | Delete
selectedItem: selectedItem,
[28176] Fix | Delete
inputValue: inputValue
[28177] Fix | Delete
};
[28178] Fix | Delete
}
[28179] Fix | Delete
[28180] Fix | Delete
var defaultStateValues = {
[28181] Fix | Delete
activeIndex: -1,
[28182] Fix | Delete
selectedItems: []
[28183] Fix | Delete
};
[28184] Fix | Delete
/**
[28185] Fix | Delete
* Returns the initial value for a state key in the following order:
[28186] Fix | Delete
* 1. controlled prop, 2. initial prop, 3. default prop, 4. default
[28187] Fix | Delete
* value from Downshift.
[28188] Fix | Delete
*
[28189] Fix | Delete
* @param {Object} props Props passed to the hook.
[28190] Fix | Delete
* @param {string} propKey Props key to generate the value for.
[28191] Fix | Delete
* @returns {any} The initial value for that prop.
[28192] Fix | Delete
*/
[28193] Fix | Delete
[28194] Fix | Delete
function getInitialValue(props, propKey) {
[28195] Fix | Delete
return getInitialValue$1(props, propKey, defaultStateValues);
[28196] Fix | Delete
}
[28197] Fix | Delete
/**
[28198] Fix | Delete
* Returns the default value for a state key in the following order:
[28199] Fix | Delete
* 1. controlled prop, 2. default prop, 3. default value from Downshift.
[28200] Fix | Delete
*
[28201] Fix | Delete
* @param {Object} props Props passed to the hook.
[28202] Fix | Delete
* @param {string} propKey Props key to generate the value for.
[28203] Fix | Delete
* @returns {any} The initial value for that prop.
[28204] Fix | Delete
*/
[28205] Fix | Delete
[28206] Fix | Delete
[28207] Fix | Delete
function getDefaultValue(props, propKey) {
[28208] Fix | Delete
return getDefaultValue$1(props, propKey, defaultStateValues);
[28209] Fix | Delete
}
[28210] Fix | Delete
/**
[28211] Fix | Delete
* Gets the initial state based on the provided props. It uses initial, default
[28212] Fix | Delete
* and controlled props related to state in order to compute the initial value.
[28213] Fix | Delete
*
[28214] Fix | Delete
* @param {Object} props Props passed to the hook.
[28215] Fix | Delete
* @returns {Object} The initial state.
[28216] Fix | Delete
*/
[28217] Fix | Delete
[28218] Fix | Delete
[28219] Fix | Delete
function downshift_esm_getInitialState(props) {
[28220] Fix | Delete
var activeIndex = getInitialValue(props, 'activeIndex');
[28221] Fix | Delete
var selectedItems = getInitialValue(props, 'selectedItems');
[28222] Fix | Delete
return {
[28223] Fix | Delete
activeIndex: activeIndex,
[28224] Fix | Delete
selectedItems: selectedItems
[28225] Fix | Delete
};
[28226] Fix | Delete
}
[28227] Fix | Delete
/**
[28228] Fix | Delete
* Returns true if dropdown keydown operation is permitted. Should not be
[28229] Fix | Delete
* allowed on keydown with modifier keys (ctrl, alt, shift, meta), on
[28230] Fix | Delete
* input element with text content that is either highlighted or selection
[28231] Fix | Delete
* cursor is not at the starting position.
[28232] Fix | Delete
*
[28233] Fix | Delete
* @param {KeyboardEvent} event The event from keydown.
[28234] Fix | Delete
* @returns {boolean} Whether the operation is allowed.
[28235] Fix | Delete
*/
[28236] Fix | Delete
[28237] Fix | Delete
[28238] Fix | Delete
function isKeyDownOperationPermitted(event) {
[28239] Fix | Delete
if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {
[28240] Fix | Delete
return false;
[28241] Fix | Delete
}
[28242] Fix | Delete
[28243] Fix | Delete
var element = event.target;
[28244] Fix | Delete
[28245] Fix | Delete
if (element instanceof HTMLInputElement && // if element is a text input
[28246] Fix | Delete
element.value !== '' && (element.selectionStart !== 0 || element.selectionEnd !== 0)) {
[28247] Fix | Delete
return false;
[28248] Fix | Delete
}
[28249] Fix | Delete
[28250] Fix | Delete
return true;
[28251] Fix | Delete
}
[28252] Fix | Delete
/**
[28253] Fix | Delete
* Returns a message to be added to aria-live region when item is removed.
[28254] Fix | Delete
*
[28255] Fix | Delete
* @param {Object} selectionParameters Parameters required to build the message.
[28256] Fix | Delete
* @returns {string} The a11y message.
[28257] Fix | Delete
*/
[28258] Fix | Delete
[28259] Fix | Delete
[28260] Fix | Delete
function downshift_esm_getA11yRemovalMessage(selectionParameters) {
[28261] Fix | Delete
var removedSelectedItem = selectionParameters.removedSelectedItem,
[28262] Fix | Delete
itemToStringLocal = selectionParameters.itemToString;
[28263] Fix | Delete
return itemToStringLocal(removedSelectedItem) + " has been removed.";
[28264] Fix | Delete
}
[28265] Fix | Delete
[28266] Fix | Delete
var propTypes = {
[28267] Fix | Delete
selectedItems: prop_types_default.a.array,
[28268] Fix | Delete
initialSelectedItems: prop_types_default.a.array,
[28269] Fix | Delete
defaultSelectedItems: prop_types_default.a.array,
[28270] Fix | Delete
itemToString: prop_types_default.a.func,
[28271] Fix | Delete
getA11yRemovalMessage: prop_types_default.a.func,
[28272] Fix | Delete
stateReducer: prop_types_default.a.func,
[28273] Fix | Delete
activeIndex: prop_types_default.a.number,
[28274] Fix | Delete
initialActiveIndex: prop_types_default.a.number,
[28275] Fix | Delete
defaultActiveIndex: prop_types_default.a.number,
[28276] Fix | Delete
onActiveIndexChange: prop_types_default.a.func,
[28277] Fix | Delete
onSelectedItemsChange: prop_types_default.a.func,
[28278] Fix | Delete
keyNavigationNext: prop_types_default.a.string,
[28279] Fix | Delete
keyNavigationPrevious: prop_types_default.a.string,
[28280] Fix | Delete
environment: prop_types_default.a.shape({
[28281] Fix | Delete
addEventListener: prop_types_default.a.func,
[28282] Fix | Delete
removeEventListener: prop_types_default.a.func,
[28283] Fix | Delete
document: prop_types_default.a.shape({
[28284] Fix | Delete
getElementById: prop_types_default.a.func,
[28285] Fix | Delete
activeElement: prop_types_default.a.any,
[28286] Fix | Delete
body: prop_types_default.a.any
[28287] Fix | Delete
})
[28288] Fix | Delete
})
[28289] Fix | Delete
};
[28290] Fix | Delete
var downshift_esm_defaultProps = {
[28291] Fix | Delete
itemToString: defaultProps$3.itemToString,
[28292] Fix | Delete
stateReducer: defaultProps$3.stateReducer,
[28293] Fix | Delete
environment: defaultProps$3.environment,
[28294] Fix | Delete
getA11yRemovalMessage: downshift_esm_getA11yRemovalMessage,
[28295] Fix | Delete
keyNavigationNext: 'ArrowRight',
[28296] Fix | Delete
keyNavigationPrevious: 'ArrowLeft'
[28297] Fix | Delete
}; // eslint-disable-next-line import/no-mutable-exports
[28298] Fix | Delete
[28299] Fix | Delete
var validatePropTypes = downshift_esm_noop;
[28300] Fix | Delete
/* istanbul ignore next */
[28301] Fix | Delete
[28302] Fix | Delete
if (false) {}
[28303] Fix | Delete
[28304] Fix | Delete
var SelectedItemClick = false ? undefined : 0;
[28305] Fix | Delete
var SelectedItemKeyDownDelete = false ? undefined : 1;
[28306] Fix | Delete
var SelectedItemKeyDownBackspace = false ? undefined : 2;
[28307] Fix | Delete
var SelectedItemKeyDownNavigationNext = false ? undefined : 3;
[28308] Fix | Delete
var SelectedItemKeyDownNavigationPrevious = false ? undefined : 4;
[28309] Fix | Delete
var DropdownKeyDownNavigationPrevious = false ? undefined : 5;
[28310] Fix | Delete
var DropdownKeyDownBackspace = false ? undefined : 6;
[28311] Fix | Delete
var DropdownClick = false ? undefined : 7;
[28312] Fix | Delete
var FunctionAddSelectedItem = false ? undefined : 8;
[28313] Fix | Delete
var FunctionRemoveSelectedItem = false ? undefined : 9;
[28314] Fix | Delete
var FunctionSetSelectedItems = false ? undefined : 10;
[28315] Fix | Delete
var FunctionSetActiveIndex = false ? undefined : 11;
[28316] Fix | Delete
var FunctionReset = false ? undefined : 12;
[28317] Fix | Delete
[28318] Fix | Delete
var downshift_esm_stateChangeTypes = /*#__PURE__*/Object.freeze({
[28319] Fix | Delete
__proto__: null,
[28320] Fix | Delete
SelectedItemClick: SelectedItemClick,
[28321] Fix | Delete
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
[28322] Fix | Delete
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
[28323] Fix | Delete
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
[28324] Fix | Delete
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
[28325] Fix | Delete
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
[28326] Fix | Delete
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
[28327] Fix | Delete
DropdownClick: DropdownClick,
[28328] Fix | Delete
FunctionAddSelectedItem: FunctionAddSelectedItem,
[28329] Fix | Delete
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
[28330] Fix | Delete
FunctionSetSelectedItems: FunctionSetSelectedItems,
[28331] Fix | Delete
FunctionSetActiveIndex: FunctionSetActiveIndex,
[28332] Fix | Delete
FunctionReset: FunctionReset
[28333] Fix | Delete
});
[28334] Fix | Delete
[28335] Fix | Delete
/* eslint-disable complexity */
[28336] Fix | Delete
[28337] Fix | Delete
function downshiftMultipleSelectionReducer(state, action) {
[28338] Fix | Delete
var type = action.type,
[28339] Fix | Delete
index = action.index,
[28340] Fix | Delete
props = action.props,
[28341] Fix | Delete
selectedItem = action.selectedItem;
[28342] Fix | Delete
var activeIndex = state.activeIndex,
[28343] Fix | Delete
selectedItems = state.selectedItems;
[28344] Fix | Delete
var changes;
[28345] Fix | Delete
[28346] Fix | Delete
switch (type) {
[28347] Fix | Delete
case SelectedItemClick:
[28348] Fix | Delete
changes = {
[28349] Fix | Delete
activeIndex: index
[28350] Fix | Delete
};
[28351] Fix | Delete
break;
[28352] Fix | Delete
[28353] Fix | Delete
case SelectedItemKeyDownNavigationPrevious:
[28354] Fix | Delete
changes = {
[28355] Fix | Delete
activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1
[28356] Fix | Delete
};
[28357] Fix | Delete
break;
[28358] Fix | Delete
[28359] Fix | Delete
case SelectedItemKeyDownNavigationNext:
[28360] Fix | Delete
changes = {
[28361] Fix | Delete
activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1
[28362] Fix | Delete
};
[28363] Fix | Delete
break;
[28364] Fix | Delete
[28365] Fix | Delete
case SelectedItemKeyDownBackspace:
[28366] Fix | Delete
case SelectedItemKeyDownDelete:
[28367] Fix | Delete
{
[28368] Fix | Delete
var newActiveIndex = activeIndex;
[28369] Fix | Delete
[28370] Fix | Delete
if (selectedItems.length === 1) {
[28371] Fix | Delete
newActiveIndex = -1;
[28372] Fix | Delete
} else if (activeIndex === selectedItems.length - 1) {
[28373] Fix | Delete
newActiveIndex = selectedItems.length - 2;
[28374] Fix | Delete
}
[28375] Fix | Delete
[28376] Fix | Delete
changes = extends_extends({
[28377] Fix | Delete
selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))
[28378] Fix | Delete
}, {
[28379] Fix | Delete
activeIndex: newActiveIndex
[28380] Fix | Delete
});
[28381] Fix | Delete
break;
[28382] Fix | Delete
}
[28383] Fix | Delete
[28384] Fix | Delete
case DropdownKeyDownNavigationPrevious:
[28385] Fix | Delete
changes = {
[28386] Fix | Delete
activeIndex: selectedItems.length - 1
[28387] Fix | Delete
};
[28388] Fix | Delete
break;
[28389] Fix | Delete
[28390] Fix | Delete
case DropdownKeyDownBackspace:
[28391] Fix | Delete
changes = {
[28392] Fix | Delete
selectedItems: selectedItems.slice(0, selectedItems.length - 1)
[28393] Fix | Delete
};
[28394] Fix | Delete
break;
[28395] Fix | Delete
[28396] Fix | Delete
case FunctionAddSelectedItem:
[28397] Fix | Delete
changes = {
[28398] Fix | Delete
selectedItems: [].concat(selectedItems, [selectedItem])
[28399] Fix | Delete
};
[28400] Fix | Delete
break;
[28401] Fix | Delete
[28402] Fix | Delete
case DropdownClick:
[28403] Fix | Delete
changes = {
[28404] Fix | Delete
activeIndex: -1
[28405] Fix | Delete
};
[28406] Fix | Delete
break;
[28407] Fix | Delete
[28408] Fix | Delete
case FunctionRemoveSelectedItem:
[28409] Fix | Delete
{
[28410] Fix | Delete
var _newActiveIndex = activeIndex;
[28411] Fix | Delete
var selectedItemIndex = selectedItems.indexOf(selectedItem);
[28412] Fix | Delete
[28413] Fix | Delete
if (selectedItems.length === 1) {
[28414] Fix | Delete
_newActiveIndex = -1;
[28415] Fix | Delete
} else if (selectedItemIndex === selectedItems.length - 1) {
[28416] Fix | Delete
_newActiveIndex = selectedItems.length - 2;
[28417] Fix | Delete
}
[28418] Fix | Delete
[28419] Fix | Delete
changes = extends_extends({
[28420] Fix | Delete
selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1))
[28421] Fix | Delete
}, {
[28422] Fix | Delete
activeIndex: _newActiveIndex
[28423] Fix | Delete
});
[28424] Fix | Delete
break;
[28425] Fix | Delete
}
[28426] Fix | Delete
[28427] Fix | Delete
case FunctionSetSelectedItems:
[28428] Fix | Delete
{
[28429] Fix | Delete
var newSelectedItems = action.selectedItems;
[28430] Fix | Delete
changes = {
[28431] Fix | Delete
selectedItems: newSelectedItems
[28432] Fix | Delete
};
[28433] Fix | Delete
break;
[28434] Fix | Delete
}
[28435] Fix | Delete
[28436] Fix | Delete
case FunctionSetActiveIndex:
[28437] Fix | Delete
{
[28438] Fix | Delete
var _newActiveIndex2 = action.activeIndex;
[28439] Fix | Delete
changes = {
[28440] Fix | Delete
activeIndex: _newActiveIndex2
[28441] Fix | Delete
};
[28442] Fix | Delete
break;
[28443] Fix | Delete
}
[28444] Fix | Delete
[28445] Fix | Delete
case FunctionReset:
[28446] Fix | Delete
changes = {
[28447] Fix | Delete
activeIndex: getDefaultValue(props, 'activeIndex'),
[28448] Fix | Delete
selectedItems: getDefaultValue(props, 'selectedItems')
[28449] Fix | Delete
};
[28450] Fix | Delete
break;
[28451] Fix | Delete
[28452] Fix | Delete
default:
[28453] Fix | Delete
throw new Error('Reducer called without proper action type.');
[28454] Fix | Delete
}
[28455] Fix | Delete
[28456] Fix | Delete
return extends_extends({}, state, changes);
[28457] Fix | Delete
}
[28458] Fix | Delete
[28459] Fix | Delete
var _excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
[28460] Fix | Delete
_excluded2 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"];
[28461] Fix | Delete
useMultipleSelection.stateChangeTypes = downshift_esm_stateChangeTypes;
[28462] Fix | Delete
[28463] Fix | Delete
function useMultipleSelection(userProps) {
[28464] Fix | Delete
if (userProps === void 0) {
[28465] Fix | Delete
userProps = {};
[28466] Fix | Delete
}
[28467] Fix | Delete
[28468] Fix | Delete
validatePropTypes(userProps, useMultipleSelection); // Props defaults and destructuring.
[28469] Fix | Delete
[28470] Fix | Delete
var props = extends_extends({}, downshift_esm_defaultProps, userProps);
[28471] Fix | Delete
[28472] Fix | Delete
var getA11yRemovalMessage = props.getA11yRemovalMessage,
[28473] Fix | Delete
itemToString = props.itemToString,
[28474] Fix | Delete
environment = props.environment,
[28475] Fix | Delete
keyNavigationNext = props.keyNavigationNext,
[28476] Fix | Delete
keyNavigationPrevious = props.keyNavigationPrevious; // Reducer init.
[28477] Fix | Delete
[28478] Fix | Delete
var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, downshift_esm_getInitialState(props), props),
[28479] Fix | Delete
state = _useControlledReducer[0],
[28480] Fix | Delete
dispatch = _useControlledReducer[1];
[28481] Fix | Delete
[28482] Fix | Delete
var activeIndex = state.activeIndex,
[28483] Fix | Delete
selectedItems = state.selectedItems; // Refs.
[28484] Fix | Delete
[28485] Fix | Delete
var isInitialMountRef = Object(external_React_["useRef"])(true);
[28486] Fix | Delete
var dropdownRef = Object(external_React_["useRef"])(null);
[28487] Fix | Delete
var previousSelectedItemsRef = Object(external_React_["useRef"])(selectedItems);
[28488] Fix | Delete
var selectedItemRefs = Object(external_React_["useRef"])();
[28489] Fix | Delete
selectedItemRefs.current = [];
[28490] Fix | Delete
var latest = useLatestRef({
[28491] Fix | Delete
state: state,
[28492] Fix | Delete
props: props
[28493] Fix | Delete
}); // Effects.
[28494] Fix | Delete
[28495] Fix | Delete
/* Sets a11y status message on changes in selectedItem. */
[28496] Fix | Delete
[28497] Fix | Delete
Object(external_React_["useEffect"])(function () {
[28498] Fix | Delete
if (isInitialMountRef.current) {
[28499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function