downshift 6.1.2-alpha.0 → 6.1.4

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.
Files changed (36) hide show
  1. package/README.md +4 -1
  2. package/dist/downshift.cjs.js +139 -118
  3. package/dist/downshift.esm.js +140 -120
  4. package/dist/downshift.native.cjs.js +137 -116
  5. package/dist/downshift.umd.js +786 -936
  6. package/dist/downshift.umd.js.map +1 -1
  7. package/dist/downshift.umd.min.js +2 -28
  8. package/dist/downshift.umd.min.js.map +1 -1
  9. package/dist/src/hooks/reducer.d.ts +1 -0
  10. package/dist/src/hooks/useSelect/__tests__/utils.test.d.ts +1 -0
  11. package/dist/src/hooks/useSelect/reducer.d.ts +1 -0
  12. package/dist/src/hooks/useSelect/stateChangeTypes.d.ts +23 -0
  13. package/dist/src/hooks/useSelect/types.d.ts +7 -0
  14. package/dist/src/hooks/useSelect/utils.d.ts +23 -0
  15. package/dist/src/hooks/utils.d.ts +112 -0
  16. package/dist/src/is.macro.d.ts +2 -0
  17. package/dist/src/productionEnum.macro.d.ts +2 -0
  18. package/dist/src/set-a11y-status.d.ts +6 -0
  19. package/dist/src/types.d.ts +10 -0
  20. package/dist/src/utils.d.ts +156 -0
  21. package/dist/{basic.test.d.ts → test/basic.test.d.ts} +0 -0
  22. package/dist/{custom.test.d.ts → test/custom.test.d.ts} +0 -0
  23. package/dist/test/setup.d.ts +1 -0
  24. package/package.json +49 -36
  25. package/preact/dist/downshift.cjs.js +140 -118
  26. package/preact/dist/downshift.esm.js +141 -120
  27. package/preact/dist/downshift.umd.js +337 -437
  28. package/preact/dist/downshift.umd.js.map +1 -1
  29. package/preact/dist/downshift.umd.min.js +2 -11
  30. package/preact/dist/downshift.umd.min.js.map +1 -1
  31. package/typings/index.d.ts +4 -13
  32. package/dist/downshift.cjs.d.ts +0 -1
  33. package/dist/downshift.esm.d.ts +0 -1
  34. package/dist/downshift.native.cjs.d.ts +0 -1
  35. package/dist/downshift.umd.d.ts +0 -1
  36. package/dist/downshift.umd.min.d.ts +0 -1
@@ -63,12 +63,14 @@ function scrollIntoView(node, menuNode) {
63
63
  /**
64
64
  * @param {HTMLElement} parent the parent node
65
65
  * @param {HTMLElement} child the child node
66
+ * @param {Window} environment The window context where downshift renders.
66
67
  * @return {Boolean} whether the parent is the child or the child is in the parent
67
68
  */
68
69
 
69
70
 
70
71
  function isOrContainsNode(parent, child, environment) {
71
- return parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
72
+ var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
73
+ return result;
72
74
  }
73
75
  /**
74
76
  * Simple debounce implementation. Will call the given
@@ -422,7 +424,7 @@ function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFr
422
424
  *
423
425
  * @param {EventTarget} target Target to check.
424
426
  * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
425
- * @param {Environment} environment The environment.
427
+ * @param {Window} environment The window context where downshift renders.
426
428
  * @param {boolean} checkActiveElement Whether to also check activeElement.
427
429
  *
428
430
  * @returns {boolean} Whether or not the target is within downshift elements.
@@ -552,6 +554,12 @@ var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
552
554
  touchEnd: touchEnd
553
555
  });
554
556
 
557
+ var _excluded$4 = ["refKey", "ref"],
558
+ _excluded2$3 = ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"],
559
+ _excluded3$2 = ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"],
560
+ _excluded4$1 = ["refKey", "ref"],
561
+ _excluded5$1 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
562
+
555
563
  var Downshift = /*#__PURE__*/function () {
556
564
  var Downshift = /*#__PURE__*/function (_Component) {
557
565
  _inheritsLoose__default['default'](Downshift, _Component);
@@ -671,6 +679,8 @@ var Downshift = /*#__PURE__*/function () {
671
679
  isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
672
680
 
673
681
  var nextState = {}; // this is just used to tell whether the state changed
682
+
683
+ var nextFullState = {}; // we need to call on change if the outside world is controlling any of our state
674
684
  // and we're trying to update that state. OR if the selection has changed and we're
675
685
  // trying to update the selection
676
686
 
@@ -696,7 +706,7 @@ var Downshift = /*#__PURE__*/function () {
696
706
  return;
697
707
  }
698
708
 
699
- newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
709
+ nextFullState[key] = newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
700
710
 
701
711
  if (!isControlledProp(_this.props, key)) {
702
712
  nextState[key] = newStateToSet[key];
@@ -745,7 +755,7 @@ var Downshift = /*#__PURE__*/function () {
745
755
  _ref$refKey = _ref.refKey,
746
756
  refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
747
757
  ref = _ref.ref,
748
- rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["refKey", "ref"]);
758
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$4);
749
759
 
750
760
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
751
761
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -929,7 +939,7 @@ var Downshift = /*#__PURE__*/function () {
929
939
  var onKeyDown = _ref3.onKeyDown,
930
940
  onKeyUp = _ref3.onKeyUp,
931
941
  onBlur = _ref3.onBlur,
932
- rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"]);
942
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$3);
933
943
 
934
944
  var _this$getState5 = _this.getState(),
935
945
  isOpen = _this$getState5.isOpen;
@@ -997,10 +1007,10 @@ var Downshift = /*#__PURE__*/function () {
997
1007
  _this.internalSetTimeout(function () {
998
1008
  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)
999
1009
  ) {
1000
- _this.reset({
1001
- type: blurButton
1002
- });
1003
- }
1010
+ _this.reset({
1011
+ type: blurButton
1012
+ });
1013
+ }
1004
1014
  });
1005
1015
  };
1006
1016
 
@@ -1018,7 +1028,7 @@ var Downshift = /*#__PURE__*/function () {
1018
1028
  onChange = _ref4.onChange,
1019
1029
  onInput = _ref4.onInput;
1020
1030
  _ref4.onChangeText;
1021
- var rest = _objectWithoutPropertiesLoose__default['default'](_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
1031
+ var rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded3$2);
1022
1032
 
1023
1033
  var onChangeKey;
1024
1034
  var eventHandlers = {};
@@ -1093,7 +1103,7 @@ var Downshift = /*#__PURE__*/function () {
1093
1103
  _ref5$refKey = _ref5.refKey,
1094
1104
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
1095
1105
  ref = _ref5.ref,
1096
- props = _objectWithoutPropertiesLoose__default['default'](_ref5, ["refKey", "ref"]);
1106
+ props = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded4$1);
1097
1107
 
1098
1108
  var _ref6 = _temp6 === void 0 ? {} : _temp6,
1099
1109
  _ref6$suppressRefErro = _ref6.suppressRefError,
@@ -1118,7 +1128,7 @@ var Downshift = /*#__PURE__*/function () {
1118
1128
  item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ?
1119
1129
  /* istanbul ignore next */
1120
1130
  undefined : requiredProp('getItemProps', 'item') : _ref7$item,
1121
- rest = _objectWithoutPropertiesLoose__default['default'](_ref7, ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"]);
1131
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref7, _excluded5$1);
1122
1132
 
1123
1133
  if (index === undefined) {
1124
1134
  _this.items.push(item);
@@ -1444,7 +1454,7 @@ var Downshift = /*#__PURE__*/function () {
1444
1454
  _this7.isMouseDown = false; // if the target element or the activeElement is within a downshift node
1445
1455
  // then we don't want to reset downshift
1446
1456
 
1447
- var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment.document);
1457
+ var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment);
1448
1458
 
1449
1459
  if (!contextWithinDownshift && _this7.getState().isOpen) {
1450
1460
  _this7.reset({
@@ -1470,7 +1480,7 @@ var Downshift = /*#__PURE__*/function () {
1470
1480
  };
1471
1481
 
1472
1482
  var onTouchEnd = function onTouchEnd(event) {
1473
- var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment.document, false);
1483
+ var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment, false);
1474
1484
 
1475
1485
  if (!_this7.isTouchMove && !contextWithinDownshift && _this7.getState().isOpen) {
1476
1486
  _this7.reset({
@@ -1626,9 +1636,9 @@ var Downshift = /*#__PURE__*/function () {
1626
1636
  selectedItemChanged: function selectedItemChanged(prevItem, item) {
1627
1637
  return prevItem !== item;
1628
1638
  },
1629
- environment: typeof window === 'undefined'
1639
+ environment:
1630
1640
  /* istanbul ignore next (ssr) */
1631
- ? {} : window,
1641
+ typeof window === 'undefined' ? {} : window,
1632
1642
  stateReducer: function stateReducer(state, stateToSet) {
1633
1643
  return stateToSet;
1634
1644
  },
@@ -1639,6 +1649,8 @@ var Downshift = /*#__PURE__*/function () {
1639
1649
  return Downshift;
1640
1650
  }();
1641
1651
 
1652
+ var Downshift$1 = Downshift;
1653
+
1642
1654
  function validateGetMenuPropsCalledCorrectly(node, _ref12) {
1643
1655
  var refKey = _ref12.refKey;
1644
1656
 
@@ -1667,6 +1679,7 @@ function validateGetRootPropsCalledCorrectly(element, _ref13) {
1667
1679
  }
1668
1680
  }
1669
1681
 
1682
+ var _excluded$3 = ["isInitialMount", "highlightedIndex", "items", "environment"];
1670
1683
  var dropdownDefaultStateValues = {
1671
1684
  highlightedIndex: -1,
1672
1685
  isOpen: false,
@@ -1864,9 +1877,9 @@ var defaultProps$3 = {
1864
1877
  getA11ySelectionMessage: getA11ySelectionMessage,
1865
1878
  scrollIntoView: scrollIntoView,
1866
1879
  circularNavigation: false,
1867
- environment: typeof window === 'undefined'
1880
+ environment:
1868
1881
  /* istanbul ignore next (ssr) */
1869
- ? {} : window
1882
+ typeof window === 'undefined' ? {} : window
1870
1883
  };
1871
1884
 
1872
1885
  function getDefaultValue$1(props, propKey, defaultStateValues) {
@@ -1992,7 +2005,7 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
1992
2005
  var onTouchEnd = function onTouchEnd(event) {
1993
2006
  if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
1994
2007
  return ref.current;
1995
- }), environment.document, false)) {
2008
+ }), environment, false)) {
1996
2009
  handleBlur();
1997
2010
  }
1998
2011
  };
@@ -2080,11 +2093,11 @@ function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
2080
2093
  highlightedIndex = _ref2.highlightedIndex,
2081
2094
  items = _ref2.items,
2082
2095
  environment = _ref2.environment,
2083
- rest = _objectWithoutPropertiesLoose__default['default'](_ref2, ["isInitialMount", "highlightedIndex", "items", "environment"]);
2096
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref2, _excluded$3);
2084
2097
 
2085
2098
  // Sets a11y status message on changes in state.
2086
2099
  preact.useEffect(function () {
2087
- if (isInitialMount) {
2100
+ if (isInitialMount || false) {
2088
2101
  return;
2089
2102
  }
2090
2103
 
@@ -2215,58 +2228,57 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
2215
2228
  }
2216
2229
  /* eslint-enable complexity */
2217
2230
 
2218
- function getItemIndexByCharacterKey(keysSoFar, highlightedIndex, items, itemToString, getItemNodeFromIndex) {
2219
- var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
2220
-
2221
- for (var index = 0; index < items.length; index++) {
2222
- var offsetIndex = (index + highlightedIndex + 1) % items.length;
2223
-
2224
- if (itemToString(items[offsetIndex]).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
2225
- var element = getItemNodeFromIndex(offsetIndex);
2226
-
2227
- if (!(element && element.hasAttribute('disabled'))) {
2228
- return offsetIndex;
2229
- }
2231
+ function getItemIndexByCharacterKey({ keysSoFar, highlightedIndex, items, itemToString, getItemNodeFromIndex, }) {
2232
+ const lowerCasedKeysSoFar = keysSoFar.toLowerCase();
2233
+ for (let index = 0; index < items.length; index++) {
2234
+ const offsetIndex = (index + highlightedIndex + 1) % items.length;
2235
+ const item = items[offsetIndex];
2236
+ if (item !== undefined &&
2237
+ itemToString(item)
2238
+ .toLowerCase()
2239
+ .startsWith(lowerCasedKeysSoFar)) {
2240
+ const element = getItemNodeFromIndex(offsetIndex);
2241
+ if (!element?.hasAttribute('disabled')) {
2242
+ return offsetIndex;
2243
+ }
2244
+ }
2230
2245
  }
2231
- }
2232
-
2233
- return highlightedIndex;
2246
+ return highlightedIndex;
2234
2247
  }
2235
-
2236
- var propTypes$2 = {
2237
- items: PropTypes__default['default'].array.isRequired,
2238
- itemToString: PropTypes__default['default'].func,
2239
- getA11yStatusMessage: PropTypes__default['default'].func,
2240
- getA11ySelectionMessage: PropTypes__default['default'].func,
2241
- circularNavigation: PropTypes__default['default'].bool,
2242
- highlightedIndex: PropTypes__default['default'].number,
2243
- defaultHighlightedIndex: PropTypes__default['default'].number,
2244
- initialHighlightedIndex: PropTypes__default['default'].number,
2245
- isOpen: PropTypes__default['default'].bool,
2246
- defaultIsOpen: PropTypes__default['default'].bool,
2247
- initialIsOpen: PropTypes__default['default'].bool,
2248
- selectedItem: PropTypes__default['default'].any,
2249
- initialSelectedItem: PropTypes__default['default'].any,
2250
- defaultSelectedItem: PropTypes__default['default'].any,
2251
- id: PropTypes__default['default'].string,
2252
- labelId: PropTypes__default['default'].string,
2253
- menuId: PropTypes__default['default'].string,
2254
- getItemId: PropTypes__default['default'].func,
2255
- toggleButtonId: PropTypes__default['default'].string,
2256
- stateReducer: PropTypes__default['default'].func,
2257
- onSelectedItemChange: PropTypes__default['default'].func,
2258
- onHighlightedIndexChange: PropTypes__default['default'].func,
2259
- onStateChange: PropTypes__default['default'].func,
2260
- onIsOpenChange: PropTypes__default['default'].func,
2261
- environment: PropTypes__default['default'].shape({
2262
- addEventListener: PropTypes__default['default'].func,
2263
- removeEventListener: PropTypes__default['default'].func,
2264
- document: PropTypes__default['default'].shape({
2265
- getElementById: PropTypes__default['default'].func,
2266
- activeElement: PropTypes__default['default'].any,
2267
- body: PropTypes__default['default'].any
2268
- })
2269
- })
2248
+ const propTypes$2 = {
2249
+ items: PropTypes__default['default'].array.isRequired,
2250
+ itemToString: PropTypes__default['default'].func,
2251
+ getA11yStatusMessage: PropTypes__default['default'].func,
2252
+ getA11ySelectionMessage: PropTypes__default['default'].func,
2253
+ circularNavigation: PropTypes__default['default'].bool,
2254
+ highlightedIndex: PropTypes__default['default'].number,
2255
+ defaultHighlightedIndex: PropTypes__default['default'].number,
2256
+ initialHighlightedIndex: PropTypes__default['default'].number,
2257
+ isOpen: PropTypes__default['default'].bool,
2258
+ defaultIsOpen: PropTypes__default['default'].bool,
2259
+ initialIsOpen: PropTypes__default['default'].bool,
2260
+ selectedItem: PropTypes__default['default'].any,
2261
+ initialSelectedItem: PropTypes__default['default'].any,
2262
+ defaultSelectedItem: PropTypes__default['default'].any,
2263
+ id: PropTypes__default['default'].string,
2264
+ labelId: PropTypes__default['default'].string,
2265
+ menuId: PropTypes__default['default'].string,
2266
+ getItemId: PropTypes__default['default'].func,
2267
+ toggleButtonId: PropTypes__default['default'].string,
2268
+ stateReducer: PropTypes__default['default'].func,
2269
+ onSelectedItemChange: PropTypes__default['default'].func,
2270
+ onHighlightedIndexChange: PropTypes__default['default'].func,
2271
+ onStateChange: PropTypes__default['default'].func,
2272
+ onIsOpenChange: PropTypes__default['default'].func,
2273
+ environment: PropTypes__default['default'].shape({
2274
+ addEventListener: PropTypes__default['default'].func,
2275
+ removeEventListener: PropTypes__default['default'].func,
2276
+ document: PropTypes__default['default'].shape({
2277
+ getElementById: PropTypes__default['default'].func,
2278
+ activeElement: PropTypes__default['default'].any,
2279
+ body: PropTypes__default['default'].any,
2280
+ }),
2281
+ }),
2270
2282
  };
2271
2283
  /**
2272
2284
  * Default implementation for status message. Only added when menu is open.
@@ -2276,39 +2288,29 @@ var propTypes$2 = {
2276
2288
  * @param {Object} param the downshift state and other relevant properties
2277
2289
  * @return {String} the a11y status message
2278
2290
  */
2279
-
2280
- function getA11yStatusMessage(_ref) {
2281
- var isOpen = _ref.isOpen,
2282
- resultCount = _ref.resultCount,
2283
- previousResultCount = _ref.previousResultCount;
2284
-
2285
- if (!isOpen) {
2291
+ function getA11yStatusMessage({ isOpen, resultCount, previousResultCount, }) {
2292
+ if (!isOpen) {
2293
+ return '';
2294
+ }
2295
+ if (!resultCount) {
2296
+ return 'No results are available.';
2297
+ }
2298
+ if (resultCount !== previousResultCount) {
2299
+ 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.`;
2300
+ }
2286
2301
  return '';
2287
- }
2288
-
2289
- if (!resultCount) {
2290
- return 'No results are available.';
2291
- }
2292
-
2293
- if (resultCount !== previousResultCount) {
2294
- 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.";
2295
- }
2296
-
2297
- return '';
2298
2302
  }
2299
-
2300
- var defaultProps$2 = _extends__default['default']({}, defaultProps$3, {
2301
- getA11yStatusMessage: getA11yStatusMessage
2302
- }); // eslint-disable-next-line import/no-mutable-exports
2303
-
2304
-
2305
- var validatePropTypes$2 = noop;
2303
+ const defaultProps$2 = {
2304
+ ...defaultProps$3,
2305
+ getA11yStatusMessage,
2306
+ };
2307
+ // eslint-disable-next-line import/no-mutable-exports
2308
+ let validatePropTypes$2 = noop;
2306
2309
  /* istanbul ignore next */
2307
-
2308
2310
  if (process.env.NODE_ENV !== 'production') {
2309
- validatePropTypes$2 = function validatePropTypes(options, caller) {
2310
- PropTypes__default['default'].checkPropTypes(propTypes$2, options, 'prop', caller.name);
2311
- };
2311
+ validatePropTypes$2 = (options, caller) => {
2312
+ PropTypes__default['default'].checkPropTypes(propTypes$2, options, 'prop', caller.name);
2313
+ };
2312
2314
  }
2313
2315
 
2314
2316
  var MenuKeyDownArrowDown = process.env.NODE_ENV !== "production" ? '__menu_keydown_arrow_down__' : 0;
@@ -2383,7 +2385,13 @@ function downshiftSelectReducer(state, action) {
2383
2385
  {
2384
2386
  var lowercasedKey = action.key;
2385
2387
  var inputValue = "" + state.inputValue + lowercasedKey;
2386
- var itemIndex = getItemIndexByCharacterKey(inputValue, state.selectedItem ? props.items.indexOf(state.selectedItem) : -1, props.items, props.itemToString, action.getItemNodeFromIndex);
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
+ });
2387
2395
  changes = _extends__default['default']({
2388
2396
  inputValue: inputValue
2389
2397
  }, itemIndex >= 0 && {
@@ -2448,7 +2456,13 @@ function downshiftSelectReducer(state, action) {
2448
2456
 
2449
2457
  var _inputValue = "" + state.inputValue + _lowercasedKey;
2450
2458
 
2451
- var highlightedIndex = getItemIndexByCharacterKey(_inputValue, state.highlightedIndex, props.items, props.itemToString, action.getItemNodeFromIndex);
2459
+ var highlightedIndex = getItemIndexByCharacterKey({
2460
+ keysSoFar: _inputValue,
2461
+ highlightedIndex: state.highlightedIndex,
2462
+ items: props.items,
2463
+ itemToString: props.itemToString,
2464
+ getItemNodeFromIndex: action.getItemNodeFromIndex
2465
+ });
2452
2466
  changes = _extends__default['default']({
2453
2467
  inputValue: _inputValue
2454
2468
  }, highlightedIndex >= 0 && {
@@ -2483,6 +2497,9 @@ function downshiftSelectReducer(state, action) {
2483
2497
  }
2484
2498
  /* eslint-enable complexity */
2485
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"];
2486
2503
  useSelect.stateChangeTypes = stateChangeTypes$2;
2487
2504
 
2488
2505
  function useSelect(userProps) {
@@ -2773,7 +2790,7 @@ function useSelect(userProps) {
2773
2790
  onKeyDown = _ref.onKeyDown,
2774
2791
  onBlur = _ref.onBlur,
2775
2792
  ref = _ref.ref,
2776
- rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"]);
2793
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$2);
2777
2794
 
2778
2795
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
2779
2796
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -2838,7 +2855,7 @@ function useSelect(userProps) {
2838
2855
  _ref3$refKey = _ref3.refKey,
2839
2856
  refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2840
2857
  ref = _ref3.ref,
2841
- rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["onClick", "onKeyDown", "refKey", "ref"]);
2858
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$2);
2842
2859
 
2843
2860
  var _ref4 = _temp4 === void 0 ? {} : _temp4,
2844
2861
  _ref4$suppressRefErro = _ref4.suppressRefError,
@@ -2887,7 +2904,7 @@ function useSelect(userProps) {
2887
2904
  _ref5$refKey = _ref5.refKey,
2888
2905
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
2889
2906
  ref = _ref5.ref,
2890
- rest = _objectWithoutPropertiesLoose__default['default'](_ref5, ["item", "index", "onMouseMove", "onClick", "refKey", "ref"]);
2907
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3$1);
2891
2908
 
2892
2909
  var _latest$current = latest.current,
2893
2910
  latestState = _latest$current.state,
@@ -3223,6 +3240,11 @@ function downshiftUseComboboxReducer(state, action) {
3223
3240
  }
3224
3241
  /* eslint-enable complexity */
3225
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"];
3226
3248
  useCombobox.stateChangeTypes = stateChangeTypes$1;
3227
3249
 
3228
3250
  function useCombobox(userProps) {
@@ -3393,8 +3415,8 @@ function useCombobox(userProps) {
3393
3415
 
3394
3416
  if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
3395
3417
  ) {
3396
- return;
3397
- }
3418
+ return;
3419
+ }
3398
3420
 
3399
3421
  event.preventDefault();
3400
3422
  dispatch({
@@ -3419,7 +3441,7 @@ function useCombobox(userProps) {
3419
3441
  _ref$refKey = _ref.refKey,
3420
3442
  refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
3421
3443
  ref = _ref.ref,
3422
- rest = _objectWithoutPropertiesLoose__default['default'](_ref, ["onMouseLeave", "refKey", "ref"]);
3444
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref, _excluded$1);
3423
3445
 
3424
3446
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
3425
3447
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -3446,7 +3468,7 @@ function useCombobox(userProps) {
3446
3468
  onMouseMove = _ref3.onMouseMove,
3447
3469
  onClick = _ref3.onClick;
3448
3470
  _ref3.onPress;
3449
- var rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
3471
+ var rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded2$1);
3450
3472
 
3451
3473
  var _latest$current = latest.current,
3452
3474
  latestProps = _latest$current.props,
@@ -3500,7 +3522,7 @@ function useCombobox(userProps) {
3500
3522
  var _ref5$refKey = _ref5.refKey,
3501
3523
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
3502
3524
  ref = _ref5.ref,
3503
- rest = _objectWithoutPropertiesLoose__default['default'](_ref5, ["onClick", "onPress", "refKey", "ref"]);
3525
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref5, _excluded3);
3504
3526
 
3505
3527
  var toggleButtonHandleClick = function toggleButtonHandleClick() {
3506
3528
  dispatch({
@@ -3530,7 +3552,7 @@ function useCombobox(userProps) {
3530
3552
  var _ref6$refKey = _ref6.refKey,
3531
3553
  refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
3532
3554
  ref = _ref6.ref,
3533
- rest = _objectWithoutPropertiesLoose__default['default'](_ref6, ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"]);
3555
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref6, _excluded4);
3534
3556
 
3535
3557
  var _ref7 = _temp6 === void 0 ? {} : _temp6,
3536
3558
  _ref7$suppressRefErro = _ref7.suppressRefError,
@@ -3594,7 +3616,7 @@ function useCombobox(userProps) {
3594
3616
  _ref8$refKey = _ref8.refKey,
3595
3617
  refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
3596
3618
  ref = _ref8.ref,
3597
- rest = _objectWithoutPropertiesLoose__default['default'](_ref8, ["refKey", "ref"]);
3619
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref8, _excluded5);
3598
3620
 
3599
3621
  var _ref9 = _temp8 === void 0 ? {} : _temp8,
3600
3622
  _ref9$suppressRefErro = _ref9.suppressRefError,
@@ -3734,9 +3756,7 @@ function isKeyDownOperationPermitted(event) {
3734
3756
  var element = event.target;
3735
3757
 
3736
3758
  if (element instanceof HTMLInputElement && // if element is a text input
3737
- element.value !== '' && ( // and we have text in it
3738
- // and cursor is either not at the start or is currently highlighting text.
3739
- element.selectionStart !== 0 || element.selectionEnd !== 0)) {
3759
+ element.value !== '' && (element.selectionStart !== 0 || element.selectionEnd !== 0)) {
3740
3760
  return false;
3741
3761
  }
3742
3762
 
@@ -3953,6 +3973,8 @@ function downshiftMultipleSelectionReducer(state, action) {
3953
3973
  return _extends__default['default']({}, state, changes);
3954
3974
  }
3955
3975
 
3976
+ var _excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
3977
+ _excluded2 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"];
3956
3978
  useMultipleSelection.stateChangeTypes = stateChangeTypes;
3957
3979
 
3958
3980
  function useMultipleSelection(userProps) {
@@ -4082,7 +4104,7 @@ function useMultipleSelection(userProps) {
4082
4104
  onKeyDown = _ref3.onKeyDown,
4083
4105
  selectedItem = _ref3.selectedItem,
4084
4106
  index = _ref3.index,
4085
- rest = _objectWithoutPropertiesLoose__default['default'](_ref3, ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"]);
4107
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref3, _excluded);
4086
4108
 
4087
4109
  var latestState = latest.current.state;
4088
4110
  var itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
@@ -4123,7 +4145,7 @@ function useMultipleSelection(userProps) {
4123
4145
  onClick = _ref4.onClick,
4124
4146
  _ref4$preventKeyActio = _ref4.preventKeyAction,
4125
4147
  preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
4126
- rest = _objectWithoutPropertiesLoose__default['default'](_ref4, ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"]);
4148
+ rest = _objectWithoutPropertiesLoose__default['default'](_ref4, _excluded2);
4127
4149
 
4128
4150
  var _ref5 = _temp3 === void 0 ? {} : _temp3,
4129
4151
  _ref5$suppressRefErro = _ref5.suppressRefError,
@@ -4197,7 +4219,7 @@ function useMultipleSelection(userProps) {
4197
4219
  };
4198
4220
  }
4199
4221
 
4200
- exports.default = Downshift;
4222
+ exports['default'] = Downshift$1;
4201
4223
  exports.resetIdCounter = resetIdCounter;
4202
4224
  exports.useCombobox = useCombobox;
4203
4225
  exports.useMultipleSelection = useMultipleSelection;