downshift 7.2.1 → 7.2.2-alpha.0

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.
@@ -510,18 +510,9 @@ var Downshift = /*#__PURE__*/function () {
510
510
  };
511
511
  _this.input = null;
512
512
  _this.items = [];
513
- // itemCount can be changed asynchronously
514
- // from within downshift (so it can't come from a prop)
515
- // this is why we store it as an instance and use
516
- // getItemCount rather than just use items.length
517
- // (to support windowing + async)
518
513
  _this.itemCount = null;
519
514
  _this.previousResultCount = 0;
520
515
  _this.timeoutIds = [];
521
- /**
522
- * @param {Function} fn the function to call after the time
523
- * @param {Number} time the time to wait
524
- */
525
516
  _this.internalSetTimeout = function (fn, time) {
526
517
  var id = setTimeout(function () {
527
518
  _this.timeoutIds = _this.timeoutIds.filter(function (i) {
@@ -576,14 +567,6 @@ var Downshift = /*#__PURE__*/function () {
576
567
  _this.selectHighlightedItem = function (otherStateToSet, cb) {
577
568
  return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
578
569
  };
579
- // any piece of our state can live in two places:
580
- // 1. Uncontrolled: it's internal (this.state)
581
- // We will call this.setState to update that state
582
- // 2. Controlled: it's external (this.props)
583
- // We will call this.props.onStateChange to update that state
584
- //
585
- // In addition, we'll call this.props.onChange if the
586
- // selectedItem is changed.
587
570
  _this.internalSetState = function (stateToSet, cb) {
588
571
  var isItemSelected, onChangeArg;
589
572
  var onStateChangeArg = {};
@@ -666,7 +649,6 @@ var Downshift = /*#__PURE__*/function () {
666
649
  _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
667
650
  });
668
651
  };
669
- //////////////////////////// ROOT
670
652
  _this.rootRef = function (node) {
671
653
  return _this._rootNode = node;
672
654
  };
@@ -689,7 +671,6 @@ var Downshift = /*#__PURE__*/function () {
689
671
  isOpen = _this$getState.isOpen;
690
672
  return _extends__default["default"]((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
691
673
  };
692
- //\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT
693
674
  _this.keyDownHandlers = {
694
675
  ArrowDown: function ArrowDown(event) {
695
676
  var _this2 = this;
@@ -774,7 +755,6 @@ var Downshift = /*#__PURE__*/function () {
774
755
  }));
775
756
  }
776
757
  };
777
- //////////////////////////// BUTTON
778
758
  _this.buttonKeyDownHandlers = _extends__default["default"]({}, _this.keyDownHandlers, {
779
759
  ' ': function _(event) {
780
760
  event.preventDefault();
@@ -898,16 +878,12 @@ var Downshift = /*#__PURE__*/function () {
898
878
  }
899
879
  });
900
880
  };
901
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON
902
- /////////////////////////////// LABEL
903
881
  _this.getLabelProps = function (props) {
904
882
  return _extends__default["default"]({
905
883
  htmlFor: _this.inputId,
906
884
  id: _this.labelId
907
885
  }, props);
908
886
  };
909
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL
910
- /////////////////////////////// INPUT
911
887
  _this.getInputProps = function (_temp4) {
912
888
  var _ref4 = _temp4 === void 0 ? {} : _temp4,
913
889
  onKeyDown = _ref4.onKeyDown,
@@ -968,8 +944,6 @@ var Downshift = /*#__PURE__*/function () {
968
944
  }
969
945
  });
970
946
  };
971
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT
972
- /////////////////////////////// MENU
973
947
  _this.menuRef = function (node) {
974
948
  _this._menuNode = node;
975
949
  };
@@ -988,8 +962,6 @@ var Downshift = /*#__PURE__*/function () {
988
962
  _this.getMenuProps.suppressRefError = suppressRefError;
989
963
  return _extends__default["default"]((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
990
964
  };
991
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU
992
- /////////////////////////////// ITEM
993
965
  _this.getItemProps = function (_temp7) {
994
966
  var _enabledEventHandlers;
995
967
  var _ref7 = _temp7 === void 0 ? {} : _temp7,
@@ -1053,7 +1025,6 @@ var Downshift = /*#__PURE__*/function () {
1053
1025
  'aria-selected': _this.getState().highlightedIndex === index
1054
1026
  }, eventHandlers, rest);
1055
1027
  };
1056
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM
1057
1028
  _this.clearItems = function () {
1058
1029
  _this.items = [];
1059
1030
  };
@@ -1261,7 +1232,10 @@ var Downshift = /*#__PURE__*/function () {
1261
1232
  isOpen: isOpen,
1262
1233
  selectedItem: selectedItem
1263
1234
  };
1264
- };
1235
+ }
1236
+
1237
+ //////////////////////////// ROOT
1238
+ ;
1265
1239
  _proto.componentDidMount = function componentDidMount() {
1266
1240
  var _this7 = this;
1267
1241
  /* istanbul ignore if (react-native) */
@@ -2242,8 +2216,8 @@ function downshiftSelectReducer(state, action) {
2242
2216
  /* eslint-enable complexity */
2243
2217
 
2244
2218
  var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
2245
- _excluded2$2 = ["onBlur", "onClick", "onKeyDown", "refKey", "ref"],
2246
- _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref", "disabled"];
2219
+ _excluded2$2 = ["onBlur", "onClick", "onPress", "onKeyDown", "refKey", "ref"],
2220
+ _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "onPress", "refKey", "ref", "disabled"];
2247
2221
  useSelect.stateChangeTypes = stateChangeTypes$2;
2248
2222
  function useSelect(userProps) {
2249
2223
  if (userProps === void 0) {
@@ -2533,8 +2507,9 @@ function useSelect(userProps) {
2533
2507
  var _extends3;
2534
2508
  var _ref3 = _temp3 === void 0 ? {} : _temp3,
2535
2509
  onBlur = _ref3.onBlur,
2536
- onClick = _ref3.onClick,
2537
- onKeyDown = _ref3.onKeyDown,
2510
+ onClick = _ref3.onClick;
2511
+ _ref3.onPress;
2512
+ var onKeyDown = _ref3.onKeyDown,
2538
2513
  _ref3$refKey = _ref3.refKey,
2539
2514
  refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2540
2515
  ref = _ref3.ref,
@@ -2571,8 +2546,11 @@ function useSelect(userProps) {
2571
2546
  toggleButtonRef.current = toggleButtonNode;
2572
2547
  }), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);
2573
2548
  if (!rest.disabled) {
2574
- toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
2575
- toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
2549
+ /* istanbul ignore if (react-native) */
2550
+ {
2551
+ toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
2552
+ toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
2553
+ }
2576
2554
  }
2577
2555
  setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
2578
2556
  return toggleProps;
@@ -2583,8 +2561,9 @@ function useSelect(userProps) {
2583
2561
  itemProp = _ref5.item,
2584
2562
  indexProp = _ref5.index,
2585
2563
  onMouseMove = _ref5.onMouseMove,
2586
- onClick = _ref5.onClick,
2587
- _ref5$refKey = _ref5.refKey,
2564
+ onClick = _ref5.onClick;
2565
+ _ref5.onPress;
2566
+ var _ref5$refKey = _ref5.refKey,
2588
2567
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
2589
2568
  ref = _ref5.ref,
2590
2569
  disabled = _ref5.disabled,
@@ -2626,7 +2605,10 @@ function useSelect(userProps) {
2626
2605
  }
2627
2606
  }), _extends4), rest);
2628
2607
  if (!disabled) {
2629
- itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
2608
+ /* istanbul ignore next (react-native) */
2609
+ {
2610
+ itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
2611
+ }
2630
2612
  }
2631
2613
  itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
2632
2614
  return itemProps;
@@ -497,18 +497,9 @@ var Downshift = /*#__PURE__*/function () {
497
497
  };
498
498
  _this.input = null;
499
499
  _this.items = [];
500
- // itemCount can be changed asynchronously
501
- // from within downshift (so it can't come from a prop)
502
- // this is why we store it as an instance and use
503
- // getItemCount rather than just use items.length
504
- // (to support windowing + async)
505
500
  _this.itemCount = null;
506
501
  _this.previousResultCount = 0;
507
502
  _this.timeoutIds = [];
508
- /**
509
- * @param {Function} fn the function to call after the time
510
- * @param {Number} time the time to wait
511
- */
512
503
  _this.internalSetTimeout = function (fn, time) {
513
504
  var id = setTimeout(function () {
514
505
  _this.timeoutIds = _this.timeoutIds.filter(function (i) {
@@ -563,14 +554,6 @@ var Downshift = /*#__PURE__*/function () {
563
554
  _this.selectHighlightedItem = function (otherStateToSet, cb) {
564
555
  return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
565
556
  };
566
- // any piece of our state can live in two places:
567
- // 1. Uncontrolled: it's internal (this.state)
568
- // We will call this.setState to update that state
569
- // 2. Controlled: it's external (this.props)
570
- // We will call this.props.onStateChange to update that state
571
- //
572
- // In addition, we'll call this.props.onChange if the
573
- // selectedItem is changed.
574
557
  _this.internalSetState = function (stateToSet, cb) {
575
558
  var isItemSelected, onChangeArg;
576
559
  var onStateChangeArg = {};
@@ -653,7 +636,6 @@ var Downshift = /*#__PURE__*/function () {
653
636
  _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
654
637
  });
655
638
  };
656
- //////////////////////////// ROOT
657
639
  _this.rootRef = function (node) {
658
640
  return _this._rootNode = node;
659
641
  };
@@ -676,7 +658,6 @@ var Downshift = /*#__PURE__*/function () {
676
658
  isOpen = _this$getState.isOpen;
677
659
  return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
678
660
  };
679
- //\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT
680
661
  _this.keyDownHandlers = {
681
662
  ArrowDown: function ArrowDown(event) {
682
663
  var _this2 = this;
@@ -761,7 +742,6 @@ var Downshift = /*#__PURE__*/function () {
761
742
  }));
762
743
  }
763
744
  };
764
- //////////////////////////// BUTTON
765
745
  _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
766
746
  ' ': function _(event) {
767
747
  event.preventDefault();
@@ -885,16 +865,12 @@ var Downshift = /*#__PURE__*/function () {
885
865
  }
886
866
  });
887
867
  };
888
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON
889
- /////////////////////////////// LABEL
890
868
  _this.getLabelProps = function (props) {
891
869
  return _extends({
892
870
  htmlFor: _this.inputId,
893
871
  id: _this.labelId
894
872
  }, props);
895
873
  };
896
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL
897
- /////////////////////////////// INPUT
898
874
  _this.getInputProps = function (_temp4) {
899
875
  var _ref4 = _temp4 === void 0 ? {} : _temp4,
900
876
  onKeyDown = _ref4.onKeyDown,
@@ -955,8 +931,6 @@ var Downshift = /*#__PURE__*/function () {
955
931
  }
956
932
  });
957
933
  };
958
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT
959
- /////////////////////////////// MENU
960
934
  _this.menuRef = function (node) {
961
935
  _this._menuNode = node;
962
936
  };
@@ -975,8 +949,6 @@ var Downshift = /*#__PURE__*/function () {
975
949
  _this.getMenuProps.suppressRefError = suppressRefError;
976
950
  return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
977
951
  };
978
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU
979
- /////////////////////////////// ITEM
980
952
  _this.getItemProps = function (_temp7) {
981
953
  var _enabledEventHandlers;
982
954
  var _ref7 = _temp7 === void 0 ? {} : _temp7,
@@ -1040,7 +1012,6 @@ var Downshift = /*#__PURE__*/function () {
1040
1012
  'aria-selected': _this.getState().highlightedIndex === index
1041
1013
  }, eventHandlers, rest);
1042
1014
  };
1043
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM
1044
1015
  _this.clearItems = function () {
1045
1016
  _this.items = [];
1046
1017
  };
@@ -1248,7 +1219,10 @@ var Downshift = /*#__PURE__*/function () {
1248
1219
  isOpen: isOpen,
1249
1220
  selectedItem: selectedItem
1250
1221
  };
1251
- };
1222
+ }
1223
+
1224
+ //////////////////////////// ROOT
1225
+ ;
1252
1226
  _proto.componentDidMount = function componentDidMount() {
1253
1227
  var _this7 = this;
1254
1228
  /* istanbul ignore if (react-native) */
@@ -2229,8 +2203,8 @@ function downshiftSelectReducer(state, action) {
2229
2203
  /* eslint-enable complexity */
2230
2204
 
2231
2205
  var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
2232
- _excluded2$2 = ["onBlur", "onClick", "onKeyDown", "refKey", "ref"],
2233
- _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref", "disabled"];
2206
+ _excluded2$2 = ["onBlur", "onClick", "onPress", "onKeyDown", "refKey", "ref"],
2207
+ _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "onPress", "refKey", "ref", "disabled"];
2234
2208
  useSelect.stateChangeTypes = stateChangeTypes$2;
2235
2209
  function useSelect(userProps) {
2236
2210
  if (userProps === void 0) {
@@ -2520,8 +2494,9 @@ function useSelect(userProps) {
2520
2494
  var _extends3;
2521
2495
  var _ref3 = _temp3 === void 0 ? {} : _temp3,
2522
2496
  onBlur = _ref3.onBlur,
2523
- onClick = _ref3.onClick,
2524
- onKeyDown = _ref3.onKeyDown,
2497
+ onClick = _ref3.onClick;
2498
+ _ref3.onPress;
2499
+ var onKeyDown = _ref3.onKeyDown,
2525
2500
  _ref3$refKey = _ref3.refKey,
2526
2501
  refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2527
2502
  ref = _ref3.ref,
@@ -2558,8 +2533,11 @@ function useSelect(userProps) {
2558
2533
  toggleButtonRef.current = toggleButtonNode;
2559
2534
  }), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);
2560
2535
  if (!rest.disabled) {
2561
- toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
2562
- toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
2536
+ /* istanbul ignore if (react-native) */
2537
+ {
2538
+ toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
2539
+ toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
2540
+ }
2563
2541
  }
2564
2542
  setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
2565
2543
  return toggleProps;
@@ -2570,8 +2548,9 @@ function useSelect(userProps) {
2570
2548
  itemProp = _ref5.item,
2571
2549
  indexProp = _ref5.index,
2572
2550
  onMouseMove = _ref5.onMouseMove,
2573
- onClick = _ref5.onClick,
2574
- _ref5$refKey = _ref5.refKey,
2551
+ onClick = _ref5.onClick;
2552
+ _ref5.onPress;
2553
+ var _ref5$refKey = _ref5.refKey,
2575
2554
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
2576
2555
  ref = _ref5.ref,
2577
2556
  disabled = _ref5.disabled,
@@ -2613,7 +2592,10 @@ function useSelect(userProps) {
2613
2592
  }
2614
2593
  }), _extends4), rest);
2615
2594
  if (!disabled) {
2616
- itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
2595
+ /* istanbul ignore next (react-native) */
2596
+ {
2597
+ itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
2598
+ }
2617
2599
  }
2618
2600
  itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
2619
2601
  return itemProps;
@@ -480,18 +480,9 @@ var Downshift = /*#__PURE__*/function () {
480
480
  };
481
481
  _this.input = null;
482
482
  _this.items = [];
483
- // itemCount can be changed asynchronously
484
- // from within downshift (so it can't come from a prop)
485
- // this is why we store it as an instance and use
486
- // getItemCount rather than just use items.length
487
- // (to support windowing + async)
488
483
  _this.itemCount = null;
489
484
  _this.previousResultCount = 0;
490
485
  _this.timeoutIds = [];
491
- /**
492
- * @param {Function} fn the function to call after the time
493
- * @param {Number} time the time to wait
494
- */
495
486
  _this.internalSetTimeout = function (fn, time) {
496
487
  var id = setTimeout(function () {
497
488
  _this.timeoutIds = _this.timeoutIds.filter(function (i) {
@@ -546,14 +537,6 @@ var Downshift = /*#__PURE__*/function () {
546
537
  _this.selectHighlightedItem = function (otherStateToSet, cb) {
547
538
  return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
548
539
  };
549
- // any piece of our state can live in two places:
550
- // 1. Uncontrolled: it's internal (this.state)
551
- // We will call this.setState to update that state
552
- // 2. Controlled: it's external (this.props)
553
- // We will call this.props.onStateChange to update that state
554
- //
555
- // In addition, we'll call this.props.onChange if the
556
- // selectedItem is changed.
557
540
  _this.internalSetState = function (stateToSet, cb) {
558
541
  var isItemSelected, onChangeArg;
559
542
  var onStateChangeArg = {};
@@ -636,7 +619,6 @@ var Downshift = /*#__PURE__*/function () {
636
619
  _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
637
620
  });
638
621
  };
639
- //////////////////////////// ROOT
640
622
  _this.rootRef = function (node) {
641
623
  return _this._rootNode = node;
642
624
  };
@@ -659,7 +641,6 @@ var Downshift = /*#__PURE__*/function () {
659
641
  isOpen = _this$getState.isOpen;
660
642
  return _extends__default["default"]((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
661
643
  };
662
- //\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT
663
644
  _this.keyDownHandlers = {
664
645
  ArrowDown: function ArrowDown(event) {
665
646
  var _this2 = this;
@@ -744,7 +725,6 @@ var Downshift = /*#__PURE__*/function () {
744
725
  }));
745
726
  }
746
727
  };
747
- //////////////////////////// BUTTON
748
728
  _this.buttonKeyDownHandlers = _extends__default["default"]({}, _this.keyDownHandlers, {
749
729
  ' ': function _(event) {
750
730
  event.preventDefault();
@@ -860,16 +840,12 @@ var Downshift = /*#__PURE__*/function () {
860
840
  }
861
841
  });
862
842
  };
863
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON
864
- /////////////////////////////// LABEL
865
843
  _this.getLabelProps = function (props) {
866
844
  return _extends__default["default"]({
867
845
  htmlFor: _this.inputId,
868
846
  id: _this.labelId
869
847
  }, props);
870
848
  };
871
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL
872
- /////////////////////////////// INPUT
873
849
  _this.getInputProps = function (_temp4) {
874
850
  var _ref4 = _temp4 === void 0 ? {} : _temp4,
875
851
  onKeyDown = _ref4.onKeyDown,
@@ -945,8 +921,6 @@ var Downshift = /*#__PURE__*/function () {
945
921
  }
946
922
  });
947
923
  };
948
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT
949
- /////////////////////////////// MENU
950
924
  _this.menuRef = function (node) {
951
925
  _this._menuNode = node;
952
926
  };
@@ -965,8 +939,6 @@ var Downshift = /*#__PURE__*/function () {
965
939
  _this.getMenuProps.suppressRefError = suppressRefError;
966
940
  return _extends__default["default"]((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
967
941
  };
968
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU
969
- /////////////////////////////// ITEM
970
942
  _this.getItemProps = function (_temp7) {
971
943
  var _enabledEventHandlers;
972
944
  var _ref7 = _temp7 === void 0 ? {} : _temp7,
@@ -1030,7 +1002,6 @@ var Downshift = /*#__PURE__*/function () {
1030
1002
  'aria-selected': _this.getState().highlightedIndex === index
1031
1003
  }, eventHandlers, rest);
1032
1004
  };
1033
- //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM
1034
1005
  _this.clearItems = function () {
1035
1006
  _this.items = [];
1036
1007
  };
@@ -1233,7 +1204,10 @@ var Downshift = /*#__PURE__*/function () {
1233
1204
  isOpen: isOpen,
1234
1205
  selectedItem: selectedItem
1235
1206
  };
1236
- };
1207
+ }
1208
+
1209
+ //////////////////////////// ROOT
1210
+ ;
1237
1211
  _proto.componentDidMount = function componentDidMount() {
1238
1212
  var _this7 = this;
1239
1213
  /* istanbul ignore if (react-native) */
@@ -1523,9 +1497,6 @@ function getItemIndex(index, item, items) {
1523
1497
  function itemToString(item) {
1524
1498
  return item ? String(item) : '';
1525
1499
  }
1526
- function isAcceptedCharacterKey(key) {
1527
- return /^\S{1}$/.test(key);
1528
- }
1529
1500
  function capitalizeString(string) {
1530
1501
  return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
1531
1502
  }
@@ -2113,8 +2084,8 @@ function downshiftSelectReducer(state, action) {
2113
2084
  /* eslint-enable complexity */
2114
2085
 
2115
2086
  var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
2116
- _excluded2$2 = ["onBlur", "onClick", "onKeyDown", "refKey", "ref"],
2117
- _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref", "disabled"];
2087
+ _excluded2$2 = ["onBlur", "onClick", "onPress", "onKeyDown", "refKey", "ref"],
2088
+ _excluded3$1 = ["item", "index", "onMouseMove", "onClick", "onPress", "refKey", "ref", "disabled"];
2118
2089
  useSelect.stateChangeTypes = stateChangeTypes$2;
2119
2090
  function useSelect(userProps) {
2120
2091
  if (userProps === void 0) {
@@ -2399,10 +2370,11 @@ function useSelect(userProps) {
2399
2370
  var getToggleButtonProps = react.useCallback(function (_temp3, _temp4) {
2400
2371
  var _extends3;
2401
2372
  var _ref3 = _temp3 === void 0 ? {} : _temp3,
2402
- onBlur = _ref3.onBlur,
2403
- onClick = _ref3.onClick,
2404
- onKeyDown = _ref3.onKeyDown,
2405
- _ref3$refKey = _ref3.refKey,
2373
+ onBlur = _ref3.onBlur;
2374
+ _ref3.onClick;
2375
+ var onPress = _ref3.onPress;
2376
+ _ref3.onKeyDown;
2377
+ var _ref3$refKey = _ref3.refKey,
2406
2378
  refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
2407
2379
  ref = _ref3.ref,
2408
2380
  rest = _objectWithoutPropertiesLoose__default["default"](_ref3, _excluded2$2);
@@ -2422,24 +2394,14 @@ function useSelect(userProps) {
2422
2394
  });
2423
2395
  }
2424
2396
  };
2425
- var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {
2426
- var key = normalizeArrowKey(event);
2427
- if (key && toggleButtonKeyDownHandlers[key]) {
2428
- toggleButtonKeyDownHandlers[key](event);
2429
- } else if (isAcceptedCharacterKey(key)) {
2430
- dispatch({
2431
- type: ToggleButtonKeyDownCharacter,
2432
- key: key,
2433
- getItemNodeFromIndex: getItemNodeFromIndex
2434
- });
2435
- }
2436
- };
2437
2397
  var toggleProps = _extends__default["default"]((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {
2438
2398
  toggleButtonRef.current = toggleButtonNode;
2439
2399
  }), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);
2440
2400
  if (!rest.disabled) {
2441
- toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
2442
- toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
2401
+ /* istanbul ignore if (react-native) */
2402
+ {
2403
+ toggleProps.onPress = callAllEventHandlers(onPress, toggleButtonHandleClick);
2404
+ }
2443
2405
  }
2444
2406
  setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
2445
2407
  return toggleProps;
@@ -2449,8 +2411,9 @@ function useSelect(userProps) {
2449
2411
  var _ref5 = _temp5 === void 0 ? {} : _temp5,
2450
2412
  itemProp = _ref5.item,
2451
2413
  indexProp = _ref5.index,
2452
- onMouseMove = _ref5.onMouseMove,
2453
- onClick = _ref5.onClick,
2414
+ onMouseMove = _ref5.onMouseMove;
2415
+ _ref5.onClick;
2416
+ var onPress = _ref5.onPress,
2454
2417
  _ref5$refKey = _ref5.refKey,
2455
2418
  refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
2456
2419
  ref = _ref5.ref,
@@ -2493,7 +2456,10 @@ function useSelect(userProps) {
2493
2456
  }
2494
2457
  }), _extends4), rest);
2495
2458
  if (!disabled) {
2496
- itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
2459
+ /* istanbul ignore next (react-native) */
2460
+ {
2461
+ itemProps.onPress = callAllEventHandlers(onPress, itemHandleClick);
2462
+ }
2497
2463
  }
2498
2464
  itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
2499
2465
  return itemProps;