downshift 6.1.3 → 6.1.5
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/README.md +6 -2
- package/dist/downshift.cjs.js +130 -111
- package/dist/downshift.esm.js +131 -113
- package/dist/downshift.native.cjs.js +130 -111
- package/dist/downshift.umd.js +801 -928
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +16 -28
- package/dist/downshift.umd.min.js.map +1 -1
- package/dist/src/hooks/reducer.d.ts +1 -0
- package/dist/src/hooks/useSelect/__tests__/utils.test.d.ts +1 -0
- package/dist/src/hooks/useSelect/reducer.d.ts +1 -0
- package/dist/src/hooks/useSelect/stateChangeTypes.d.ts +23 -0
- package/dist/src/hooks/useSelect/types.d.ts +7 -0
- package/dist/src/hooks/useSelect/utils.d.ts +23 -0
- package/dist/src/hooks/utils.d.ts +112 -0
- package/dist/src/is.macro.d.ts +2 -0
- package/dist/src/productionEnum.macro.d.ts +2 -0
- package/dist/src/set-a11y-status.d.ts +6 -0
- package/dist/src/types.d.ts +10 -0
- package/dist/src/utils.d.ts +156 -0
- package/dist/{basic.test.d.ts → test/basic.test.d.ts} +0 -0
- package/dist/{custom.test.d.ts → test/custom.test.d.ts} +0 -0
- package/dist/test/setup.d.ts +1 -0
- package/package.json +43 -42
- package/preact/dist/downshift.cjs.js +131 -111
- package/preact/dist/downshift.esm.js +132 -113
- package/preact/dist/downshift.umd.js +352 -429
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +16 -11
- package/preact/dist/downshift.umd.min.js.map +1 -1
- package/typings/index.d.ts +4 -13
|
@@ -10,6 +10,7 @@ var PropTypes = require('prop-types');
|
|
|
10
10
|
var react = require('react');
|
|
11
11
|
var reactIs = require('react-is');
|
|
12
12
|
var computeScrollIntoView = require('compute-scroll-into-view');
|
|
13
|
+
var tslib = require('tslib');
|
|
13
14
|
|
|
14
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
16
|
|
|
@@ -169,7 +170,7 @@ function resetIdCounter() {
|
|
|
169
170
|
}
|
|
170
171
|
/**
|
|
171
172
|
* Default implementation for status message. Only added when menu is open.
|
|
172
|
-
* Will
|
|
173
|
+
* Will specify if there are results in the list, and if so, how many,
|
|
173
174
|
* and what keys are relevant.
|
|
174
175
|
*
|
|
175
176
|
* @param {Object} param the downshift state and other relevant properties
|
|
@@ -548,6 +549,12 @@ var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
|
548
549
|
touchEnd: touchEnd
|
|
549
550
|
});
|
|
550
551
|
|
|
552
|
+
var _excluded$4 = ["refKey", "ref"],
|
|
553
|
+
_excluded2$3 = ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"],
|
|
554
|
+
_excluded3$2 = ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"],
|
|
555
|
+
_excluded4$1 = ["refKey", "ref"],
|
|
556
|
+
_excluded5$1 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
557
|
+
|
|
551
558
|
var Downshift = /*#__PURE__*/function () {
|
|
552
559
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
553
560
|
_inheritsLoose__default['default'](Downshift, _Component);
|
|
@@ -667,6 +674,8 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
667
674
|
isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
|
|
668
675
|
|
|
669
676
|
var nextState = {}; // this is just used to tell whether the state changed
|
|
677
|
+
|
|
678
|
+
var nextFullState = {}; // we need to call on change if the outside world is controlling any of our state
|
|
670
679
|
// and we're trying to update that state. OR if the selection has changed and we're
|
|
671
680
|
// trying to update the selection
|
|
672
681
|
|
|
@@ -692,7 +701,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
692
701
|
return;
|
|
693
702
|
}
|
|
694
703
|
|
|
695
|
-
newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
|
|
704
|
+
nextFullState[key] = newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
|
|
696
705
|
|
|
697
706
|
if (!isControlledProp(_this.props, key)) {
|
|
698
707
|
nextState[key] = newStateToSet[key];
|
|
@@ -741,7 +750,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
741
750
|
_ref$refKey = _ref.refKey,
|
|
742
751
|
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
|
|
743
752
|
ref = _ref.ref,
|
|
744
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref,
|
|
753
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$4);
|
|
745
754
|
|
|
746
755
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
747
756
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
@@ -925,7 +934,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
925
934
|
_ref3.onKeyDown;
|
|
926
935
|
_ref3.onKeyUp;
|
|
927
936
|
_ref3.onBlur;
|
|
928
|
-
var rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
937
|
+
var rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$3);
|
|
929
938
|
|
|
930
939
|
var _this$getState5 = _this.getState(),
|
|
931
940
|
isOpen = _this$getState5.isOpen;
|
|
@@ -984,10 +993,10 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
984
993
|
_this.internalSetTimeout(function () {
|
|
985
994
|
if (!_this.isMouseDown && (_this.props.environment.document.activeElement == null || _this.props.environment.document.activeElement.id !== _this.inputId) && _this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
|
|
986
995
|
) {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
996
|
+
_this.reset({
|
|
997
|
+
type: blurButton
|
|
998
|
+
});
|
|
999
|
+
}
|
|
991
1000
|
});
|
|
992
1001
|
};
|
|
993
1002
|
|
|
@@ -1005,7 +1014,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1005
1014
|
onChange = _ref4.onChange,
|
|
1006
1015
|
onInput = _ref4.onInput,
|
|
1007
1016
|
onChangeText = _ref4.onChangeText,
|
|
1008
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref4,
|
|
1017
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded3$2);
|
|
1009
1018
|
|
|
1010
1019
|
var onChangeKey;
|
|
1011
1020
|
var eventHandlers = {};
|
|
@@ -1097,7 +1106,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1097
1106
|
_ref5$refKey = _ref5.refKey,
|
|
1098
1107
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
1099
1108
|
ref = _ref5.ref,
|
|
1100
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref5,
|
|
1109
|
+
props = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded4$1);
|
|
1101
1110
|
|
|
1102
1111
|
var _ref6 = _temp6 === void 0 ? {} : _temp6,
|
|
1103
1112
|
_ref6$suppressRefErro = _ref6.suppressRefError,
|
|
@@ -1122,7 +1131,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1122
1131
|
item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ?
|
|
1123
1132
|
/* istanbul ignore next */
|
|
1124
1133
|
undefined : requiredProp('getItemProps', 'item') : _ref7$item,
|
|
1125
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref7,
|
|
1134
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref7, _excluded5$1);
|
|
1126
1135
|
|
|
1127
1136
|
if (index === undefined) {
|
|
1128
1137
|
_this.items.push(item);
|
|
@@ -1551,9 +1560,9 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1551
1560
|
selectedItemChanged: function selectedItemChanged(prevItem, item) {
|
|
1552
1561
|
return prevItem !== item;
|
|
1553
1562
|
},
|
|
1554
|
-
environment:
|
|
1563
|
+
environment:
|
|
1555
1564
|
/* istanbul ignore next (ssr) */
|
|
1556
|
-
? {} : window,
|
|
1565
|
+
typeof window === 'undefined' ? {} : window,
|
|
1557
1566
|
stateReducer: function stateReducer(state, stateToSet) {
|
|
1558
1567
|
return stateToSet;
|
|
1559
1568
|
},
|
|
@@ -1610,6 +1619,7 @@ process.env.NODE_ENV !== "production" ? Downshift.propTypes = {
|
|
|
1610
1619
|
/* eslint-enable react/no-unused-prop-types */
|
|
1611
1620
|
|
|
1612
1621
|
} : void 0;
|
|
1622
|
+
var Downshift$1 = Downshift;
|
|
1613
1623
|
|
|
1614
1624
|
function validateGetMenuPropsCalledCorrectly(node, _ref12) {
|
|
1615
1625
|
var refKey = _ref12.refKey;
|
|
@@ -1639,6 +1649,7 @@ function validateGetRootPropsCalledCorrectly(element, _ref13) {
|
|
|
1639
1649
|
}
|
|
1640
1650
|
}
|
|
1641
1651
|
|
|
1652
|
+
var _excluded$3 = ["isInitialMount", "highlightedIndex", "items", "environment"];
|
|
1642
1653
|
var dropdownDefaultStateValues = {
|
|
1643
1654
|
highlightedIndex: -1,
|
|
1644
1655
|
isOpen: false,
|
|
@@ -1836,9 +1847,9 @@ var defaultProps$3 = {
|
|
|
1836
1847
|
getA11ySelectionMessage: getA11ySelectionMessage,
|
|
1837
1848
|
scrollIntoView: scrollIntoView,
|
|
1838
1849
|
circularNavigation: false,
|
|
1839
|
-
environment:
|
|
1850
|
+
environment:
|
|
1840
1851
|
/* istanbul ignore next (ssr) */
|
|
1841
|
-
? {} : window
|
|
1852
|
+
typeof window === 'undefined' ? {} : window
|
|
1842
1853
|
};
|
|
1843
1854
|
|
|
1844
1855
|
function getDefaultValue$1(props, propKey, defaultStateValues) {
|
|
@@ -2052,11 +2063,11 @@ function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
|
|
|
2052
2063
|
highlightedIndex = _ref2.highlightedIndex,
|
|
2053
2064
|
items = _ref2.items,
|
|
2054
2065
|
environment = _ref2.environment,
|
|
2055
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref2,
|
|
2066
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref2, _excluded$3);
|
|
2056
2067
|
|
|
2057
2068
|
// Sets a11y status message on changes in state.
|
|
2058
2069
|
react.useEffect(function () {
|
|
2059
|
-
if (isInitialMount) {
|
|
2070
|
+
if (isInitialMount || true) {
|
|
2060
2071
|
return;
|
|
2061
2072
|
}
|
|
2062
2073
|
|
|
@@ -2187,58 +2198,58 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
|
2187
2198
|
}
|
|
2188
2199
|
/* eslint-enable complexity */
|
|
2189
2200
|
|
|
2190
|
-
function getItemIndexByCharacterKey(
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2201
|
+
function getItemIndexByCharacterKey(_a) {
|
|
2202
|
+
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
|
|
2203
|
+
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
|
|
2204
|
+
for (var index = 0; index < items.length; index++) {
|
|
2205
|
+
var offsetIndex = (index + highlightedIndex + 1) % items.length;
|
|
2206
|
+
var item = items[offsetIndex];
|
|
2207
|
+
if (item !== undefined &&
|
|
2208
|
+
itemToString(item)
|
|
2209
|
+
.toLowerCase()
|
|
2210
|
+
.startsWith(lowerCasedKeysSoFar)) {
|
|
2211
|
+
var element = getItemNodeFromIndex(offsetIndex);
|
|
2212
|
+
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
|
|
2213
|
+
return offsetIndex;
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2202
2216
|
}
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
return highlightedIndex;
|
|
2217
|
+
return highlightedIndex;
|
|
2206
2218
|
}
|
|
2207
|
-
|
|
2208
2219
|
var propTypes$2 = {
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2220
|
+
items: PropTypes__default['default'].array.isRequired,
|
|
2221
|
+
itemToString: PropTypes__default['default'].func,
|
|
2222
|
+
getA11yStatusMessage: PropTypes__default['default'].func,
|
|
2223
|
+
getA11ySelectionMessage: PropTypes__default['default'].func,
|
|
2224
|
+
circularNavigation: PropTypes__default['default'].bool,
|
|
2225
|
+
highlightedIndex: PropTypes__default['default'].number,
|
|
2226
|
+
defaultHighlightedIndex: PropTypes__default['default'].number,
|
|
2227
|
+
initialHighlightedIndex: PropTypes__default['default'].number,
|
|
2228
|
+
isOpen: PropTypes__default['default'].bool,
|
|
2229
|
+
defaultIsOpen: PropTypes__default['default'].bool,
|
|
2230
|
+
initialIsOpen: PropTypes__default['default'].bool,
|
|
2231
|
+
selectedItem: PropTypes__default['default'].any,
|
|
2232
|
+
initialSelectedItem: PropTypes__default['default'].any,
|
|
2233
|
+
defaultSelectedItem: PropTypes__default['default'].any,
|
|
2234
|
+
id: PropTypes__default['default'].string,
|
|
2235
|
+
labelId: PropTypes__default['default'].string,
|
|
2236
|
+
menuId: PropTypes__default['default'].string,
|
|
2237
|
+
getItemId: PropTypes__default['default'].func,
|
|
2238
|
+
toggleButtonId: PropTypes__default['default'].string,
|
|
2239
|
+
stateReducer: PropTypes__default['default'].func,
|
|
2240
|
+
onSelectedItemChange: PropTypes__default['default'].func,
|
|
2241
|
+
onHighlightedIndexChange: PropTypes__default['default'].func,
|
|
2242
|
+
onStateChange: PropTypes__default['default'].func,
|
|
2243
|
+
onIsOpenChange: PropTypes__default['default'].func,
|
|
2244
|
+
environment: PropTypes__default['default'].shape({
|
|
2245
|
+
addEventListener: PropTypes__default['default'].func,
|
|
2246
|
+
removeEventListener: PropTypes__default['default'].func,
|
|
2247
|
+
document: PropTypes__default['default'].shape({
|
|
2248
|
+
getElementById: PropTypes__default['default'].func,
|
|
2249
|
+
activeElement: PropTypes__default['default'].any,
|
|
2250
|
+
body: PropTypes__default['default'].any
|
|
2251
|
+
})
|
|
2240
2252
|
})
|
|
2241
|
-
})
|
|
2242
2253
|
};
|
|
2243
2254
|
/**
|
|
2244
2255
|
* Default implementation for status message. Only added when menu is open.
|
|
@@ -2248,39 +2259,27 @@ var propTypes$2 = {
|
|
|
2248
2259
|
* @param {Object} param the downshift state and other relevant properties
|
|
2249
2260
|
* @return {String} the a11y status message
|
|
2250
2261
|
*/
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2262
|
+
function getA11yStatusMessage(_a) {
|
|
2263
|
+
var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;
|
|
2264
|
+
if (!isOpen) {
|
|
2265
|
+
return '';
|
|
2266
|
+
}
|
|
2267
|
+
if (!resultCount) {
|
|
2268
|
+
return 'No results are available.';
|
|
2269
|
+
}
|
|
2270
|
+
if (resultCount !== previousResultCount) {
|
|
2271
|
+
return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.";
|
|
2272
|
+
}
|
|
2258
2273
|
return '';
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
if (!resultCount) {
|
|
2262
|
-
return 'No results are available.';
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
if (resultCount !== previousResultCount) {
|
|
2266
|
-
return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.";
|
|
2267
|
-
}
|
|
2268
|
-
|
|
2269
|
-
return '';
|
|
2270
2274
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
getA11yStatusMessage: getA11yStatusMessage
|
|
2274
|
-
}); // eslint-disable-next-line import/no-mutable-exports
|
|
2275
|
-
|
|
2276
|
-
|
|
2275
|
+
var defaultProps$2 = tslib.__assign(tslib.__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });
|
|
2276
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
2277
2277
|
var validatePropTypes$2 = noop;
|
|
2278
2278
|
/* istanbul ignore next */
|
|
2279
|
-
|
|
2280
2279
|
if (process.env.NODE_ENV !== 'production') {
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2280
|
+
validatePropTypes$2 = function (options, caller) {
|
|
2281
|
+
PropTypes__default['default'].checkPropTypes(propTypes$2, options, 'prop', caller.name);
|
|
2282
|
+
};
|
|
2284
2283
|
}
|
|
2285
2284
|
|
|
2286
2285
|
var MenuKeyDownArrowDown = process.env.NODE_ENV !== "production" ? '__menu_keydown_arrow_down__' : 0;
|
|
@@ -2355,7 +2354,13 @@ function downshiftSelectReducer(state, action) {
|
|
|
2355
2354
|
{
|
|
2356
2355
|
var lowercasedKey = action.key;
|
|
2357
2356
|
var inputValue = "" + state.inputValue + lowercasedKey;
|
|
2358
|
-
var itemIndex = getItemIndexByCharacterKey(
|
|
2357
|
+
var itemIndex = getItemIndexByCharacterKey({
|
|
2358
|
+
keysSoFar: inputValue,
|
|
2359
|
+
highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
|
|
2360
|
+
items: props.items,
|
|
2361
|
+
itemToString: props.itemToString,
|
|
2362
|
+
getItemNodeFromIndex: action.getItemNodeFromIndex
|
|
2363
|
+
});
|
|
2359
2364
|
changes = _extends__default['default']({
|
|
2360
2365
|
inputValue: inputValue
|
|
2361
2366
|
}, itemIndex >= 0 && {
|
|
@@ -2420,7 +2425,13 @@ function downshiftSelectReducer(state, action) {
|
|
|
2420
2425
|
|
|
2421
2426
|
var _inputValue = "" + state.inputValue + _lowercasedKey;
|
|
2422
2427
|
|
|
2423
|
-
var highlightedIndex = getItemIndexByCharacterKey(
|
|
2428
|
+
var highlightedIndex = getItemIndexByCharacterKey({
|
|
2429
|
+
keysSoFar: _inputValue,
|
|
2430
|
+
highlightedIndex: state.highlightedIndex,
|
|
2431
|
+
items: props.items,
|
|
2432
|
+
itemToString: props.itemToString,
|
|
2433
|
+
getItemNodeFromIndex: action.getItemNodeFromIndex
|
|
2434
|
+
});
|
|
2424
2435
|
changes = _extends__default['default']({
|
|
2425
2436
|
inputValue: _inputValue
|
|
2426
2437
|
}, highlightedIndex >= 0 && {
|
|
@@ -2455,6 +2466,9 @@ function downshiftSelectReducer(state, action) {
|
|
|
2455
2466
|
}
|
|
2456
2467
|
/* eslint-enable complexity */
|
|
2457
2468
|
|
|
2469
|
+
var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
|
|
2470
|
+
_excluded2$2 = ["onClick", "onKeyDown", "refKey", "ref"],
|
|
2471
|
+
_excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref"];
|
|
2458
2472
|
useSelect.stateChangeTypes = stateChangeTypes$2;
|
|
2459
2473
|
|
|
2460
2474
|
function useSelect(userProps) {
|
|
@@ -2745,7 +2759,7 @@ function useSelect(userProps) {
|
|
|
2745
2759
|
onKeyDown = _ref.onKeyDown,
|
|
2746
2760
|
onBlur = _ref.onBlur,
|
|
2747
2761
|
ref = _ref.ref,
|
|
2748
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref,
|
|
2762
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$2);
|
|
2749
2763
|
|
|
2750
2764
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
2751
2765
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
@@ -2810,7 +2824,7 @@ function useSelect(userProps) {
|
|
|
2810
2824
|
_ref3$refKey = _ref3.refKey,
|
|
2811
2825
|
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
|
|
2812
2826
|
ref = _ref3.ref,
|
|
2813
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
2827
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$2);
|
|
2814
2828
|
|
|
2815
2829
|
var _ref4 = _temp4 === void 0 ? {} : _temp4,
|
|
2816
2830
|
_ref4$suppressRefErro = _ref4.suppressRefError,
|
|
@@ -2859,7 +2873,7 @@ function useSelect(userProps) {
|
|
|
2859
2873
|
_ref5$refKey = _ref5.refKey,
|
|
2860
2874
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
2861
2875
|
ref = _ref5.ref,
|
|
2862
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref5,
|
|
2876
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3$1);
|
|
2863
2877
|
|
|
2864
2878
|
var _latest$current = latest.current,
|
|
2865
2879
|
latestState = _latest$current.state,
|
|
@@ -3195,6 +3209,11 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3195
3209
|
}
|
|
3196
3210
|
/* eslint-enable complexity */
|
|
3197
3211
|
|
|
3212
|
+
var _excluded$1 = ["onMouseLeave", "refKey", "ref"],
|
|
3213
|
+
_excluded2$1 = ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"],
|
|
3214
|
+
_excluded3 = ["onClick", "onPress", "refKey", "ref"],
|
|
3215
|
+
_excluded4 = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"],
|
|
3216
|
+
_excluded5 = ["refKey", "ref"];
|
|
3198
3217
|
useCombobox.stateChangeTypes = stateChangeTypes$1;
|
|
3199
3218
|
|
|
3200
3219
|
function useCombobox(userProps) {
|
|
@@ -3365,8 +3384,8 @@ function useCombobox(userProps) {
|
|
|
3365
3384
|
|
|
3366
3385
|
if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
|
|
3367
3386
|
) {
|
|
3368
|
-
|
|
3369
|
-
|
|
3387
|
+
return;
|
|
3388
|
+
}
|
|
3370
3389
|
|
|
3371
3390
|
event.preventDefault();
|
|
3372
3391
|
dispatch({
|
|
@@ -3391,7 +3410,7 @@ function useCombobox(userProps) {
|
|
|
3391
3410
|
_ref$refKey = _ref.refKey,
|
|
3392
3411
|
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
|
|
3393
3412
|
ref = _ref.ref,
|
|
3394
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref,
|
|
3413
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$1);
|
|
3395
3414
|
|
|
3396
3415
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
3397
3416
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
@@ -3418,7 +3437,7 @@ function useCombobox(userProps) {
|
|
|
3418
3437
|
onMouseMove = _ref3.onMouseMove;
|
|
3419
3438
|
_ref3.onClick;
|
|
3420
3439
|
var onPress = _ref3.onPress,
|
|
3421
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
3440
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$1);
|
|
3422
3441
|
|
|
3423
3442
|
var _latest$current = latest.current,
|
|
3424
3443
|
latestProps = _latest$current.props,
|
|
@@ -3474,7 +3493,7 @@ function useCombobox(userProps) {
|
|
|
3474
3493
|
_ref5$refKey = _ref5.refKey,
|
|
3475
3494
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
3476
3495
|
ref = _ref5.ref,
|
|
3477
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref5,
|
|
3496
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3);
|
|
3478
3497
|
|
|
3479
3498
|
var toggleButtonHandleClick = function toggleButtonHandleClick() {
|
|
3480
3499
|
dispatch({
|
|
@@ -3505,7 +3524,7 @@ function useCombobox(userProps) {
|
|
|
3505
3524
|
_ref6$refKey = _ref6.refKey,
|
|
3506
3525
|
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
|
|
3507
3526
|
ref = _ref6.ref,
|
|
3508
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref6,
|
|
3527
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref6, _excluded4);
|
|
3509
3528
|
|
|
3510
3529
|
var _ref7 = _temp6 === void 0 ? {} : _temp6,
|
|
3511
3530
|
_ref7$suppressRefErro = _ref7.suppressRefError,
|
|
@@ -3583,7 +3602,7 @@ function useCombobox(userProps) {
|
|
|
3583
3602
|
_ref8$refKey = _ref8.refKey,
|
|
3584
3603
|
refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
|
|
3585
3604
|
ref = _ref8.ref,
|
|
3586
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref8,
|
|
3605
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref8, _excluded5);
|
|
3587
3606
|
|
|
3588
3607
|
var _ref9 = _temp8 === void 0 ? {} : _temp8,
|
|
3589
3608
|
_ref9$suppressRefErro = _ref9.suppressRefError,
|
|
@@ -3723,9 +3742,7 @@ function isKeyDownOperationPermitted(event) {
|
|
|
3723
3742
|
var element = event.target;
|
|
3724
3743
|
|
|
3725
3744
|
if (element instanceof HTMLInputElement && // if element is a text input
|
|
3726
|
-
element.value !== '' && (
|
|
3727
|
-
// and cursor is either not at the start or is currently highlighting text.
|
|
3728
|
-
element.selectionStart !== 0 || element.selectionEnd !== 0)) {
|
|
3745
|
+
element.value !== '' && (element.selectionStart !== 0 || element.selectionEnd !== 0)) {
|
|
3729
3746
|
return false;
|
|
3730
3747
|
}
|
|
3731
3748
|
|
|
@@ -3942,6 +3959,8 @@ function downshiftMultipleSelectionReducer(state, action) {
|
|
|
3942
3959
|
return _extends__default['default']({}, state, changes);
|
|
3943
3960
|
}
|
|
3944
3961
|
|
|
3962
|
+
var _excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
|
|
3963
|
+
_excluded2 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"];
|
|
3945
3964
|
useMultipleSelection.stateChangeTypes = stateChangeTypes;
|
|
3946
3965
|
|
|
3947
3966
|
function useMultipleSelection(userProps) {
|
|
@@ -4071,7 +4090,7 @@ function useMultipleSelection(userProps) {
|
|
|
4071
4090
|
onKeyDown = _ref3.onKeyDown,
|
|
4072
4091
|
selectedItem = _ref3.selectedItem,
|
|
4073
4092
|
index = _ref3.index,
|
|
4074
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
4093
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded);
|
|
4075
4094
|
|
|
4076
4095
|
var latestState = latest.current.state;
|
|
4077
4096
|
var itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
|
|
@@ -4112,7 +4131,7 @@ function useMultipleSelection(userProps) {
|
|
|
4112
4131
|
onClick = _ref4.onClick,
|
|
4113
4132
|
_ref4$preventKeyActio = _ref4.preventKeyAction,
|
|
4114
4133
|
preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
|
|
4115
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref4,
|
|
4134
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded2);
|
|
4116
4135
|
|
|
4117
4136
|
var _ref5 = _temp3 === void 0 ? {} : _temp3,
|
|
4118
4137
|
_ref5$suppressRefErro = _ref5.suppressRefError,
|
|
@@ -4186,7 +4205,7 @@ function useMultipleSelection(userProps) {
|
|
|
4186
4205
|
};
|
|
4187
4206
|
}
|
|
4188
4207
|
|
|
4189
|
-
exports
|
|
4208
|
+
exports['default'] = Downshift$1;
|
|
4190
4209
|
exports.resetIdCounter = resetIdCounter;
|
|
4191
4210
|
exports.useCombobox = useCombobox;
|
|
4192
4211
|
exports.useMultipleSelection = useMultipleSelection;
|