Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
return initialHighlightedIndex;
[26500] Fix | Delete
}
[26501] Fix | Delete
[26502] Fix | Delete
if (defaultHighlightedIndex !== undefined) {
[26503] Fix | Delete
return defaultHighlightedIndex;
[26504] Fix | Delete
}
[26505] Fix | Delete
[26506] Fix | Delete
if (selectedItem) {
[26507] Fix | Delete
if (offset === 0) {
[26508] Fix | Delete
return items.indexOf(selectedItem);
[26509] Fix | Delete
}
[26510] Fix | Delete
[26511] Fix | Delete
return getNextWrappingIndex(offset, items.indexOf(selectedItem), items.length, getItemNodeFromIndex, false);
[26512] Fix | Delete
}
[26513] Fix | Delete
[26514] Fix | Delete
if (offset === 0) {
[26515] Fix | Delete
return -1;
[26516] Fix | Delete
}
[26517] Fix | Delete
[26518] Fix | Delete
return offset < 0 ? items.length - 1 : 0;
[26519] Fix | Delete
}
[26520] Fix | Delete
/**
[26521] Fix | Delete
* Reuse the movement tracking of mouse and touch events.
[26522] Fix | Delete
*
[26523] Fix | Delete
* @param {boolean} isOpen Whether the dropdown is open or not.
[26524] Fix | Delete
* @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)
[26525] Fix | Delete
* @param {Object} environment Environment where component/hook exists.
[26526] Fix | Delete
* @param {Function} handleBlur Handler on blur from mouse or touch.
[26527] Fix | Delete
* @returns {Object} Ref containing whether mouseDown or touchMove event is happening
[26528] Fix | Delete
*/
[26529] Fix | Delete
[26530] Fix | Delete
[26531] Fix | Delete
function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {
[26532] Fix | Delete
var mouseAndTouchTrackersRef = Object(external_React_["useRef"])({
[26533] Fix | Delete
isMouseDown: false,
[26534] Fix | Delete
isTouchMove: false
[26535] Fix | Delete
});
[26536] Fix | Delete
Object(external_React_["useEffect"])(function () {
[26537] Fix | Delete
// The same strategy for checking if a click occurred inside or outside downsift
[26538] Fix | Delete
// as in downshift.js.
[26539] Fix | Delete
var onMouseDown = function onMouseDown() {
[26540] Fix | Delete
mouseAndTouchTrackersRef.current.isMouseDown = true;
[26541] Fix | Delete
};
[26542] Fix | Delete
[26543] Fix | Delete
var onMouseUp = function onMouseUp(event) {
[26544] Fix | Delete
mouseAndTouchTrackersRef.current.isMouseDown = false;
[26545] Fix | Delete
[26546] Fix | Delete
if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
[26547] Fix | Delete
return ref.current;
[26548] Fix | Delete
}), environment)) {
[26549] Fix | Delete
handleBlur();
[26550] Fix | Delete
}
[26551] Fix | Delete
};
[26552] Fix | Delete
[26553] Fix | Delete
var onTouchStart = function onTouchStart() {
[26554] Fix | Delete
mouseAndTouchTrackersRef.current.isTouchMove = false;
[26555] Fix | Delete
};
[26556] Fix | Delete
[26557] Fix | Delete
var onTouchMove = function onTouchMove() {
[26558] Fix | Delete
mouseAndTouchTrackersRef.current.isTouchMove = true;
[26559] Fix | Delete
};
[26560] Fix | Delete
[26561] Fix | Delete
var onTouchEnd = function onTouchEnd(event) {
[26562] Fix | Delete
if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
[26563] Fix | Delete
return ref.current;
[26564] Fix | Delete
}), environment, false)) {
[26565] Fix | Delete
handleBlur();
[26566] Fix | Delete
}
[26567] Fix | Delete
};
[26568] Fix | Delete
[26569] Fix | Delete
environment.addEventListener('mousedown', onMouseDown);
[26570] Fix | Delete
environment.addEventListener('mouseup', onMouseUp);
[26571] Fix | Delete
environment.addEventListener('touchstart', onTouchStart);
[26572] Fix | Delete
environment.addEventListener('touchmove', onTouchMove);
[26573] Fix | Delete
environment.addEventListener('touchend', onTouchEnd);
[26574] Fix | Delete
return function cleanup() {
[26575] Fix | Delete
environment.removeEventListener('mousedown', onMouseDown);
[26576] Fix | Delete
environment.removeEventListener('mouseup', onMouseUp);
[26577] Fix | Delete
environment.removeEventListener('touchstart', onTouchStart);
[26578] Fix | Delete
environment.removeEventListener('touchmove', onTouchMove);
[26579] Fix | Delete
environment.removeEventListener('touchend', onTouchEnd);
[26580] Fix | Delete
}; // eslint-disable-next-line react-hooks/exhaustive-deps
[26581] Fix | Delete
}, [isOpen, environment]);
[26582] Fix | Delete
return mouseAndTouchTrackersRef;
[26583] Fix | Delete
}
[26584] Fix | Delete
/* istanbul ignore next */
[26585] Fix | Delete
// eslint-disable-next-line import/no-mutable-exports
[26586] Fix | Delete
[26587] Fix | Delete
[26588] Fix | Delete
var useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {
[26589] Fix | Delete
return downshift_esm_noop;
[26590] Fix | Delete
};
[26591] Fix | Delete
/**
[26592] Fix | Delete
* Custom hook that checks if getter props are called correctly.
[26593] Fix | Delete
*
[26594] Fix | Delete
* @param {...any} propKeys Getter prop names to be handled.
[26595] Fix | Delete
* @returns {Function} Setter function called inside getter props to set call information.
[26596] Fix | Delete
*/
[26597] Fix | Delete
[26598] Fix | Delete
/* istanbul ignore next */
[26599] Fix | Delete
[26600] Fix | Delete
[26601] Fix | Delete
if (false) {}
[26602] Fix | Delete
[26603] Fix | Delete
function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
[26604] Fix | Delete
var isInitialMount = _ref2.isInitialMount,
[26605] Fix | Delete
highlightedIndex = _ref2.highlightedIndex,
[26606] Fix | Delete
items = _ref2.items,
[26607] Fix | Delete
environment = _ref2.environment,
[26608] Fix | Delete
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref2, _excluded$3);
[26609] Fix | Delete
[26610] Fix | Delete
// Sets a11y status message on changes in state.
[26611] Fix | Delete
Object(external_React_["useEffect"])(function () {
[26612] Fix | Delete
if (isInitialMount || false) {
[26613] Fix | Delete
return;
[26614] Fix | Delete
}
[26615] Fix | Delete
[26616] Fix | Delete
updateA11yStatus(function () {
[26617] Fix | Delete
return getA11yMessage(extends_extends({
[26618] Fix | Delete
highlightedIndex: highlightedIndex,
[26619] Fix | Delete
highlightedItem: items[highlightedIndex],
[26620] Fix | Delete
resultCount: items.length
[26621] Fix | Delete
}, rest));
[26622] Fix | Delete
}, environment.document); // eslint-disable-next-line react-hooks/exhaustive-deps
[26623] Fix | Delete
}, dependencyArray);
[26624] Fix | Delete
}
[26625] Fix | Delete
[26626] Fix | Delete
function useScrollIntoView(_ref3) {
[26627] Fix | Delete
var highlightedIndex = _ref3.highlightedIndex,
[26628] Fix | Delete
isOpen = _ref3.isOpen,
[26629] Fix | Delete
itemRefs = _ref3.itemRefs,
[26630] Fix | Delete
getItemNodeFromIndex = _ref3.getItemNodeFromIndex,
[26631] Fix | Delete
menuElement = _ref3.menuElement,
[26632] Fix | Delete
scrollIntoViewProp = _ref3.scrollIntoView;
[26633] Fix | Delete
// used not to scroll on highlight by mouse.
[26634] Fix | Delete
var shouldScrollRef = Object(external_React_["useRef"])(true); // Scroll on highlighted item if change comes from keyboard.
[26635] Fix | Delete
[26636] Fix | Delete
useIsomorphicLayoutEffect(function () {
[26637] Fix | Delete
if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {
[26638] Fix | Delete
return;
[26639] Fix | Delete
}
[26640] Fix | Delete
[26641] Fix | Delete
if (shouldScrollRef.current === false) {
[26642] Fix | Delete
shouldScrollRef.current = true;
[26643] Fix | Delete
} else {
[26644] Fix | Delete
scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);
[26645] Fix | Delete
} // eslint-disable-next-line react-hooks/exhaustive-deps
[26646] Fix | Delete
[26647] Fix | Delete
}, [highlightedIndex]);
[26648] Fix | Delete
return shouldScrollRef;
[26649] Fix | Delete
} // eslint-disable-next-line import/no-mutable-exports
[26650] Fix | Delete
[26651] Fix | Delete
[26652] Fix | Delete
var useControlPropsValidator = downshift_esm_noop;
[26653] Fix | Delete
/* istanbul ignore next */
[26654] Fix | Delete
[26655] Fix | Delete
if (false) {}
[26656] Fix | Delete
[26657] Fix | Delete
/* eslint-disable complexity */
[26658] Fix | Delete
[26659] Fix | Delete
function downshiftCommonReducer(state, action, stateChangeTypes) {
[26660] Fix | Delete
var type = action.type,
[26661] Fix | Delete
props = action.props;
[26662] Fix | Delete
var changes;
[26663] Fix | Delete
[26664] Fix | Delete
switch (type) {
[26665] Fix | Delete
case stateChangeTypes.ItemMouseMove:
[26666] Fix | Delete
changes = {
[26667] Fix | Delete
highlightedIndex: action.index
[26668] Fix | Delete
};
[26669] Fix | Delete
break;
[26670] Fix | Delete
[26671] Fix | Delete
case stateChangeTypes.MenuMouseLeave:
[26672] Fix | Delete
changes = {
[26673] Fix | Delete
highlightedIndex: -1
[26674] Fix | Delete
};
[26675] Fix | Delete
break;
[26676] Fix | Delete
[26677] Fix | Delete
case stateChangeTypes.ToggleButtonClick:
[26678] Fix | Delete
case stateChangeTypes.FunctionToggleMenu:
[26679] Fix | Delete
changes = {
[26680] Fix | Delete
isOpen: !state.isOpen,
[26681] Fix | Delete
highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)
[26682] Fix | Delete
};
[26683] Fix | Delete
break;
[26684] Fix | Delete
[26685] Fix | Delete
case stateChangeTypes.FunctionOpenMenu:
[26686] Fix | Delete
changes = {
[26687] Fix | Delete
isOpen: true,
[26688] Fix | Delete
highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)
[26689] Fix | Delete
};
[26690] Fix | Delete
break;
[26691] Fix | Delete
[26692] Fix | Delete
case stateChangeTypes.FunctionCloseMenu:
[26693] Fix | Delete
changes = {
[26694] Fix | Delete
isOpen: false
[26695] Fix | Delete
};
[26696] Fix | Delete
break;
[26697] Fix | Delete
[26698] Fix | Delete
case stateChangeTypes.FunctionSetHighlightedIndex:
[26699] Fix | Delete
changes = {
[26700] Fix | Delete
highlightedIndex: action.highlightedIndex
[26701] Fix | Delete
};
[26702] Fix | Delete
break;
[26703] Fix | Delete
[26704] Fix | Delete
case stateChangeTypes.FunctionSetInputValue:
[26705] Fix | Delete
changes = {
[26706] Fix | Delete
inputValue: action.inputValue
[26707] Fix | Delete
};
[26708] Fix | Delete
break;
[26709] Fix | Delete
[26710] Fix | Delete
case stateChangeTypes.FunctionReset:
[26711] Fix | Delete
changes = {
[26712] Fix | Delete
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
[26713] Fix | Delete
isOpen: getDefaultValue$1(props, 'isOpen'),
[26714] Fix | Delete
selectedItem: getDefaultValue$1(props, 'selectedItem'),
[26715] Fix | Delete
inputValue: getDefaultValue$1(props, 'inputValue')
[26716] Fix | Delete
};
[26717] Fix | Delete
break;
[26718] Fix | Delete
[26719] Fix | Delete
default:
[26720] Fix | Delete
throw new Error('Reducer called without proper action type.');
[26721] Fix | Delete
}
[26722] Fix | Delete
[26723] Fix | Delete
return extends_extends({}, state, changes);
[26724] Fix | Delete
}
[26725] Fix | Delete
/* eslint-enable complexity */
[26726] Fix | Delete
[26727] Fix | Delete
function getItemIndexByCharacterKey(_a) {
[26728] Fix | Delete
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
[26729] Fix | Delete
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
[26730] Fix | Delete
for (var index = 0; index < items.length; index++) {
[26731] Fix | Delete
var offsetIndex = (index + highlightedIndex + 1) % items.length;
[26732] Fix | Delete
var item = items[offsetIndex];
[26733] Fix | Delete
if (item !== undefined &&
[26734] Fix | Delete
itemToString(item)
[26735] Fix | Delete
.toLowerCase()
[26736] Fix | Delete
.startsWith(lowerCasedKeysSoFar)) {
[26737] Fix | Delete
var element = getItemNodeFromIndex(offsetIndex);
[26738] Fix | Delete
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
[26739] Fix | Delete
return offsetIndex;
[26740] Fix | Delete
}
[26741] Fix | Delete
}
[26742] Fix | Delete
}
[26743] Fix | Delete
return highlightedIndex;
[26744] Fix | Delete
}
[26745] Fix | Delete
var propTypes$2 = {
[26746] Fix | Delete
items: prop_types_default.a.array.isRequired,
[26747] Fix | Delete
itemToString: prop_types_default.a.func,
[26748] Fix | Delete
getA11yStatusMessage: prop_types_default.a.func,
[26749] Fix | Delete
getA11ySelectionMessage: prop_types_default.a.func,
[26750] Fix | Delete
circularNavigation: prop_types_default.a.bool,
[26751] Fix | Delete
highlightedIndex: prop_types_default.a.number,
[26752] Fix | Delete
defaultHighlightedIndex: prop_types_default.a.number,
[26753] Fix | Delete
initialHighlightedIndex: prop_types_default.a.number,
[26754] Fix | Delete
isOpen: prop_types_default.a.bool,
[26755] Fix | Delete
defaultIsOpen: prop_types_default.a.bool,
[26756] Fix | Delete
initialIsOpen: prop_types_default.a.bool,
[26757] Fix | Delete
selectedItem: prop_types_default.a.any,
[26758] Fix | Delete
initialSelectedItem: prop_types_default.a.any,
[26759] Fix | Delete
defaultSelectedItem: prop_types_default.a.any,
[26760] Fix | Delete
id: prop_types_default.a.string,
[26761] Fix | Delete
labelId: prop_types_default.a.string,
[26762] Fix | Delete
menuId: prop_types_default.a.string,
[26763] Fix | Delete
getItemId: prop_types_default.a.func,
[26764] Fix | Delete
toggleButtonId: prop_types_default.a.string,
[26765] Fix | Delete
stateReducer: prop_types_default.a.func,
[26766] Fix | Delete
onSelectedItemChange: prop_types_default.a.func,
[26767] Fix | Delete
onHighlightedIndexChange: prop_types_default.a.func,
[26768] Fix | Delete
onStateChange: prop_types_default.a.func,
[26769] Fix | Delete
onIsOpenChange: prop_types_default.a.func,
[26770] Fix | Delete
environment: prop_types_default.a.shape({
[26771] Fix | Delete
addEventListener: prop_types_default.a.func,
[26772] Fix | Delete
removeEventListener: prop_types_default.a.func,
[26773] Fix | Delete
document: prop_types_default.a.shape({
[26774] Fix | Delete
getElementById: prop_types_default.a.func,
[26775] Fix | Delete
activeElement: prop_types_default.a.any,
[26776] Fix | Delete
body: prop_types_default.a.any
[26777] Fix | Delete
})
[26778] Fix | Delete
})
[26779] Fix | Delete
};
[26780] Fix | Delete
/**
[26781] Fix | Delete
* Default implementation for status message. Only added when menu is open.
[26782] Fix | Delete
* Will specift if there are results in the list, and if so, how many,
[26783] Fix | Delete
* and what keys are relevant.
[26784] Fix | Delete
*
[26785] Fix | Delete
* @param {Object} param the downshift state and other relevant properties
[26786] Fix | Delete
* @return {String} the a11y status message
[26787] Fix | Delete
*/
[26788] Fix | Delete
function downshift_esm_getA11yStatusMessage(_a) {
[26789] Fix | Delete
var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;
[26790] Fix | Delete
if (!isOpen) {
[26791] Fix | Delete
return '';
[26792] Fix | Delete
}
[26793] Fix | Delete
if (!resultCount) {
[26794] Fix | Delete
return 'No results are available.';
[26795] Fix | Delete
}
[26796] Fix | Delete
if (resultCount !== previousResultCount) {
[26797] Fix | Delete
return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.";
[26798] Fix | Delete
}
[26799] Fix | Delete
return '';
[26800] Fix | Delete
}
[26801] Fix | Delete
var defaultProps$2 = __assign(__assign({}, defaultProps$3), { getA11yStatusMessage: downshift_esm_getA11yStatusMessage });
[26802] Fix | Delete
// eslint-disable-next-line import/no-mutable-exports
[26803] Fix | Delete
var validatePropTypes$2 = downshift_esm_noop;
[26804] Fix | Delete
/* istanbul ignore next */
[26805] Fix | Delete
if (false) {}
[26806] Fix | Delete
[26807] Fix | Delete
var MenuKeyDownArrowDown = false ? undefined : 0;
[26808] Fix | Delete
var MenuKeyDownArrowUp = false ? undefined : 1;
[26809] Fix | Delete
var MenuKeyDownEscape = false ? undefined : 2;
[26810] Fix | Delete
var MenuKeyDownHome = false ? undefined : 3;
[26811] Fix | Delete
var MenuKeyDownEnd = false ? undefined : 4;
[26812] Fix | Delete
var MenuKeyDownEnter = false ? undefined : 5;
[26813] Fix | Delete
var MenuKeyDownSpaceButton = false ? undefined : 6;
[26814] Fix | Delete
var MenuKeyDownCharacter = false ? undefined : 7;
[26815] Fix | Delete
var MenuBlur = false ? undefined : 8;
[26816] Fix | Delete
var MenuMouseLeave$1 = false ? undefined : 9;
[26817] Fix | Delete
var ItemMouseMove$1 = false ? undefined : 10;
[26818] Fix | Delete
var ItemClick$1 = false ? undefined : 11;
[26819] Fix | Delete
var ToggleButtonClick$1 = false ? undefined : 12;
[26820] Fix | Delete
var ToggleButtonKeyDownArrowDown = false ? undefined : 13;
[26821] Fix | Delete
var ToggleButtonKeyDownArrowUp = false ? undefined : 14;
[26822] Fix | Delete
var ToggleButtonKeyDownCharacter = false ? undefined : 15;
[26823] Fix | Delete
var FunctionToggleMenu$1 = false ? undefined : 16;
[26824] Fix | Delete
var FunctionOpenMenu$1 = false ? undefined : 17;
[26825] Fix | Delete
var FunctionCloseMenu$1 = false ? undefined : 18;
[26826] Fix | Delete
var FunctionSetHighlightedIndex$1 = false ? undefined : 19;
[26827] Fix | Delete
var FunctionSelectItem$1 = false ? undefined : 20;
[26828] Fix | Delete
var FunctionSetInputValue$1 = false ? undefined : 21;
[26829] Fix | Delete
var FunctionReset$2 = false ? undefined : 22;
[26830] Fix | Delete
[26831] Fix | Delete
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
[26832] Fix | Delete
__proto__: null,
[26833] Fix | Delete
MenuKeyDownArrowDown: MenuKeyDownArrowDown,
[26834] Fix | Delete
MenuKeyDownArrowUp: MenuKeyDownArrowUp,
[26835] Fix | Delete
MenuKeyDownEscape: MenuKeyDownEscape,
[26836] Fix | Delete
MenuKeyDownHome: MenuKeyDownHome,
[26837] Fix | Delete
MenuKeyDownEnd: MenuKeyDownEnd,
[26838] Fix | Delete
MenuKeyDownEnter: MenuKeyDownEnter,
[26839] Fix | Delete
MenuKeyDownSpaceButton: MenuKeyDownSpaceButton,
[26840] Fix | Delete
MenuKeyDownCharacter: MenuKeyDownCharacter,
[26841] Fix | Delete
MenuBlur: MenuBlur,
[26842] Fix | Delete
MenuMouseLeave: MenuMouseLeave$1,
[26843] Fix | Delete
ItemMouseMove: ItemMouseMove$1,
[26844] Fix | Delete
ItemClick: ItemClick$1,
[26845] Fix | Delete
ToggleButtonClick: ToggleButtonClick$1,
[26846] Fix | Delete
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
[26847] Fix | Delete
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
[26848] Fix | Delete
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
[26849] Fix | Delete
FunctionToggleMenu: FunctionToggleMenu$1,
[26850] Fix | Delete
FunctionOpenMenu: FunctionOpenMenu$1,
[26851] Fix | Delete
FunctionCloseMenu: FunctionCloseMenu$1,
[26852] Fix | Delete
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
[26853] Fix | Delete
FunctionSelectItem: FunctionSelectItem$1,
[26854] Fix | Delete
FunctionSetInputValue: FunctionSetInputValue$1,
[26855] Fix | Delete
FunctionReset: FunctionReset$2
[26856] Fix | Delete
});
[26857] Fix | Delete
[26858] Fix | Delete
/* eslint-disable complexity */
[26859] Fix | Delete
[26860] Fix | Delete
function downshiftSelectReducer(state, action) {
[26861] Fix | Delete
var type = action.type,
[26862] Fix | Delete
props = action.props,
[26863] Fix | Delete
shiftKey = action.shiftKey;
[26864] Fix | Delete
var changes;
[26865] Fix | Delete
[26866] Fix | Delete
switch (type) {
[26867] Fix | Delete
case ItemClick$1:
[26868] Fix | Delete
changes = {
[26869] Fix | Delete
isOpen: getDefaultValue$1(props, 'isOpen'),
[26870] Fix | Delete
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
[26871] Fix | Delete
selectedItem: props.items[action.index]
[26872] Fix | Delete
};
[26873] Fix | Delete
break;
[26874] Fix | Delete
[26875] Fix | Delete
case ToggleButtonKeyDownCharacter:
[26876] Fix | Delete
{
[26877] Fix | Delete
var lowercasedKey = action.key;
[26878] Fix | Delete
var inputValue = "" + state.inputValue + lowercasedKey;
[26879] Fix | Delete
var itemIndex = getItemIndexByCharacterKey({
[26880] Fix | Delete
keysSoFar: inputValue,
[26881] Fix | Delete
highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
[26882] Fix | Delete
items: props.items,
[26883] Fix | Delete
itemToString: props.itemToString,
[26884] Fix | Delete
getItemNodeFromIndex: action.getItemNodeFromIndex
[26885] Fix | Delete
});
[26886] Fix | Delete
changes = extends_extends({
[26887] Fix | Delete
inputValue: inputValue
[26888] Fix | Delete
}, itemIndex >= 0 && {
[26889] Fix | Delete
selectedItem: props.items[itemIndex]
[26890] Fix | Delete
});
[26891] Fix | Delete
}
[26892] Fix | Delete
break;
[26893] Fix | Delete
[26894] Fix | Delete
case ToggleButtonKeyDownArrowDown:
[26895] Fix | Delete
changes = {
[26896] Fix | Delete
highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
[26897] Fix | Delete
isOpen: true
[26898] Fix | Delete
};
[26899] Fix | Delete
break;
[26900] Fix | Delete
[26901] Fix | Delete
case ToggleButtonKeyDownArrowUp:
[26902] Fix | Delete
changes = {
[26903] Fix | Delete
highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
[26904] Fix | Delete
isOpen: true
[26905] Fix | Delete
};
[26906] Fix | Delete
break;
[26907] Fix | Delete
[26908] Fix | Delete
case MenuKeyDownEnter:
[26909] Fix | Delete
case MenuKeyDownSpaceButton:
[26910] Fix | Delete
changes = extends_extends({
[26911] Fix | Delete
isOpen: getDefaultValue$1(props, 'isOpen'),
[26912] Fix | Delete
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')
[26913] Fix | Delete
}, state.highlightedIndex >= 0 && {
[26914] Fix | Delete
selectedItem: props.items[state.highlightedIndex]
[26915] Fix | Delete
});
[26916] Fix | Delete
break;
[26917] Fix | Delete
[26918] Fix | Delete
case MenuKeyDownHome:
[26919] Fix | Delete
changes = {
[26920] Fix | Delete
highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
[26921] Fix | Delete
};
[26922] Fix | Delete
break;
[26923] Fix | Delete
[26924] Fix | Delete
case MenuKeyDownEnd:
[26925] Fix | Delete
changes = {
[26926] Fix | Delete
highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
[26927] Fix | Delete
};
[26928] Fix | Delete
break;
[26929] Fix | Delete
[26930] Fix | Delete
case MenuKeyDownEscape:
[26931] Fix | Delete
changes = {
[26932] Fix | Delete
isOpen: false,
[26933] Fix | Delete
highlightedIndex: -1
[26934] Fix | Delete
};
[26935] Fix | Delete
break;
[26936] Fix | Delete
[26937] Fix | Delete
case MenuBlur:
[26938] Fix | Delete
changes = {
[26939] Fix | Delete
isOpen: false,
[26940] Fix | Delete
highlightedIndex: -1
[26941] Fix | Delete
};
[26942] Fix | Delete
break;
[26943] Fix | Delete
[26944] Fix | Delete
case MenuKeyDownCharacter:
[26945] Fix | Delete
{
[26946] Fix | Delete
var _lowercasedKey = action.key;
[26947] Fix | Delete
[26948] Fix | Delete
var _inputValue = "" + state.inputValue + _lowercasedKey;
[26949] Fix | Delete
[26950] Fix | Delete
var highlightedIndex = getItemIndexByCharacterKey({
[26951] Fix | Delete
keysSoFar: _inputValue,
[26952] Fix | Delete
highlightedIndex: state.highlightedIndex,
[26953] Fix | Delete
items: props.items,
[26954] Fix | Delete
itemToString: props.itemToString,
[26955] Fix | Delete
getItemNodeFromIndex: action.getItemNodeFromIndex
[26956] Fix | Delete
});
[26957] Fix | Delete
changes = extends_extends({
[26958] Fix | Delete
inputValue: _inputValue
[26959] Fix | Delete
}, highlightedIndex >= 0 && {
[26960] Fix | Delete
highlightedIndex: highlightedIndex
[26961] Fix | Delete
});
[26962] Fix | Delete
}
[26963] Fix | Delete
break;
[26964] Fix | Delete
[26965] Fix | Delete
case MenuKeyDownArrowDown:
[26966] Fix | Delete
changes = {
[26967] Fix | Delete
highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
[26968] Fix | Delete
};
[26969] Fix | Delete
break;
[26970] Fix | Delete
[26971] Fix | Delete
case MenuKeyDownArrowUp:
[26972] Fix | Delete
changes = {
[26973] Fix | Delete
highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
[26974] Fix | Delete
};
[26975] Fix | Delete
break;
[26976] Fix | Delete
[26977] Fix | Delete
case FunctionSelectItem$1:
[26978] Fix | Delete
changes = {
[26979] Fix | Delete
selectedItem: action.selectedItem
[26980] Fix | Delete
};
[26981] Fix | Delete
break;
[26982] Fix | Delete
[26983] Fix | Delete
default:
[26984] Fix | Delete
return downshiftCommonReducer(state, action, stateChangeTypes$2);
[26985] Fix | Delete
}
[26986] Fix | Delete
[26987] Fix | Delete
return extends_extends({}, state, changes);
[26988] Fix | Delete
}
[26989] Fix | Delete
/* eslint-enable complexity */
[26990] Fix | Delete
[26991] Fix | Delete
var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
[26992] Fix | Delete
_excluded2$2 = ["onClick", "onKeyDown", "refKey", "ref"],
[26993] Fix | Delete
_excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref"];
[26994] Fix | Delete
useSelect.stateChangeTypes = stateChangeTypes$2;
[26995] Fix | Delete
[26996] Fix | Delete
function useSelect(userProps) {
[26997] Fix | Delete
if (userProps === void 0) {
[26998] Fix | Delete
userProps = {};
[26999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function