downshift 9.4.0-alpha.1 → 9.4.0-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.
@@ -2178,6 +2178,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2178
2178
  } else {
2179
2179
  shouldScrollRef.current = true;
2180
2180
  }
2181
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally only re-runs when highlightedIndex changes; other params are refs/stable values that don't trigger scrolling
2181
2182
  }, [highlightedIndex]);
2182
2183
  return React__namespace.useCallback(function preventScroll() {
2183
2184
  shouldScrollRef.current = false;
@@ -2190,7 +2191,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2190
2191
  *
2191
2192
  * @param prevState The previous dropdown state.
2192
2193
  * @param newState The new dropdown state.
2193
- * @returns Wheather the states are deeply equal.
2194
+ * @returns Whether the states are deeply equal.
2194
2195
  */
2195
2196
  function isDropdownStateEqual(prevState, newState) {
2196
2197
  return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;
@@ -2254,7 +2255,6 @@ function downshiftCommonReducer(state, props, action, stateChangeTypes) {
2254
2255
  }
2255
2256
  return _extends({}, state, changes);
2256
2257
  }
2257
- /* eslint-enable complexity */
2258
2258
 
2259
2259
  var propTypes$3 = _extends({}, dropdownPropTypes, {
2260
2260
  items: PropTypes.array.isRequired,
@@ -2156,6 +2156,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2156
2156
  } else {
2157
2157
  shouldScrollRef.current = true;
2158
2158
  }
2159
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally only re-runs when highlightedIndex changes; other params are refs/stable values that don't trigger scrolling
2159
2160
  }, [highlightedIndex]);
2160
2161
  return React.useCallback(function preventScroll() {
2161
2162
  shouldScrollRef.current = false;
@@ -2168,7 +2169,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2168
2169
  *
2169
2170
  * @param prevState The previous dropdown state.
2170
2171
  * @param newState The new dropdown state.
2171
- * @returns Wheather the states are deeply equal.
2172
+ * @returns Whether the states are deeply equal.
2172
2173
  */
2173
2174
  function isDropdownStateEqual(prevState, newState) {
2174
2175
  return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;
@@ -2232,7 +2233,6 @@ function downshiftCommonReducer(state, props, action, stateChangeTypes) {
2232
2233
  }
2233
2234
  return _extends({}, state, changes);
2234
2235
  }
2235
- /* eslint-enable complexity */
2236
2236
 
2237
2237
  var propTypes$3 = _extends({}, dropdownPropTypes, {
2238
2238
  items: PropTypes.array.isRequired,
@@ -2031,6 +2031,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2031
2031
  } else {
2032
2032
  shouldScrollRef.current = true;
2033
2033
  }
2034
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally only re-runs when highlightedIndex changes; other params are refs/stable values that don't trigger scrolling
2034
2035
  }, [highlightedIndex]);
2035
2036
  return React__namespace.useCallback(function preventScroll() {
2036
2037
  shouldScrollRef.current = false;
@@ -2043,7 +2044,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2043
2044
  *
2044
2045
  * @param prevState The previous dropdown state.
2045
2046
  * @param newState The new dropdown state.
2046
- * @returns Wheather the states are deeply equal.
2047
+ * @returns Whether the states are deeply equal.
2047
2048
  */
2048
2049
  function isDropdownStateEqual(prevState, newState) {
2049
2050
  return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;
@@ -2107,7 +2108,6 @@ function downshiftCommonReducer(state, props, action, stateChangeTypes) {
2107
2108
  }
2108
2109
  return _extends({}, state, changes);
2109
2110
  }
2110
- /* eslint-enable complexity */
2111
2111
 
2112
2112
  var propTypes$3 = _extends({}, dropdownPropTypes, {
2113
2113
  items: PropTypes.array.isRequired,
@@ -2176,6 +2176,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2176
2176
  } else {
2177
2177
  shouldScrollRef.current = true;
2178
2178
  }
2179
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally only re-runs when highlightedIndex changes; other params are refs/stable values that don't trigger scrolling
2179
2180
  }, [highlightedIndex]);
2180
2181
  return React__namespace.useCallback(function preventScroll() {
2181
2182
  shouldScrollRef.current = false;
@@ -2188,7 +2189,7 @@ function useScrollIntoView(scrollIntoView, highlightedIndex, isOpen, menuElement
2188
2189
  *
2189
2190
  * @param prevState The previous dropdown state.
2190
2191
  * @param newState The new dropdown state.
2191
- * @returns Wheather the states are deeply equal.
2192
+ * @returns Whether the states are deeply equal.
2192
2193
  */
2193
2194
  function isDropdownStateEqual(prevState, newState) {
2194
2195
  return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;
@@ -2252,7 +2253,6 @@ function downshiftCommonReducer(state, props, action, stateChangeTypes) {
2252
2253
  }
2253
2254
  return _extends({}, state, changes);
2254
2255
  }
2255
- /* eslint-enable complexity */
2256
2256
 
2257
2257
  var propTypes$3 = _extends({}, dropdownPropTypes, {
2258
2258
  items: PropTypes.array.isRequired,
@@ -1,12 +1,16 @@
1
1
  import React from 'react';
2
- export type Callback = () => void;
3
2
  export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
3
+ export type AnyRef = React.Ref<any>;
4
4
  export interface Environment {
5
5
  addEventListener: typeof window.addEventListener;
6
6
  removeEventListener: typeof window.removeEventListener;
7
7
  document: Document;
8
8
  Node: typeof window.Node;
9
9
  }
10
+ export interface GetPropsCommonOptions {
11
+ suppressRefError?: boolean;
12
+ }
13
+ export type Callback = () => void;
10
14
  export interface DownshiftState<Item> {
11
15
  highlightedIndex: number | null;
12
16
  inputValue: string | null;
@@ -136,9 +140,6 @@ export interface GetMenuPropsReturnValue {
136
140
  role: 'listbox';
137
141
  id: string;
138
142
  }
139
- export interface GetPropsCommonOptions {
140
- suppressRefError?: boolean;
141
- }
142
143
  export interface GetPropsWithRefKey {
143
144
  refKey?: string;
144
145
  }
@@ -3531,6 +3531,7 @@
3531
3531
  } else {
3532
3532
  shouldScrollRef.current = true;
3533
3533
  }
3534
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally only re-runs when highlightedIndex changes; other params are refs/stable values that don't trigger scrolling
3534
3535
  }, [highlightedIndex]);
3535
3536
  return React__namespace.useCallback(function preventScroll() {
3536
3537
  shouldScrollRef.current = false;
@@ -3543,7 +3544,7 @@
3543
3544
  *
3544
3545
  * @param prevState The previous dropdown state.
3545
3546
  * @param newState The new dropdown state.
3546
- * @returns Wheather the states are deeply equal.
3547
+ * @returns Whether the states are deeply equal.
3547
3548
  */
3548
3549
  function isDropdownStateEqual(prevState, newState) {
3549
3550
  return prevState.isOpen === newState.isOpen && prevState.inputValue === newState.inputValue && prevState.highlightedIndex === newState.highlightedIndex && prevState.selectedItem === newState.selectedItem;
@@ -3607,7 +3608,6 @@
3607
3608
  }
3608
3609
  return _extends({}, state, changes);
3609
3610
  }
3610
- /* eslint-enable complexity */
3611
3611
 
3612
3612
  var propTypes$3 = _extends({}, dropdownPropTypes, {
3613
3613
  items: PropTypes.array.isRequired,