downshift 9.0.4 → 9.0.6
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 +256 -236
- package/dist/downshift.esm.js +94 -66
- package/dist/downshift.native.cjs.js +256 -236
- package/dist/downshift.nativeweb.cjs.js +256 -236
- package/dist/downshift.umd.js +135 -110
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/dist/src/hooks/utils.d.ts +7 -0
- package/package.json +37 -37
- package/preact/dist/downshift.cjs.js +218 -198
- package/preact/dist/downshift.esm.js +94 -66
- package/preact/dist/downshift.umd.js +189 -165
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +2 -2
- package/preact/dist/downshift.umd.min.js.map +1 -1
|
@@ -11,14 +11,6 @@ var computeScrollIntoView = require('compute-scroll-into-view');
|
|
|
11
11
|
var PropTypes = require('prop-types');
|
|
12
12
|
var tslib = require('tslib');
|
|
13
13
|
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
17
|
-
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
18
|
-
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
|
|
19
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
21
|
-
|
|
22
14
|
var idCounter = 0;
|
|
23
15
|
|
|
24
16
|
/**
|
|
@@ -148,7 +140,7 @@ function generateId() {
|
|
|
148
140
|
*/
|
|
149
141
|
function resetIdCounter() {
|
|
150
142
|
// istanbul ignore next
|
|
151
|
-
if ('useId' in
|
|
143
|
+
if ('useId' in React) {
|
|
152
144
|
console.warn("It is not necessary to call resetIdCounter when using React 18+");
|
|
153
145
|
return;
|
|
154
146
|
}
|
|
@@ -489,23 +481,23 @@ var touchEnd = process.env.NODE_ENV !== "production" ? '__autocomplete_touchend_
|
|
|
489
481
|
|
|
490
482
|
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
491
483
|
__proto__: null,
|
|
492
|
-
|
|
493
|
-
|
|
484
|
+
blurButton: blurButton,
|
|
485
|
+
blurInput: blurInput,
|
|
486
|
+
changeInput: changeInput,
|
|
487
|
+
clickButton: clickButton,
|
|
488
|
+
clickItem: clickItem,
|
|
489
|
+
controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
|
|
494
490
|
itemMouseEnter: itemMouseEnter,
|
|
495
|
-
keyDownArrowUp: keyDownArrowUp,
|
|
496
491
|
keyDownArrowDown: keyDownArrowDown,
|
|
497
|
-
|
|
492
|
+
keyDownArrowUp: keyDownArrowUp,
|
|
493
|
+
keyDownEnd: keyDownEnd,
|
|
498
494
|
keyDownEnter: keyDownEnter,
|
|
495
|
+
keyDownEscape: keyDownEscape,
|
|
499
496
|
keyDownHome: keyDownHome,
|
|
500
|
-
keyDownEnd: keyDownEnd,
|
|
501
|
-
clickItem: clickItem,
|
|
502
|
-
blurInput: blurInput,
|
|
503
|
-
changeInput: changeInput,
|
|
504
497
|
keyDownSpaceButton: keyDownSpaceButton,
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
touchEnd: touchEnd
|
|
498
|
+
mouseUp: mouseUp,
|
|
499
|
+
touchEnd: touchEnd,
|
|
500
|
+
unknown: unknown
|
|
509
501
|
});
|
|
510
502
|
|
|
511
503
|
var _excluded$3 = ["refKey", "ref"],
|
|
@@ -568,7 +560,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
568
560
|
otherStateToSet = {};
|
|
569
561
|
}
|
|
570
562
|
otherStateToSet = pickState(otherStateToSet);
|
|
571
|
-
_this.internalSetState(
|
|
563
|
+
_this.internalSetState(_extends({
|
|
572
564
|
highlightedIndex: highlightedIndex
|
|
573
565
|
}, otherStateToSet));
|
|
574
566
|
};
|
|
@@ -582,7 +574,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
582
574
|
};
|
|
583
575
|
_this.selectItem = function (item, otherStateToSet, cb) {
|
|
584
576
|
otherStateToSet = pickState(otherStateToSet);
|
|
585
|
-
_this.internalSetState(
|
|
577
|
+
_this.internalSetState(_extends({
|
|
586
578
|
isOpen: _this.props.defaultIsOpen,
|
|
587
579
|
highlightedIndex: _this.props.defaultHighlightedIndex,
|
|
588
580
|
selectedItem: item,
|
|
@@ -618,7 +610,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
618
610
|
// preserving the cursor position.
|
|
619
611
|
// See https://github.com/downshift-js/downshift/issues/217 for more info.
|
|
620
612
|
if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {
|
|
621
|
-
_this.props.onInputValueChange(stateToSet.inputValue,
|
|
613
|
+
_this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));
|
|
622
614
|
}
|
|
623
615
|
return _this.setState(function (state) {
|
|
624
616
|
var _newStateToSet;
|
|
@@ -666,7 +658,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
666
658
|
// if stateToSet is a function, then we weren't able to call onInputValueChange
|
|
667
659
|
// earlier, so we'll call it now that we know what the inputValue state will be.
|
|
668
660
|
if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {
|
|
669
|
-
_this.props.onInputValueChange(newStateToSet.inputValue,
|
|
661
|
+
_this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));
|
|
670
662
|
}
|
|
671
663
|
return nextState;
|
|
672
664
|
}, function () {
|
|
@@ -700,7 +692,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
700
692
|
_ref$refKey = _ref.refKey,
|
|
701
693
|
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
|
|
702
694
|
ref = _ref.ref,
|
|
703
|
-
rest =
|
|
695
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
704
696
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
705
697
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
706
698
|
suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
|
|
@@ -711,7 +703,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
711
703
|
_this.getRootProps.suppressRefError = suppressRefError;
|
|
712
704
|
var _this$getState = _this.getState(),
|
|
713
705
|
isOpen = _this$getState.isOpen;
|
|
714
|
-
return
|
|
706
|
+
return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : undefined, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
|
|
715
707
|
};
|
|
716
708
|
//\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT
|
|
717
709
|
_this.keyDownHandlers = {
|
|
@@ -790,7 +782,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
790
782
|
},
|
|
791
783
|
Escape: function Escape(event) {
|
|
792
784
|
event.preventDefault();
|
|
793
|
-
this.reset(
|
|
785
|
+
this.reset(_extends({
|
|
794
786
|
type: keyDownEscape
|
|
795
787
|
}, !this.state.isOpen && {
|
|
796
788
|
selectedItem: null,
|
|
@@ -799,7 +791,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
799
791
|
}
|
|
800
792
|
};
|
|
801
793
|
//////////////////////////// BUTTON
|
|
802
|
-
_this.buttonKeyDownHandlers =
|
|
794
|
+
_this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
|
|
803
795
|
' ': function _(event) {
|
|
804
796
|
event.preventDefault();
|
|
805
797
|
this.toggleMenu({
|
|
@@ -807,7 +799,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
807
799
|
});
|
|
808
800
|
}
|
|
809
801
|
});
|
|
810
|
-
_this.inputKeyDownHandlers =
|
|
802
|
+
_this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
|
|
811
803
|
Home: function Home(event) {
|
|
812
804
|
var _this$getState3 = this.getState(),
|
|
813
805
|
isOpen = _this$getState3.isOpen;
|
|
@@ -856,7 +848,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
856
848
|
var onKeyDown = _ref3.onKeyDown,
|
|
857
849
|
onKeyUp = _ref3.onKeyUp,
|
|
858
850
|
onBlur = _ref3.onBlur,
|
|
859
|
-
rest =
|
|
851
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);
|
|
860
852
|
var _this$getState5 = _this.getState(),
|
|
861
853
|
isOpen = _this$getState5.isOpen;
|
|
862
854
|
var enabledEventHandlers = {
|
|
@@ -866,7 +858,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
866
858
|
onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
|
|
867
859
|
};
|
|
868
860
|
var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
|
|
869
|
-
return
|
|
861
|
+
return _extends({
|
|
870
862
|
type: 'button',
|
|
871
863
|
role: 'button',
|
|
872
864
|
'aria-label': isOpen ? 'close menu' : 'open menu',
|
|
@@ -932,7 +924,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
932
924
|
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON
|
|
933
925
|
/////////////////////////////// LABEL
|
|
934
926
|
_this.getLabelProps = function (props) {
|
|
935
|
-
return
|
|
927
|
+
return _extends({
|
|
936
928
|
htmlFor: _this.inputId,
|
|
937
929
|
id: _this.labelId
|
|
938
930
|
}, props);
|
|
@@ -946,7 +938,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
946
938
|
onChange = _ref4.onChange,
|
|
947
939
|
onInput = _ref4.onInput;
|
|
948
940
|
_ref4.onChangeText;
|
|
949
|
-
var rest =
|
|
941
|
+
var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);
|
|
950
942
|
var onChangeKey;
|
|
951
943
|
var eventHandlers = {};
|
|
952
944
|
|
|
@@ -962,7 +954,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
962
954
|
var _eventHandlers;
|
|
963
955
|
eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);
|
|
964
956
|
}
|
|
965
|
-
return
|
|
957
|
+
return _extends({
|
|
966
958
|
'aria-autocomplete': 'list',
|
|
967
959
|
'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : undefined,
|
|
968
960
|
'aria-controls': isOpen ? _this.menuId : undefined,
|
|
@@ -1015,14 +1007,14 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1015
1007
|
_ref5$refKey = _ref5.refKey,
|
|
1016
1008
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
1017
1009
|
ref = _ref5.ref,
|
|
1018
|
-
props =
|
|
1010
|
+
props = _objectWithoutPropertiesLoose(_ref5, _excluded4$2);
|
|
1019
1011
|
var _ref6 = _temp6 === void 0 ? {} : _temp6,
|
|
1020
1012
|
_ref6$suppressRefErro = _ref6.suppressRefError,
|
|
1021
1013
|
suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;
|
|
1022
1014
|
_this.getMenuProps.called = true;
|
|
1023
1015
|
_this.getMenuProps.refKey = refKey;
|
|
1024
1016
|
_this.getMenuProps.suppressRefError = suppressRefError;
|
|
1025
|
-
return
|
|
1017
|
+
return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? undefined : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
|
|
1026
1018
|
};
|
|
1027
1019
|
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU
|
|
1028
1020
|
/////////////////////////////// ITEM
|
|
@@ -1036,7 +1028,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1036
1028
|
var index = _ref7.index,
|
|
1037
1029
|
_ref7$item = _ref7.item,
|
|
1038
1030
|
item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ? /* istanbul ignore next */undefined : requiredProp('getItemProps', 'item') : _ref7$item,
|
|
1039
|
-
rest =
|
|
1031
|
+
rest = _objectWithoutPropertiesLoose(_ref7, _excluded5);
|
|
1040
1032
|
if (index === undefined) {
|
|
1041
1033
|
_this.items.push(item);
|
|
1042
1034
|
index = _this.items.indexOf(item);
|
|
@@ -1083,7 +1075,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1083
1075
|
var eventHandlers = rest.disabled ? {
|
|
1084
1076
|
onMouseDown: enabledEventHandlers.onMouseDown
|
|
1085
1077
|
} : enabledEventHandlers;
|
|
1086
|
-
return
|
|
1078
|
+
return _extends({
|
|
1087
1079
|
id: _this.getItemId(index),
|
|
1088
1080
|
role: 'option',
|
|
1089
1081
|
'aria-selected': _this.getState().highlightedIndex === index
|
|
@@ -1100,7 +1092,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1100
1092
|
otherStateToSet = pickState(otherStateToSet);
|
|
1101
1093
|
_this.internalSetState(function (_ref8) {
|
|
1102
1094
|
var selectedItem = _ref8.selectedItem;
|
|
1103
|
-
return
|
|
1095
|
+
return _extends({
|
|
1104
1096
|
isOpen: _this.props.defaultIsOpen,
|
|
1105
1097
|
highlightedIndex: _this.props.defaultHighlightedIndex,
|
|
1106
1098
|
inputValue: _this.props.itemToString(selectedItem)
|
|
@@ -1114,7 +1106,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1114
1106
|
otherStateToSet = pickState(otherStateToSet);
|
|
1115
1107
|
_this.internalSetState(function (_ref9) {
|
|
1116
1108
|
var isOpen = _ref9.isOpen;
|
|
1117
|
-
return
|
|
1109
|
+
return _extends({
|
|
1118
1110
|
isOpen: !isOpen
|
|
1119
1111
|
}, isOpen && {
|
|
1120
1112
|
highlightedIndex: _this.props.defaultHighlightedIndex
|
|
@@ -1149,7 +1141,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1149
1141
|
var state = _this.getState();
|
|
1150
1142
|
var item = _this.items[state.highlightedIndex];
|
|
1151
1143
|
var resultCount = _this.getItemCount();
|
|
1152
|
-
var status = _this.props.getA11yStatusMessage(
|
|
1144
|
+
var status = _this.props.getA11yStatusMessage(_extends({
|
|
1153
1145
|
itemToString: _this.props.itemToString,
|
|
1154
1146
|
previousResultCount: _this.previousResultCount,
|
|
1155
1147
|
resultCount: resultCount,
|
|
@@ -1181,7 +1173,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1181
1173
|
_this.state = _state;
|
|
1182
1174
|
return _this;
|
|
1183
1175
|
}
|
|
1184
|
-
|
|
1176
|
+
_inheritsLoose(Downshift, _Component);
|
|
1185
1177
|
var _proto = Downshift.prototype;
|
|
1186
1178
|
/**
|
|
1187
1179
|
* Clear all running timeouts
|
|
@@ -1535,7 +1527,7 @@ function callOnChangeProps(action, state, newState) {
|
|
|
1535
1527
|
}
|
|
1536
1528
|
});
|
|
1537
1529
|
if (props.onStateChange && Object.keys(changes).length) {
|
|
1538
|
-
props.onStateChange(
|
|
1530
|
+
props.onStateChange(_extends({
|
|
1539
1531
|
type: type
|
|
1540
1532
|
}, changes));
|
|
1541
1533
|
}
|
|
@@ -1545,7 +1537,7 @@ function invokeOnChangeHandler(key, action, state, newState) {
|
|
|
1545
1537
|
type = action.type;
|
|
1546
1538
|
var handler = "on" + capitalizeString(key) + "Change";
|
|
1547
1539
|
if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
|
|
1548
|
-
props[handler](
|
|
1540
|
+
props[handler](_extends({
|
|
1549
1541
|
type: type
|
|
1550
1542
|
}, newState));
|
|
1551
1543
|
}
|
|
@@ -1573,7 +1565,7 @@ var updateA11yStatus = debounce(function (status, document) {
|
|
|
1573
1565
|
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
1574
1566
|
|
|
1575
1567
|
// istanbul ignore next
|
|
1576
|
-
var useElementIds = 'useId' in
|
|
1568
|
+
var useElementIds = 'useId' in React // Avoid conditional useId call
|
|
1577
1569
|
? function useElementIds(_ref) {
|
|
1578
1570
|
var id = _ref.id,
|
|
1579
1571
|
labelId = _ref.labelId,
|
|
@@ -1582,7 +1574,7 @@ var useElementIds = 'useId' in React__default["default"] // Avoid conditional us
|
|
|
1582
1574
|
toggleButtonId = _ref.toggleButtonId,
|
|
1583
1575
|
inputId = _ref.inputId;
|
|
1584
1576
|
// Avoid conditional useId call
|
|
1585
|
-
var reactId = "downshift-" +
|
|
1577
|
+
var reactId = "downshift-" + React.useId();
|
|
1586
1578
|
if (!id) {
|
|
1587
1579
|
id = reactId;
|
|
1588
1580
|
}
|
|
@@ -1664,7 +1656,7 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
|
|
|
1664
1656
|
actionRef.current = action;
|
|
1665
1657
|
state = getState(state, action.props);
|
|
1666
1658
|
var changes = reducer(state, action);
|
|
1667
|
-
var newState = action.props.stateReducer(state,
|
|
1659
|
+
var newState = action.props.stateReducer(state, _extends({}, action, {
|
|
1668
1660
|
changes: changes
|
|
1669
1661
|
}));
|
|
1670
1662
|
return newState;
|
|
@@ -1674,7 +1666,7 @@ function useEnhancedReducer(reducer, props, createInitialState, isStateEqual) {
|
|
|
1674
1666
|
dispatch = _useReducer[1];
|
|
1675
1667
|
var propsRef = useLatestRef(props);
|
|
1676
1668
|
var dispatchWithProps = React.useCallback(function (action) {
|
|
1677
|
-
return dispatch(
|
|
1669
|
+
return dispatch(_extends({
|
|
1678
1670
|
props: propsRef.current
|
|
1679
1671
|
}, action));
|
|
1680
1672
|
}, [propsRef]);
|
|
@@ -1745,7 +1737,7 @@ function getInitialValue$1(props, propKey, defaultStateValues) {
|
|
|
1745
1737
|
function getInitialState$2(props) {
|
|
1746
1738
|
var selectedItem = getInitialValue$1(props, 'selectedItem');
|
|
1747
1739
|
var isOpen = getInitialValue$1(props, 'isOpen');
|
|
1748
|
-
var highlightedIndex =
|
|
1740
|
+
var highlightedIndex = getInitialHighlightedIndex(props);
|
|
1749
1741
|
var inputValue = getInitialValue$1(props, 'inputValue');
|
|
1750
1742
|
return {
|
|
1751
1743
|
highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.findIndex(function (item) {
|
|
@@ -1769,10 +1761,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
|
|
|
1769
1761
|
}
|
|
1770
1762
|
|
|
1771
1763
|
// initialHighlightedIndex will give value to highlightedIndex on initial state only.
|
|
1772
|
-
if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex])) {
|
|
1764
|
+
if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex], initialHighlightedIndex)) {
|
|
1773
1765
|
return initialHighlightedIndex;
|
|
1774
1766
|
}
|
|
1775
|
-
if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex])) {
|
|
1767
|
+
if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex], defaultHighlightedIndex)) {
|
|
1776
1768
|
return defaultHighlightedIndex;
|
|
1777
1769
|
}
|
|
1778
1770
|
if (selectedItem) {
|
|
@@ -1780,10 +1772,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
|
|
|
1780
1772
|
return itemToKey(selectedItem) === itemToKey(item);
|
|
1781
1773
|
});
|
|
1782
1774
|
}
|
|
1783
|
-
if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
|
|
1775
|
+
if (offset < 0 && !isItemDisabled(items[items.length - 1], items.length - 1)) {
|
|
1784
1776
|
return items.length - 1;
|
|
1785
1777
|
}
|
|
1786
|
-
if (offset > 0 && !isItemDisabled(items[0])) {
|
|
1778
|
+
if (offset > 0 && !isItemDisabled(items[0], 0)) {
|
|
1787
1779
|
return 0;
|
|
1788
1780
|
}
|
|
1789
1781
|
return -1;
|
|
@@ -1993,10 +1985,10 @@ function getChangesOnSelection(props, highlightedIndex, inputValue) {
|
|
|
1993
1985
|
inputValue = true;
|
|
1994
1986
|
}
|
|
1995
1987
|
var shouldSelect = ((_props$items = props.items) == null ? void 0 : _props$items.length) && highlightedIndex >= 0;
|
|
1996
|
-
return
|
|
1988
|
+
return _extends({
|
|
1997
1989
|
isOpen: false,
|
|
1998
1990
|
highlightedIndex: -1
|
|
1999
|
-
}, shouldSelect &&
|
|
1991
|
+
}, shouldSelect && _extends({
|
|
2000
1992
|
selectedItem: props.items[highlightedIndex],
|
|
2001
1993
|
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2002
1994
|
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')
|
|
@@ -2021,8 +2013,8 @@ function isDropdownsStateEqual(prevState, newState) {
|
|
|
2021
2013
|
* Tracks if it's the first render.
|
|
2022
2014
|
*/
|
|
2023
2015
|
function useIsInitialMount() {
|
|
2024
|
-
var isInitialMountRef =
|
|
2025
|
-
|
|
2016
|
+
var isInitialMountRef = React.useRef(true);
|
|
2017
|
+
React.useEffect(function () {
|
|
2026
2018
|
isInitialMountRef.current = false;
|
|
2027
2019
|
return function () {
|
|
2028
2020
|
isInitialMountRef.current = true;
|
|
@@ -2031,46 +2023,74 @@ function useIsInitialMount() {
|
|
|
2031
2023
|
return isInitialMountRef.current;
|
|
2032
2024
|
}
|
|
2033
2025
|
|
|
2026
|
+
/**
|
|
2027
|
+
* Returns the new highlightedIndex based on the defaultHighlightedIndex prop, if it's not disabled.
|
|
2028
|
+
*
|
|
2029
|
+
* @param {Object} props Props from useCombobox or useSelect.
|
|
2030
|
+
* @returns {number} The highlighted index.
|
|
2031
|
+
*/
|
|
2032
|
+
function getDefaultHighlightedIndex(props) {
|
|
2033
|
+
var highlightedIndex = getDefaultValue$1(props, 'highlightedIndex');
|
|
2034
|
+
if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {
|
|
2035
|
+
return -1;
|
|
2036
|
+
}
|
|
2037
|
+
return highlightedIndex;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
/**
|
|
2041
|
+
* Returns the new highlightedIndex based on the initialHighlightedIndex prop, if not disabled.
|
|
2042
|
+
*
|
|
2043
|
+
* @param {Object} props Props from useCombobox or useSelect.
|
|
2044
|
+
* @returns {number} The highlighted index.
|
|
2045
|
+
*/
|
|
2046
|
+
function getInitialHighlightedIndex(props) {
|
|
2047
|
+
var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
|
|
2048
|
+
if (highlightedIndex > -1 && props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)) {
|
|
2049
|
+
return -1;
|
|
2050
|
+
}
|
|
2051
|
+
return highlightedIndex;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2034
2054
|
// Shared between all exports.
|
|
2035
2055
|
var commonPropTypes = {
|
|
2036
|
-
environment:
|
|
2037
|
-
addEventListener:
|
|
2038
|
-
removeEventListener:
|
|
2039
|
-
document:
|
|
2040
|
-
createElement:
|
|
2041
|
-
getElementById:
|
|
2042
|
-
activeElement:
|
|
2043
|
-
body:
|
|
2056
|
+
environment: PropTypes.shape({
|
|
2057
|
+
addEventListener: PropTypes.func.isRequired,
|
|
2058
|
+
removeEventListener: PropTypes.func.isRequired,
|
|
2059
|
+
document: PropTypes.shape({
|
|
2060
|
+
createElement: PropTypes.func.isRequired,
|
|
2061
|
+
getElementById: PropTypes.func.isRequired,
|
|
2062
|
+
activeElement: PropTypes.any.isRequired,
|
|
2063
|
+
body: PropTypes.any.isRequired
|
|
2044
2064
|
}).isRequired,
|
|
2045
|
-
Node:
|
|
2065
|
+
Node: PropTypes.func.isRequired
|
|
2046
2066
|
}),
|
|
2047
|
-
itemToString:
|
|
2048
|
-
itemToKey:
|
|
2049
|
-
stateReducer:
|
|
2067
|
+
itemToString: PropTypes.func,
|
|
2068
|
+
itemToKey: PropTypes.func,
|
|
2069
|
+
stateReducer: PropTypes.func
|
|
2050
2070
|
};
|
|
2051
2071
|
|
|
2052
2072
|
// Shared between useSelect, useCombobox, Downshift.
|
|
2053
|
-
var commonDropdownPropTypes =
|
|
2054
|
-
getA11yStatusMessage:
|
|
2055
|
-
highlightedIndex:
|
|
2056
|
-
defaultHighlightedIndex:
|
|
2057
|
-
initialHighlightedIndex:
|
|
2058
|
-
isOpen:
|
|
2059
|
-
defaultIsOpen:
|
|
2060
|
-
initialIsOpen:
|
|
2061
|
-
selectedItem:
|
|
2062
|
-
initialSelectedItem:
|
|
2063
|
-
defaultSelectedItem:
|
|
2064
|
-
id:
|
|
2065
|
-
labelId:
|
|
2066
|
-
menuId:
|
|
2067
|
-
getItemId:
|
|
2068
|
-
toggleButtonId:
|
|
2069
|
-
onSelectedItemChange:
|
|
2070
|
-
onHighlightedIndexChange:
|
|
2071
|
-
onStateChange:
|
|
2072
|
-
onIsOpenChange:
|
|
2073
|
-
scrollIntoView:
|
|
2073
|
+
var commonDropdownPropTypes = _extends({}, commonPropTypes, {
|
|
2074
|
+
getA11yStatusMessage: PropTypes.func,
|
|
2075
|
+
highlightedIndex: PropTypes.number,
|
|
2076
|
+
defaultHighlightedIndex: PropTypes.number,
|
|
2077
|
+
initialHighlightedIndex: PropTypes.number,
|
|
2078
|
+
isOpen: PropTypes.bool,
|
|
2079
|
+
defaultIsOpen: PropTypes.bool,
|
|
2080
|
+
initialIsOpen: PropTypes.bool,
|
|
2081
|
+
selectedItem: PropTypes.any,
|
|
2082
|
+
initialSelectedItem: PropTypes.any,
|
|
2083
|
+
defaultSelectedItem: PropTypes.any,
|
|
2084
|
+
id: PropTypes.string,
|
|
2085
|
+
labelId: PropTypes.string,
|
|
2086
|
+
menuId: PropTypes.string,
|
|
2087
|
+
getItemId: PropTypes.func,
|
|
2088
|
+
toggleButtonId: PropTypes.string,
|
|
2089
|
+
onSelectedItemChange: PropTypes.func,
|
|
2090
|
+
onHighlightedIndexChange: PropTypes.func,
|
|
2091
|
+
onStateChange: PropTypes.func,
|
|
2092
|
+
onIsOpenChange: PropTypes.func,
|
|
2093
|
+
scrollIntoView: PropTypes.func
|
|
2074
2094
|
});
|
|
2075
2095
|
|
|
2076
2096
|
function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
@@ -2108,7 +2128,7 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
|
2108
2128
|
break;
|
|
2109
2129
|
case stateChangeTypes.FunctionSetHighlightedIndex:
|
|
2110
2130
|
changes = {
|
|
2111
|
-
highlightedIndex: action.highlightedIndex
|
|
2131
|
+
highlightedIndex: props.isItemDisabled(props.items[action.highlightedIndex], action.highlightedIndex) ? -1 : action.highlightedIndex
|
|
2112
2132
|
};
|
|
2113
2133
|
break;
|
|
2114
2134
|
case stateChangeTypes.FunctionSetInputValue:
|
|
@@ -2118,7 +2138,7 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
|
2118
2138
|
break;
|
|
2119
2139
|
case stateChangeTypes.FunctionReset:
|
|
2120
2140
|
changes = {
|
|
2121
|
-
highlightedIndex:
|
|
2141
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
2122
2142
|
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2123
2143
|
selectedItem: getDefaultValue$1(props, 'selectedItem'),
|
|
2124
2144
|
inputValue: getDefaultValue$1(props, 'inputValue')
|
|
@@ -2127,7 +2147,7 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
|
2127
2147
|
default:
|
|
2128
2148
|
throw new Error('Reducer called without proper action type.');
|
|
2129
2149
|
}
|
|
2130
|
-
return
|
|
2150
|
+
return _extends({}, state, changes);
|
|
2131
2151
|
}
|
|
2132
2152
|
/* eslint-enable complexity */
|
|
2133
2153
|
|
|
@@ -2146,7 +2166,7 @@ function getItemIndexByCharacterKey(_a) {
|
|
|
2146
2166
|
}
|
|
2147
2167
|
return highlightedIndex;
|
|
2148
2168
|
}
|
|
2149
|
-
var propTypes$2 = tslib.__assign(tslib.__assign({}, commonDropdownPropTypes), { items:
|
|
2169
|
+
var propTypes$2 = tslib.__assign(tslib.__assign({}, commonDropdownPropTypes), { items: PropTypes.array.isRequired, isItemDisabled: PropTypes.func });
|
|
2150
2170
|
var defaultProps$2 = tslib.__assign(tslib.__assign({}, defaultProps$3), { isItemDisabled: function () {
|
|
2151
2171
|
return false;
|
|
2152
2172
|
} });
|
|
@@ -2155,7 +2175,7 @@ var validatePropTypes$2 = noop;
|
|
|
2155
2175
|
/* istanbul ignore next */
|
|
2156
2176
|
if (process.env.NODE_ENV !== 'production') {
|
|
2157
2177
|
validatePropTypes$2 = function (options, caller) {
|
|
2158
|
-
|
|
2178
|
+
PropTypes.checkPropTypes(propTypes$2, options, 'prop', caller.name);
|
|
2159
2179
|
};
|
|
2160
2180
|
}
|
|
2161
2181
|
|
|
@@ -2184,28 +2204,28 @@ var FunctionReset$2 = process.env.NODE_ENV !== "production" ? '__function_reset_
|
|
|
2184
2204
|
|
|
2185
2205
|
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
|
|
2186
2206
|
__proto__: null,
|
|
2207
|
+
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2208
|
+
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2209
|
+
FunctionReset: FunctionReset$2,
|
|
2210
|
+
FunctionSelectItem: FunctionSelectItem$1,
|
|
2211
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2212
|
+
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2213
|
+
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2214
|
+
ItemClick: ItemClick$1,
|
|
2215
|
+
ItemMouseMove: ItemMouseMove$1,
|
|
2216
|
+
MenuMouseLeave: MenuMouseLeave$1,
|
|
2217
|
+
ToggleButtonBlur: ToggleButtonBlur,
|
|
2187
2218
|
ToggleButtonClick: ToggleButtonClick$1,
|
|
2188
2219
|
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
|
|
2189
2220
|
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
|
|
2190
2221
|
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
|
|
2191
|
-
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2192
|
-
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2193
2222
|
ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,
|
|
2194
2223
|
ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,
|
|
2195
|
-
|
|
2196
|
-
|
|
2224
|
+
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2225
|
+
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2197
2226
|
ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
ItemMouseMove: ItemMouseMove$1,
|
|
2201
|
-
ItemClick: ItemClick$1,
|
|
2202
|
-
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2203
|
-
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2204
|
-
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2205
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2206
|
-
FunctionSelectItem: FunctionSelectItem$1,
|
|
2207
|
-
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2208
|
-
FunctionReset: FunctionReset$2
|
|
2227
|
+
ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,
|
|
2228
|
+
ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton
|
|
2209
2229
|
});
|
|
2210
2230
|
|
|
2211
2231
|
/* eslint-disable complexity */
|
|
@@ -2219,7 +2239,7 @@ function downshiftSelectReducer(state, action) {
|
|
|
2219
2239
|
case ItemClick$1:
|
|
2220
2240
|
changes = {
|
|
2221
2241
|
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2222
|
-
highlightedIndex:
|
|
2242
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
2223
2243
|
selectedItem: props.items[action.index]
|
|
2224
2244
|
};
|
|
2225
2245
|
break;
|
|
@@ -2298,7 +2318,7 @@ function downshiftSelectReducer(state, action) {
|
|
|
2298
2318
|
};
|
|
2299
2319
|
break;
|
|
2300
2320
|
case ToggleButtonBlur:
|
|
2301
|
-
changes =
|
|
2321
|
+
changes = _extends({
|
|
2302
2322
|
isOpen: false,
|
|
2303
2323
|
highlightedIndex: -1
|
|
2304
2324
|
}, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && {
|
|
@@ -2313,7 +2333,7 @@ function downshiftSelectReducer(state, action) {
|
|
|
2313
2333
|
default:
|
|
2314
2334
|
return downshiftCommonReducer(state, action, stateChangeTypes$2);
|
|
2315
2335
|
}
|
|
2316
|
-
return
|
|
2336
|
+
return _extends({}, state, changes);
|
|
2317
2337
|
}
|
|
2318
2338
|
/* eslint-enable complexity */
|
|
2319
2339
|
|
|
@@ -2328,7 +2348,7 @@ function useSelect(userProps) {
|
|
|
2328
2348
|
}
|
|
2329
2349
|
validatePropTypes$2(userProps, useSelect);
|
|
2330
2350
|
// Props defaults and destructuring.
|
|
2331
|
-
var props =
|
|
2351
|
+
var props = _extends({}, defaultProps$2, userProps);
|
|
2332
2352
|
var scrollIntoView = props.scrollIntoView,
|
|
2333
2353
|
environment = props.environment,
|
|
2334
2354
|
getA11yStatusMessage = props.getA11yStatusMessage;
|
|
@@ -2544,12 +2564,12 @@ function useSelect(userProps) {
|
|
|
2544
2564
|
var getLabelProps = React.useCallback(function (_temp) {
|
|
2545
2565
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
2546
2566
|
onClick = _ref.onClick,
|
|
2547
|
-
labelProps =
|
|
2567
|
+
labelProps = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
2548
2568
|
var labelHandleClick = function labelHandleClick() {
|
|
2549
2569
|
var _toggleButtonRef$curr;
|
|
2550
2570
|
(_toggleButtonRef$curr = toggleButtonRef.current) == null || _toggleButtonRef$curr.focus();
|
|
2551
2571
|
};
|
|
2552
|
-
return
|
|
2572
|
+
return _extends({
|
|
2553
2573
|
id: elementIds.labelId,
|
|
2554
2574
|
htmlFor: elementIds.toggleButtonId,
|
|
2555
2575
|
onClick: callAllEventHandlers(onClick, labelHandleClick)
|
|
@@ -2562,7 +2582,7 @@ function useSelect(userProps) {
|
|
|
2562
2582
|
_ref2$refKey = _ref2.refKey,
|
|
2563
2583
|
refKey = _ref2$refKey === void 0 ? 'ref' : _ref2$refKey,
|
|
2564
2584
|
ref = _ref2.ref,
|
|
2565
|
-
rest =
|
|
2585
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
|
|
2566
2586
|
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
2567
2587
|
_ref3$suppressRefErro = _ref3.suppressRefError,
|
|
2568
2588
|
suppressRefError = _ref3$suppressRefErro === void 0 ? false : _ref3$suppressRefErro;
|
|
@@ -2572,7 +2592,7 @@ function useSelect(userProps) {
|
|
|
2572
2592
|
});
|
|
2573
2593
|
};
|
|
2574
2594
|
setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
|
|
2575
|
-
return
|
|
2595
|
+
return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {
|
|
2576
2596
|
menuRef.current = menuNode;
|
|
2577
2597
|
}), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : "" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends2), rest);
|
|
2578
2598
|
}, [dispatch, setGetterPropCallInfo, elementIds]);
|
|
@@ -2586,7 +2606,7 @@ function useSelect(userProps) {
|
|
|
2586
2606
|
_ref4$refKey = _ref4.refKey,
|
|
2587
2607
|
refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,
|
|
2588
2608
|
ref = _ref4.ref,
|
|
2589
|
-
rest =
|
|
2609
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$1);
|
|
2590
2610
|
var _ref5 = _temp5 === void 0 ? {} : _temp5,
|
|
2591
2611
|
_ref5$suppressRefErro = _ref5.suppressRefError,
|
|
2592
2612
|
suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;
|
|
@@ -2614,7 +2634,7 @@ function useSelect(userProps) {
|
|
|
2614
2634
|
});
|
|
2615
2635
|
}
|
|
2616
2636
|
};
|
|
2617
|
-
var toggleProps =
|
|
2637
|
+
var toggleProps = _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {
|
|
2618
2638
|
toggleButtonRef.current = toggleButtonNode;
|
|
2619
2639
|
}), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = rest && rest['aria-label'] ? undefined : "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);
|
|
2620
2640
|
if (!rest.disabled) {
|
|
@@ -2640,7 +2660,7 @@ function useSelect(userProps) {
|
|
|
2640
2660
|
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
|
|
2641
2661
|
disabledProp = _ref6.disabled,
|
|
2642
2662
|
ref = _ref6.ref,
|
|
2643
|
-
rest =
|
|
2663
|
+
rest = _objectWithoutPropertiesLoose(_ref6, _excluded4$1);
|
|
2644
2664
|
if (disabledProp !== undefined) {
|
|
2645
2665
|
console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.');
|
|
2646
2666
|
}
|
|
@@ -2672,11 +2692,11 @@ function useSelect(userProps) {
|
|
|
2672
2692
|
return e.preventDefault();
|
|
2673
2693
|
}; // keep focus on the toggle after item click select.
|
|
2674
2694
|
|
|
2675
|
-
var itemProps =
|
|
2695
|
+
var itemProps = _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (itemNode) {
|
|
2676
2696
|
if (itemNode) {
|
|
2677
2697
|
itemRefs.current[elementIds.getItemId(index)] = itemNode;
|
|
2678
2698
|
}
|
|
2679
|
-
}), _extends4['aria-disabled'] = disabled, _extends4['aria-selected'] =
|
|
2699
|
+
}), _extends4['aria-disabled'] = disabled, _extends4['aria-selected'] = item === latestState.selectedItem, _extends4.id = elementIds.getItemId(index), _extends4.role = 'option', _extends4), rest);
|
|
2680
2700
|
if (!disabled) {
|
|
2681
2701
|
/* istanbul ignore next (react-native) */
|
|
2682
2702
|
{
|
|
@@ -2735,29 +2755,29 @@ var ControlledPropUpdatedSelectedItem = process.env.NODE_ENV !== "production" ?
|
|
|
2735
2755
|
|
|
2736
2756
|
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
|
|
2737
2757
|
__proto__: null,
|
|
2758
|
+
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem,
|
|
2759
|
+
FunctionCloseMenu: FunctionCloseMenu,
|
|
2760
|
+
FunctionOpenMenu: FunctionOpenMenu,
|
|
2761
|
+
FunctionReset: FunctionReset$1,
|
|
2762
|
+
FunctionSelectItem: FunctionSelectItem,
|
|
2763
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
2764
|
+
FunctionSetInputValue: FunctionSetInputValue,
|
|
2765
|
+
FunctionToggleMenu: FunctionToggleMenu,
|
|
2766
|
+
InputBlur: InputBlur,
|
|
2767
|
+
InputChange: InputChange,
|
|
2768
|
+
InputClick: InputClick,
|
|
2738
2769
|
InputKeyDownArrowDown: InputKeyDownArrowDown,
|
|
2739
2770
|
InputKeyDownArrowUp: InputKeyDownArrowUp,
|
|
2771
|
+
InputKeyDownEnd: InputKeyDownEnd,
|
|
2772
|
+
InputKeyDownEnter: InputKeyDownEnter,
|
|
2740
2773
|
InputKeyDownEscape: InputKeyDownEscape,
|
|
2741
2774
|
InputKeyDownHome: InputKeyDownHome,
|
|
2742
|
-
InputKeyDownEnd: InputKeyDownEnd,
|
|
2743
|
-
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
2744
2775
|
InputKeyDownPageDown: InputKeyDownPageDown,
|
|
2745
|
-
|
|
2746
|
-
InputChange: InputChange,
|
|
2747
|
-
InputBlur: InputBlur,
|
|
2748
|
-
InputClick: InputClick,
|
|
2749
|
-
MenuMouseLeave: MenuMouseLeave,
|
|
2750
|
-
ItemMouseMove: ItemMouseMove,
|
|
2776
|
+
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
2751
2777
|
ItemClick: ItemClick,
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
FunctionCloseMenu: FunctionCloseMenu,
|
|
2756
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
2757
|
-
FunctionSelectItem: FunctionSelectItem,
|
|
2758
|
-
FunctionSetInputValue: FunctionSetInputValue,
|
|
2759
|
-
FunctionReset: FunctionReset$1,
|
|
2760
|
-
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
|
|
2778
|
+
ItemMouseMove: ItemMouseMove,
|
|
2779
|
+
MenuMouseLeave: MenuMouseLeave,
|
|
2780
|
+
ToggleButtonClick: ToggleButtonClick
|
|
2761
2781
|
});
|
|
2762
2782
|
|
|
2763
2783
|
function getInitialState$1(props) {
|
|
@@ -2767,18 +2787,18 @@ function getInitialState$1(props) {
|
|
|
2767
2787
|
if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {
|
|
2768
2788
|
inputValue = props.itemToString(selectedItem);
|
|
2769
2789
|
}
|
|
2770
|
-
return
|
|
2790
|
+
return _extends({}, initialState, {
|
|
2771
2791
|
inputValue: inputValue
|
|
2772
2792
|
});
|
|
2773
2793
|
}
|
|
2774
|
-
var propTypes$1 =
|
|
2775
|
-
items:
|
|
2776
|
-
isItemDisabled:
|
|
2777
|
-
inputValue:
|
|
2778
|
-
defaultInputValue:
|
|
2779
|
-
initialInputValue:
|
|
2780
|
-
inputId:
|
|
2781
|
-
onInputValueChange:
|
|
2794
|
+
var propTypes$1 = _extends({}, commonDropdownPropTypes, {
|
|
2795
|
+
items: PropTypes.array.isRequired,
|
|
2796
|
+
isItemDisabled: PropTypes.func,
|
|
2797
|
+
inputValue: PropTypes.string,
|
|
2798
|
+
defaultInputValue: PropTypes.string,
|
|
2799
|
+
initialInputValue: PropTypes.string,
|
|
2800
|
+
inputId: PropTypes.string,
|
|
2801
|
+
onInputValueChange: PropTypes.func
|
|
2782
2802
|
});
|
|
2783
2803
|
|
|
2784
2804
|
/**
|
|
@@ -2825,10 +2845,10 @@ var validatePropTypes$1 = noop;
|
|
|
2825
2845
|
/* istanbul ignore next */
|
|
2826
2846
|
if (process.env.NODE_ENV !== 'production') {
|
|
2827
2847
|
validatePropTypes$1 = function validatePropTypes(options, caller) {
|
|
2828
|
-
|
|
2848
|
+
PropTypes.checkPropTypes(propTypes$1, options, 'prop', caller.name);
|
|
2829
2849
|
};
|
|
2830
2850
|
}
|
|
2831
|
-
var defaultProps$1 =
|
|
2851
|
+
var defaultProps$1 = _extends({}, defaultProps$3, {
|
|
2832
2852
|
isItemDisabled: function isItemDisabled() {
|
|
2833
2853
|
return false;
|
|
2834
2854
|
}
|
|
@@ -2845,7 +2865,7 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
2845
2865
|
case ItemClick:
|
|
2846
2866
|
changes = {
|
|
2847
2867
|
isOpen: getDefaultValue$1(props, 'isOpen'),
|
|
2848
|
-
highlightedIndex:
|
|
2868
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
2849
2869
|
selectedItem: props.items[action.index],
|
|
2850
2870
|
inputValue: props.itemToString(props.items[action.index])
|
|
2851
2871
|
};
|
|
@@ -2882,7 +2902,7 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
2882
2902
|
changes = getChangesOnSelection(props, state.highlightedIndex);
|
|
2883
2903
|
break;
|
|
2884
2904
|
case InputKeyDownEscape:
|
|
2885
|
-
changes =
|
|
2905
|
+
changes = _extends({
|
|
2886
2906
|
isOpen: false,
|
|
2887
2907
|
highlightedIndex: -1
|
|
2888
2908
|
}, !state.isOpen && {
|
|
@@ -2911,7 +2931,7 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
2911
2931
|
};
|
|
2912
2932
|
break;
|
|
2913
2933
|
case InputBlur:
|
|
2914
|
-
changes =
|
|
2934
|
+
changes = _extends({
|
|
2915
2935
|
isOpen: false,
|
|
2916
2936
|
highlightedIndex: -1
|
|
2917
2937
|
}, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && action.selectItem && {
|
|
@@ -2922,7 +2942,7 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
2922
2942
|
case InputChange:
|
|
2923
2943
|
changes = {
|
|
2924
2944
|
isOpen: true,
|
|
2925
|
-
highlightedIndex:
|
|
2945
|
+
highlightedIndex: getDefaultHighlightedIndex(props),
|
|
2926
2946
|
inputValue: action.inputValue
|
|
2927
2947
|
};
|
|
2928
2948
|
break;
|
|
@@ -2946,7 +2966,7 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
2946
2966
|
default:
|
|
2947
2967
|
return downshiftCommonReducer(state, action, stateChangeTypes$1);
|
|
2948
2968
|
}
|
|
2949
|
-
return
|
|
2969
|
+
return _extends({}, state, changes);
|
|
2950
2970
|
}
|
|
2951
2971
|
/* eslint-enable complexity */
|
|
2952
2972
|
|
|
@@ -2961,7 +2981,7 @@ function useCombobox(userProps) {
|
|
|
2961
2981
|
}
|
|
2962
2982
|
validatePropTypes$1(userProps, useCombobox);
|
|
2963
2983
|
// Props defaults and destructuring.
|
|
2964
|
-
var props =
|
|
2984
|
+
var props = _extends({}, defaultProps$1, userProps);
|
|
2965
2985
|
var items = props.items,
|
|
2966
2986
|
scrollIntoView = props.scrollIntoView,
|
|
2967
2987
|
environment = props.environment,
|
|
@@ -3127,7 +3147,7 @@ function useCombobox(userProps) {
|
|
|
3127
3147
|
|
|
3128
3148
|
// Getter props.
|
|
3129
3149
|
var getLabelProps = React.useCallback(function (labelProps) {
|
|
3130
|
-
return
|
|
3150
|
+
return _extends({
|
|
3131
3151
|
id: elementIds.labelId,
|
|
3132
3152
|
htmlFor: elementIds.inputId
|
|
3133
3153
|
}, labelProps);
|
|
@@ -3139,12 +3159,12 @@ function useCombobox(userProps) {
|
|
|
3139
3159
|
_ref$refKey = _ref.refKey,
|
|
3140
3160
|
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
|
|
3141
3161
|
ref = _ref.ref,
|
|
3142
|
-
rest =
|
|
3162
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
3143
3163
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
3144
3164
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
3145
3165
|
suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
|
|
3146
3166
|
setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
|
|
3147
|
-
return
|
|
3167
|
+
return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {
|
|
3148
3168
|
menuRef.current = menuNode;
|
|
3149
3169
|
}), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = rest && rest['aria-label'] ? undefined : "" + elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {
|
|
3150
3170
|
dispatch({
|
|
@@ -3165,7 +3185,7 @@ function useCombobox(userProps) {
|
|
|
3165
3185
|
onClick = _ref3.onClick;
|
|
3166
3186
|
_ref3.onPress;
|
|
3167
3187
|
var disabledProp = _ref3.disabled,
|
|
3168
|
-
rest =
|
|
3188
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
|
|
3169
3189
|
if (disabledProp !== undefined) {
|
|
3170
3190
|
console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');
|
|
3171
3191
|
}
|
|
@@ -3199,11 +3219,11 @@ function useCombobox(userProps) {
|
|
|
3199
3219
|
return e.preventDefault();
|
|
3200
3220
|
}; // keep focus on the input after item click select.
|
|
3201
3221
|
|
|
3202
|
-
return
|
|
3222
|
+
return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {
|
|
3203
3223
|
if (itemNode) {
|
|
3204
3224
|
itemRefs.current[elementIds.getItemId(index)] = itemNode;
|
|
3205
3225
|
}
|
|
3206
|
-
}), _extends3['aria-disabled'] = disabled, _extends3['aria-selected'] =
|
|
3226
|
+
}), _extends3['aria-disabled'] = disabled, _extends3['aria-selected'] = index === latestState.highlightedIndex, _extends3.id = elementIds.getItemId(index), _extends3.role = 'option', _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), {
|
|
3207
3227
|
onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
|
|
3208
3228
|
onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown)
|
|
3209
3229
|
}, rest);
|
|
@@ -3216,16 +3236,16 @@ function useCombobox(userProps) {
|
|
|
3216
3236
|
var _ref5$refKey = _ref5.refKey,
|
|
3217
3237
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
3218
3238
|
ref = _ref5.ref,
|
|
3219
|
-
rest =
|
|
3239
|
+
rest = _objectWithoutPropertiesLoose(_ref5, _excluded3);
|
|
3220
3240
|
var latestState = latest.current.state;
|
|
3221
3241
|
var toggleButtonHandleClick = function toggleButtonHandleClick() {
|
|
3222
3242
|
dispatch({
|
|
3223
3243
|
type: ToggleButtonClick
|
|
3224
3244
|
});
|
|
3225
3245
|
};
|
|
3226
|
-
return
|
|
3246
|
+
return _extends((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {
|
|
3227
3247
|
toggleButtonRef.current = toggleButtonNode;
|
|
3228
|
-
}), _extends4['aria-controls'] = elementIds.menuId, _extends4['aria-expanded'] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled &&
|
|
3248
|
+
}), _extends4['aria-controls'] = elementIds.menuId, _extends4['aria-expanded'] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && _extends({}, {
|
|
3229
3249
|
onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
|
|
3230
3250
|
}), rest);
|
|
3231
3251
|
}, [dispatch, latest, elementIds]);
|
|
@@ -3241,7 +3261,7 @@ function useCombobox(userProps) {
|
|
|
3241
3261
|
_ref6$refKey = _ref6.refKey,
|
|
3242
3262
|
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
|
|
3243
3263
|
ref = _ref6.ref,
|
|
3244
|
-
rest =
|
|
3264
|
+
rest = _objectWithoutPropertiesLoose(_ref6, _excluded4);
|
|
3245
3265
|
var _ref7 = _temp6 === void 0 ? {} : _temp6,
|
|
3246
3266
|
_ref7$suppressRefErro = _ref7.suppressRefError,
|
|
3247
3267
|
suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;
|
|
@@ -3282,7 +3302,7 @@ function useCombobox(userProps) {
|
|
|
3282
3302
|
var _eventHandlers;
|
|
3283
3303
|
eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onClick = callAllEventHandlers(onClick, inputHandleClick), _eventHandlers);
|
|
3284
3304
|
}
|
|
3285
|
-
return
|
|
3305
|
+
return _extends((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
|
|
3286
3306
|
inputRef.current = inputNode;
|
|
3287
3307
|
}), _extends5['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5['aria-expanded'] = latestState.isOpen, _extends5['aria-labelledby'] = rest && rest['aria-label'] ? undefined : elementIds.labelId, _extends5.autoComplete = 'off', _extends5.id = elementIds.inputId, _extends5.role = 'combobox', _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest);
|
|
3288
3308
|
}, [dispatch, elementIds, environment, inputKeyDownHandlers, latest, mouseAndTouchTrackers, setGetterPropCallInfo]);
|
|
@@ -3435,17 +3455,17 @@ var propTypes = {
|
|
|
3435
3455
|
stateReducer: commonPropTypes.stateReducer,
|
|
3436
3456
|
itemToKey: commonPropTypes.itemToKey,
|
|
3437
3457
|
environment: commonPropTypes.environment,
|
|
3438
|
-
selectedItems:
|
|
3439
|
-
initialSelectedItems:
|
|
3440
|
-
defaultSelectedItems:
|
|
3441
|
-
getA11yStatusMessage:
|
|
3442
|
-
activeIndex:
|
|
3443
|
-
initialActiveIndex:
|
|
3444
|
-
defaultActiveIndex:
|
|
3445
|
-
onActiveIndexChange:
|
|
3446
|
-
onSelectedItemsChange:
|
|
3447
|
-
keyNavigationNext:
|
|
3448
|
-
keyNavigationPrevious:
|
|
3458
|
+
selectedItems: PropTypes.array,
|
|
3459
|
+
initialSelectedItems: PropTypes.array,
|
|
3460
|
+
defaultSelectedItems: PropTypes.array,
|
|
3461
|
+
getA11yStatusMessage: PropTypes.func,
|
|
3462
|
+
activeIndex: PropTypes.number,
|
|
3463
|
+
initialActiveIndex: PropTypes.number,
|
|
3464
|
+
defaultActiveIndex: PropTypes.number,
|
|
3465
|
+
onActiveIndexChange: PropTypes.func,
|
|
3466
|
+
onSelectedItemsChange: PropTypes.func,
|
|
3467
|
+
keyNavigationNext: PropTypes.string,
|
|
3468
|
+
keyNavigationPrevious: PropTypes.string
|
|
3449
3469
|
};
|
|
3450
3470
|
var defaultProps = {
|
|
3451
3471
|
itemToKey: defaultProps$3.itemToKey,
|
|
@@ -3460,7 +3480,7 @@ var validatePropTypes = noop;
|
|
|
3460
3480
|
/* istanbul ignore next */
|
|
3461
3481
|
if (process.env.NODE_ENV !== 'production') {
|
|
3462
3482
|
validatePropTypes = function validatePropTypes(options, caller) {
|
|
3463
|
-
|
|
3483
|
+
PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name);
|
|
3464
3484
|
};
|
|
3465
3485
|
}
|
|
3466
3486
|
|
|
@@ -3480,19 +3500,19 @@ var FunctionReset = process.env.NODE_ENV !== "production" ? '__function_reset__'
|
|
|
3480
3500
|
|
|
3481
3501
|
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
3482
3502
|
__proto__: null,
|
|
3483
|
-
SelectedItemClick: SelectedItemClick,
|
|
3484
|
-
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3485
|
-
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3486
|
-
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3487
|
-
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
|
|
3488
|
-
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3489
|
-
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3490
3503
|
DropdownClick: DropdownClick,
|
|
3504
|
+
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3505
|
+
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3491
3506
|
FunctionAddSelectedItem: FunctionAddSelectedItem,
|
|
3492
3507
|
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
|
|
3493
|
-
|
|
3508
|
+
FunctionReset: FunctionReset,
|
|
3494
3509
|
FunctionSetActiveIndex: FunctionSetActiveIndex,
|
|
3495
|
-
|
|
3510
|
+
FunctionSetSelectedItems: FunctionSetSelectedItems,
|
|
3511
|
+
SelectedItemClick: SelectedItemClick,
|
|
3512
|
+
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3513
|
+
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3514
|
+
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3515
|
+
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious
|
|
3496
3516
|
});
|
|
3497
3517
|
|
|
3498
3518
|
/* eslint-disable complexity */
|
|
@@ -3532,7 +3552,7 @@ function downshiftMultipleSelectionReducer(state, action) {
|
|
|
3532
3552
|
} else if (activeIndex === selectedItems.length - 1) {
|
|
3533
3553
|
newActiveIndex = selectedItems.length - 2;
|
|
3534
3554
|
}
|
|
3535
|
-
changes =
|
|
3555
|
+
changes = _extends({
|
|
3536
3556
|
selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))
|
|
3537
3557
|
}, {
|
|
3538
3558
|
activeIndex: newActiveIndex
|
|
@@ -3604,7 +3624,7 @@ function downshiftMultipleSelectionReducer(state, action) {
|
|
|
3604
3624
|
default:
|
|
3605
3625
|
throw new Error('Reducer called without proper action type.');
|
|
3606
3626
|
}
|
|
3607
|
-
return
|
|
3627
|
+
return _extends({}, state, changes);
|
|
3608
3628
|
}
|
|
3609
3629
|
|
|
3610
3630
|
var _excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
|
|
@@ -3616,7 +3636,7 @@ function useMultipleSelection(userProps) {
|
|
|
3616
3636
|
}
|
|
3617
3637
|
validatePropTypes(userProps, useMultipleSelection);
|
|
3618
3638
|
// Props defaults and destructuring.
|
|
3619
|
-
var props =
|
|
3639
|
+
var props = _extends({}, defaultProps, userProps);
|
|
3620
3640
|
var getA11yStatusMessage = props.getA11yStatusMessage,
|
|
3621
3641
|
environment = props.environment,
|
|
3622
3642
|
keyNavigationNext = props.keyNavigationNext,
|
|
@@ -3709,7 +3729,7 @@ function useMultipleSelection(userProps) {
|
|
|
3709
3729
|
onKeyDown = _ref3.onKeyDown,
|
|
3710
3730
|
selectedItemProp = _ref3.selectedItem,
|
|
3711
3731
|
indexProp = _ref3.index,
|
|
3712
|
-
rest =
|
|
3732
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
3713
3733
|
var latestState = latest.current.state;
|
|
3714
3734
|
var _getItemAndIndex = getItemAndIndex(selectedItemProp, indexProp, latestState.selectedItems, 'Pass either item or index to getSelectedItemProps!'),
|
|
3715
3735
|
index = _getItemAndIndex[1];
|
|
@@ -3726,7 +3746,7 @@ function useMultipleSelection(userProps) {
|
|
|
3726
3746
|
selectedItemKeyDownHandlers[key](event);
|
|
3727
3747
|
}
|
|
3728
3748
|
};
|
|
3729
|
-
return
|
|
3749
|
+
return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (selectedItemNode) {
|
|
3730
3750
|
if (selectedItemNode) {
|
|
3731
3751
|
selectedItemRefs.current.push(selectedItemNode);
|
|
3732
3752
|
}
|
|
@@ -3742,7 +3762,7 @@ function useMultipleSelection(userProps) {
|
|
|
3742
3762
|
onClick = _ref4.onClick,
|
|
3743
3763
|
_ref4$preventKeyActio = _ref4.preventKeyAction,
|
|
3744
3764
|
preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
|
|
3745
|
-
rest =
|
|
3765
|
+
rest = _objectWithoutPropertiesLoose(_ref4, _excluded2);
|
|
3746
3766
|
var _ref5 = _temp3 === void 0 ? {} : _temp3,
|
|
3747
3767
|
_ref5$suppressRefErro = _ref5.suppressRefError,
|
|
3748
3768
|
suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;
|
|
@@ -3758,7 +3778,7 @@ function useMultipleSelection(userProps) {
|
|
|
3758
3778
|
type: DropdownClick
|
|
3759
3779
|
});
|
|
3760
3780
|
};
|
|
3761
|
-
return
|
|
3781
|
+
return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (dropdownNode) {
|
|
3762
3782
|
if (dropdownNode) {
|
|
3763
3783
|
dropdownRef.current = dropdownNode;
|
|
3764
3784
|
}
|
|
@@ -3811,7 +3831,7 @@ function useMultipleSelection(userProps) {
|
|
|
3811
3831
|
};
|
|
3812
3832
|
}
|
|
3813
3833
|
|
|
3814
|
-
exports
|
|
3834
|
+
exports.default = Downshift$1;
|
|
3815
3835
|
exports.resetIdCounter = resetIdCounter;
|
|
3816
3836
|
exports.useCombobox = useCombobox;
|
|
3817
3837
|
exports.useMultipleSelection = useMultipleSelection;
|