Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
MenuMouseLeave: MenuMouseLeave,
[27500] Fix | Delete
ItemMouseMove: ItemMouseMove,
[27501] Fix | Delete
ItemClick: ItemClick,
[27502] Fix | Delete
ToggleButtonClick: ToggleButtonClick,
[27503] Fix | Delete
FunctionToggleMenu: FunctionToggleMenu,
[27504] Fix | Delete
FunctionOpenMenu: FunctionOpenMenu,
[27505] Fix | Delete
FunctionCloseMenu: FunctionCloseMenu,
[27506] Fix | Delete
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
[27507] Fix | Delete
FunctionSelectItem: FunctionSelectItem,
[27508] Fix | Delete
FunctionSetInputValue: FunctionSetInputValue,
[27509] Fix | Delete
FunctionReset: FunctionReset$1,
[27510] Fix | Delete
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
[27511] Fix | Delete
});
[27512] Fix | Delete
[27513] Fix | Delete
function getInitialState$1(props) {
[27514] Fix | Delete
var initialState = getInitialState$2(props);
[27515] Fix | Delete
var selectedItem = initialState.selectedItem;
[27516] Fix | Delete
var inputValue = initialState.inputValue;
[27517] Fix | Delete
[27518] Fix | Delete
if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {
[27519] Fix | Delete
inputValue = props.itemToString(selectedItem);
[27520] Fix | Delete
}
[27521] Fix | Delete
[27522] Fix | Delete
return extends_extends({}, initialState, {
[27523] Fix | Delete
inputValue: inputValue
[27524] Fix | Delete
});
[27525] Fix | Delete
}
[27526] Fix | Delete
[27527] Fix | Delete
var propTypes$1 = {
[27528] Fix | Delete
items: prop_types_default.a.array.isRequired,
[27529] Fix | Delete
itemToString: prop_types_default.a.func,
[27530] Fix | Delete
getA11yStatusMessage: prop_types_default.a.func,
[27531] Fix | Delete
getA11ySelectionMessage: prop_types_default.a.func,
[27532] Fix | Delete
circularNavigation: prop_types_default.a.bool,
[27533] Fix | Delete
highlightedIndex: prop_types_default.a.number,
[27534] Fix | Delete
defaultHighlightedIndex: prop_types_default.a.number,
[27535] Fix | Delete
initialHighlightedIndex: prop_types_default.a.number,
[27536] Fix | Delete
isOpen: prop_types_default.a.bool,
[27537] Fix | Delete
defaultIsOpen: prop_types_default.a.bool,
[27538] Fix | Delete
initialIsOpen: prop_types_default.a.bool,
[27539] Fix | Delete
selectedItem: prop_types_default.a.any,
[27540] Fix | Delete
initialSelectedItem: prop_types_default.a.any,
[27541] Fix | Delete
defaultSelectedItem: prop_types_default.a.any,
[27542] Fix | Delete
inputValue: prop_types_default.a.string,
[27543] Fix | Delete
defaultInputValue: prop_types_default.a.string,
[27544] Fix | Delete
initialInputValue: prop_types_default.a.string,
[27545] Fix | Delete
id: prop_types_default.a.string,
[27546] Fix | Delete
labelId: prop_types_default.a.string,
[27547] Fix | Delete
menuId: prop_types_default.a.string,
[27548] Fix | Delete
getItemId: prop_types_default.a.func,
[27549] Fix | Delete
inputId: prop_types_default.a.string,
[27550] Fix | Delete
toggleButtonId: prop_types_default.a.string,
[27551] Fix | Delete
stateReducer: prop_types_default.a.func,
[27552] Fix | Delete
onSelectedItemChange: prop_types_default.a.func,
[27553] Fix | Delete
onHighlightedIndexChange: prop_types_default.a.func,
[27554] Fix | Delete
onStateChange: prop_types_default.a.func,
[27555] Fix | Delete
onIsOpenChange: prop_types_default.a.func,
[27556] Fix | Delete
onInputValueChange: prop_types_default.a.func,
[27557] Fix | Delete
environment: prop_types_default.a.shape({
[27558] Fix | Delete
addEventListener: prop_types_default.a.func,
[27559] Fix | Delete
removeEventListener: prop_types_default.a.func,
[27560] Fix | Delete
document: prop_types_default.a.shape({
[27561] Fix | Delete
getElementById: prop_types_default.a.func,
[27562] Fix | Delete
activeElement: prop_types_default.a.any,
[27563] Fix | Delete
body: prop_types_default.a.any
[27564] Fix | Delete
})
[27565] Fix | Delete
})
[27566] Fix | Delete
};
[27567] Fix | Delete
/**
[27568] Fix | Delete
* The useCombobox version of useControlledReducer, which also
[27569] Fix | Delete
* checks if the controlled prop selectedItem changed between
[27570] Fix | Delete
* renders. If so, it will also update inputValue with its
[27571] Fix | Delete
* string equivalent. It uses the common useEnhancedReducer to
[27572] Fix | Delete
* compute the rest of the state.
[27573] Fix | Delete
*
[27574] Fix | Delete
* @param {Function} reducer Reducer function from downshift.
[27575] Fix | Delete
* @param {Object} initialState Initial state of the hook.
[27576] Fix | Delete
* @param {Object} props The hook props.
[27577] Fix | Delete
* @returns {Array} An array with the state and an action dispatcher.
[27578] Fix | Delete
*/
[27579] Fix | Delete
[27580] Fix | Delete
function useControlledReducer(reducer, initialState, props) {
[27581] Fix | Delete
var previousSelectedItemRef = Object(external_React_["useRef"])();
[27582] Fix | Delete
[27583] Fix | Delete
var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
[27584] Fix | Delete
state = _useEnhancedReducer[0],
[27585] Fix | Delete
dispatch = _useEnhancedReducer[1]; // ToDo: if needed, make same approach as selectedItemChanged from Downshift.
[27586] Fix | Delete
[27587] Fix | Delete
[27588] Fix | Delete
Object(external_React_["useEffect"])(function () {
[27589] Fix | Delete
if (isControlledProp(props, 'selectedItem')) {
[27590] Fix | Delete
if (previousSelectedItemRef.current !== props.selectedItem) {
[27591] Fix | Delete
dispatch({
[27592] Fix | Delete
type: ControlledPropUpdatedSelectedItem,
[27593] Fix | Delete
inputValue: props.itemToString(props.selectedItem)
[27594] Fix | Delete
});
[27595] Fix | Delete
}
[27596] Fix | Delete
[27597] Fix | Delete
previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;
[27598] Fix | Delete
}
[27599] Fix | Delete
});
[27600] Fix | Delete
return [getState(state, props), dispatch];
[27601] Fix | Delete
} // eslint-disable-next-line import/no-mutable-exports
[27602] Fix | Delete
[27603] Fix | Delete
[27604] Fix | Delete
var validatePropTypes$1 = downshift_esm_noop;
[27605] Fix | Delete
/* istanbul ignore next */
[27606] Fix | Delete
[27607] Fix | Delete
if (false) {}
[27608] Fix | Delete
[27609] Fix | Delete
var defaultProps$1 = extends_extends({}, defaultProps$3, {
[27610] Fix | Delete
getA11yStatusMessage: getA11yStatusMessage$1,
[27611] Fix | Delete
circularNavigation: true
[27612] Fix | Delete
});
[27613] Fix | Delete
[27614] Fix | Delete
/* eslint-disable complexity */
[27615] Fix | Delete
[27616] Fix | Delete
function downshiftUseComboboxReducer(state, action) {
[27617] Fix | Delete
var type = action.type,
[27618] Fix | Delete
props = action.props,
[27619] Fix | Delete
shiftKey = action.shiftKey;
[27620] Fix | Delete
var changes;
[27621] Fix | Delete
[27622] Fix | Delete
switch (type) {
[27623] Fix | Delete
case ItemClick:
[27624] Fix | Delete
changes = {
[27625] Fix | Delete
isOpen: getDefaultValue$1(props, 'isOpen'),
[27626] Fix | Delete
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
[27627] Fix | Delete
selectedItem: props.items[action.index],
[27628] Fix | Delete
inputValue: props.itemToString(props.items[action.index])
[27629] Fix | Delete
};
[27630] Fix | Delete
break;
[27631] Fix | Delete
[27632] Fix | Delete
case InputKeyDownArrowDown:
[27633] Fix | Delete
if (state.isOpen) {
[27634] Fix | Delete
changes = {
[27635] Fix | Delete
highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
[27636] Fix | Delete
};
[27637] Fix | Delete
} else {
[27638] Fix | Delete
changes = {
[27639] Fix | Delete
highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
[27640] Fix | Delete
isOpen: props.items.length >= 0
[27641] Fix | Delete
};
[27642] Fix | Delete
}
[27643] Fix | Delete
[27644] Fix | Delete
break;
[27645] Fix | Delete
[27646] Fix | Delete
case InputKeyDownArrowUp:
[27647] Fix | Delete
if (state.isOpen) {
[27648] Fix | Delete
changes = {
[27649] Fix | Delete
highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
[27650] Fix | Delete
};
[27651] Fix | Delete
} else {
[27652] Fix | Delete
changes = {
[27653] Fix | Delete
highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
[27654] Fix | Delete
isOpen: props.items.length >= 0
[27655] Fix | Delete
};
[27656] Fix | Delete
}
[27657] Fix | Delete
[27658] Fix | Delete
break;
[27659] Fix | Delete
[27660] Fix | Delete
case InputKeyDownEnter:
[27661] Fix | Delete
changes = extends_extends({}, state.isOpen && state.highlightedIndex >= 0 && {
[27662] Fix | Delete
selectedItem: props.items[state.highlightedIndex],
[27663] Fix | Delete
isOpen: getDefaultValue$1(props, 'isOpen'),
[27664] Fix | Delete
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
[27665] Fix | Delete
inputValue: props.itemToString(props.items[state.highlightedIndex])
[27666] Fix | Delete
});
[27667] Fix | Delete
break;
[27668] Fix | Delete
[27669] Fix | Delete
case InputKeyDownEscape:
[27670] Fix | Delete
changes = extends_extends({
[27671] Fix | Delete
isOpen: false,
[27672] Fix | Delete
highlightedIndex: -1
[27673] Fix | Delete
}, !state.isOpen && {
[27674] Fix | Delete
selectedItem: null,
[27675] Fix | Delete
inputValue: ''
[27676] Fix | Delete
});
[27677] Fix | Delete
break;
[27678] Fix | Delete
[27679] Fix | Delete
case InputKeyDownHome:
[27680] Fix | Delete
changes = {
[27681] Fix | Delete
highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
[27682] Fix | Delete
};
[27683] Fix | Delete
break;
[27684] Fix | Delete
[27685] Fix | Delete
case InputKeyDownEnd:
[27686] Fix | Delete
changes = {
[27687] Fix | Delete
highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
[27688] Fix | Delete
};
[27689] Fix | Delete
break;
[27690] Fix | Delete
[27691] Fix | Delete
case InputBlur:
[27692] Fix | Delete
changes = extends_extends({
[27693] Fix | Delete
isOpen: false,
[27694] Fix | Delete
highlightedIndex: -1
[27695] Fix | Delete
}, state.highlightedIndex >= 0 && action.selectItem && {
[27696] Fix | Delete
selectedItem: props.items[state.highlightedIndex],
[27697] Fix | Delete
inputValue: props.itemToString(props.items[state.highlightedIndex])
[27698] Fix | Delete
});
[27699] Fix | Delete
break;
[27700] Fix | Delete
[27701] Fix | Delete
case InputChange:
[27702] Fix | Delete
changes = {
[27703] Fix | Delete
isOpen: true,
[27704] Fix | Delete
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
[27705] Fix | Delete
inputValue: action.inputValue
[27706] Fix | Delete
};
[27707] Fix | Delete
break;
[27708] Fix | Delete
[27709] Fix | Delete
case FunctionSelectItem:
[27710] Fix | Delete
changes = {
[27711] Fix | Delete
selectedItem: action.selectedItem,
[27712] Fix | Delete
inputValue: props.itemToString(action.selectedItem)
[27713] Fix | Delete
};
[27714] Fix | Delete
break;
[27715] Fix | Delete
[27716] Fix | Delete
case ControlledPropUpdatedSelectedItem:
[27717] Fix | Delete
changes = {
[27718] Fix | Delete
inputValue: action.inputValue
[27719] Fix | Delete
};
[27720] Fix | Delete
break;
[27721] Fix | Delete
[27722] Fix | Delete
default:
[27723] Fix | Delete
return downshiftCommonReducer(state, action, stateChangeTypes$1);
[27724] Fix | Delete
}
[27725] Fix | Delete
[27726] Fix | Delete
return extends_extends({}, state, changes);
[27727] Fix | Delete
}
[27728] Fix | Delete
/* eslint-enable complexity */
[27729] Fix | Delete
[27730] Fix | Delete
var _excluded$1 = ["onMouseLeave", "refKey", "ref"],
[27731] Fix | Delete
_excluded2$1 = ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"],
[27732] Fix | Delete
_excluded3 = ["onClick", "onPress", "refKey", "ref"],
[27733] Fix | Delete
_excluded4 = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"],
[27734] Fix | Delete
_excluded5 = ["refKey", "ref"];
[27735] Fix | Delete
useCombobox.stateChangeTypes = stateChangeTypes$1;
[27736] Fix | Delete
[27737] Fix | Delete
function useCombobox(userProps) {
[27738] Fix | Delete
if (userProps === void 0) {
[27739] Fix | Delete
userProps = {};
[27740] Fix | Delete
}
[27741] Fix | Delete
[27742] Fix | Delete
validatePropTypes$1(userProps, useCombobox); // Props defaults and destructuring.
[27743] Fix | Delete
[27744] Fix | Delete
var props = extends_extends({}, defaultProps$1, userProps);
[27745] Fix | Delete
[27746] Fix | Delete
var initialIsOpen = props.initialIsOpen,
[27747] Fix | Delete
defaultIsOpen = props.defaultIsOpen,
[27748] Fix | Delete
items = props.items,
[27749] Fix | Delete
scrollIntoView = props.scrollIntoView,
[27750] Fix | Delete
environment = props.environment,
[27751] Fix | Delete
getA11yStatusMessage = props.getA11yStatusMessage,
[27752] Fix | Delete
getA11ySelectionMessage = props.getA11ySelectionMessage,
[27753] Fix | Delete
itemToString = props.itemToString; // Initial state depending on controlled props.
[27754] Fix | Delete
[27755] Fix | Delete
var initialState = getInitialState$1(props);
[27756] Fix | Delete
[27757] Fix | Delete
var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, initialState, props),
[27758] Fix | Delete
state = _useControlledReducer[0],
[27759] Fix | Delete
dispatch = _useControlledReducer[1];
[27760] Fix | Delete
[27761] Fix | Delete
var isOpen = state.isOpen,
[27762] Fix | Delete
highlightedIndex = state.highlightedIndex,
[27763] Fix | Delete
selectedItem = state.selectedItem,
[27764] Fix | Delete
inputValue = state.inputValue; // Element refs.
[27765] Fix | Delete
[27766] Fix | Delete
var menuRef = Object(external_React_["useRef"])(null);
[27767] Fix | Delete
var itemRefs = Object(external_React_["useRef"])({});
[27768] Fix | Delete
var inputRef = Object(external_React_["useRef"])(null);
[27769] Fix | Delete
var toggleButtonRef = Object(external_React_["useRef"])(null);
[27770] Fix | Delete
var comboboxRef = Object(external_React_["useRef"])(null);
[27771] Fix | Delete
var isInitialMountRef = Object(external_React_["useRef"])(true); // prevent id re-generation between renders.
[27772] Fix | Delete
[27773] Fix | Delete
var elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
[27774] Fix | Delete
[27775] Fix | Delete
var previousResultCountRef = Object(external_React_["useRef"])(); // utility callback to get item element.
[27776] Fix | Delete
[27777] Fix | Delete
var latest = useLatestRef({
[27778] Fix | Delete
state: state,
[27779] Fix | Delete
props: props
[27780] Fix | Delete
});
[27781] Fix | Delete
var getItemNodeFromIndex = Object(external_React_["useCallback"])(function (index) {
[27782] Fix | Delete
return itemRefs.current[elementIds.getItemId(index)];
[27783] Fix | Delete
}, [elementIds]); // Effects.
[27784] Fix | Delete
// Sets a11y status message on changes in state.
[27785] Fix | Delete
[27786] Fix | Delete
useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], extends_extends({
[27787] Fix | Delete
isInitialMount: isInitialMountRef.current,
[27788] Fix | Delete
previousResultCount: previousResultCountRef.current,
[27789] Fix | Delete
items: items,
[27790] Fix | Delete
environment: environment,
[27791] Fix | Delete
itemToString: itemToString
[27792] Fix | Delete
}, state)); // Sets a11y status message on changes in selectedItem.
[27793] Fix | Delete
[27794] Fix | Delete
useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], extends_extends({
[27795] Fix | Delete
isInitialMount: isInitialMountRef.current,
[27796] Fix | Delete
previousResultCount: previousResultCountRef.current,
[27797] Fix | Delete
items: items,
[27798] Fix | Delete
environment: environment,
[27799] Fix | Delete
itemToString: itemToString
[27800] Fix | Delete
}, state)); // Scroll on highlighted item if change comes from keyboard.
[27801] Fix | Delete
[27802] Fix | Delete
var shouldScrollRef = useScrollIntoView({
[27803] Fix | Delete
menuElement: menuRef.current,
[27804] Fix | Delete
highlightedIndex: highlightedIndex,
[27805] Fix | Delete
isOpen: isOpen,
[27806] Fix | Delete
itemRefs: itemRefs,
[27807] Fix | Delete
scrollIntoView: scrollIntoView,
[27808] Fix | Delete
getItemNodeFromIndex: getItemNodeFromIndex
[27809] Fix | Delete
});
[27810] Fix | Delete
useControlPropsValidator({
[27811] Fix | Delete
isInitialMount: isInitialMountRef.current,
[27812] Fix | Delete
props: props,
[27813] Fix | Delete
state: state
[27814] Fix | Delete
}); // Focus the input on first render if required.
[27815] Fix | Delete
[27816] Fix | Delete
Object(external_React_["useEffect"])(function () {
[27817] Fix | Delete
var focusOnOpen = initialIsOpen || defaultIsOpen || isOpen;
[27818] Fix | Delete
[27819] Fix | Delete
if (focusOnOpen && inputRef.current) {
[27820] Fix | Delete
inputRef.current.focus();
[27821] Fix | Delete
} // eslint-disable-next-line react-hooks/exhaustive-deps
[27822] Fix | Delete
[27823] Fix | Delete
}, []);
[27824] Fix | Delete
Object(external_React_["useEffect"])(function () {
[27825] Fix | Delete
if (isInitialMountRef.current) {
[27826] Fix | Delete
return;
[27827] Fix | Delete
}
[27828] Fix | Delete
[27829] Fix | Delete
previousResultCountRef.current = items.length;
[27830] Fix | Delete
}); // Add mouse/touch events to document.
[27831] Fix | Delete
[27832] Fix | Delete
var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [comboboxRef, menuRef, toggleButtonRef], environment, function () {
[27833] Fix | Delete
dispatch({
[27834] Fix | Delete
type: InputBlur,
[27835] Fix | Delete
selectItem: false
[27836] Fix | Delete
});
[27837] Fix | Delete
});
[27838] Fix | Delete
var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getComboboxProps', 'getMenuProps'); // Make initial ref false.
[27839] Fix | Delete
[27840] Fix | Delete
Object(external_React_["useEffect"])(function () {
[27841] Fix | Delete
isInitialMountRef.current = false;
[27842] Fix | Delete
}, []); // Reset itemRefs on close.
[27843] Fix | Delete
[27844] Fix | Delete
Object(external_React_["useEffect"])(function () {
[27845] Fix | Delete
if (!isOpen) {
[27846] Fix | Delete
itemRefs.current = {};
[27847] Fix | Delete
}
[27848] Fix | Delete
}, [isOpen]);
[27849] Fix | Delete
/* Event handler functions */
[27850] Fix | Delete
[27851] Fix | Delete
var inputKeyDownHandlers = Object(external_React_["useMemo"])(function () {
[27852] Fix | Delete
return {
[27853] Fix | Delete
ArrowDown: function ArrowDown(event) {
[27854] Fix | Delete
event.preventDefault();
[27855] Fix | Delete
dispatch({
[27856] Fix | Delete
type: InputKeyDownArrowDown,
[27857] Fix | Delete
shiftKey: event.shiftKey,
[27858] Fix | Delete
getItemNodeFromIndex: getItemNodeFromIndex
[27859] Fix | Delete
});
[27860] Fix | Delete
},
[27861] Fix | Delete
ArrowUp: function ArrowUp(event) {
[27862] Fix | Delete
event.preventDefault();
[27863] Fix | Delete
dispatch({
[27864] Fix | Delete
type: InputKeyDownArrowUp,
[27865] Fix | Delete
shiftKey: event.shiftKey,
[27866] Fix | Delete
getItemNodeFromIndex: getItemNodeFromIndex
[27867] Fix | Delete
});
[27868] Fix | Delete
},
[27869] Fix | Delete
Home: function Home(event) {
[27870] Fix | Delete
if (!latest.current.state.isOpen) {
[27871] Fix | Delete
return;
[27872] Fix | Delete
}
[27873] Fix | Delete
[27874] Fix | Delete
event.preventDefault();
[27875] Fix | Delete
dispatch({
[27876] Fix | Delete
type: InputKeyDownHome,
[27877] Fix | Delete
getItemNodeFromIndex: getItemNodeFromIndex
[27878] Fix | Delete
});
[27879] Fix | Delete
},
[27880] Fix | Delete
End: function End(event) {
[27881] Fix | Delete
if (!latest.current.state.isOpen) {
[27882] Fix | Delete
return;
[27883] Fix | Delete
}
[27884] Fix | Delete
[27885] Fix | Delete
event.preventDefault();
[27886] Fix | Delete
dispatch({
[27887] Fix | Delete
type: InputKeyDownEnd,
[27888] Fix | Delete
getItemNodeFromIndex: getItemNodeFromIndex
[27889] Fix | Delete
});
[27890] Fix | Delete
},
[27891] Fix | Delete
Escape: function Escape() {
[27892] Fix | Delete
var latestState = latest.current.state;
[27893] Fix | Delete
[27894] Fix | Delete
if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
[27895] Fix | Delete
dispatch({
[27896] Fix | Delete
type: InputKeyDownEscape
[27897] Fix | Delete
});
[27898] Fix | Delete
}
[27899] Fix | Delete
},
[27900] Fix | Delete
Enter: function Enter(event) {
[27901] Fix | Delete
var latestState = latest.current.state; // if closed or no highlighted index, do nothing.
[27902] Fix | Delete
[27903] Fix | Delete
if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
[27904] Fix | Delete
) {
[27905] Fix | Delete
return;
[27906] Fix | Delete
}
[27907] Fix | Delete
[27908] Fix | Delete
event.preventDefault();
[27909] Fix | Delete
dispatch({
[27910] Fix | Delete
type: InputKeyDownEnter,
[27911] Fix | Delete
getItemNodeFromIndex: getItemNodeFromIndex
[27912] Fix | Delete
});
[27913] Fix | Delete
}
[27914] Fix | Delete
};
[27915] Fix | Delete
}, [dispatch, latest, getItemNodeFromIndex]); // Getter props.
[27916] Fix | Delete
[27917] Fix | Delete
var getLabelProps = Object(external_React_["useCallback"])(function (labelProps) {
[27918] Fix | Delete
return extends_extends({
[27919] Fix | Delete
id: elementIds.labelId,
[27920] Fix | Delete
htmlFor: elementIds.inputId
[27921] Fix | Delete
}, labelProps);
[27922] Fix | Delete
}, [elementIds]);
[27923] Fix | Delete
var getMenuProps = Object(external_React_["useCallback"])(function (_temp, _temp2) {
[27924] Fix | Delete
var _extends2;
[27925] Fix | Delete
[27926] Fix | Delete
var _ref = _temp === void 0 ? {} : _temp,
[27927] Fix | Delete
onMouseLeave = _ref.onMouseLeave,
[27928] Fix | Delete
_ref$refKey = _ref.refKey,
[27929] Fix | Delete
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
[27930] Fix | Delete
ref = _ref.ref,
[27931] Fix | Delete
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, _excluded$1);
[27932] Fix | Delete
[27933] Fix | Delete
var _ref2 = _temp2 === void 0 ? {} : _temp2,
[27934] Fix | Delete
_ref2$suppressRefErro = _ref2.suppressRefError,
[27935] Fix | Delete
suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
[27936] Fix | Delete
[27937] Fix | Delete
setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
[27938] Fix | Delete
return extends_extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {
[27939] Fix | Delete
menuRef.current = menuNode;
[27940] Fix | Delete
}), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {
[27941] Fix | Delete
dispatch({
[27942] Fix | Delete
type: MenuMouseLeave
[27943] Fix | Delete
});
[27944] Fix | Delete
}), _extends2), rest);
[27945] Fix | Delete
}, [dispatch, setGetterPropCallInfo, elementIds]);
[27946] Fix | Delete
var getItemProps = Object(external_React_["useCallback"])(function (_temp3) {
[27947] Fix | Delete
var _extends3, _ref4;
[27948] Fix | Delete
[27949] Fix | Delete
var _ref3 = _temp3 === void 0 ? {} : _temp3,
[27950] Fix | Delete
item = _ref3.item,
[27951] Fix | Delete
index = _ref3.index,
[27952] Fix | Delete
_ref3$refKey = _ref3.refKey,
[27953] Fix | Delete
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
[27954] Fix | Delete
ref = _ref3.ref,
[27955] Fix | Delete
onMouseMove = _ref3.onMouseMove,
[27956] Fix | Delete
onClick = _ref3.onClick;
[27957] Fix | Delete
_ref3.onPress;
[27958] Fix | Delete
var rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, _excluded2$1);
[27959] Fix | Delete
[27960] Fix | Delete
var _latest$current = latest.current,
[27961] Fix | Delete
latestProps = _latest$current.props,
[27962] Fix | Delete
latestState = _latest$current.state;
[27963] Fix | Delete
var itemIndex = getItemIndex(index, item, latestProps.items);
[27964] Fix | Delete
[27965] Fix | Delete
if (itemIndex < 0) {
[27966] Fix | Delete
throw new Error('Pass either item or item index in getItemProps!');
[27967] Fix | Delete
}
[27968] Fix | Delete
[27969] Fix | Delete
var onSelectKey = 'onClick';
[27970] Fix | Delete
var customClickHandler = onClick;
[27971] Fix | Delete
[27972] Fix | Delete
var itemHandleMouseMove = function itemHandleMouseMove() {
[27973] Fix | Delete
if (index === latestState.highlightedIndex) {
[27974] Fix | Delete
return;
[27975] Fix | Delete
}
[27976] Fix | Delete
[27977] Fix | Delete
shouldScrollRef.current = false;
[27978] Fix | Delete
dispatch({
[27979] Fix | Delete
type: ItemMouseMove,
[27980] Fix | Delete
index: index
[27981] Fix | Delete
});
[27982] Fix | Delete
};
[27983] Fix | Delete
[27984] Fix | Delete
var itemHandleClick = function itemHandleClick() {
[27985] Fix | Delete
dispatch({
[27986] Fix | Delete
type: ItemClick,
[27987] Fix | Delete
index: index
[27988] Fix | Delete
});
[27989] Fix | Delete
[27990] Fix | Delete
if (inputRef.current) {
[27991] Fix | Delete
inputRef.current.focus();
[27992] Fix | Delete
}
[27993] Fix | Delete
};
[27994] Fix | Delete
[27995] Fix | Delete
return extends_extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {
[27996] Fix | Delete
if (itemNode) {
[27997] Fix | Delete
itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
[27998] Fix | Delete
}
[27999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function