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
@@ -2,7 +2,7 @@ import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from '@babel/runtime/helpers/esm/extends';
3
3
  import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
4
4
  import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
5
- import { cloneElement, Component, useRef, useEffect, useLayoutEffect, useCallback, useReducer, useMemo } from 'preact';
5
+ import { cloneElement, Component, useRef, useEffect, useCallback, useLayoutEffect, useReducer, useMemo } from 'preact';
6
6
  import { isForwardRef } from 'react-is';
7
7
  import computeScrollIntoView from 'compute-scroll-into-view';
8
8
  import PropTypes from 'prop-types';
@@ -50,12 +50,14 @@ function scrollIntoView(node, menuNode) {
50
50
  /**
51
51
  * @param {HTMLElement} parent the parent node
52
52
  * @param {HTMLElement} child the child node
53
+ * @param {Window} environment The window context where downshift renders.
53
54
  * @return {Boolean} whether the parent is the child or the child is in the parent
54
55
  */
55
56
 
56
57
 
57
58
  function isOrContainsNode(parent, child, environment) {
58
- return parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
59
+ var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
60
+ return result;
59
61
  }
60
62
  /**
61
63
  * Simple debounce implementation. Will call the given
@@ -409,7 +411,7 @@ function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFr
409
411
  *
410
412
  * @param {EventTarget} target Target to check.
411
413
  * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
412
- * @param {Environment} environment The environment.
414
+ * @param {Window} environment The window context where downshift renders.
413
415
  * @param {boolean} checkActiveElement Whether to also check activeElement.
414
416
  *
415
417
  * @returns {boolean} Whether or not the target is within downshift elements.
@@ -539,6 +541,12 @@ var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
539
541
  touchEnd: touchEnd
540
542
  });
541
543
 
544
+ var _excluded$4 = ["refKey", "ref"],
545
+ _excluded2$3 = ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"],
546
+ _excluded3$2 = ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"],
547
+ _excluded4$1 = ["refKey", "ref"],
548
+ _excluded5$1 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
549
+
542
550
  var Downshift = /*#__PURE__*/function () {
543
551
  var Downshift = /*#__PURE__*/function (_Component) {
544
552
  _inheritsLoose(Downshift, _Component);
@@ -658,6 +666,8 @@ var Downshift = /*#__PURE__*/function () {
658
666
  isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
659
667
 
660
668
  var nextState = {}; // this is just used to tell whether the state changed
669
+
670
+ var nextFullState = {}; // we need to call on change if the outside world is controlling any of our state
661
671
  // and we're trying to update that state. OR if the selection has changed and we're
662
672
  // trying to update the selection
663
673
 
@@ -683,7 +693,7 @@ var Downshift = /*#__PURE__*/function () {
683
693
  return;
684
694
  }
685
695
 
686
- newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
696
+ nextFullState[key] = newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
687
697
 
688
698
  if (!isControlledProp(_this.props, key)) {
689
699
  nextState[key] = newStateToSet[key];
@@ -732,7 +742,7 @@ var Downshift = /*#__PURE__*/function () {
732
742
  _ref$refKey = _ref.refKey,
733
743
  refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
734
744
  ref = _ref.ref,
735
- rest = _objectWithoutPropertiesLoose(_ref, ["refKey", "ref"]);
745
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
736
746
 
737
747
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
738
748
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -916,7 +926,7 @@ var Downshift = /*#__PURE__*/function () {
916
926
  var onKeyDown = _ref3.onKeyDown,
917
927
  onKeyUp = _ref3.onKeyUp,
918
928
  onBlur = _ref3.onBlur,
919
- rest = _objectWithoutPropertiesLoose(_ref3, ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"]);
929
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);
920
930
 
921
931
  var _this$getState5 = _this.getState(),
922
932
  isOpen = _this$getState5.isOpen;
@@ -984,10 +994,10 @@ var Downshift = /*#__PURE__*/function () {
984
994
  _this.internalSetTimeout(function () {
985
995
  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
996
  ) {
987
- _this.reset({
988
- type: blurButton
989
- });
990
- }
997
+ _this.reset({
998
+ type: blurButton
999
+ });
1000
+ }
991
1001
  });
992
1002
  };
993
1003
 
@@ -1005,7 +1015,7 @@ var Downshift = /*#__PURE__*/function () {
1005
1015
  onChange = _ref4.onChange,
1006
1016
  onInput = _ref4.onInput;
1007
1017
  _ref4.onChangeText;
1008
- var rest = _objectWithoutPropertiesLoose(_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
1018
+ var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);
1009
1019
 
1010
1020
  var onChangeKey;
1011
1021
  var eventHandlers = {};
@@ -1080,7 +1090,7 @@ var Downshift = /*#__PURE__*/function () {
1080
1090
  _ref5$refKey = _ref5.refKey,
1081
1091
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
1082
1092
  ref = _ref5.ref,
1083
- props = _objectWithoutPropertiesLoose(_ref5, ["refKey", "ref"]);
1093
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded4$1);
1084
1094
 
1085
1095
  var _ref6 = _temp6 === void 0 ? {} : _temp6,
1086
1096
  _ref6$suppressRefErro = _ref6.suppressRefError,
@@ -1105,7 +1115,7 @@ var Downshift = /*#__PURE__*/function () {
1105
1115
  item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ?
1106
1116
  /* istanbul ignore next */
1107
1117
  undefined : requiredProp('getItemProps', 'item') : _ref7$item,
1108
- rest = _objectWithoutPropertiesLoose(_ref7, ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"]);
1118
+ rest = _objectWithoutPropertiesLoose(_ref7, _excluded5$1);
1109
1119
 
1110
1120
  if (index === undefined) {
1111
1121
  _this.items.push(item);
@@ -1431,7 +1441,7 @@ var Downshift = /*#__PURE__*/function () {
1431
1441
  _this7.isMouseDown = false; // if the target element or the activeElement is within a downshift node
1432
1442
  // then we don't want to reset downshift
1433
1443
 
1434
- var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment.document);
1444
+ var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment);
1435
1445
 
1436
1446
  if (!contextWithinDownshift && _this7.getState().isOpen) {
1437
1447
  _this7.reset({
@@ -1457,7 +1467,7 @@ var Downshift = /*#__PURE__*/function () {
1457
1467
  };
1458
1468
 
1459
1469
  var onTouchEnd = function onTouchEnd(event) {
1460
- var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment.document, false);
1470
+ var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment, false);
1461
1471
 
1462
1472
  if (!_this7.isTouchMove && !contextWithinDownshift && _this7.getState().isOpen) {
1463
1473
  _this7.reset({
@@ -1613,9 +1623,9 @@ var Downshift = /*#__PURE__*/function () {
1613
1623
  selectedItemChanged: function selectedItemChanged(prevItem, item) {
1614
1624
  return prevItem !== item;
1615
1625
  },
1616
- environment: typeof window === 'undefined'
1626
+ environment:
1617
1627
  /* istanbul ignore next (ssr) */
1618
- ? {} : window,
1628
+ typeof window === 'undefined' ? {} : window,
1619
1629
  stateReducer: function stateReducer(state, stateToSet) {
1620
1630
  return stateToSet;
1621
1631
  },
@@ -1626,6 +1636,8 @@ var Downshift = /*#__PURE__*/function () {
1626
1636
  return Downshift;
1627
1637
  }();
1628
1638
 
1639
+ var Downshift$1 = Downshift;
1640
+
1629
1641
  function validateGetMenuPropsCalledCorrectly(node, _ref12) {
1630
1642
  var refKey = _ref12.refKey;
1631
1643
 
@@ -1654,6 +1666,7 @@ function validateGetRootPropsCalledCorrectly(element, _ref13) {
1654
1666
  }
1655
1667
  }
1656
1668
 
1669
+ var _excluded$3 = ["isInitialMount", "highlightedIndex", "items", "environment"];
1657
1670
  var dropdownDefaultStateValues = {
1658
1671
  highlightedIndex: -1,
1659
1672
  isOpen: false,
@@ -1851,9 +1864,9 @@ var defaultProps$3 = {
1851
1864
  getA11ySelectionMessage: getA11ySelectionMessage,
1852
1865
  scrollIntoView: scrollIntoView,
1853
1866
  circularNavigation: false,
1854
- environment: typeof window === 'undefined'
1867
+ environment:
1855
1868
  /* istanbul ignore next (ssr) */
1856
- ? {} : window
1869
+ typeof window === 'undefined' ? {} : window
1857
1870
  };
1858
1871
 
1859
1872
  function getDefaultValue$1(props, propKey, defaultStateValues) {
@@ -1979,7 +1992,7 @@ function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, hand
1979
1992
  var onTouchEnd = function onTouchEnd(event) {
1980
1993
  if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
1981
1994
  return ref.current;
1982
- }), environment.document, false)) {
1995
+ }), environment, false)) {
1983
1996
  handleBlur();
1984
1997
  }
1985
1998
  };
@@ -2067,11 +2080,11 @@ function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
2067
2080
  highlightedIndex = _ref2.highlightedIndex,
2068
2081
  items = _ref2.items,
2069
2082
  environment = _ref2.environment,
2070
- rest = _objectWithoutPropertiesLoose(_ref2, ["isInitialMount", "highlightedIndex", "items", "environment"]);
2083
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded$3);
2071
2084
 
2072
2085
  // Sets a11y status message on changes in state.
2073
2086
  useEffect(function () {
2074
- if (isInitialMount) {
2087
+ if (isInitialMount || false) {
2075
2088
  return;
2076
2089
  }
2077
2090
 
@@ -2202,58 +2215,57 @@ function downshiftCommonReducer(state, action, stateChangeTypes) {
2202
2215
  }
2203
2216
  /* eslint-enable complexity */
2204
2217
 
2205
- function getItemIndexByCharacterKey(keysSoFar, highlightedIndex, items, itemToString, getItemNodeFromIndex) {
2206
- var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
2207
-
2208
- for (var index = 0; index < items.length; index++) {
2209
- var offsetIndex = (index + highlightedIndex + 1) % items.length;
2210
-
2211
- if (itemToString(items[offsetIndex]).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
2212
- var element = getItemNodeFromIndex(offsetIndex);
2213
-
2214
- if (!(element && element.hasAttribute('disabled'))) {
2215
- return offsetIndex;
2216
- }
2218
+ function getItemIndexByCharacterKey({ keysSoFar, highlightedIndex, items, itemToString, getItemNodeFromIndex, }) {
2219
+ const lowerCasedKeysSoFar = keysSoFar.toLowerCase();
2220
+ for (let index = 0; index < items.length; index++) {
2221
+ const offsetIndex = (index + highlightedIndex + 1) % items.length;
2222
+ const item = items[offsetIndex];
2223
+ if (item !== undefined &&
2224
+ itemToString(item)
2225
+ .toLowerCase()
2226
+ .startsWith(lowerCasedKeysSoFar)) {
2227
+ const element = getItemNodeFromIndex(offsetIndex);
2228
+ if (!element?.hasAttribute('disabled')) {
2229
+ return offsetIndex;
2230
+ }
2231
+ }
2217
2232
  }
2218
- }
2219
-
2220
- return highlightedIndex;
2233
+ return highlightedIndex;
2221
2234
  }
2222
-
2223
- var propTypes$2 = {
2224
- items: PropTypes.array.isRequired,
2225
- itemToString: PropTypes.func,
2226
- getA11yStatusMessage: PropTypes.func,
2227
- getA11ySelectionMessage: PropTypes.func,
2228
- circularNavigation: PropTypes.bool,
2229
- highlightedIndex: PropTypes.number,
2230
- defaultHighlightedIndex: PropTypes.number,
2231
- initialHighlightedIndex: PropTypes.number,
2232
- isOpen: PropTypes.bool,
2233
- defaultIsOpen: PropTypes.bool,
2234
- initialIsOpen: PropTypes.bool,
2235
- selectedItem: PropTypes.any,
2236
- initialSelectedItem: PropTypes.any,
2237
- defaultSelectedItem: PropTypes.any,
2238
- id: PropTypes.string,
2239
- labelId: PropTypes.string,
2240
- menuId: PropTypes.string,
2241
- getItemId: PropTypes.func,
2242
- toggleButtonId: PropTypes.string,
2243
- stateReducer: PropTypes.func,
2244
- onSelectedItemChange: PropTypes.func,
2245
- onHighlightedIndexChange: PropTypes.func,
2246
- onStateChange: PropTypes.func,
2247
- onIsOpenChange: PropTypes.func,
2248
- environment: PropTypes.shape({
2249
- addEventListener: PropTypes.func,
2250
- removeEventListener: PropTypes.func,
2251
- document: PropTypes.shape({
2252
- getElementById: PropTypes.func,
2253
- activeElement: PropTypes.any,
2254
- body: PropTypes.any
2255
- })
2256
- })
2235
+ const propTypes$2 = {
2236
+ items: PropTypes.array.isRequired,
2237
+ itemToString: PropTypes.func,
2238
+ getA11yStatusMessage: PropTypes.func,
2239
+ getA11ySelectionMessage: PropTypes.func,
2240
+ circularNavigation: PropTypes.bool,
2241
+ highlightedIndex: PropTypes.number,
2242
+ defaultHighlightedIndex: PropTypes.number,
2243
+ initialHighlightedIndex: PropTypes.number,
2244
+ isOpen: PropTypes.bool,
2245
+ defaultIsOpen: PropTypes.bool,
2246
+ initialIsOpen: PropTypes.bool,
2247
+ selectedItem: PropTypes.any,
2248
+ initialSelectedItem: PropTypes.any,
2249
+ defaultSelectedItem: PropTypes.any,
2250
+ id: PropTypes.string,
2251
+ labelId: PropTypes.string,
2252
+ menuId: PropTypes.string,
2253
+ getItemId: PropTypes.func,
2254
+ toggleButtonId: PropTypes.string,
2255
+ stateReducer: PropTypes.func,
2256
+ onSelectedItemChange: PropTypes.func,
2257
+ onHighlightedIndexChange: PropTypes.func,
2258
+ onStateChange: PropTypes.func,
2259
+ onIsOpenChange: PropTypes.func,
2260
+ environment: PropTypes.shape({
2261
+ addEventListener: PropTypes.func,
2262
+ removeEventListener: PropTypes.func,
2263
+ document: PropTypes.shape({
2264
+ getElementById: PropTypes.func,
2265
+ activeElement: PropTypes.any,
2266
+ body: PropTypes.any,
2267
+ }),
2268
+ }),
2257
2269
  };
2258
2270
  /**
2259
2271
  * Default implementation for status message. Only added when menu is open.
@@ -2263,39 +2275,29 @@ var propTypes$2 = {
2263
2275
  * @param {Object} param the downshift state and other relevant properties
2264
2276
  * @return {String} the a11y status message
2265
2277
  */
2266
-
2267
- function getA11yStatusMessage(_ref) {
2268
- var isOpen = _ref.isOpen,
2269
- resultCount = _ref.resultCount,
2270
- previousResultCount = _ref.previousResultCount;
2271
-
2272
- if (!isOpen) {
2278
+ function getA11yStatusMessage({ isOpen, resultCount, previousResultCount, }) {
2279
+ if (!isOpen) {
2280
+ return '';
2281
+ }
2282
+ if (!resultCount) {
2283
+ return 'No results are available.';
2284
+ }
2285
+ if (resultCount !== previousResultCount) {
2286
+ 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.`;
2287
+ }
2273
2288
  return '';
2274
- }
2275
-
2276
- if (!resultCount) {
2277
- return 'No results are available.';
2278
- }
2279
-
2280
- if (resultCount !== previousResultCount) {
2281
- 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.";
2282
- }
2283
-
2284
- return '';
2285
2289
  }
2286
-
2287
- var defaultProps$2 = _extends({}, defaultProps$3, {
2288
- getA11yStatusMessage: getA11yStatusMessage
2289
- }); // eslint-disable-next-line import/no-mutable-exports
2290
-
2291
-
2292
- var validatePropTypes$2 = noop;
2290
+ const defaultProps$2 = {
2291
+ ...defaultProps$3,
2292
+ getA11yStatusMessage,
2293
+ };
2294
+ // eslint-disable-next-line import/no-mutable-exports
2295
+ let validatePropTypes$2 = noop;
2293
2296
  /* istanbul ignore next */
2294
-
2295
2297
  if (process.env.NODE_ENV !== 'production') {
2296
- validatePropTypes$2 = function validatePropTypes(options, caller) {
2297
- PropTypes.checkPropTypes(propTypes$2, options, 'prop', caller.name);
2298
- };
2298
+ validatePropTypes$2 = (options, caller) => {
2299
+ PropTypes.checkPropTypes(propTypes$2, options, 'prop', caller.name);
2300
+ };
2299
2301
  }
2300
2302
 
2301
2303
  var MenuKeyDownArrowDown = process.env.NODE_ENV !== "production" ? '__menu_keydown_arrow_down__' : 0;
@@ -2370,7 +2372,13 @@ function downshiftSelectReducer(state, action) {
2370
2372
  {
2371
2373
  var lowercasedKey = action.key;
2372
2374
  var inputValue = "" + state.inputValue + lowercasedKey;
2373
- var itemIndex = getItemIndexByCharacterKey(inputValue, state.selectedItem ? props.items.indexOf(state.selectedItem) : -1, props.items, props.itemToString, action.getItemNodeFromIndex);
2375
+ var itemIndex = getItemIndexByCharacterKey({
2376
+ keysSoFar: inputValue,
2377
+ highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
2378
+ items: props.items,
2379
+ itemToString: props.itemToString,
2380
+ getItemNodeFromIndex: action.getItemNodeFromIndex
2381
+ });
2374
2382
  changes = _extends({
2375
2383
  inputValue: inputValue
2376
2384
  }, itemIndex >= 0 && {
@@ -2435,7 +2443,13 @@ function downshiftSelectReducer(state, action) {
2435
2443
 
2436
2444
  var _inputValue = "" + state.inputValue + _lowercasedKey;
2437
2445
 
2438
- var highlightedIndex = getItemIndexByCharacterKey(_inputValue, state.highlightedIndex, props.items, props.itemToString, action.getItemNodeFromIndex);
2446
+ var highlightedIndex = getItemIndexByCharacterKey({
2447
+ keysSoFar: _inputValue,
2448
+ highlightedIndex: state.highlightedIndex,
2449
+ items: props.items,
2450
+ itemToString: props.itemToString,
2451
+ getItemNodeFromIndex: action.getItemNodeFromIndex
2452
+ });
2439
2453
  changes = _extends({
2440
2454
  inputValue: _inputValue
2441
2455
  }, highlightedIndex >= 0 && {
@@ -2470,6 +2484,9 @@ function downshiftSelectReducer(state, action) {
2470
2484
  }
2471
2485
  /* eslint-enable complexity */
2472
2486
 
2487
+ var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
2488
+ _excluded2$2 = ["onClick", "onKeyDown", "refKey", "ref"],
2489
+ _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref"];
2473
2490
  useSelect.stateChangeTypes = stateChangeTypes$2;
2474
2491
 
2475
2492
  function useSelect(userProps) {
@@ -2760,7 +2777,7 @@ function useSelect(userProps) {
2760
2777
  onKeyDown = _ref.onKeyDown,
2761
2778
  onBlur = _ref.onBlur,
2762
2779
  ref = _ref.ref,
2763
- rest = _objectWithoutPropertiesLoose(_ref, ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"]);
2780
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
2764
2781
 
2765
2782
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
2766
2783
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -2825,7 +2842,7 @@ function useSelect(userProps) {
2825
2842
  _ref3$refKey = _ref3.refKey,
2826
2843
  refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2827
2844
  ref = _ref3.ref,
2828
- rest = _objectWithoutPropertiesLoose(_ref3, ["onClick", "onKeyDown", "refKey", "ref"]);
2845
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$2);
2829
2846
 
2830
2847
  var _ref4 = _temp4 === void 0 ? {} : _temp4,
2831
2848
  _ref4$suppressRefErro = _ref4.suppressRefError,
@@ -2874,7 +2891,7 @@ function useSelect(userProps) {
2874
2891
  _ref5$refKey = _ref5.refKey,
2875
2892
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
2876
2893
  ref = _ref5.ref,
2877
- rest = _objectWithoutPropertiesLoose(_ref5, ["item", "index", "onMouseMove", "onClick", "refKey", "ref"]);
2894
+ rest = _objectWithoutPropertiesLoose(_ref5, _excluded3$1);
2878
2895
 
2879
2896
  var _latest$current = latest.current,
2880
2897
  latestState = _latest$current.state,
@@ -3210,6 +3227,11 @@ function downshiftUseComboboxReducer(state, action) {
3210
3227
  }
3211
3228
  /* eslint-enable complexity */
3212
3229
 
3230
+ var _excluded$1 = ["onMouseLeave", "refKey", "ref"],
3231
+ _excluded2$1 = ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"],
3232
+ _excluded3 = ["onClick", "onPress", "refKey", "ref"],
3233
+ _excluded4 = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"],
3234
+ _excluded5 = ["refKey", "ref"];
3213
3235
  useCombobox.stateChangeTypes = stateChangeTypes$1;
3214
3236
 
3215
3237
  function useCombobox(userProps) {
@@ -3380,8 +3402,8 @@ function useCombobox(userProps) {
3380
3402
 
3381
3403
  if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
3382
3404
  ) {
3383
- return;
3384
- }
3405
+ return;
3406
+ }
3385
3407
 
3386
3408
  event.preventDefault();
3387
3409
  dispatch({
@@ -3406,7 +3428,7 @@ function useCombobox(userProps) {
3406
3428
  _ref$refKey = _ref.refKey,
3407
3429
  refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
3408
3430
  ref = _ref.ref,
3409
- rest = _objectWithoutPropertiesLoose(_ref, ["onMouseLeave", "refKey", "ref"]);
3431
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
3410
3432
 
3411
3433
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
3412
3434
  _ref2$suppressRefErro = _ref2.suppressRefError,
@@ -3433,7 +3455,7 @@ function useCombobox(userProps) {
3433
3455
  onMouseMove = _ref3.onMouseMove,
3434
3456
  onClick = _ref3.onClick;
3435
3457
  _ref3.onPress;
3436
- var rest = _objectWithoutPropertiesLoose(_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
3458
+ var rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
3437
3459
 
3438
3460
  var _latest$current = latest.current,
3439
3461
  latestProps = _latest$current.props,
@@ -3487,7 +3509,7 @@ function useCombobox(userProps) {
3487
3509
  var _ref5$refKey = _ref5.refKey,
3488
3510
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
3489
3511
  ref = _ref5.ref,
3490
- rest = _objectWithoutPropertiesLoose(_ref5, ["onClick", "onPress", "refKey", "ref"]);
3512
+ rest = _objectWithoutPropertiesLoose(_ref5, _excluded3);
3491
3513
 
3492
3514
  var toggleButtonHandleClick = function toggleButtonHandleClick() {
3493
3515
  dispatch({
@@ -3517,7 +3539,7 @@ function useCombobox(userProps) {
3517
3539
  var _ref6$refKey = _ref6.refKey,
3518
3540
  refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
3519
3541
  ref = _ref6.ref,
3520
- rest = _objectWithoutPropertiesLoose(_ref6, ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"]);
3542
+ rest = _objectWithoutPropertiesLoose(_ref6, _excluded4);
3521
3543
 
3522
3544
  var _ref7 = _temp6 === void 0 ? {} : _temp6,
3523
3545
  _ref7$suppressRefErro = _ref7.suppressRefError,
@@ -3581,7 +3603,7 @@ function useCombobox(userProps) {
3581
3603
  _ref8$refKey = _ref8.refKey,
3582
3604
  refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
3583
3605
  ref = _ref8.ref,
3584
- rest = _objectWithoutPropertiesLoose(_ref8, ["refKey", "ref"]);
3606
+ rest = _objectWithoutPropertiesLoose(_ref8, _excluded5);
3585
3607
 
3586
3608
  var _ref9 = _temp8 === void 0 ? {} : _temp8,
3587
3609
  _ref9$suppressRefErro = _ref9.suppressRefError,
@@ -3721,9 +3743,7 @@ function isKeyDownOperationPermitted(event) {
3721
3743
  var element = event.target;
3722
3744
 
3723
3745
  if (element instanceof HTMLInputElement && // if element is a text input
3724
- element.value !== '' && ( // and we have text in it
3725
- // and cursor is either not at the start or is currently highlighting text.
3726
- element.selectionStart !== 0 || element.selectionEnd !== 0)) {
3746
+ element.value !== '' && (element.selectionStart !== 0 || element.selectionEnd !== 0)) {
3727
3747
  return false;
3728
3748
  }
3729
3749
 
@@ -3940,6 +3960,8 @@ function downshiftMultipleSelectionReducer(state, action) {
3940
3960
  return _extends({}, state, changes);
3941
3961
  }
3942
3962
 
3963
+ var _excluded = ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"],
3964
+ _excluded2 = ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"];
3943
3965
  useMultipleSelection.stateChangeTypes = stateChangeTypes;
3944
3966
 
3945
3967
  function useMultipleSelection(userProps) {
@@ -4069,7 +4091,7 @@ function useMultipleSelection(userProps) {
4069
4091
  onKeyDown = _ref3.onKeyDown,
4070
4092
  selectedItem = _ref3.selectedItem,
4071
4093
  index = _ref3.index,
4072
- rest = _objectWithoutPropertiesLoose(_ref3, ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"]);
4094
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
4073
4095
 
4074
4096
  var latestState = latest.current.state;
4075
4097
  var itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
@@ -4110,7 +4132,7 @@ function useMultipleSelection(userProps) {
4110
4132
  onClick = _ref4.onClick,
4111
4133
  _ref4$preventKeyActio = _ref4.preventKeyAction,
4112
4134
  preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
4113
- rest = _objectWithoutPropertiesLoose(_ref4, ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"]);
4135
+ rest = _objectWithoutPropertiesLoose(_ref4, _excluded2);
4114
4136
 
4115
4137
  var _ref5 = _temp3 === void 0 ? {} : _temp3,
4116
4138
  _ref5$suppressRefErro = _ref5.suppressRefError,
@@ -4184,5 +4206,4 @@ function useMultipleSelection(userProps) {
4184
4206
  };
4185
4207
  }
4186
4208
 
4187
- export default Downshift;
4188
- export { resetIdCounter, useCombobox, useMultipleSelection, useSelect };
4209
+ export { Downshift$1 as default, resetIdCounter, useCombobox, useMultipleSelection, useSelect };