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 CHANGED
@@ -10,7 +10,7 @@ autocomplete, combobox or select dropdown components.</p>
10
10
  > [Read the docs](https://downshift-js.com) |
11
11
  > [See the intro blog post](https://kentcdodds.com/blog/introducing-downshift-for-react)
12
12
  > |
13
- > [Listen to the Episode 79 of the Full Stack Radio podcast](https://simplecast.com/s/f2e65eaf)
13
+ > [Listen to the Episode 79 of the Full Stack Radio podcast](https://fullstackradio.com/79)
14
14
 
15
15
  <hr />
16
16
 
@@ -32,7 +32,7 @@ autocomplete, combobox or select dropdown components.</p>
32
32
 
33
33
  You need an autocomplete, a combobox or a select experience in your application
34
34
  and you want it to be accessible. You also want it to be simple and flexible to
35
- account for your use cases. Finally, it should follow the ARIA design pattern
35
+ account for your use cases. Finally, it should follow the [ARIA][aria] design pattern
36
36
  for a [combobox][combobox-aria] or a [select][select-aria], depending on your
37
37
  use case.
38
38
 
@@ -1403,6 +1403,8 @@ Thanks goes to these people ([emoji key][emojis]):
1403
1403
  <td align="center"><a href="https://github.com/fcrezza"><img src="https://avatars2.githubusercontent.com/u/48123020?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Anang Fachreza</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=fcrezza" title="Documentation">📖</a> <a href="#example-fcrezza" title="Examples">💡</a></td>
1404
1404
  <td align="center"><a href="http://nickdeom.com"><img src="https://avatars2.githubusercontent.com/u/56491159?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nick Deom</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=ndeom" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/issues?q=author%3Andeom" title="Bug reports">🐛</a></td>
1405
1405
  <td align="center"><a href="https://github.com/clementgarbay"><img src="https://avatars3.githubusercontent.com/u/12433625?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Clément Garbay</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=clementgarbay" title="Code">💻</a></td>
1406
+ <td align="center"><a href="https://github.com/KaiminHuang"><img src="https://avatars.githubusercontent.com/u/5600404?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaimin Huang</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=KaiminHuang" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/issues?q=author%3AKaiminHuang" title="Bug reports">🐛</a></td>
1407
+ <td align="center"><a href="http://theredcircuit.com"><img src="https://avatars.githubusercontent.com/u/1242456?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Welling</b></sub></a><br /><a href="https://github.com/downshift-js/downshift/commits?author=davewelling" title="Code">💻</a> <a href="https://github.com/downshift-js/downshift/issues?q=author%3Adavewelling" title="Bug reports">🐛</a></td>
1406
1408
  </tr>
1407
1409
  </table>
1408
1410
 
@@ -1480,6 +1482,8 @@ MIT
1480
1482
  [multiple-selection-readme]:
1481
1483
  https://github.com/downshift-js/downshift/tree/master/src/hooks/useMultipleSelection
1482
1484
  [bundle-phobia-link]: https://bundlephobia.com/result?p=downshift@3.4.8
1485
+ [aria]:
1486
+ https://www.w3.org/TR/wai-aria-practices/
1483
1487
  [combobox-aria]:
1484
1488
  https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
1485
1489
  [select-aria]:
@@ -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 specift if there are results in the list, and if so, how many,
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, ["refKey", "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
  var onKeyDown = _ref3.onKeyDown,
926
935
  onKeyUp = _ref3.onKeyUp,
927
936
  onBlur = _ref3.onBlur,
928
- rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"]);
937
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$3);
929
938
 
930
939
  var _this$getState5 = _this.getState(),
931
940
  isOpen = _this$getState5.isOpen;
@@ -993,10 +1002,10 @@ var Downshift = /*#__PURE__*/function () {
993
1002
  _this.internalSetTimeout(function () {
994
1003
  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)
995
1004
  ) {
996
- _this.reset({
997
- type: blurButton
998
- });
999
- }
1005
+ _this.reset({
1006
+ type: blurButton
1007
+ });
1008
+ }
1000
1009
  });
1001
1010
  };
1002
1011
 
@@ -1014,7 +1023,7 @@ var Downshift = /*#__PURE__*/function () {
1014
1023
  onChange = _ref4.onChange,
1015
1024
  onInput = _ref4.onInput;
1016
1025
  _ref4.onChangeText;
1017
- var rest = _objectWithoutPropertiesLoose__default['default'](_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
1026
+ var rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded3$2);
1018
1027
 
1019
1028
  var onChangeKey;
1020
1029
  var eventHandlers = {};
@@ -1089,7 +1098,7 @@ var Downshift = /*#__PURE__*/function () {
1089
1098
  _ref5$refKey = _ref5.refKey,
1090
1099
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
1091
1100
  ref = _ref5.ref,
1092
- props = _objectWithoutPropertiesLoose__default['default'](_ref5, ["refKey", "ref"]);
1101
+ props = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded4$1);
1093
1102
 
1094
1103
  var _ref6 = _temp6 === void 0 ? {} : _temp6,
1095
1104
  _ref6$suppressRefErro = _ref6.suppressRefError,
@@ -1114,7 +1123,7 @@ var Downshift = /*#__PURE__*/function () {
1114
1123
  item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ?
1115
1124
  /* istanbul ignore next */
1116
1125
  undefined : requiredProp('getItemProps', 'item') : _ref7$item,
1117
- rest = _objectWithoutPropertiesLoose__default['default'](_ref7, ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"]);
1126
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref7, _excluded5$1);
1118
1127
 
1119
1128
  if (index === undefined) {
1120
1129
  _this.items.push(item);
@@ -1622,9 +1631,9 @@ var Downshift = /*#__PURE__*/function () {
1622
1631
  selectedItemChanged: function selectedItemChanged(prevItem, item) {
1623
1632
  return prevItem !== item;
1624
1633
  },
1625
- environment: typeof window === 'undefined'
1634
+ environment:
1626
1635
  /* istanbul ignore next (ssr) */
1627
- ? {} : window,
1636
+ typeof window === 'undefined' ? {} : window,
1628
1637
  stateReducer: function stateReducer(state, stateToSet) {
1629
1638
  return stateToSet;
1630
1639
  },
@@ -1681,6 +1690,7 @@ process.env.NODE_ENV !== "production" ? Downshift.propTypes = {
1681
1690
  /* eslint-enable react/no-unused-prop-types */
1682
1691
 
1683
1692
  } : void 0;
1693
+ var Downshift$1 = Downshift;
1684
1694
 
1685
1695
  function validateGetMenuPropsCalledCorrectly(node, _ref12) {
1686
1696
  var refKey = _ref12.refKey;
@@ -1710,6 +1720,7 @@ function validateGetRootPropsCalledCorrectly(element, _ref13) {
1710
1720
  }
1711
1721
  }
1712
1722
 
1723
+ var _excluded$3 = ["isInitialMount", "highlightedIndex", "items", "environment"];
1713
1724
  var dropdownDefaultStateValues = {
1714
1725
  highlightedIndex: -1,
1715
1726
  isOpen: false,
@@ -1907,9 +1918,9 @@ var defaultProps$3 = {
1907
1918
  getA11ySelectionMessage: getA11ySelectionMessage,
1908
1919
  scrollIntoView: scrollIntoView,
1909
1920
  circularNavigation: false,
1910
- environment: typeof window === 'undefined'
1921
+ environment:
1911
1922
  /* istanbul ignore next (ssr) */
1912
- ? {} : window
1923
+ typeof window === 'undefined' ? {} : window
1913
1924
  };
1914
1925
 
1915
1926
  function getDefaultValue$1(props, propKey, defaultStateValues) {
@@ -2123,11 +2134,11 @@ function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
2123
2134
  highlightedIndex = _ref2.highlightedIndex,
2124
2135
  items = _ref2.items,
2125
2136
  environment = _ref2.environment,
2126
- rest = _objectWithoutPropertiesLoose__default['default'](_ref2, ["isInitialMount", "highlightedIndex", "items", "environment"]);
2137
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref2, _excluded$3);
2127
2138
 
2128
2139
  // Sets a11y status message on changes in state.
2129
2140
  react.useEffect(function () {
2130
- if (isInitialMount) {
2141
+ if (isInitialMount || false) {
2131
2142
  return;
2132
2143
  }
2133
2144
 
@@ -2258,58 +2269,58 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
2258
2269
  }
2259
2270
  /* eslint-enable complexity */
2260
2271
 
2261
- function getItemIndexByCharacterKey(keysSoFar, highlightedIndex, items, itemToString, getItemNodeFromIndex) {
2262
- var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
2263
-
2264
- for (var index = 0; index < items.length; index++) {
2265
- var offsetIndex = (index + highlightedIndex + 1) % items.length;
2266
-
2267
- if (itemToString(items[offsetIndex]).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
2268
- var element = getItemNodeFromIndex(offsetIndex);
2269
-
2270
- if (!(element && element.hasAttribute('disabled'))) {
2271
- return offsetIndex;
2272
- }
2272
+ function getItemIndexByCharacterKey(_a) {
2273
+ var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
2274
+ var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
2275
+ for (var index = 0; index < items.length; index++) {
2276
+ var offsetIndex = (index + highlightedIndex + 1) % items.length;
2277
+ var item = items[offsetIndex];
2278
+ if (item !== undefined &&
2279
+ itemToString(item)
2280
+ .toLowerCase()
2281
+ .startsWith(lowerCasedKeysSoFar)) {
2282
+ var element = getItemNodeFromIndex(offsetIndex);
2283
+ if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
2284
+ return offsetIndex;
2285
+ }
2286
+ }
2273
2287
  }
2274
- }
2275
-
2276
- return highlightedIndex;
2288
+ return highlightedIndex;
2277
2289
  }
2278
-
2279
2290
  var propTypes$2 = {
2280
- items: PropTypes__default['default'].array.isRequired,
2281
- itemToString: PropTypes__default['default'].func,
2282
- getA11yStatusMessage: PropTypes__default['default'].func,
2283
- getA11ySelectionMessage: PropTypes__default['default'].func,
2284
- circularNavigation: PropTypes__default['default'].bool,
2285
- highlightedIndex: PropTypes__default['default'].number,
2286
- defaultHighlightedIndex: PropTypes__default['default'].number,
2287
- initialHighlightedIndex: PropTypes__default['default'].number,
2288
- isOpen: PropTypes__default['default'].bool,
2289
- defaultIsOpen: PropTypes__default['default'].bool,
2290
- initialIsOpen: PropTypes__default['default'].bool,
2291
- selectedItem: PropTypes__default['default'].any,
2292
- initialSelectedItem: PropTypes__default['default'].any,
2293
- defaultSelectedItem: PropTypes__default['default'].any,
2294
- id: PropTypes__default['default'].string,
2295
- labelId: PropTypes__default['default'].string,
2296
- menuId: PropTypes__default['default'].string,
2297
- getItemId: PropTypes__default['default'].func,
2298
- toggleButtonId: PropTypes__default['default'].string,
2299
- stateReducer: PropTypes__default['default'].func,
2300
- onSelectedItemChange: PropTypes__default['default'].func,
2301
- onHighlightedIndexChange: PropTypes__default['default'].func,
2302
- onStateChange: PropTypes__default['default'].func,
2303
- onIsOpenChange: PropTypes__default['default'].func,
2304
- environment: PropTypes__default['default'].shape({
2305
- addEventListener: PropTypes__default['default'].func,
2306
- removeEventListener: PropTypes__default['default'].func,
2307
- document: PropTypes__default['default'].shape({
2308
- getElementById: PropTypes__default['default'].func,
2309
- activeElement: PropTypes__default['default'].any,
2310
- body: PropTypes__default['default'].any
2291
+ items: PropTypes__default['default'].array.isRequired,
2292
+ itemToString: PropTypes__default['default'].func,
2293
+ getA11yStatusMessage: PropTypes__default['default'].func,
2294
+ getA11ySelectionMessage: PropTypes__default['default'].func,
2295
+ circularNavigation: PropTypes__default['default'].bool,
2296
+ highlightedIndex: PropTypes__default['default'].number,
2297
+ defaultHighlightedIndex: PropTypes__default['default'].number,
2298
+ initialHighlightedIndex: PropTypes__default['default'].number,
2299
+ isOpen: PropTypes__default['default'].bool,
2300
+ defaultIsOpen: PropTypes__default['default'].bool,
2301
+ initialIsOpen: PropTypes__default['default'].bool,
2302
+ selectedItem: PropTypes__default['default'].any,
2303
+ initialSelectedItem: PropTypes__default['default'].any,
2304
+ defaultSelectedItem: PropTypes__default['default'].any,
2305
+ id: PropTypes__default['default'].string,
2306
+ labelId: PropTypes__default['default'].string,
2307
+ menuId: PropTypes__default['default'].string,
2308
+ getItemId: PropTypes__default['default'].func,
2309
+ toggleButtonId: PropTypes__default['default'].string,
2310
+ stateReducer: PropTypes__default['default'].func,
2311
+ onSelectedItemChange: PropTypes__default['default'].func,
2312
+ onHighlightedIndexChange: PropTypes__default['default'].func,
2313
+ onStateChange: PropTypes__default['default'].func,
2314
+ onIsOpenChange: PropTypes__default['default'].func,
2315
+ environment: PropTypes__default['default'].shape({
2316
+ addEventListener: PropTypes__default['default'].func,
2317
+ removeEventListener: PropTypes__default['default'].func,
2318
+ document: PropTypes__default['default'].shape({
2319
+ getElementById: PropTypes__default['default'].func,
2320
+ activeElement: PropTypes__default['default'].any,
2321
+ body: PropTypes__default['default'].any
2322
+ })
2311
2323
  })
2312
- })
2313
2324
  };
2314
2325
  /**
2315
2326
  * Default implementation for status message. Only added when menu is open.
@@ -2319,39 +2330,27 @@ var propTypes$2 = {
2319
2330
  * @param {Object} param the downshift state and other relevant properties
2320
2331
  * @return {String} the a11y status message
2321
2332
  */
2322
-
2323
- function getA11yStatusMessage(_ref) {
2324
- var isOpen = _ref.isOpen,
2325
- resultCount = _ref.resultCount,
2326
- previousResultCount = _ref.previousResultCount;
2327
-
2328
- if (!isOpen) {
2333
+ function getA11yStatusMessage(_a) {
2334
+ var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;
2335
+ if (!isOpen) {
2336
+ return '';
2337
+ }
2338
+ if (!resultCount) {
2339
+ return 'No results are available.';
2340
+ }
2341
+ if (resultCount !== previousResultCount) {
2342
+ 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.";
2343
+ }
2329
2344
  return '';
2330
- }
2331
-
2332
- if (!resultCount) {
2333
- return 'No results are available.';
2334
- }
2335
-
2336
- if (resultCount !== previousResultCount) {
2337
- 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.";
2338
- }
2339
-
2340
- return '';
2341
2345
  }
2342
-
2343
- var defaultProps$2 = _extends__default['default']({}, defaultProps$3, {
2344
- getA11yStatusMessage: getA11yStatusMessage
2345
- }); // eslint-disable-next-line import/no-mutable-exports
2346
-
2347
-
2346
+ var defaultProps$2 = tslib.__assign(tslib.__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });
2347
+ // eslint-disable-next-line import/no-mutable-exports
2348
2348
  var validatePropTypes$2 = noop;
2349
2349
  /* istanbul ignore next */
2350
-
2351
2350
  if (process.env.NODE_ENV !== 'production') {
2352
- validatePropTypes$2 = function validatePropTypes(options, caller) {
2353
- PropTypes__default['default'].checkPropTypes(propTypes$2, options, 'prop', caller.name);
2354
- };
2351
+ validatePropTypes$2 = function (options, caller) {
2352
+ PropTypes__default['default'].checkPropTypes(propTypes$2, options, 'prop', caller.name);
2353
+ };
2355
2354
  }
2356
2355
 
2357
2356
  var MenuKeyDownArrowDown = process.env.NODE_ENV !== "production" ? '__menu_keydown_arrow_down__' : 0;
@@ -2426,7 +2425,13 @@ function downshiftSelectReducer(state, action) {
2426
2425
  {
2427
2426
  var lowercasedKey = action.key;
2428
2427
  var inputValue = "" + state.inputValue + lowercasedKey;
2429
- var itemIndex = getItemIndexByCharacterKey(inputValue, state.selectedItem ? props.items.indexOf(state.selectedItem) : -1, props.items, props.itemToString, action.getItemNodeFromIndex);
2428
+ var itemIndex = getItemIndexByCharacterKey({
2429
+ keysSoFar: inputValue,
2430
+ highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
2431
+ items: props.items,
2432
+ itemToString: props.itemToString,
2433
+ getItemNodeFromIndex: action.getItemNodeFromIndex
2434
+ });
2430
2435
  changes = _extends__default['default']({
2431
2436
  inputValue: inputValue
2432
2437
  }, itemIndex >= 0 && {
@@ -2491,7 +2496,13 @@ function downshiftSelectReducer(state, action) {
2491
2496
 
2492
2497
  var _inputValue = "" + state.inputValue + _lowercasedKey;
2493
2498
 
2494
- var highlightedIndex = getItemIndexByCharacterKey(_inputValue, state.highlightedIndex, props.items, props.itemToString, action.getItemNodeFromIndex);
2499
+ var highlightedIndex = getItemIndexByCharacterKey({
2500
+ keysSoFar: _inputValue,
2501
+ highlightedIndex: state.highlightedIndex,
2502
+ items: props.items,
2503
+ itemToString: props.itemToString,
2504
+ getItemNodeFromIndex: action.getItemNodeFromIndex
2505
+ });
2495
2506
  changes = _extends__default['default']({
2496
2507
  inputValue: _inputValue
2497
2508
  }, highlightedIndex >= 0 && {
@@ -2526,6 +2537,9 @@ function downshiftSelectReducer(state, action) {
2526
2537
  }
2527
2538
  /* eslint-enable complexity */
2528
2539
 
2540
+ var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
2541
+ _excluded2$2 = ["onClick", "onKeyDown", "refKey", "ref"],
2542
+ _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref"];
2529
2543
  useSelect.stateChangeTypes = stateChangeTypes$2;
2530
2544
 
2531
2545
  function useSelect(userProps) {
@@ -2816,7 +2830,7 @@ function useSelect(userProps) {
2816
2830
  onKeyDown = _ref.onKeyDown,
2817
2831
  onBlur = _ref.onBlur,
2818
2832
  ref = _ref.ref,
2819
- rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"]);
2833
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$2);
2820
2834
 
2821
2835
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
2822
2836
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -2881,7 +2895,7 @@ function useSelect(userProps) {
2881
2895
  _ref3$refKey = _ref3.refKey,
2882
2896
  refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2883
2897
  ref = _ref3.ref,
2884
- rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["onClick", "onKeyDown", "refKey", "ref"]);
2898
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$2);
2885
2899
 
2886
2900
  var _ref4 = _temp4 === void 0 ? {} : _temp4,
2887
2901
  _ref4$suppressRefErro = _ref4.suppressRefError,
@@ -2930,7 +2944,7 @@ function useSelect(userProps) {
2930
2944
  _ref5$refKey = _ref5.refKey,
2931
2945
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
2932
2946
  ref = _ref5.ref,
2933
- rest = _objectWithoutPropertiesLoose__default['default'](_ref5, ["item", "index", "onMouseMove", "onClick", "refKey", "ref"]);
2947
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3$1);
2934
2948
 
2935
2949
  var _latest$current = latest.current,
2936
2950
  latestState = _latest$current.state,
@@ -3266,6 +3280,11 @@ function downshiftUseComboboxReducer(state, action) {
3266
3280
  }
3267
3281
  /* eslint-enable complexity */
3268
3282
 
3283
+ var _excluded$1 = ["onMouseLeave", "refKey", "ref"],
3284
+ _excluded2$1 = ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"],
3285
+ _excluded3 = ["onClick", "onPress", "refKey", "ref"],
3286
+ _excluded4 = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"],
3287
+ _excluded5 = ["refKey", "ref"];
3269
3288
  useCombobox.stateChangeTypes = stateChangeTypes$1;
3270
3289
 
3271
3290
  function useCombobox(userProps) {
@@ -3436,8 +3455,8 @@ function useCombobox(userProps) {
3436
3455
 
3437
3456
  if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
3438
3457
  ) {
3439
- return;
3440
- }
3458
+ return;
3459
+ }
3441
3460
 
3442
3461
  event.preventDefault();
3443
3462
  dispatch({
@@ -3462,7 +3481,7 @@ function useCombobox(userProps) {
3462
3481
  _ref$refKey = _ref.refKey,
3463
3482
  refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
3464
3483
  ref = _ref.ref,
3465
- rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["onMouseLeave", "refKey", "ref"]);
3484
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$1);
3466
3485
 
3467
3486
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
3468
3487
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -3489,7 +3508,7 @@ function useCombobox(userProps) {
3489
3508
  onMouseMove = _ref3.onMouseMove,
3490
3509
  onClick = _ref3.onClick;
3491
3510
  _ref3.onPress;
3492
- var rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
3511
+ var rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$1);
3493
3512
 
3494
3513
  var _latest$current = latest.current,
3495
3514
  latestProps = _latest$current.props,
@@ -3543,7 +3562,7 @@ function useCombobox(userProps) {
3543
3562
  var _ref5$refKey = _ref5.refKey,
3544
3563
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
3545
3564
  ref = _ref5.ref,
3546
- rest = _objectWithoutPropertiesLoose__default['default'](_ref5, ["onClick", "onPress", "refKey", "ref"]);
3565
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3);
3547
3566
 
3548
3567
  var toggleButtonHandleClick = function toggleButtonHandleClick() {
3549
3568
  dispatch({
@@ -3573,7 +3592,7 @@ function useCombobox(userProps) {
3573
3592
  var _ref6$refKey = _ref6.refKey,
3574
3593
  refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
3575
3594
  ref = _ref6.ref,
3576
- rest = _objectWithoutPropertiesLoose__default['default'](_ref6, ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"]);
3595
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref6, _excluded4);
3577
3596
 
3578
3597
  var _ref7 = _temp6 === void 0 ? {} : _temp6,
3579
3598
  _ref7$suppressRefErro = _ref7.suppressRefError,
@@ -3637,7 +3656,7 @@ function useCombobox(userProps) {
3637
3656
  _ref8$refKey = _ref8.refKey,
3638
3657
  refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
3639
3658
  ref = _ref8.ref,
3640
- rest = _objectWithoutPropertiesLoose__default['default'](_ref8, ["refKey", "ref"]);
3659
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref8, _excluded5);
3641
3660
 
3642
3661
  var _ref9 = _temp8 === void 0 ? {} : _temp8,
3643
3662
  _ref9$suppressRefErro = _ref9.suppressRefError,
@@ -3777,9 +3796,7 @@ function isKeyDownOperationPermitted(event) {
3777
3796
  var element = event.target;
3778
3797
 
3779
3798
  if (element instanceof HTMLInputElement && // if element is a text input
3780
- element.value !== '' && ( // and we have text in it
3781
- // and cursor is either not at the start or is currently highlighting text.
3782
- element.selectionStart !== 0 || element.selectionEnd !== 0)) {
3799
+ element.value !== '' && (element.selectionStart !== 0 || element.selectionEnd !== 0)) {
3783
3800
  return false;
3784
3801
  }
3785
3802
 
@@ -3996,6 +4013,8 @@ function downshiftMultipleSelectionReducer(state, action) {
3996
4013
  return _extends__default['default']({}, state, changes);
3997
4014
  }
3998
4015
 
4016
+ var _excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
4017
+ _excluded2 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"];
3999
4018
  useMultipleSelection.stateChangeTypes = stateChangeTypes;
4000
4019
 
4001
4020
  function useMultipleSelection(userProps) {
@@ -4125,7 +4144,7 @@ function useMultipleSelection(userProps) {
4125
4144
  onKeyDown = _ref3.onKeyDown,
4126
4145
  selectedItem = _ref3.selectedItem,
4127
4146
  index = _ref3.index,
4128
- rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"]);
4147
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded);
4129
4148
 
4130
4149
  var latestState = latest.current.state;
4131
4150
  var itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
@@ -4166,7 +4185,7 @@ function useMultipleSelection(userProps) {
4166
4185
  onClick = _ref4.onClick,
4167
4186
  _ref4$preventKeyActio = _ref4.preventKeyAction,
4168
4187
  preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
4169
- rest = _objectWithoutPropertiesLoose__default['default'](_ref4, ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"]);
4188
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded2);
4170
4189
 
4171
4190
  var _ref5 = _temp3 === void 0 ? {} : _temp3,
4172
4191
  _ref5$suppressRefErro = _ref5.suppressRefError,
@@ -4240,7 +4259,7 @@ function useMultipleSelection(userProps) {
4240
4259
  };
4241
4260
  }
4242
4261
 
4243
- exports.default = Downshift;
4262
+ exports['default'] = Downshift$1;
4244
4263
  exports.resetIdCounter = resetIdCounter;
4245
4264
  exports.useCombobox = useCombobox;
4246
4265
  exports.useMultipleSelection = useMultipleSelection;