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
|
@@ -9,6 +9,7 @@ var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
|
|
|
9
9
|
var preact = require('preact');
|
|
10
10
|
var reactIs = require('react-is');
|
|
11
11
|
var computeScrollIntoView = require('compute-scroll-into-view');
|
|
12
|
+
var tslib = require('tslib');
|
|
12
13
|
var PropTypes = require('prop-types');
|
|
13
14
|
|
|
14
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -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
|
|
@@ -554,6 +555,12 @@ var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
|
554
555
|
touchEnd: touchEnd
|
|
555
556
|
});
|
|
556
557
|
|
|
558
|
+
var _excluded$4 = ["refKey", "ref"],
|
|
559
|
+
_excluded2$3 = ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"],
|
|
560
|
+
_excluded3$2 = ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"],
|
|
561
|
+
_excluded4$1 = ["refKey", "ref"],
|
|
562
|
+
_excluded5$1 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
563
|
+
|
|
557
564
|
var Downshift = /*#__PURE__*/function () {
|
|
558
565
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
559
566
|
_inheritsLoose__default['default'](Downshift, _Component);
|
|
@@ -673,6 +680,8 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
673
680
|
isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
|
|
674
681
|
|
|
675
682
|
var nextState = {}; // this is just used to tell whether the state changed
|
|
683
|
+
|
|
684
|
+
var nextFullState = {}; // we need to call on change if the outside world is controlling any of our state
|
|
676
685
|
// and we're trying to update that state. OR if the selection has changed and we're
|
|
677
686
|
// trying to update the selection
|
|
678
687
|
|
|
@@ -698,7 +707,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
698
707
|
return;
|
|
699
708
|
}
|
|
700
709
|
|
|
701
|
-
newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
|
|
710
|
+
nextFullState[key] = newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
|
|
702
711
|
|
|
703
712
|
if (!isControlledProp(_this.props, key)) {
|
|
704
713
|
nextState[key] = newStateToSet[key];
|
|
@@ -747,7 +756,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
747
756
|
_ref$refKey = _ref.refKey,
|
|
748
757
|
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
|
|
749
758
|
ref = _ref.ref,
|
|
750
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref,
|
|
759
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$4);
|
|
751
760
|
|
|
752
761
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
753
762
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
@@ -931,7 +940,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
931
940
|
var onKeyDown = _ref3.onKeyDown,
|
|
932
941
|
onKeyUp = _ref3.onKeyUp,
|
|
933
942
|
onBlur = _ref3.onBlur,
|
|
934
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
943
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$3);
|
|
935
944
|
|
|
936
945
|
var _this$getState5 = _this.getState(),
|
|
937
946
|
isOpen = _this$getState5.isOpen;
|
|
@@ -999,10 +1008,10 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
999
1008
|
_this.internalSetTimeout(function () {
|
|
1000
1009
|
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)
|
|
1001
1010
|
) {
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1011
|
+
_this.reset({
|
|
1012
|
+
type: blurButton
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1006
1015
|
});
|
|
1007
1016
|
};
|
|
1008
1017
|
|
|
@@ -1020,7 +1029,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1020
1029
|
onChange = _ref4.onChange,
|
|
1021
1030
|
onInput = _ref4.onInput;
|
|
1022
1031
|
_ref4.onChangeText;
|
|
1023
|
-
var rest = _objectWithoutPropertiesLoose__default['default'](_ref4,
|
|
1032
|
+
var rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded3$2);
|
|
1024
1033
|
|
|
1025
1034
|
var onChangeKey;
|
|
1026
1035
|
var eventHandlers = {};
|
|
@@ -1095,7 +1104,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1095
1104
|
_ref5$refKey = _ref5.refKey,
|
|
1096
1105
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
1097
1106
|
ref = _ref5.ref,
|
|
1098
|
-
props = _objectWithoutPropertiesLoose__default['default'](_ref5,
|
|
1107
|
+
props = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded4$1);
|
|
1099
1108
|
|
|
1100
1109
|
var _ref6 = _temp6 === void 0 ? {} : _temp6,
|
|
1101
1110
|
_ref6$suppressRefErro = _ref6.suppressRefError,
|
|
@@ -1120,7 +1129,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1120
1129
|
item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ?
|
|
1121
1130
|
/* istanbul ignore next */
|
|
1122
1131
|
undefined : requiredProp('getItemProps', 'item') : _ref7$item,
|
|
1123
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref7,
|
|
1132
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref7, _excluded5$1);
|
|
1124
1133
|
|
|
1125
1134
|
if (index === undefined) {
|
|
1126
1135
|
_this.items.push(item);
|
|
@@ -1628,9 +1637,9 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1628
1637
|
selectedItemChanged: function selectedItemChanged(prevItem, item) {
|
|
1629
1638
|
return prevItem !== item;
|
|
1630
1639
|
},
|
|
1631
|
-
environment:
|
|
1640
|
+
environment:
|
|
1632
1641
|
/* istanbul ignore next (ssr) */
|
|
1633
|
-
? {} : window,
|
|
1642
|
+
typeof window === 'undefined' ? {} : window,
|
|
1634
1643
|
stateReducer: function stateReducer(state, stateToSet) {
|
|
1635
1644
|
return stateToSet;
|
|
1636
1645
|
},
|
|
@@ -1641,6 +1650,8 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1641
1650
|
return Downshift;
|
|
1642
1651
|
}();
|
|
1643
1652
|
|
|
1653
|
+
var Downshift$1 = Downshift;
|
|
1654
|
+
|
|
1644
1655
|
function validateGetMenuPropsCalledCorrectly(node, _ref12) {
|
|
1645
1656
|
var refKey = _ref12.refKey;
|
|
1646
1657
|
|
|
@@ -1669,6 +1680,7 @@ function validateGetRootPropsCalledCorrectly(element, _ref13) {
|
|
|
1669
1680
|
}
|
|
1670
1681
|
}
|
|
1671
1682
|
|
|
1683
|
+
var _excluded$3 = ["isInitialMount", "highlightedIndex", "items", "environment"];
|
|
1672
1684
|
var dropdownDefaultStateValues = {
|
|
1673
1685
|
highlightedIndex: -1,
|
|
1674
1686
|
isOpen: false,
|
|
@@ -1866,9 +1878,9 @@ var defaultProps$3 = {
|
|
|
1866
1878
|
getA11ySelectionMessage: getA11ySelectionMessage,
|
|
1867
1879
|
scrollIntoView: scrollIntoView,
|
|
1868
1880
|
circularNavigation: false,
|
|
1869
|
-
environment:
|
|
1881
|
+
environment:
|
|
1870
1882
|
/* istanbul ignore next (ssr) */
|
|
1871
|
-
? {} : window
|
|
1883
|
+
typeof window === 'undefined' ? {} : window
|
|
1872
1884
|
};
|
|
1873
1885
|
|
|
1874
1886
|
function getDefaultValue$1(props, propKey, defaultStateValues) {
|
|
@@ -2082,11 +2094,11 @@ function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
|
|
|
2082
2094
|
highlightedIndex = _ref2.highlightedIndex,
|
|
2083
2095
|
items = _ref2.items,
|
|
2084
2096
|
environment = _ref2.environment,
|
|
2085
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref2,
|
|
2097
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref2, _excluded$3);
|
|
2086
2098
|
|
|
2087
2099
|
// Sets a11y status message on changes in state.
|
|
2088
2100
|
preact.useEffect(function () {
|
|
2089
|
-
if (isInitialMount) {
|
|
2101
|
+
if (isInitialMount || false) {
|
|
2090
2102
|
return;
|
|
2091
2103
|
}
|
|
2092
2104
|
|
|
@@ -2217,58 +2229,58 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
|
|
|
2217
2229
|
}
|
|
2218
2230
|
/* eslint-enable complexity */
|
|
2219
2231
|
|
|
2220
|
-
function getItemIndexByCharacterKey(
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
+
function getItemIndexByCharacterKey(_a) {
|
|
2233
|
+
var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
|
|
2234
|
+
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
|
|
2235
|
+
for (var index = 0; index < items.length; index++) {
|
|
2236
|
+
var offsetIndex = (index + highlightedIndex + 1) % items.length;
|
|
2237
|
+
var item = items[offsetIndex];
|
|
2238
|
+
if (item !== undefined &&
|
|
2239
|
+
itemToString(item)
|
|
2240
|
+
.toLowerCase()
|
|
2241
|
+
.startsWith(lowerCasedKeysSoFar)) {
|
|
2242
|
+
var element = getItemNodeFromIndex(offsetIndex);
|
|
2243
|
+
if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
|
|
2244
|
+
return offsetIndex;
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2232
2247
|
}
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
return highlightedIndex;
|
|
2248
|
+
return highlightedIndex;
|
|
2236
2249
|
}
|
|
2237
|
-
|
|
2238
2250
|
var propTypes$2 = {
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2251
|
+
items: PropTypes__default['default'].array.isRequired,
|
|
2252
|
+
itemToString: PropTypes__default['default'].func,
|
|
2253
|
+
getA11yStatusMessage: PropTypes__default['default'].func,
|
|
2254
|
+
getA11ySelectionMessage: PropTypes__default['default'].func,
|
|
2255
|
+
circularNavigation: PropTypes__default['default'].bool,
|
|
2256
|
+
highlightedIndex: PropTypes__default['default'].number,
|
|
2257
|
+
defaultHighlightedIndex: PropTypes__default['default'].number,
|
|
2258
|
+
initialHighlightedIndex: PropTypes__default['default'].number,
|
|
2259
|
+
isOpen: PropTypes__default['default'].bool,
|
|
2260
|
+
defaultIsOpen: PropTypes__default['default'].bool,
|
|
2261
|
+
initialIsOpen: PropTypes__default['default'].bool,
|
|
2262
|
+
selectedItem: PropTypes__default['default'].any,
|
|
2263
|
+
initialSelectedItem: PropTypes__default['default'].any,
|
|
2264
|
+
defaultSelectedItem: PropTypes__default['default'].any,
|
|
2265
|
+
id: PropTypes__default['default'].string,
|
|
2266
|
+
labelId: PropTypes__default['default'].string,
|
|
2267
|
+
menuId: PropTypes__default['default'].string,
|
|
2268
|
+
getItemId: PropTypes__default['default'].func,
|
|
2269
|
+
toggleButtonId: PropTypes__default['default'].string,
|
|
2270
|
+
stateReducer: PropTypes__default['default'].func,
|
|
2271
|
+
onSelectedItemChange: PropTypes__default['default'].func,
|
|
2272
|
+
onHighlightedIndexChange: PropTypes__default['default'].func,
|
|
2273
|
+
onStateChange: PropTypes__default['default'].func,
|
|
2274
|
+
onIsOpenChange: PropTypes__default['default'].func,
|
|
2275
|
+
environment: PropTypes__default['default'].shape({
|
|
2276
|
+
addEventListener: PropTypes__default['default'].func,
|
|
2277
|
+
removeEventListener: PropTypes__default['default'].func,
|
|
2278
|
+
document: PropTypes__default['default'].shape({
|
|
2279
|
+
getElementById: PropTypes__default['default'].func,
|
|
2280
|
+
activeElement: PropTypes__default['default'].any,
|
|
2281
|
+
body: PropTypes__default['default'].any
|
|
2282
|
+
})
|
|
2270
2283
|
})
|
|
2271
|
-
})
|
|
2272
2284
|
};
|
|
2273
2285
|
/**
|
|
2274
2286
|
* Default implementation for status message. Only added when menu is open.
|
|
@@ -2278,39 +2290,27 @@ var propTypes$2 = {
|
|
|
2278
2290
|
* @param {Object} param the downshift state and other relevant properties
|
|
2279
2291
|
* @return {String} the a11y status message
|
|
2280
2292
|
*/
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2293
|
+
function getA11yStatusMessage(_a) {
|
|
2294
|
+
var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;
|
|
2295
|
+
if (!isOpen) {
|
|
2296
|
+
return '';
|
|
2297
|
+
}
|
|
2298
|
+
if (!resultCount) {
|
|
2299
|
+
return 'No results are available.';
|
|
2300
|
+
}
|
|
2301
|
+
if (resultCount !== previousResultCount) {
|
|
2302
|
+
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.";
|
|
2303
|
+
}
|
|
2288
2304
|
return '';
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
if (!resultCount) {
|
|
2292
|
-
return 'No results are available.';
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
if (resultCount !== previousResultCount) {
|
|
2296
|
-
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.";
|
|
2297
|
-
}
|
|
2298
|
-
|
|
2299
|
-
return '';
|
|
2300
2305
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
getA11yStatusMessage: getA11yStatusMessage
|
|
2304
|
-
}); // eslint-disable-next-line import/no-mutable-exports
|
|
2305
|
-
|
|
2306
|
-
|
|
2306
|
+
var defaultProps$2 = tslib.__assign(tslib.__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });
|
|
2307
|
+
// eslint-disable-next-line import/no-mutable-exports
|
|
2307
2308
|
var validatePropTypes$2 = noop;
|
|
2308
2309
|
/* istanbul ignore next */
|
|
2309
|
-
|
|
2310
2310
|
if (process.env.NODE_ENV !== 'production') {
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2311
|
+
validatePropTypes$2 = function (options, caller) {
|
|
2312
|
+
PropTypes__default['default'].checkPropTypes(propTypes$2, options, 'prop', caller.name);
|
|
2313
|
+
};
|
|
2314
2314
|
}
|
|
2315
2315
|
|
|
2316
2316
|
var MenuKeyDownArrowDown = process.env.NODE_ENV !== "production" ? '__menu_keydown_arrow_down__' : 0;
|
|
@@ -2385,7 +2385,13 @@ function downshiftSelectReducer(state, action) {
|
|
|
2385
2385
|
{
|
|
2386
2386
|
var lowercasedKey = action.key;
|
|
2387
2387
|
var inputValue = "" + state.inputValue + lowercasedKey;
|
|
2388
|
-
var itemIndex = getItemIndexByCharacterKey(
|
|
2388
|
+
var itemIndex = getItemIndexByCharacterKey({
|
|
2389
|
+
keysSoFar: inputValue,
|
|
2390
|
+
highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
|
|
2391
|
+
items: props.items,
|
|
2392
|
+
itemToString: props.itemToString,
|
|
2393
|
+
getItemNodeFromIndex: action.getItemNodeFromIndex
|
|
2394
|
+
});
|
|
2389
2395
|
changes = _extends__default['default']({
|
|
2390
2396
|
inputValue: inputValue
|
|
2391
2397
|
}, itemIndex >= 0 && {
|
|
@@ -2450,7 +2456,13 @@ function downshiftSelectReducer(state, action) {
|
|
|
2450
2456
|
|
|
2451
2457
|
var _inputValue = "" + state.inputValue + _lowercasedKey;
|
|
2452
2458
|
|
|
2453
|
-
var highlightedIndex = getItemIndexByCharacterKey(
|
|
2459
|
+
var highlightedIndex = getItemIndexByCharacterKey({
|
|
2460
|
+
keysSoFar: _inputValue,
|
|
2461
|
+
highlightedIndex: state.highlightedIndex,
|
|
2462
|
+
items: props.items,
|
|
2463
|
+
itemToString: props.itemToString,
|
|
2464
|
+
getItemNodeFromIndex: action.getItemNodeFromIndex
|
|
2465
|
+
});
|
|
2454
2466
|
changes = _extends__default['default']({
|
|
2455
2467
|
inputValue: _inputValue
|
|
2456
2468
|
}, highlightedIndex >= 0 && {
|
|
@@ -2485,6 +2497,9 @@ function downshiftSelectReducer(state, action) {
|
|
|
2485
2497
|
}
|
|
2486
2498
|
/* eslint-enable complexity */
|
|
2487
2499
|
|
|
2500
|
+
var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
|
|
2501
|
+
_excluded2$2 = ["onClick", "onKeyDown", "refKey", "ref"],
|
|
2502
|
+
_excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref"];
|
|
2488
2503
|
useSelect.stateChangeTypes = stateChangeTypes$2;
|
|
2489
2504
|
|
|
2490
2505
|
function useSelect(userProps) {
|
|
@@ -2775,7 +2790,7 @@ function useSelect(userProps) {
|
|
|
2775
2790
|
onKeyDown = _ref.onKeyDown,
|
|
2776
2791
|
onBlur = _ref.onBlur,
|
|
2777
2792
|
ref = _ref.ref,
|
|
2778
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref,
|
|
2793
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$2);
|
|
2779
2794
|
|
|
2780
2795
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
2781
2796
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
@@ -2840,7 +2855,7 @@ function useSelect(userProps) {
|
|
|
2840
2855
|
_ref3$refKey = _ref3.refKey,
|
|
2841
2856
|
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
|
|
2842
2857
|
ref = _ref3.ref,
|
|
2843
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
2858
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$2);
|
|
2844
2859
|
|
|
2845
2860
|
var _ref4 = _temp4 === void 0 ? {} : _temp4,
|
|
2846
2861
|
_ref4$suppressRefErro = _ref4.suppressRefError,
|
|
@@ -2889,7 +2904,7 @@ function useSelect(userProps) {
|
|
|
2889
2904
|
_ref5$refKey = _ref5.refKey,
|
|
2890
2905
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
2891
2906
|
ref = _ref5.ref,
|
|
2892
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref5,
|
|
2907
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3$1);
|
|
2893
2908
|
|
|
2894
2909
|
var _latest$current = latest.current,
|
|
2895
2910
|
latestState = _latest$current.state,
|
|
@@ -3225,6 +3240,11 @@ function downshiftUseComboboxReducer(state, action) {
|
|
|
3225
3240
|
}
|
|
3226
3241
|
/* eslint-enable complexity */
|
|
3227
3242
|
|
|
3243
|
+
var _excluded$1 = ["onMouseLeave", "refKey", "ref"],
|
|
3244
|
+
_excluded2$1 = ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"],
|
|
3245
|
+
_excluded3 = ["onClick", "onPress", "refKey", "ref"],
|
|
3246
|
+
_excluded4 = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"],
|
|
3247
|
+
_excluded5 = ["refKey", "ref"];
|
|
3228
3248
|
useCombobox.stateChangeTypes = stateChangeTypes$1;
|
|
3229
3249
|
|
|
3230
3250
|
function useCombobox(userProps) {
|
|
@@ -3395,8 +3415,8 @@ function useCombobox(userProps) {
|
|
|
3395
3415
|
|
|
3396
3416
|
if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
|
|
3397
3417
|
) {
|
|
3398
|
-
|
|
3399
|
-
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3400
3420
|
|
|
3401
3421
|
event.preventDefault();
|
|
3402
3422
|
dispatch({
|
|
@@ -3421,7 +3441,7 @@ function useCombobox(userProps) {
|
|
|
3421
3441
|
_ref$refKey = _ref.refKey,
|
|
3422
3442
|
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
|
|
3423
3443
|
ref = _ref.ref,
|
|
3424
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref,
|
|
3444
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$1);
|
|
3425
3445
|
|
|
3426
3446
|
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
3427
3447
|
_ref2$suppressRefErro = _ref2.suppressRefError,
|
|
@@ -3448,7 +3468,7 @@ function useCombobox(userProps) {
|
|
|
3448
3468
|
onMouseMove = _ref3.onMouseMove,
|
|
3449
3469
|
onClick = _ref3.onClick;
|
|
3450
3470
|
_ref3.onPress;
|
|
3451
|
-
var rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
3471
|
+
var rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$1);
|
|
3452
3472
|
|
|
3453
3473
|
var _latest$current = latest.current,
|
|
3454
3474
|
latestProps = _latest$current.props,
|
|
@@ -3502,7 +3522,7 @@ function useCombobox(userProps) {
|
|
|
3502
3522
|
var _ref5$refKey = _ref5.refKey,
|
|
3503
3523
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
3504
3524
|
ref = _ref5.ref,
|
|
3505
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref5,
|
|
3525
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3);
|
|
3506
3526
|
|
|
3507
3527
|
var toggleButtonHandleClick = function toggleButtonHandleClick() {
|
|
3508
3528
|
dispatch({
|
|
@@ -3532,7 +3552,7 @@ function useCombobox(userProps) {
|
|
|
3532
3552
|
var _ref6$refKey = _ref6.refKey,
|
|
3533
3553
|
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
|
|
3534
3554
|
ref = _ref6.ref,
|
|
3535
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref6,
|
|
3555
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref6, _excluded4);
|
|
3536
3556
|
|
|
3537
3557
|
var _ref7 = _temp6 === void 0 ? {} : _temp6,
|
|
3538
3558
|
_ref7$suppressRefErro = _ref7.suppressRefError,
|
|
@@ -3596,7 +3616,7 @@ function useCombobox(userProps) {
|
|
|
3596
3616
|
_ref8$refKey = _ref8.refKey,
|
|
3597
3617
|
refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
|
|
3598
3618
|
ref = _ref8.ref,
|
|
3599
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref8,
|
|
3619
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref8, _excluded5);
|
|
3600
3620
|
|
|
3601
3621
|
var _ref9 = _temp8 === void 0 ? {} : _temp8,
|
|
3602
3622
|
_ref9$suppressRefErro = _ref9.suppressRefError,
|
|
@@ -3736,9 +3756,7 @@ function isKeyDownOperationPermitted(event) {
|
|
|
3736
3756
|
var element = event.target;
|
|
3737
3757
|
|
|
3738
3758
|
if (element instanceof HTMLInputElement && // if element is a text input
|
|
3739
|
-
element.value !== '' && (
|
|
3740
|
-
// and cursor is either not at the start or is currently highlighting text.
|
|
3741
|
-
element.selectionStart !== 0 || element.selectionEnd !== 0)) {
|
|
3759
|
+
element.value !== '' && (element.selectionStart !== 0 || element.selectionEnd !== 0)) {
|
|
3742
3760
|
return false;
|
|
3743
3761
|
}
|
|
3744
3762
|
|
|
@@ -3955,6 +3973,8 @@ function downshiftMultipleSelectionReducer(state, action) {
|
|
|
3955
3973
|
return _extends__default['default']({}, state, changes);
|
|
3956
3974
|
}
|
|
3957
3975
|
|
|
3976
|
+
var _excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
|
|
3977
|
+
_excluded2 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"];
|
|
3958
3978
|
useMultipleSelection.stateChangeTypes = stateChangeTypes;
|
|
3959
3979
|
|
|
3960
3980
|
function useMultipleSelection(userProps) {
|
|
@@ -4084,7 +4104,7 @@ function useMultipleSelection(userProps) {
|
|
|
4084
4104
|
onKeyDown = _ref3.onKeyDown,
|
|
4085
4105
|
selectedItem = _ref3.selectedItem,
|
|
4086
4106
|
index = _ref3.index,
|
|
4087
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref3,
|
|
4107
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded);
|
|
4088
4108
|
|
|
4089
4109
|
var latestState = latest.current.state;
|
|
4090
4110
|
var itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
|
|
@@ -4125,7 +4145,7 @@ function useMultipleSelection(userProps) {
|
|
|
4125
4145
|
onClick = _ref4.onClick,
|
|
4126
4146
|
_ref4$preventKeyActio = _ref4.preventKeyAction,
|
|
4127
4147
|
preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
|
|
4128
|
-
rest = _objectWithoutPropertiesLoose__default['default'](_ref4,
|
|
4148
|
+
rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded2);
|
|
4129
4149
|
|
|
4130
4150
|
var _ref5 = _temp3 === void 0 ? {} : _temp3,
|
|
4131
4151
|
_ref5$suppressRefErro = _ref5.suppressRefError,
|
|
@@ -4199,7 +4219,7 @@ function useMultipleSelection(userProps) {
|
|
|
4199
4219
|
};
|
|
4200
4220
|
}
|
|
4201
4221
|
|
|
4202
|
-
exports
|
|
4222
|
+
exports['default'] = Downshift$1;
|
|
4203
4223
|
exports.resetIdCounter = resetIdCounter;
|
|
4204
4224
|
exports.useCombobox = useCombobox;
|
|
4205
4225
|
exports.useMultipleSelection = useMultipleSelection;
|