downshift 9.0.7-alpha.1 → 9.0.7-alpha.2

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.
@@ -1834,10 +1834,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1834
1834
  *
1835
1835
  * @param {Window} environment The environment to add the event listeners to, for instance window.
1836
1836
  * @param {() => void} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
1837
- * @param {Array<{current: HTMLElement}>} downshiftElementRefs The refs for the element that should not trigger a blur action from mouseDown or touchEnd.
1837
+ * @param {Array<{current: HTMLElement}>} downshiftElementsRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.
1838
1838
  * @returns {{isMouseDown: boolean, isTouchMove: boolean, isTouchEnd: boolean}} The mouse and touch events information, if any of are happening.
1839
1839
  */
1840
- function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs) {
1840
+ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementsRefs) {
1841
1841
  var mouseAndTouchTrackersRef = React.useRef({
1842
1842
  isMouseDown: false,
1843
1843
  isTouchMove: false,
@@ -1847,7 +1847,7 @@ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs)
1847
1847
  if (!environment) {
1848
1848
  return noop;
1849
1849
  }
1850
- var downshiftElements = downshiftElementRefs.map(function (ref) {
1850
+ var downshiftElements = downshiftElementsRefs.map(function (ref) {
1851
1851
  return ref.current;
1852
1852
  });
1853
1853
  function onMouseDown() {
@@ -1878,16 +1878,14 @@ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs)
1878
1878
  environment.addEventListener('touchstart', onTouchStart);
1879
1879
  environment.addEventListener('touchmove', onTouchMove);
1880
1880
  environment.addEventListener('touchend', onTouchEnd);
1881
- console.log('adds events', downshiftElementRefs);
1882
1881
  return function cleanup() {
1883
1882
  environment.removeEventListener('mousedown', onMouseDown);
1884
1883
  environment.removeEventListener('mouseup', onMouseUp);
1885
1884
  environment.removeEventListener('touchstart', onTouchStart);
1886
1885
  environment.removeEventListener('touchmove', onTouchMove);
1887
1886
  environment.removeEventListener('touchend', onTouchEnd);
1888
- console.log('cleans up events', downshiftElementRefs);
1889
1887
  };
1890
- }, [environment, handleBlur, downshiftElementRefs]);
1888
+ }, [downshiftElementsRefs, environment, handleBlur]);
1891
1889
  return mouseAndTouchTrackersRef.current;
1892
1890
  }
1893
1891
 
@@ -2414,6 +2412,7 @@ function useSelect(userProps) {
2414
2412
  var toggleButtonRef = React.useRef(null);
2415
2413
  var menuRef = React.useRef(null);
2416
2414
  var itemRefs = React.useRef({});
2415
+
2417
2416
  // used to keep the inputValue clearTimeout object between renders.
2418
2417
  var clearTimeoutRef = React.useRef(null);
2419
2418
  // prevent id re-generation between renders.
@@ -2482,7 +2481,7 @@ function useSelect(userProps) {
2482
2481
  });
2483
2482
  }
2484
2483
  }, [dispatch, latest]), React.useMemo(function () {
2485
- return [toggleButtonRef, menuRef];
2484
+ return [menuRef, toggleButtonRef];
2486
2485
  }, []));
2487
2486
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
2488
2487
  // Reset itemRefs on close.
@@ -3104,7 +3103,7 @@ function useCombobox(userProps) {
3104
3103
  });
3105
3104
  }
3106
3105
  }, [dispatch, latest]), React.useMemo(function () {
3107
- return [toggleButtonRef, menuRef, inputRef];
3106
+ return [menuRef, toggleButtonRef, inputRef];
3108
3107
  }, []));
3109
3108
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
3110
3109
  // Reset itemRefs on close.
@@ -1821,10 +1821,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1821
1821
  *
1822
1822
  * @param {Window} environment The environment to add the event listeners to, for instance window.
1823
1823
  * @param {() => void} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
1824
- * @param {Array<{current: HTMLElement}>} downshiftElementRefs The refs for the element that should not trigger a blur action from mouseDown or touchEnd.
1824
+ * @param {Array<{current: HTMLElement}>} downshiftElementsRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.
1825
1825
  * @returns {{isMouseDown: boolean, isTouchMove: boolean, isTouchEnd: boolean}} The mouse and touch events information, if any of are happening.
1826
1826
  */
1827
- function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs) {
1827
+ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementsRefs) {
1828
1828
  var mouseAndTouchTrackersRef = useRef({
1829
1829
  isMouseDown: false,
1830
1830
  isTouchMove: false,
@@ -1834,7 +1834,7 @@ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs)
1834
1834
  if (!environment) {
1835
1835
  return noop;
1836
1836
  }
1837
- var downshiftElements = downshiftElementRefs.map(function (ref) {
1837
+ var downshiftElements = downshiftElementsRefs.map(function (ref) {
1838
1838
  return ref.current;
1839
1839
  });
1840
1840
  function onMouseDown() {
@@ -1865,16 +1865,14 @@ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs)
1865
1865
  environment.addEventListener('touchstart', onTouchStart);
1866
1866
  environment.addEventListener('touchmove', onTouchMove);
1867
1867
  environment.addEventListener('touchend', onTouchEnd);
1868
- console.log('adds events', downshiftElementRefs);
1869
1868
  return function cleanup() {
1870
1869
  environment.removeEventListener('mousedown', onMouseDown);
1871
1870
  environment.removeEventListener('mouseup', onMouseUp);
1872
1871
  environment.removeEventListener('touchstart', onTouchStart);
1873
1872
  environment.removeEventListener('touchmove', onTouchMove);
1874
1873
  environment.removeEventListener('touchend', onTouchEnd);
1875
- console.log('cleans up events', downshiftElementRefs);
1876
1874
  };
1877
- }, [environment, handleBlur, downshiftElementRefs]);
1875
+ }, [downshiftElementsRefs, environment, handleBlur]);
1878
1876
  return mouseAndTouchTrackersRef.current;
1879
1877
  }
1880
1878
 
@@ -2401,6 +2399,7 @@ function useSelect(userProps) {
2401
2399
  var toggleButtonRef = useRef(null);
2402
2400
  var menuRef = useRef(null);
2403
2401
  var itemRefs = useRef({});
2402
+
2404
2403
  // used to keep the inputValue clearTimeout object between renders.
2405
2404
  var clearTimeoutRef = useRef(null);
2406
2405
  // prevent id re-generation between renders.
@@ -2469,7 +2468,7 @@ function useSelect(userProps) {
2469
2468
  });
2470
2469
  }
2471
2470
  }, [dispatch, latest]), useMemo(function () {
2472
- return [toggleButtonRef, menuRef];
2471
+ return [menuRef, toggleButtonRef];
2473
2472
  }, []));
2474
2473
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
2475
2474
  // Reset itemRefs on close.
@@ -3091,7 +3090,7 @@ function useCombobox(userProps) {
3091
3090
  });
3092
3091
  }
3093
3092
  }, [dispatch, latest]), useMemo(function () {
3094
- return [toggleButtonRef, menuRef, inputRef];
3093
+ return [menuRef, toggleButtonRef, inputRef];
3095
3094
  }, []));
3096
3095
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
3097
3096
  // Reset itemRefs on close.
@@ -1730,10 +1730,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1730
1730
  *
1731
1731
  * @param {Window} environment The environment to add the event listeners to, for instance window.
1732
1732
  * @param {() => void} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
1733
- * @param {Array<{current: HTMLElement}>} downshiftElementRefs The refs for the element that should not trigger a blur action from mouseDown or touchEnd.
1733
+ * @param {Array<{current: HTMLElement}>} downshiftElementsRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.
1734
1734
  * @returns {{isMouseDown: boolean, isTouchMove: boolean, isTouchEnd: boolean}} The mouse and touch events information, if any of are happening.
1735
1735
  */
1736
- function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs) {
1736
+ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementsRefs) {
1737
1737
  var mouseAndTouchTrackersRef = React.useRef({
1738
1738
  isMouseDown: false,
1739
1739
  isTouchMove: false,
@@ -1743,7 +1743,7 @@ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs)
1743
1743
  {
1744
1744
  return noop;
1745
1745
  }
1746
- }, [environment, handleBlur, downshiftElementRefs]);
1746
+ }, [downshiftElementsRefs, environment, handleBlur]);
1747
1747
  return mouseAndTouchTrackersRef.current;
1748
1748
  }
1749
1749
 
@@ -2270,6 +2270,7 @@ function useSelect(userProps) {
2270
2270
  var toggleButtonRef = React.useRef(null);
2271
2271
  var menuRef = React.useRef(null);
2272
2272
  var itemRefs = React.useRef({});
2273
+
2273
2274
  // used to keep the inputValue clearTimeout object between renders.
2274
2275
  var clearTimeoutRef = React.useRef(null);
2275
2276
  // prevent id re-generation between renders.
@@ -2338,7 +2339,7 @@ function useSelect(userProps) {
2338
2339
  });
2339
2340
  }
2340
2341
  }, [dispatch, latest]), React.useMemo(function () {
2341
- return [toggleButtonRef, menuRef];
2342
+ return [menuRef, toggleButtonRef];
2342
2343
  }, []));
2343
2344
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
2344
2345
  // Reset itemRefs on close.
@@ -2948,7 +2949,7 @@ function useCombobox(userProps) {
2948
2949
  });
2949
2950
  }
2950
2951
  }, [dispatch, latest]), React.useMemo(function () {
2951
- return [toggleButtonRef, menuRef, inputRef];
2952
+ return [menuRef, toggleButtonRef, inputRef];
2952
2953
  }, []));
2953
2954
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
2954
2955
  // Reset itemRefs on close.
@@ -1829,10 +1829,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1829
1829
  *
1830
1830
  * @param {Window} environment The environment to add the event listeners to, for instance window.
1831
1831
  * @param {() => void} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
1832
- * @param {Array<{current: HTMLElement}>} downshiftElementRefs The refs for the element that should not trigger a blur action from mouseDown or touchEnd.
1832
+ * @param {Array<{current: HTMLElement}>} downshiftElementsRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.
1833
1833
  * @returns {{isMouseDown: boolean, isTouchMove: boolean, isTouchEnd: boolean}} The mouse and touch events information, if any of are happening.
1834
1834
  */
1835
- function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs) {
1835
+ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementsRefs) {
1836
1836
  var mouseAndTouchTrackersRef = React.useRef({
1837
1837
  isMouseDown: false,
1838
1838
  isTouchMove: false,
@@ -1842,7 +1842,7 @@ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs)
1842
1842
  if (!environment) {
1843
1843
  return noop;
1844
1844
  }
1845
- var downshiftElements = downshiftElementRefs.map(function (ref) {
1845
+ var downshiftElements = downshiftElementsRefs.map(function (ref) {
1846
1846
  return ref.current;
1847
1847
  });
1848
1848
  function onMouseDown() {
@@ -1873,16 +1873,14 @@ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs)
1873
1873
  environment.addEventListener('touchstart', onTouchStart);
1874
1874
  environment.addEventListener('touchmove', onTouchMove);
1875
1875
  environment.addEventListener('touchend', onTouchEnd);
1876
- console.log('adds events', downshiftElementRefs);
1877
1876
  return function cleanup() {
1878
1877
  environment.removeEventListener('mousedown', onMouseDown);
1879
1878
  environment.removeEventListener('mouseup', onMouseUp);
1880
1879
  environment.removeEventListener('touchstart', onTouchStart);
1881
1880
  environment.removeEventListener('touchmove', onTouchMove);
1882
1881
  environment.removeEventListener('touchend', onTouchEnd);
1883
- console.log('cleans up events', downshiftElementRefs);
1884
1882
  };
1885
- }, [environment, handleBlur, downshiftElementRefs]);
1883
+ }, [downshiftElementsRefs, environment, handleBlur]);
1886
1884
  return mouseAndTouchTrackersRef.current;
1887
1885
  }
1888
1886
 
@@ -2409,6 +2407,7 @@ function useSelect(userProps) {
2409
2407
  var toggleButtonRef = React.useRef(null);
2410
2408
  var menuRef = React.useRef(null);
2411
2409
  var itemRefs = React.useRef({});
2410
+
2412
2411
  // used to keep the inputValue clearTimeout object between renders.
2413
2412
  var clearTimeoutRef = React.useRef(null);
2414
2413
  // prevent id re-generation between renders.
@@ -2477,7 +2476,7 @@ function useSelect(userProps) {
2477
2476
  });
2478
2477
  }
2479
2478
  }, [dispatch, latest]), React.useMemo(function () {
2480
- return [toggleButtonRef, menuRef];
2479
+ return [menuRef, toggleButtonRef];
2481
2480
  }, []));
2482
2481
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
2483
2482
  // Reset itemRefs on close.
@@ -3087,7 +3086,7 @@ function useCombobox(userProps) {
3087
3086
  });
3088
3087
  }
3089
3088
  }, [dispatch, latest]), React.useMemo(function () {
3090
- return [toggleButtonRef, menuRef, inputRef];
3089
+ return [menuRef, toggleButtonRef, inputRef];
3091
3090
  }, []));
3092
3091
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
3093
3092
  // Reset itemRefs on close.
@@ -3187,10 +3187,10 @@
3187
3187
  *
3188
3188
  * @param {Window} environment The environment to add the event listeners to, for instance window.
3189
3189
  * @param {() => void} handleBlur The function that is called if mouseDown or touchEnd occured outside the downshiftElements.
3190
- * @param {Array<{current: HTMLElement}>} downshiftElementRefs The refs for the element that should not trigger a blur action from mouseDown or touchEnd.
3190
+ * @param {Array<{current: HTMLElement}>} downshiftElementsRefs The refs for the elements that should not trigger a blur action from mouseDown or touchEnd.
3191
3191
  * @returns {{isMouseDown: boolean, isTouchMove: boolean, isTouchEnd: boolean}} The mouse and touch events information, if any of are happening.
3192
3192
  */
3193
- function useMouseAndTouchTracker(environment, handleBlur, downshiftElementRefs) {
3193
+ function useMouseAndTouchTracker(environment, handleBlur, downshiftElementsRefs) {
3194
3194
  var mouseAndTouchTrackersRef = React.useRef({
3195
3195
  isMouseDown: false,
3196
3196
  isTouchMove: false,
@@ -3200,7 +3200,7 @@
3200
3200
  if (!environment) {
3201
3201
  return noop;
3202
3202
  }
3203
- var downshiftElements = downshiftElementRefs.map(function (ref) {
3203
+ var downshiftElements = downshiftElementsRefs.map(function (ref) {
3204
3204
  return ref.current;
3205
3205
  });
3206
3206
  function onMouseDown() {
@@ -3231,16 +3231,14 @@
3231
3231
  environment.addEventListener('touchstart', onTouchStart);
3232
3232
  environment.addEventListener('touchmove', onTouchMove);
3233
3233
  environment.addEventListener('touchend', onTouchEnd);
3234
- console.log('adds events', downshiftElementRefs);
3235
3234
  return function cleanup() {
3236
3235
  environment.removeEventListener('mousedown', onMouseDown);
3237
3236
  environment.removeEventListener('mouseup', onMouseUp);
3238
3237
  environment.removeEventListener('touchstart', onTouchStart);
3239
3238
  environment.removeEventListener('touchmove', onTouchMove);
3240
3239
  environment.removeEventListener('touchend', onTouchEnd);
3241
- console.log('cleans up events', downshiftElementRefs);
3242
3240
  };
3243
- }, [environment, handleBlur, downshiftElementRefs]);
3241
+ }, [downshiftElementsRefs, environment, handleBlur]);
3244
3242
  return mouseAndTouchTrackersRef.current;
3245
3243
  }
3246
3244
 
@@ -3798,6 +3796,7 @@
3798
3796
  var toggleButtonRef = React.useRef(null);
3799
3797
  var menuRef = React.useRef(null);
3800
3798
  var itemRefs = React.useRef({});
3799
+
3801
3800
  // used to keep the inputValue clearTimeout object between renders.
3802
3801
  var clearTimeoutRef = React.useRef(null);
3803
3802
  // prevent id re-generation between renders.
@@ -3866,7 +3865,7 @@
3866
3865
  });
3867
3866
  }
3868
3867
  }, [dispatch, latest]), React.useMemo(function () {
3869
- return [toggleButtonRef, menuRef];
3868
+ return [menuRef, toggleButtonRef];
3870
3869
  }, []));
3871
3870
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
3872
3871
  // Reset itemRefs on close.
@@ -4488,7 +4487,7 @@
4488
4487
  });
4489
4488
  }
4490
4489
  }, [dispatch, latest]), React.useMemo(function () {
4491
- return [toggleButtonRef, menuRef, inputRef];
4490
+ return [menuRef, toggleButtonRef, inputRef];
4492
4491
  }, []));
4493
4492
  var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
4494
4493
  // Reset itemRefs on close.