downshift 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/downshift.cjs.js +173 -173
- package/dist/downshift.esm.js +173 -173
- package/dist/downshift.native.cjs.js +169 -177
- package/dist/downshift.umd.js +412 -403
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +26 -2
- package/dist/downshift.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/preact/dist/downshift.cjs.js +173 -173
- package/preact/dist/downshift.esm.js +173 -173
- package/preact/dist/downshift.umd.js +255 -246
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +11 -2
- package/preact/dist/downshift.umd.min.js.map +1 -1
package/dist/downshift.cjs.js
CHANGED
|
@@ -175,7 +175,7 @@ function resetIdCounter() {
|
|
|
175
175
|
*/
|
|
176
176
|
|
|
177
177
|
|
|
178
|
-
function getA11yStatusMessage(_ref2) {
|
|
178
|
+
function getA11yStatusMessage$1(_ref2) {
|
|
179
179
|
var isOpen = _ref2.isOpen,
|
|
180
180
|
resultCount = _ref2.resultCount,
|
|
181
181
|
previousResultCount = _ref2.previousResultCount;
|
|
@@ -525,7 +525,7 @@ var blurButton = process.env.NODE_ENV !== "production" ? '__autocomplete_blur_bu
|
|
|
525
525
|
var controlledPropUpdatedSelectedItem = process.env.NODE_ENV !== "production" ? '__autocomplete_controlled_prop_updated_selected_item__' : 15;
|
|
526
526
|
var touchEnd = process.env.NODE_ENV !== "production" ? '__autocomplete_touchend__' : 16;
|
|
527
527
|
|
|
528
|
-
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
528
|
+
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
529
529
|
__proto__: null,
|
|
530
530
|
unknown: unknown,
|
|
531
531
|
mouseUp: mouseUp,
|
|
@@ -918,9 +918,9 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
918
918
|
|
|
919
919
|
_this.getToggleButtonProps = function (_temp3) {
|
|
920
920
|
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
921
|
-
onClick = _ref3.onClick
|
|
922
|
-
|
|
923
|
-
onKeyDown = _ref3.onKeyDown,
|
|
921
|
+
onClick = _ref3.onClick;
|
|
922
|
+
_ref3.onPress;
|
|
923
|
+
var onKeyDown = _ref3.onKeyDown,
|
|
924
924
|
onKeyUp = _ref3.onKeyUp,
|
|
925
925
|
onBlur = _ref3.onBlur,
|
|
926
926
|
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"]);
|
|
@@ -928,7 +928,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
928
928
|
var _this$getState5 = _this.getState(),
|
|
929
929
|
isOpen = _this$getState5.isOpen;
|
|
930
930
|
|
|
931
|
-
var enabledEventHandlers =
|
|
931
|
+
var enabledEventHandlers = {
|
|
932
932
|
onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
|
|
933
933
|
onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
|
|
934
934
|
onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
|
|
@@ -963,7 +963,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
963
963
|
|
|
964
964
|
/* istanbul ignore if (can't reasonably test this) */
|
|
965
965
|
|
|
966
|
-
if (
|
|
966
|
+
if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {
|
|
967
967
|
event.target.focus();
|
|
968
968
|
} // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
|
|
969
969
|
// if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
|
|
@@ -1010,9 +1010,9 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1010
1010
|
onKeyDown = _ref4.onKeyDown,
|
|
1011
1011
|
onBlur = _ref4.onBlur,
|
|
1012
1012
|
onChange = _ref4.onChange,
|
|
1013
|
-
onInput = _ref4.onInput
|
|
1014
|
-
|
|
1015
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
|
|
1013
|
+
onInput = _ref4.onInput;
|
|
1014
|
+
_ref4.onChangeText;
|
|
1015
|
+
var rest = _objectWithoutPropertiesLoose__default['default'](_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
|
|
1016
1016
|
|
|
1017
1017
|
var onChangeKey;
|
|
1018
1018
|
var eventHandlers = {};
|
|
@@ -1058,7 +1058,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1058
1058
|
_this.internalSetState({
|
|
1059
1059
|
type: changeInput,
|
|
1060
1060
|
isOpen: true,
|
|
1061
|
-
inputValue:
|
|
1061
|
+
inputValue: event.target.value,
|
|
1062
1062
|
highlightedIndex: _this.props.defaultHighlightedIndex
|
|
1063
1063
|
});
|
|
1064
1064
|
};
|
|
@@ -1105,9 +1105,9 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1105
1105
|
var _ref7 = _temp7 === void 0 ? {} : _temp7,
|
|
1106
1106
|
onMouseMove = _ref7.onMouseMove,
|
|
1107
1107
|
onMouseDown = _ref7.onMouseDown,
|
|
1108
|
-
onClick = _ref7.onClick
|
|
1109
|
-
|
|
1110
|
-
index = _ref7.index,
|
|
1108
|
+
onClick = _ref7.onClick;
|
|
1109
|
+
_ref7.onPress;
|
|
1110
|
+
var index = _ref7.index,
|
|
1111
1111
|
_ref7$item = _ref7.item,
|
|
1112
1112
|
item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ?
|
|
1113
1113
|
/* istanbul ignore next */
|
|
@@ -1122,8 +1122,8 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1122
1122
|
_this.items[index] = item;
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
|
-
var onSelectKey =
|
|
1126
|
-
var customClickHandler =
|
|
1125
|
+
var onSelectKey = 'onClick';
|
|
1126
|
+
var customClickHandler = onClick;
|
|
1127
1127
|
var enabledEventHandlers = (_enabledEventHandlers = {
|
|
1128
1128
|
// onMouseMove is used over onMouseEnter here. onMouseMove
|
|
1129
1129
|
// is only triggered on actual mouse movement while onMouseEnter
|
|
@@ -1513,7 +1513,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1513
1513
|
validateControlledUnchanged(this.state, prevProps, this.props);
|
|
1514
1514
|
/* istanbul ignore if (react-native) */
|
|
1515
1515
|
|
|
1516
|
-
if (
|
|
1516
|
+
if (this.getMenuProps.called && !this.getMenuProps.suppressRefError) {
|
|
1517
1517
|
validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
@@ -1598,7 +1598,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1598
1598
|
Downshift.defaultProps = {
|
|
1599
1599
|
defaultHighlightedIndex: null,
|
|
1600
1600
|
defaultIsOpen: false,
|
|
1601
|
-
getA11yStatusMessage: getA11yStatusMessage,
|
|
1601
|
+
getA11yStatusMessage: getA11yStatusMessage$1,
|
|
1602
1602
|
itemToString: function itemToString(i) {
|
|
1603
1603
|
if (i == null) {
|
|
1604
1604
|
return '';
|
|
@@ -1629,7 +1629,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1629
1629
|
suppressRefError: false,
|
|
1630
1630
|
scrollIntoView: scrollIntoView
|
|
1631
1631
|
};
|
|
1632
|
-
Downshift.stateChangeTypes = stateChangeTypes;
|
|
1632
|
+
Downshift.stateChangeTypes = stateChangeTypes$3;
|
|
1633
1633
|
return Downshift;
|
|
1634
1634
|
}();
|
|
1635
1635
|
|
|
@@ -1891,7 +1891,7 @@ function useEnhancedReducer(reducer, initialState, props) {
|
|
|
1891
1891
|
*/
|
|
1892
1892
|
|
|
1893
1893
|
|
|
1894
|
-
function useControlledReducer(reducer, initialState, props) {
|
|
1894
|
+
function useControlledReducer$1(reducer, initialState, props) {
|
|
1895
1895
|
var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
|
|
1896
1896
|
state = _useEnhancedReducer[0],
|
|
1897
1897
|
dispatch = _useEnhancedReducer[1];
|
|
@@ -1899,7 +1899,7 @@ function useControlledReducer(reducer, initialState, props) {
|
|
|
1899
1899
|
return [getState(state, props), dispatch];
|
|
1900
1900
|
}
|
|
1901
1901
|
|
|
1902
|
-
var defaultProps = {
|
|
1902
|
+
var defaultProps$3 = {
|
|
1903
1903
|
itemToString: itemToString,
|
|
1904
1904
|
stateReducer: stateReducer,
|
|
1905
1905
|
getA11ySelectionMessage: getA11ySelectionMessage,
|
|
@@ -1910,7 +1910,7 @@ var defaultProps = {
|
|
|
1910
1910
|
? {} : window
|
|
1911
1911
|
};
|
|
1912
1912
|
|
|
1913
|
-
function getDefaultValue(props, propKey, defaultStateValues) {
|
|
1913
|
+
function getDefaultValue$1(props, propKey, defaultStateValues) {
|
|
1914
1914
|
if (defaultStateValues === void 0) {
|
|
1915
1915
|
defaultStateValues = dropdownDefaultStateValues;
|
|
1916
1916
|
}
|
|
@@ -1924,7 +1924,7 @@ function getDefaultValue(props, propKey, defaultStateValues) {
|
|
|
1924
1924
|
return defaultStateValues[propKey];
|
|
1925
1925
|
}
|
|
1926
1926
|
|
|
1927
|
-
function getInitialValue(props, propKey, defaultStateValues) {
|
|
1927
|
+
function getInitialValue$1(props, propKey, defaultStateValues) {
|
|
1928
1928
|
if (defaultStateValues === void 0) {
|
|
1929
1929
|
defaultStateValues = dropdownDefaultStateValues;
|
|
1930
1930
|
}
|
|
@@ -1939,14 +1939,14 @@ function getInitialValue(props, propKey, defaultStateValues) {
|
|
|
1939
1939
|
return props[initialPropKey];
|
|
1940
1940
|
}
|
|
1941
1941
|
|
|
1942
|
-
return getDefaultValue(props, propKey, defaultStateValues);
|
|
1942
|
+
return getDefaultValue$1(props, propKey, defaultStateValues);
|
|
1943
1943
|
}
|
|
1944
1944
|
|
|
1945
|
-
function getInitialState(props) {
|
|
1946
|
-
var selectedItem = getInitialValue(props, 'selectedItem');
|
|
1947
|
-
var isOpen = getInitialValue(props, 'isOpen');
|
|
1948
|
-
var highlightedIndex = getInitialValue(props, 'highlightedIndex');
|
|
1949
|
-
var inputValue = getInitialValue(props, 'inputValue');
|
|
1945
|
+
function getInitialState$2(props) {
|
|
1946
|
+
var selectedItem = getInitialValue$1(props, 'selectedItem');
|
|
1947
|
+
var isOpen = getInitialValue$1(props, 'isOpen');
|
|
1948
|
+
var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
|
|
1949
|
+
var inputValue = getInitialValue$1(props, 'inputValue');
|
|
1950
1950
|
return {
|
|
1951
1951
|
highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,
|
|
1952
1952
|
isOpen: isOpen,
|
|
@@ -2241,10 +2241,10 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
|
2241
2241
|
|
|
2242
2242
|
case stateChangeTypes.FunctionReset:
|
|
2243
2243
|
changes = {
|
|
2244
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
2245
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
2246
|
-
selectedItem: getDefaultValue(props, 'selectedItem'),
|
|
2247
|
-
inputValue: getDefaultValue(props, 'inputValue')
|
|
2244
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
2245
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2246
|
+
selectedItem: getDefaultValue$1(props, 'selectedItem'),
|
|
2247
|
+
inputValue: getDefaultValue$1(props, 'inputValue')
|
|
2248
2248
|
};
|
|
2249
2249
|
break;
|
|
2250
2250
|
|
|
@@ -2274,7 +2274,7 @@ function getItemIndexByCharacterKey(keysSoFar, highlightedIndex, items, itemToSt
|
|
|
2274
2274
|
return highlightedIndex;
|
|
2275
2275
|
}
|
|
2276
2276
|
|
|
2277
|
-
var propTypes = {
|
|
2277
|
+
var propTypes$2 = {
|
|
2278
2278
|
items: PropTypes__default['default'].array.isRequired,
|
|
2279
2279
|
itemToString: PropTypes__default['default'].func,
|
|
2280
2280
|
getA11yStatusMessage: PropTypes__default['default'].func,
|
|
@@ -2318,7 +2318,7 @@ var propTypes = {
|
|
|
2318
2318
|
* @return {String} the a11y status message
|
|
2319
2319
|
*/
|
|
2320
2320
|
|
|
2321
|
-
function getA11yStatusMessage
|
|
2321
|
+
function getA11yStatusMessage(_ref) {
|
|
2322
2322
|
var isOpen = _ref.isOpen,
|
|
2323
2323
|
resultCount = _ref.resultCount,
|
|
2324
2324
|
previousResultCount = _ref.previousResultCount;
|
|
@@ -2338,17 +2338,17 @@ function getA11yStatusMessage$1(_ref) {
|
|
|
2338
2338
|
return '';
|
|
2339
2339
|
}
|
|
2340
2340
|
|
|
2341
|
-
var defaultProps$
|
|
2342
|
-
getA11yStatusMessage: getA11yStatusMessage
|
|
2341
|
+
var defaultProps$2 = _extends__default['default']({}, defaultProps$3, {
|
|
2342
|
+
getA11yStatusMessage: getA11yStatusMessage
|
|
2343
2343
|
}); // eslint-disable-next-line import/no-mutable-exports
|
|
2344
2344
|
|
|
2345
2345
|
|
|
2346
|
-
var validatePropTypes = noop;
|
|
2346
|
+
var validatePropTypes$2 = noop;
|
|
2347
2347
|
/* istanbul ignore next */
|
|
2348
2348
|
|
|
2349
2349
|
if (process.env.NODE_ENV !== 'production') {
|
|
2350
|
-
validatePropTypes = function validatePropTypes(options, caller) {
|
|
2351
|
-
PropTypes__default['default'].checkPropTypes(propTypes, options, 'prop', caller.name);
|
|
2350
|
+
validatePropTypes$2 = function validatePropTypes(options, caller) {
|
|
2351
|
+
PropTypes__default['default'].checkPropTypes(propTypes$2, options, 'prop', caller.name);
|
|
2352
2352
|
};
|
|
2353
2353
|
}
|
|
2354
2354
|
|
|
@@ -2361,22 +2361,22 @@ var MenuKeyDownEnter = process.env.NODE_ENV !== "production" ? '__menu_keydown_e
|
|
|
2361
2361
|
var MenuKeyDownSpaceButton = process.env.NODE_ENV !== "production" ? '__menu_keydown_space_button__' : 6;
|
|
2362
2362
|
var MenuKeyDownCharacter = process.env.NODE_ENV !== "production" ? '__menu_keydown_character__' : 7;
|
|
2363
2363
|
var MenuBlur = process.env.NODE_ENV !== "production" ? '__menu_blur__' : 8;
|
|
2364
|
-
var MenuMouseLeave = process.env.NODE_ENV !== "production" ? '__menu_mouse_leave__' : 9;
|
|
2365
|
-
var ItemMouseMove = process.env.NODE_ENV !== "production" ? '__item_mouse_move__' : 10;
|
|
2366
|
-
var ItemClick = process.env.NODE_ENV !== "production" ? '__item_click__' : 11;
|
|
2367
|
-
var ToggleButtonClick = process.env.NODE_ENV !== "production" ? '__togglebutton_click__' : 12;
|
|
2364
|
+
var MenuMouseLeave$1 = process.env.NODE_ENV !== "production" ? '__menu_mouse_leave__' : 9;
|
|
2365
|
+
var ItemMouseMove$1 = process.env.NODE_ENV !== "production" ? '__item_mouse_move__' : 10;
|
|
2366
|
+
var ItemClick$1 = process.env.NODE_ENV !== "production" ? '__item_click__' : 11;
|
|
2367
|
+
var ToggleButtonClick$1 = process.env.NODE_ENV !== "production" ? '__togglebutton_click__' : 12;
|
|
2368
2368
|
var ToggleButtonKeyDownArrowDown = process.env.NODE_ENV !== "production" ? '__togglebutton_keydown_arrow_down__' : 13;
|
|
2369
2369
|
var ToggleButtonKeyDownArrowUp = process.env.NODE_ENV !== "production" ? '__togglebutton_keydown_arrow_up__' : 14;
|
|
2370
2370
|
var ToggleButtonKeyDownCharacter = process.env.NODE_ENV !== "production" ? '__togglebutton_keydown_character__' : 15;
|
|
2371
|
-
var FunctionToggleMenu = process.env.NODE_ENV !== "production" ? '__function_toggle_menu__' : 16;
|
|
2372
|
-
var FunctionOpenMenu = process.env.NODE_ENV !== "production" ? '__function_open_menu__' : 17;
|
|
2373
|
-
var FunctionCloseMenu = process.env.NODE_ENV !== "production" ? '__function_close_menu__' : 18;
|
|
2374
|
-
var FunctionSetHighlightedIndex = process.env.NODE_ENV !== "production" ? '__function_set_highlighted_index__' : 19;
|
|
2375
|
-
var FunctionSelectItem = process.env.NODE_ENV !== "production" ? '__function_select_item__' : 20;
|
|
2376
|
-
var FunctionSetInputValue = process.env.NODE_ENV !== "production" ? '__function_set_input_value__' : 21;
|
|
2377
|
-
var FunctionReset = process.env.NODE_ENV !== "production" ? '__function_reset__' : 22;
|
|
2371
|
+
var FunctionToggleMenu$1 = process.env.NODE_ENV !== "production" ? '__function_toggle_menu__' : 16;
|
|
2372
|
+
var FunctionOpenMenu$1 = process.env.NODE_ENV !== "production" ? '__function_open_menu__' : 17;
|
|
2373
|
+
var FunctionCloseMenu$1 = process.env.NODE_ENV !== "production" ? '__function_close_menu__' : 18;
|
|
2374
|
+
var FunctionSetHighlightedIndex$1 = process.env.NODE_ENV !== "production" ? '__function_set_highlighted_index__' : 19;
|
|
2375
|
+
var FunctionSelectItem$1 = process.env.NODE_ENV !== "production" ? '__function_select_item__' : 20;
|
|
2376
|
+
var FunctionSetInputValue$1 = process.env.NODE_ENV !== "production" ? '__function_set_input_value__' : 21;
|
|
2377
|
+
var FunctionReset$2 = process.env.NODE_ENV !== "production" ? '__function_reset__' : 22;
|
|
2378
2378
|
|
|
2379
|
-
var stateChangeTypes$
|
|
2379
|
+
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
|
|
2380
2380
|
__proto__: null,
|
|
2381
2381
|
MenuKeyDownArrowDown: MenuKeyDownArrowDown,
|
|
2382
2382
|
MenuKeyDownArrowUp: MenuKeyDownArrowUp,
|
|
@@ -2387,20 +2387,20 @@ var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
|
|
|
2387
2387
|
MenuKeyDownSpaceButton: MenuKeyDownSpaceButton,
|
|
2388
2388
|
MenuKeyDownCharacter: MenuKeyDownCharacter,
|
|
2389
2389
|
MenuBlur: MenuBlur,
|
|
2390
|
-
MenuMouseLeave: MenuMouseLeave,
|
|
2391
|
-
ItemMouseMove: ItemMouseMove,
|
|
2392
|
-
ItemClick: ItemClick,
|
|
2393
|
-
ToggleButtonClick: ToggleButtonClick,
|
|
2390
|
+
MenuMouseLeave: MenuMouseLeave$1,
|
|
2391
|
+
ItemMouseMove: ItemMouseMove$1,
|
|
2392
|
+
ItemClick: ItemClick$1,
|
|
2393
|
+
ToggleButtonClick: ToggleButtonClick$1,
|
|
2394
2394
|
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
|
|
2395
2395
|
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
|
|
2396
2396
|
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
|
|
2397
|
-
FunctionToggleMenu: FunctionToggleMenu,
|
|
2398
|
-
FunctionOpenMenu: FunctionOpenMenu,
|
|
2399
|
-
FunctionCloseMenu: FunctionCloseMenu,
|
|
2400
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
2401
|
-
FunctionSelectItem: FunctionSelectItem,
|
|
2402
|
-
FunctionSetInputValue: FunctionSetInputValue,
|
|
2403
|
-
FunctionReset: FunctionReset
|
|
2397
|
+
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2398
|
+
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2399
|
+
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2400
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2401
|
+
FunctionSelectItem: FunctionSelectItem$1,
|
|
2402
|
+
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2403
|
+
FunctionReset: FunctionReset$2
|
|
2404
2404
|
});
|
|
2405
2405
|
|
|
2406
2406
|
/* eslint-disable complexity */
|
|
@@ -2412,10 +2412,10 @@ function downshiftSelectReducer(state, action) {
|
|
|
2412
2412
|
var changes;
|
|
2413
2413
|
|
|
2414
2414
|
switch (type) {
|
|
2415
|
-
case ItemClick:
|
|
2415
|
+
case ItemClick$1:
|
|
2416
2416
|
changes = {
|
|
2417
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
2418
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
2417
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2418
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
2419
2419
|
selectedItem: props.items[action.index]
|
|
2420
2420
|
};
|
|
2421
2421
|
break;
|
|
@@ -2450,8 +2450,8 @@ function downshiftSelectReducer(state, action) {
|
|
|
2450
2450
|
case MenuKeyDownEnter:
|
|
2451
2451
|
case MenuKeyDownSpaceButton:
|
|
2452
2452
|
changes = _extends__default['default']({
|
|
2453
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
2454
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex')
|
|
2453
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2454
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')
|
|
2455
2455
|
}, state.highlightedIndex >= 0 && {
|
|
2456
2456
|
selectedItem: props.items[state.highlightedIndex]
|
|
2457
2457
|
});
|
|
@@ -2510,30 +2510,30 @@ function downshiftSelectReducer(state, action) {
|
|
|
2510
2510
|
};
|
|
2511
2511
|
break;
|
|
2512
2512
|
|
|
2513
|
-
case FunctionSelectItem:
|
|
2513
|
+
case FunctionSelectItem$1:
|
|
2514
2514
|
changes = {
|
|
2515
2515
|
selectedItem: action.selectedItem
|
|
2516
2516
|
};
|
|
2517
2517
|
break;
|
|
2518
2518
|
|
|
2519
2519
|
default:
|
|
2520
|
-
return downshiftCommonReducer(state, action, stateChangeTypes$
|
|
2520
|
+
return downshiftCommonReducer(state, action, stateChangeTypes$2);
|
|
2521
2521
|
}
|
|
2522
2522
|
|
|
2523
2523
|
return _extends__default['default']({}, state, changes);
|
|
2524
2524
|
}
|
|
2525
2525
|
/* eslint-enable complexity */
|
|
2526
2526
|
|
|
2527
|
-
useSelect.stateChangeTypes = stateChangeTypes$
|
|
2527
|
+
useSelect.stateChangeTypes = stateChangeTypes$2;
|
|
2528
2528
|
|
|
2529
2529
|
function useSelect(userProps) {
|
|
2530
2530
|
if (userProps === void 0) {
|
|
2531
2531
|
userProps = {};
|
|
2532
2532
|
}
|
|
2533
2533
|
|
|
2534
|
-
validatePropTypes(userProps, useSelect); // Props defaults and destructuring.
|
|
2534
|
+
validatePropTypes$2(userProps, useSelect); // Props defaults and destructuring.
|
|
2535
2535
|
|
|
2536
|
-
var props = _extends__default['default']({}, defaultProps$
|
|
2536
|
+
var props = _extends__default['default']({}, defaultProps$2, userProps);
|
|
2537
2537
|
|
|
2538
2538
|
var items = props.items,
|
|
2539
2539
|
scrollIntoView = props.scrollIntoView,
|
|
@@ -2544,9 +2544,9 @@ function useSelect(userProps) {
|
|
|
2544
2544
|
getA11ySelectionMessage = props.getA11ySelectionMessage,
|
|
2545
2545
|
getA11yStatusMessage = props.getA11yStatusMessage; // Initial state depending on controlled props.
|
|
2546
2546
|
|
|
2547
|
-
var initialState = getInitialState(props);
|
|
2547
|
+
var initialState = getInitialState$2(props);
|
|
2548
2548
|
|
|
2549
|
-
var _useControlledReducer = useControlledReducer(downshiftSelectReducer, initialState, props),
|
|
2549
|
+
var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, initialState, props),
|
|
2550
2550
|
state = _useControlledReducer[0],
|
|
2551
2551
|
dispatch = _useControlledReducer[1];
|
|
2552
2552
|
|
|
@@ -2608,7 +2608,7 @@ function useSelect(userProps) {
|
|
|
2608
2608
|
if (isInitialMountRef.current) {
|
|
2609
2609
|
clearTimeoutRef.current = debounce(function (outerDispatch) {
|
|
2610
2610
|
outerDispatch({
|
|
2611
|
-
type: FunctionSetInputValue,
|
|
2611
|
+
type: FunctionSetInputValue$1,
|
|
2612
2612
|
inputValue: ''
|
|
2613
2613
|
});
|
|
2614
2614
|
}, 500);
|
|
@@ -2757,39 +2757,39 @@ function useSelect(userProps) {
|
|
|
2757
2757
|
|
|
2758
2758
|
var toggleMenu = react.useCallback(function () {
|
|
2759
2759
|
dispatch({
|
|
2760
|
-
type: FunctionToggleMenu
|
|
2760
|
+
type: FunctionToggleMenu$1
|
|
2761
2761
|
});
|
|
2762
2762
|
}, [dispatch]);
|
|
2763
2763
|
var closeMenu = react.useCallback(function () {
|
|
2764
2764
|
dispatch({
|
|
2765
|
-
type: FunctionCloseMenu
|
|
2765
|
+
type: FunctionCloseMenu$1
|
|
2766
2766
|
});
|
|
2767
2767
|
}, [dispatch]);
|
|
2768
2768
|
var openMenu = react.useCallback(function () {
|
|
2769
2769
|
dispatch({
|
|
2770
|
-
type: FunctionOpenMenu
|
|
2770
|
+
type: FunctionOpenMenu$1
|
|
2771
2771
|
});
|
|
2772
2772
|
}, [dispatch]);
|
|
2773
2773
|
var setHighlightedIndex = react.useCallback(function (newHighlightedIndex) {
|
|
2774
2774
|
dispatch({
|
|
2775
|
-
type: FunctionSetHighlightedIndex,
|
|
2775
|
+
type: FunctionSetHighlightedIndex$1,
|
|
2776
2776
|
highlightedIndex: newHighlightedIndex
|
|
2777
2777
|
});
|
|
2778
2778
|
}, [dispatch]);
|
|
2779
2779
|
var selectItem = react.useCallback(function (newSelectedItem) {
|
|
2780
2780
|
dispatch({
|
|
2781
|
-
type: FunctionSelectItem,
|
|
2781
|
+
type: FunctionSelectItem$1,
|
|
2782
2782
|
selectedItem: newSelectedItem
|
|
2783
2783
|
});
|
|
2784
2784
|
}, [dispatch]);
|
|
2785
2785
|
var reset = react.useCallback(function () {
|
|
2786
2786
|
dispatch({
|
|
2787
|
-
type: FunctionReset
|
|
2787
|
+
type: FunctionReset$2
|
|
2788
2788
|
});
|
|
2789
2789
|
}, [dispatch]);
|
|
2790
2790
|
var setInputValue = react.useCallback(function (newInputValue) {
|
|
2791
2791
|
dispatch({
|
|
2792
|
-
type: FunctionSetInputValue,
|
|
2792
|
+
type: FunctionSetInputValue$1,
|
|
2793
2793
|
inputValue: newInputValue
|
|
2794
2794
|
});
|
|
2795
2795
|
}, [dispatch]); // Getter functions.
|
|
@@ -2851,7 +2851,7 @@ function useSelect(userProps) {
|
|
|
2851
2851
|
|
|
2852
2852
|
var menuHandleMouseLeave = function menuHandleMouseLeave() {
|
|
2853
2853
|
dispatch({
|
|
2854
|
-
type: MenuMouseLeave
|
|
2854
|
+
type: MenuMouseLeave$1
|
|
2855
2855
|
});
|
|
2856
2856
|
};
|
|
2857
2857
|
|
|
@@ -2883,7 +2883,7 @@ function useSelect(userProps) {
|
|
|
2883
2883
|
|
|
2884
2884
|
var toggleButtonHandleClick = function toggleButtonHandleClick() {
|
|
2885
2885
|
dispatch({
|
|
2886
|
-
type: ToggleButtonClick
|
|
2886
|
+
type: ToggleButtonClick$1
|
|
2887
2887
|
});
|
|
2888
2888
|
};
|
|
2889
2889
|
|
|
@@ -2937,14 +2937,14 @@ function useSelect(userProps) {
|
|
|
2937
2937
|
|
|
2938
2938
|
shouldScrollRef.current = false;
|
|
2939
2939
|
dispatch({
|
|
2940
|
-
type: ItemMouseMove,
|
|
2940
|
+
type: ItemMouseMove$1,
|
|
2941
2941
|
index: index
|
|
2942
2942
|
});
|
|
2943
2943
|
};
|
|
2944
2944
|
|
|
2945
2945
|
var itemHandleClick = function itemHandleClick() {
|
|
2946
2946
|
dispatch({
|
|
2947
|
-
type: ItemClick,
|
|
2947
|
+
type: ItemClick$1,
|
|
2948
2948
|
index: index
|
|
2949
2949
|
});
|
|
2950
2950
|
};
|
|
@@ -3002,20 +3002,20 @@ var InputKeyDownEnd = process.env.NODE_ENV !== "production" ? '__input_keydown_e
|
|
|
3002
3002
|
var InputKeyDownEnter = process.env.NODE_ENV !== "production" ? '__input_keydown_enter__' : 5;
|
|
3003
3003
|
var InputChange = process.env.NODE_ENV !== "production" ? '__input_change__' : 6;
|
|
3004
3004
|
var InputBlur = process.env.NODE_ENV !== "production" ? '__input_blur__' : 7;
|
|
3005
|
-
var MenuMouseLeave
|
|
3006
|
-
var ItemMouseMove
|
|
3007
|
-
var ItemClick
|
|
3008
|
-
var ToggleButtonClick
|
|
3009
|
-
var FunctionToggleMenu
|
|
3010
|
-
var FunctionOpenMenu
|
|
3011
|
-
var FunctionCloseMenu
|
|
3012
|
-
var FunctionSetHighlightedIndex
|
|
3013
|
-
var FunctionSelectItem
|
|
3014
|
-
var FunctionSetInputValue
|
|
3005
|
+
var MenuMouseLeave = process.env.NODE_ENV !== "production" ? '__menu_mouse_leave__' : 8;
|
|
3006
|
+
var ItemMouseMove = process.env.NODE_ENV !== "production" ? '__item_mouse_move__' : 9;
|
|
3007
|
+
var ItemClick = process.env.NODE_ENV !== "production" ? '__item_click__' : 10;
|
|
3008
|
+
var ToggleButtonClick = process.env.NODE_ENV !== "production" ? '__togglebutton_click__' : 11;
|
|
3009
|
+
var FunctionToggleMenu = process.env.NODE_ENV !== "production" ? '__function_toggle_menu__' : 12;
|
|
3010
|
+
var FunctionOpenMenu = process.env.NODE_ENV !== "production" ? '__function_open_menu__' : 13;
|
|
3011
|
+
var FunctionCloseMenu = process.env.NODE_ENV !== "production" ? '__function_close_menu__' : 14;
|
|
3012
|
+
var FunctionSetHighlightedIndex = process.env.NODE_ENV !== "production" ? '__function_set_highlighted_index__' : 15;
|
|
3013
|
+
var FunctionSelectItem = process.env.NODE_ENV !== "production" ? '__function_select_item__' : 16;
|
|
3014
|
+
var FunctionSetInputValue = process.env.NODE_ENV !== "production" ? '__function_set_input_value__' : 17;
|
|
3015
3015
|
var FunctionReset$1 = process.env.NODE_ENV !== "production" ? '__function_reset__' : 18;
|
|
3016
3016
|
var ControlledPropUpdatedSelectedItem = process.env.NODE_ENV !== "production" ? '__controlled_prop_updated_selected_item__' : 19;
|
|
3017
3017
|
|
|
3018
|
-
var stateChangeTypes$
|
|
3018
|
+
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
|
|
3019
3019
|
__proto__: null,
|
|
3020
3020
|
InputKeyDownArrowDown: InputKeyDownArrowDown,
|
|
3021
3021
|
InputKeyDownArrowUp: InputKeyDownArrowUp,
|
|
@@ -3025,22 +3025,22 @@ var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
|
|
|
3025
3025
|
InputKeyDownEnter: InputKeyDownEnter,
|
|
3026
3026
|
InputChange: InputChange,
|
|
3027
3027
|
InputBlur: InputBlur,
|
|
3028
|
-
MenuMouseLeave: MenuMouseLeave
|
|
3029
|
-
ItemMouseMove: ItemMouseMove
|
|
3030
|
-
ItemClick: ItemClick
|
|
3031
|
-
ToggleButtonClick: ToggleButtonClick
|
|
3032
|
-
FunctionToggleMenu: FunctionToggleMenu
|
|
3033
|
-
FunctionOpenMenu: FunctionOpenMenu
|
|
3034
|
-
FunctionCloseMenu: FunctionCloseMenu
|
|
3035
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex
|
|
3036
|
-
FunctionSelectItem: FunctionSelectItem
|
|
3037
|
-
FunctionSetInputValue: FunctionSetInputValue
|
|
3028
|
+
MenuMouseLeave: MenuMouseLeave,
|
|
3029
|
+
ItemMouseMove: ItemMouseMove,
|
|
3030
|
+
ItemClick: ItemClick,
|
|
3031
|
+
ToggleButtonClick: ToggleButtonClick,
|
|
3032
|
+
FunctionToggleMenu: FunctionToggleMenu,
|
|
3033
|
+
FunctionOpenMenu: FunctionOpenMenu,
|
|
3034
|
+
FunctionCloseMenu: FunctionCloseMenu,
|
|
3035
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
3036
|
+
FunctionSelectItem: FunctionSelectItem,
|
|
3037
|
+
FunctionSetInputValue: FunctionSetInputValue,
|
|
3038
3038
|
FunctionReset: FunctionReset$1,
|
|
3039
3039
|
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
|
|
3040
3040
|
});
|
|
3041
3041
|
|
|
3042
3042
|
function getInitialState$1(props) {
|
|
3043
|
-
var initialState = getInitialState(props);
|
|
3043
|
+
var initialState = getInitialState$2(props);
|
|
3044
3044
|
var selectedItem = initialState.selectedItem;
|
|
3045
3045
|
var inputValue = initialState.inputValue;
|
|
3046
3046
|
|
|
@@ -3106,7 +3106,7 @@ var propTypes$1 = {
|
|
|
3106
3106
|
* @returns {Array} An array with the state and an action dispatcher.
|
|
3107
3107
|
*/
|
|
3108
3108
|
|
|
3109
|
-
function useControlledReducer
|
|
3109
|
+
function useControlledReducer(reducer, initialState, props) {
|
|
3110
3110
|
var previousSelectedItemRef = react.useRef();
|
|
3111
3111
|
|
|
3112
3112
|
var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
|
|
@@ -3139,8 +3139,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
3139
3139
|
};
|
|
3140
3140
|
}
|
|
3141
3141
|
|
|
3142
|
-
var defaultProps$
|
|
3143
|
-
getA11yStatusMessage: getA11yStatusMessage,
|
|
3142
|
+
var defaultProps$1 = _extends__default['default']({}, defaultProps$3, {
|
|
3143
|
+
getA11yStatusMessage: getA11yStatusMessage$1,
|
|
3144
3144
|
circularNavigation: true
|
|
3145
3145
|
});
|
|
3146
3146
|
|
|
@@ -3153,10 +3153,10 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3153
3153
|
var changes;
|
|
3154
3154
|
|
|
3155
3155
|
switch (type) {
|
|
3156
|
-
case ItemClick
|
|
3156
|
+
case ItemClick:
|
|
3157
3157
|
changes = {
|
|
3158
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
3159
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
3158
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
3159
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
3160
3160
|
selectedItem: props.items[action.index],
|
|
3161
3161
|
inputValue: props.itemToString(props.items[action.index])
|
|
3162
3162
|
};
|
|
@@ -3193,8 +3193,8 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3193
3193
|
case InputKeyDownEnter:
|
|
3194
3194
|
changes = _extends__default['default']({}, state.isOpen && state.highlightedIndex >= 0 && {
|
|
3195
3195
|
selectedItem: props.items[state.highlightedIndex],
|
|
3196
|
-
isOpen: getDefaultValue(props, 'isOpen'),
|
|
3197
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
3196
|
+
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
3197
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
3198
3198
|
inputValue: props.itemToString(props.items[state.highlightedIndex])
|
|
3199
3199
|
});
|
|
3200
3200
|
break;
|
|
@@ -3234,12 +3234,12 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3234
3234
|
case InputChange:
|
|
3235
3235
|
changes = {
|
|
3236
3236
|
isOpen: true,
|
|
3237
|
-
highlightedIndex: getDefaultValue(props, 'highlightedIndex'),
|
|
3237
|
+
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
|
|
3238
3238
|
inputValue: action.inputValue
|
|
3239
3239
|
};
|
|
3240
3240
|
break;
|
|
3241
3241
|
|
|
3242
|
-
case FunctionSelectItem
|
|
3242
|
+
case FunctionSelectItem:
|
|
3243
3243
|
changes = {
|
|
3244
3244
|
selectedItem: action.selectedItem,
|
|
3245
3245
|
inputValue: props.itemToString(action.selectedItem)
|
|
@@ -3253,14 +3253,14 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3253
3253
|
break;
|
|
3254
3254
|
|
|
3255
3255
|
default:
|
|
3256
|
-
return downshiftCommonReducer(state, action, stateChangeTypes$
|
|
3256
|
+
return downshiftCommonReducer(state, action, stateChangeTypes$1);
|
|
3257
3257
|
}
|
|
3258
3258
|
|
|
3259
3259
|
return _extends__default['default']({}, state, changes);
|
|
3260
3260
|
}
|
|
3261
3261
|
/* eslint-enable complexity */
|
|
3262
3262
|
|
|
3263
|
-
useCombobox.stateChangeTypes = stateChangeTypes$
|
|
3263
|
+
useCombobox.stateChangeTypes = stateChangeTypes$1;
|
|
3264
3264
|
|
|
3265
3265
|
function useCombobox(userProps) {
|
|
3266
3266
|
if (userProps === void 0) {
|
|
@@ -3269,7 +3269,7 @@ function useCombobox(userProps) {
|
|
|
3269
3269
|
|
|
3270
3270
|
validatePropTypes$1(userProps, useCombobox); // Props defaults and destructuring.
|
|
3271
3271
|
|
|
3272
|
-
var props = _extends__default['default']({}, defaultProps$
|
|
3272
|
+
var props = _extends__default['default']({}, defaultProps$1, userProps);
|
|
3273
3273
|
|
|
3274
3274
|
var initialIsOpen = props.initialIsOpen,
|
|
3275
3275
|
defaultIsOpen = props.defaultIsOpen,
|
|
@@ -3282,7 +3282,7 @@ function useCombobox(userProps) {
|
|
|
3282
3282
|
|
|
3283
3283
|
var initialState = getInitialState$1(props);
|
|
3284
3284
|
|
|
3285
|
-
var _useControlledReducer = useControlledReducer
|
|
3285
|
+
var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, initialState, props),
|
|
3286
3286
|
state = _useControlledReducer[0],
|
|
3287
3287
|
dispatch = _useControlledReducer[1];
|
|
3288
3288
|
|
|
@@ -3467,7 +3467,7 @@ function useCombobox(userProps) {
|
|
|
3467
3467
|
menuRef.current = menuNode;
|
|
3468
3468
|
}), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {
|
|
3469
3469
|
dispatch({
|
|
3470
|
-
type: MenuMouseLeave
|
|
3470
|
+
type: MenuMouseLeave
|
|
3471
3471
|
});
|
|
3472
3472
|
}), _extends2), rest);
|
|
3473
3473
|
}, [dispatch, setGetterPropCallInfo, elementIds]);
|
|
@@ -3481,9 +3481,9 @@ function useCombobox(userProps) {
|
|
|
3481
3481
|
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
|
|
3482
3482
|
ref = _ref3.ref,
|
|
3483
3483
|
onMouseMove = _ref3.onMouseMove,
|
|
3484
|
-
onClick = _ref3.onClick
|
|
3485
|
-
|
|
3486
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
|
|
3484
|
+
onClick = _ref3.onClick;
|
|
3485
|
+
_ref3.onPress;
|
|
3486
|
+
var rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
|
|
3487
3487
|
|
|
3488
3488
|
var _latest$current = latest.current,
|
|
3489
3489
|
latestProps = _latest$current.props,
|
|
@@ -3494,8 +3494,8 @@ function useCombobox(userProps) {
|
|
|
3494
3494
|
throw new Error('Pass either item or item index in getItemProps!');
|
|
3495
3495
|
}
|
|
3496
3496
|
|
|
3497
|
-
var onSelectKey =
|
|
3498
|
-
var customClickHandler =
|
|
3497
|
+
var onSelectKey = 'onClick';
|
|
3498
|
+
var customClickHandler = onClick;
|
|
3499
3499
|
|
|
3500
3500
|
var itemHandleMouseMove = function itemHandleMouseMove() {
|
|
3501
3501
|
if (index === latestState.highlightedIndex) {
|
|
@@ -3504,14 +3504,14 @@ function useCombobox(userProps) {
|
|
|
3504
3504
|
|
|
3505
3505
|
shouldScrollRef.current = false;
|
|
3506
3506
|
dispatch({
|
|
3507
|
-
type: ItemMouseMove
|
|
3507
|
+
type: ItemMouseMove,
|
|
3508
3508
|
index: index
|
|
3509
3509
|
});
|
|
3510
3510
|
};
|
|
3511
3511
|
|
|
3512
3512
|
var itemHandleClick = function itemHandleClick() {
|
|
3513
3513
|
dispatch({
|
|
3514
|
-
type: ItemClick
|
|
3514
|
+
type: ItemClick,
|
|
3515
3515
|
index: index
|
|
3516
3516
|
});
|
|
3517
3517
|
|
|
@@ -3532,16 +3532,16 @@ function useCombobox(userProps) {
|
|
|
3532
3532
|
var _extends4;
|
|
3533
3533
|
|
|
3534
3534
|
var _ref5 = _temp4 === void 0 ? {} : _temp4,
|
|
3535
|
-
onClick = _ref5.onClick
|
|
3536
|
-
|
|
3537
|
-
_ref5$refKey = _ref5.refKey,
|
|
3535
|
+
onClick = _ref5.onClick;
|
|
3536
|
+
_ref5.onPress;
|
|
3537
|
+
var _ref5$refKey = _ref5.refKey,
|
|
3538
3538
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
3539
3539
|
ref = _ref5.ref,
|
|
3540
3540
|
rest = _objectWithoutPropertiesLoose__default['default'](_ref5, ["onClick", "onPress", "refKey", "ref"]);
|
|
3541
3541
|
|
|
3542
3542
|
var toggleButtonHandleClick = function toggleButtonHandleClick() {
|
|
3543
3543
|
dispatch({
|
|
3544
|
-
type: ToggleButtonClick
|
|
3544
|
+
type: ToggleButtonClick
|
|
3545
3545
|
});
|
|
3546
3546
|
|
|
3547
3547
|
if (!latest.current.state.isOpen && inputRef.current) {
|
|
@@ -3551,7 +3551,7 @@ function useCombobox(userProps) {
|
|
|
3551
3551
|
|
|
3552
3552
|
return _extends__default['default']((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {
|
|
3553
3553
|
toggleButtonRef.current = toggleButtonNode;
|
|
3554
|
-
}), _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends__default['default']({},
|
|
3554
|
+
}), _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends__default['default']({}, {
|
|
3555
3555
|
onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
|
|
3556
3556
|
}), rest);
|
|
3557
3557
|
}, [dispatch, latest, elementIds]);
|
|
@@ -3562,9 +3562,9 @@ function useCombobox(userProps) {
|
|
|
3562
3562
|
onKeyDown = _ref6.onKeyDown,
|
|
3563
3563
|
onChange = _ref6.onChange,
|
|
3564
3564
|
onInput = _ref6.onInput,
|
|
3565
|
-
onBlur = _ref6.onBlur
|
|
3566
|
-
|
|
3567
|
-
_ref6$refKey = _ref6.refKey,
|
|
3565
|
+
onBlur = _ref6.onBlur;
|
|
3566
|
+
_ref6.onChangeText;
|
|
3567
|
+
var _ref6$refKey = _ref6.refKey,
|
|
3568
3568
|
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
|
|
3569
3569
|
ref = _ref6.ref,
|
|
3570
3570
|
rest = _objectWithoutPropertiesLoose__default['default'](_ref6, ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"]);
|
|
@@ -3587,7 +3587,7 @@ function useCombobox(userProps) {
|
|
|
3587
3587
|
var inputHandleChange = function inputHandleChange(event) {
|
|
3588
3588
|
dispatch({
|
|
3589
3589
|
type: InputChange,
|
|
3590
|
-
inputValue:
|
|
3590
|
+
inputValue: event.target.value
|
|
3591
3591
|
});
|
|
3592
3592
|
};
|
|
3593
3593
|
|
|
@@ -3603,7 +3603,7 @@ function useCombobox(userProps) {
|
|
|
3603
3603
|
/* istanbul ignore next (preact) */
|
|
3604
3604
|
|
|
3605
3605
|
|
|
3606
|
-
var onChangeKey =
|
|
3606
|
+
var onChangeKey = 'onChange';
|
|
3607
3607
|
var eventHandlers = {};
|
|
3608
3608
|
|
|
3609
3609
|
if (!rest.disabled) {
|
|
@@ -3645,34 +3645,34 @@ function useCombobox(userProps) {
|
|
|
3645
3645
|
|
|
3646
3646
|
var toggleMenu = react.useCallback(function () {
|
|
3647
3647
|
dispatch({
|
|
3648
|
-
type: FunctionToggleMenu
|
|
3648
|
+
type: FunctionToggleMenu
|
|
3649
3649
|
});
|
|
3650
3650
|
}, [dispatch]);
|
|
3651
3651
|
var closeMenu = react.useCallback(function () {
|
|
3652
3652
|
dispatch({
|
|
3653
|
-
type: FunctionCloseMenu
|
|
3653
|
+
type: FunctionCloseMenu
|
|
3654
3654
|
});
|
|
3655
3655
|
}, [dispatch]);
|
|
3656
3656
|
var openMenu = react.useCallback(function () {
|
|
3657
3657
|
dispatch({
|
|
3658
|
-
type: FunctionOpenMenu
|
|
3658
|
+
type: FunctionOpenMenu
|
|
3659
3659
|
});
|
|
3660
3660
|
}, [dispatch]);
|
|
3661
3661
|
var setHighlightedIndex = react.useCallback(function (newHighlightedIndex) {
|
|
3662
3662
|
dispatch({
|
|
3663
|
-
type: FunctionSetHighlightedIndex
|
|
3663
|
+
type: FunctionSetHighlightedIndex,
|
|
3664
3664
|
highlightedIndex: newHighlightedIndex
|
|
3665
3665
|
});
|
|
3666
3666
|
}, [dispatch]);
|
|
3667
3667
|
var selectItem = react.useCallback(function (newSelectedItem) {
|
|
3668
3668
|
dispatch({
|
|
3669
|
-
type: FunctionSelectItem
|
|
3669
|
+
type: FunctionSelectItem,
|
|
3670
3670
|
selectedItem: newSelectedItem
|
|
3671
3671
|
});
|
|
3672
3672
|
}, [dispatch]);
|
|
3673
3673
|
var setInputValue = react.useCallback(function (newInputValue) {
|
|
3674
3674
|
dispatch({
|
|
3675
|
-
type: FunctionSetInputValue
|
|
3675
|
+
type: FunctionSetInputValue,
|
|
3676
3676
|
inputValue: newInputValue
|
|
3677
3677
|
});
|
|
3678
3678
|
}, [dispatch]);
|
|
@@ -3719,8 +3719,8 @@ var defaultStateValues = {
|
|
|
3719
3719
|
* @returns {any} The initial value for that prop.
|
|
3720
3720
|
*/
|
|
3721
3721
|
|
|
3722
|
-
function getInitialValue
|
|
3723
|
-
return getInitialValue(props, propKey, defaultStateValues);
|
|
3722
|
+
function getInitialValue(props, propKey) {
|
|
3723
|
+
return getInitialValue$1(props, propKey, defaultStateValues);
|
|
3724
3724
|
}
|
|
3725
3725
|
/**
|
|
3726
3726
|
* Returns the default value for a state key in the following order:
|
|
@@ -3732,8 +3732,8 @@ function getInitialValue$1(props, propKey) {
|
|
|
3732
3732
|
*/
|
|
3733
3733
|
|
|
3734
3734
|
|
|
3735
|
-
function getDefaultValue
|
|
3736
|
-
return getDefaultValue(props, propKey, defaultStateValues);
|
|
3735
|
+
function getDefaultValue(props, propKey) {
|
|
3736
|
+
return getDefaultValue$1(props, propKey, defaultStateValues);
|
|
3737
3737
|
}
|
|
3738
3738
|
/**
|
|
3739
3739
|
* Gets the initial state based on the provided props. It uses initial, default
|
|
@@ -3744,9 +3744,9 @@ function getDefaultValue$1(props, propKey) {
|
|
|
3744
3744
|
*/
|
|
3745
3745
|
|
|
3746
3746
|
|
|
3747
|
-
function getInitialState
|
|
3748
|
-
var activeIndex = getInitialValue
|
|
3749
|
-
var selectedItems = getInitialValue
|
|
3747
|
+
function getInitialState(props) {
|
|
3748
|
+
var activeIndex = getInitialValue(props, 'activeIndex');
|
|
3749
|
+
var selectedItems = getInitialValue(props, 'selectedItems');
|
|
3750
3750
|
return {
|
|
3751
3751
|
activeIndex: activeIndex,
|
|
3752
3752
|
selectedItems: selectedItems
|
|
@@ -3793,7 +3793,7 @@ function getA11yRemovalMessage(selectionParameters) {
|
|
|
3793
3793
|
return itemToStringLocal(removedSelectedItem) + " has been removed.";
|
|
3794
3794
|
}
|
|
3795
3795
|
|
|
3796
|
-
var propTypes
|
|
3796
|
+
var propTypes = {
|
|
3797
3797
|
selectedItems: PropTypes__default['default'].array,
|
|
3798
3798
|
initialSelectedItems: PropTypes__default['default'].array,
|
|
3799
3799
|
defaultSelectedItems: PropTypes__default['default'].array,
|
|
@@ -3817,21 +3817,21 @@ var propTypes$2 = {
|
|
|
3817
3817
|
})
|
|
3818
3818
|
})
|
|
3819
3819
|
};
|
|
3820
|
-
var defaultProps
|
|
3821
|
-
itemToString: defaultProps.itemToString,
|
|
3822
|
-
stateReducer: defaultProps.stateReducer,
|
|
3823
|
-
environment: defaultProps.environment,
|
|
3820
|
+
var defaultProps = {
|
|
3821
|
+
itemToString: defaultProps$3.itemToString,
|
|
3822
|
+
stateReducer: defaultProps$3.stateReducer,
|
|
3823
|
+
environment: defaultProps$3.environment,
|
|
3824
3824
|
getA11yRemovalMessage: getA11yRemovalMessage,
|
|
3825
3825
|
keyNavigationNext: 'ArrowRight',
|
|
3826
3826
|
keyNavigationPrevious: 'ArrowLeft'
|
|
3827
3827
|
}; // eslint-disable-next-line import/no-mutable-exports
|
|
3828
3828
|
|
|
3829
|
-
var validatePropTypes
|
|
3829
|
+
var validatePropTypes = noop;
|
|
3830
3830
|
/* istanbul ignore next */
|
|
3831
3831
|
|
|
3832
3832
|
if (process.env.NODE_ENV !== 'production') {
|
|
3833
|
-
validatePropTypes
|
|
3834
|
-
PropTypes__default['default'].checkPropTypes(propTypes
|
|
3833
|
+
validatePropTypes = function validatePropTypes(options, caller) {
|
|
3834
|
+
PropTypes__default['default'].checkPropTypes(propTypes, options, 'prop', caller.name);
|
|
3835
3835
|
};
|
|
3836
3836
|
}
|
|
3837
3837
|
|
|
@@ -3847,9 +3847,9 @@ var FunctionAddSelectedItem = process.env.NODE_ENV !== "production" ? '__functio
|
|
|
3847
3847
|
var FunctionRemoveSelectedItem = process.env.NODE_ENV !== "production" ? '__function_remove_selected_item__' : 9;
|
|
3848
3848
|
var FunctionSetSelectedItems = process.env.NODE_ENV !== "production" ? '__function_set_selected_items__' : 10;
|
|
3849
3849
|
var FunctionSetActiveIndex = process.env.NODE_ENV !== "production" ? '__function_set_active_index__' : 11;
|
|
3850
|
-
var FunctionReset
|
|
3850
|
+
var FunctionReset = process.env.NODE_ENV !== "production" ? '__function_reset__' : 12;
|
|
3851
3851
|
|
|
3852
|
-
var stateChangeTypes
|
|
3852
|
+
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
3853
3853
|
__proto__: null,
|
|
3854
3854
|
SelectedItemClick: SelectedItemClick,
|
|
3855
3855
|
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
@@ -3863,7 +3863,7 @@ var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
|
3863
3863
|
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
|
|
3864
3864
|
FunctionSetSelectedItems: FunctionSetSelectedItems,
|
|
3865
3865
|
FunctionSetActiveIndex: FunctionSetActiveIndex,
|
|
3866
|
-
FunctionReset: FunctionReset
|
|
3866
|
+
FunctionReset: FunctionReset
|
|
3867
3867
|
});
|
|
3868
3868
|
|
|
3869
3869
|
/* eslint-disable complexity */
|
|
@@ -3976,10 +3976,10 @@ function downshiftMultipleSelectionReducer(state, action) {
|
|
|
3976
3976
|
break;
|
|
3977
3977
|
}
|
|
3978
3978
|
|
|
3979
|
-
case FunctionReset
|
|
3979
|
+
case FunctionReset:
|
|
3980
3980
|
changes = {
|
|
3981
|
-
activeIndex: getDefaultValue
|
|
3982
|
-
selectedItems: getDefaultValue
|
|
3981
|
+
activeIndex: getDefaultValue(props, 'activeIndex'),
|
|
3982
|
+
selectedItems: getDefaultValue(props, 'selectedItems')
|
|
3983
3983
|
};
|
|
3984
3984
|
break;
|
|
3985
3985
|
|
|
@@ -3990,16 +3990,16 @@ function downshiftMultipleSelectionReducer(state, action) {
|
|
|
3990
3990
|
return _extends__default['default']({}, state, changes);
|
|
3991
3991
|
}
|
|
3992
3992
|
|
|
3993
|
-
useMultipleSelection.stateChangeTypes = stateChangeTypes
|
|
3993
|
+
useMultipleSelection.stateChangeTypes = stateChangeTypes;
|
|
3994
3994
|
|
|
3995
3995
|
function useMultipleSelection(userProps) {
|
|
3996
3996
|
if (userProps === void 0) {
|
|
3997
3997
|
userProps = {};
|
|
3998
3998
|
}
|
|
3999
3999
|
|
|
4000
|
-
validatePropTypes
|
|
4000
|
+
validatePropTypes(userProps, useMultipleSelection); // Props defaults and destructuring.
|
|
4001
4001
|
|
|
4002
|
-
var props = _extends__default['default']({}, defaultProps
|
|
4002
|
+
var props = _extends__default['default']({}, defaultProps, userProps);
|
|
4003
4003
|
|
|
4004
4004
|
var getA11yRemovalMessage = props.getA11yRemovalMessage,
|
|
4005
4005
|
itemToString = props.itemToString,
|
|
@@ -4007,7 +4007,7 @@ function useMultipleSelection(userProps) {
|
|
|
4007
4007
|
keyNavigationNext = props.keyNavigationNext,
|
|
4008
4008
|
keyNavigationPrevious = props.keyNavigationPrevious; // Reducer init.
|
|
4009
4009
|
|
|
4010
|
-
var _useControlledReducer = useControlledReducer(downshiftMultipleSelectionReducer, getInitialState
|
|
4010
|
+
var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, getInitialState(props), props),
|
|
4011
4011
|
state = _useControlledReducer[0],
|
|
4012
4012
|
dispatch = _useControlledReducer[1];
|
|
4013
4013
|
|
|
@@ -4218,7 +4218,7 @@ function useMultipleSelection(userProps) {
|
|
|
4218
4218
|
}, [dispatch]);
|
|
4219
4219
|
var reset = react.useCallback(function () {
|
|
4220
4220
|
dispatch({
|
|
4221
|
-
type: FunctionReset
|
|
4221
|
+
type: FunctionReset
|
|
4222
4222
|
});
|
|
4223
4223
|
}, [dispatch]);
|
|
4224
4224
|
return {
|