downshift 9.0.0 → 9.0.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.
@@ -1799,6 +1799,7 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1799
1799
  var items = props.items,
1800
1800
  initialHighlightedIndex = props.initialHighlightedIndex,
1801
1801
  defaultHighlightedIndex = props.defaultHighlightedIndex,
1802
+ isItemDisabled = props.isItemDisabled,
1802
1803
  itemToKey = props.itemToKey;
1803
1804
  var selectedItem = state.selectedItem,
1804
1805
  highlightedIndex = state.highlightedIndex;
@@ -1807,10 +1808,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1807
1808
  }
1808
1809
 
1809
1810
  // initialHighlightedIndex will give value to highlightedIndex on initial state only.
1810
- if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
1811
+ if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex])) {
1811
1812
  return initialHighlightedIndex;
1812
1813
  }
1813
- if (defaultHighlightedIndex !== undefined) {
1814
+ if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex])) {
1814
1815
  return defaultHighlightedIndex;
1815
1816
  }
1816
1817
  if (selectedItem) {
@@ -1960,7 +1961,7 @@ function useA11yMessageStatus(getA11yStatusMessage, options, dependencyArray, en
1960
1961
  updateA11yStatus(status, document);
1961
1962
 
1962
1963
  // eslint-disable-next-line react-hooks/exhaustive-deps
1963
- }, [dependencyArray]);
1964
+ }, dependencyArray);
1964
1965
 
1965
1966
  // Cleanup the status message container.
1966
1967
  React.useEffect(function () {
@@ -1787,6 +1787,7 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1787
1787
  var items = props.items,
1788
1788
  initialHighlightedIndex = props.initialHighlightedIndex,
1789
1789
  defaultHighlightedIndex = props.defaultHighlightedIndex,
1790
+ isItemDisabled = props.isItemDisabled,
1790
1791
  itemToKey = props.itemToKey;
1791
1792
  var selectedItem = state.selectedItem,
1792
1793
  highlightedIndex = state.highlightedIndex;
@@ -1795,10 +1796,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1795
1796
  }
1796
1797
 
1797
1798
  // initialHighlightedIndex will give value to highlightedIndex on initial state only.
1798
- if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
1799
+ if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex])) {
1799
1800
  return initialHighlightedIndex;
1800
1801
  }
1801
- if (defaultHighlightedIndex !== undefined) {
1802
+ if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex])) {
1802
1803
  return defaultHighlightedIndex;
1803
1804
  }
1804
1805
  if (selectedItem) {
@@ -1948,7 +1949,7 @@ function useA11yMessageStatus(getA11yStatusMessage, options, dependencyArray, en
1948
1949
  updateA11yStatus(status, document);
1949
1950
 
1950
1951
  // eslint-disable-next-line react-hooks/exhaustive-deps
1951
- }, [dependencyArray]);
1952
+ }, dependencyArray);
1952
1953
 
1953
1954
  // Cleanup the status message container.
1954
1955
  useEffect(function () {
@@ -1695,6 +1695,7 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1695
1695
  var items = props.items,
1696
1696
  initialHighlightedIndex = props.initialHighlightedIndex,
1697
1697
  defaultHighlightedIndex = props.defaultHighlightedIndex,
1698
+ isItemDisabled = props.isItemDisabled,
1698
1699
  itemToKey = props.itemToKey;
1699
1700
  var selectedItem = state.selectedItem,
1700
1701
  highlightedIndex = state.highlightedIndex;
@@ -1703,10 +1704,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1703
1704
  }
1704
1705
 
1705
1706
  // initialHighlightedIndex will give value to highlightedIndex on initial state only.
1706
- if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
1707
+ if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex])) {
1707
1708
  return initialHighlightedIndex;
1708
1709
  }
1709
- if (defaultHighlightedIndex !== undefined) {
1710
+ if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex])) {
1710
1711
  return defaultHighlightedIndex;
1711
1712
  }
1712
1713
  if (selectedItem) {
@@ -1818,7 +1819,7 @@ function useA11yMessageStatus(getA11yStatusMessage, options, dependencyArray, en
1818
1819
  updateA11yStatus(status, document);
1819
1820
 
1820
1821
  // eslint-disable-next-line react-hooks/exhaustive-deps
1821
- }, [dependencyArray]);
1822
+ }, dependencyArray);
1822
1823
 
1823
1824
  // Cleanup the status message container.
1824
1825
  React.useEffect(function () {
@@ -1794,6 +1794,7 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1794
1794
  var items = props.items,
1795
1795
  initialHighlightedIndex = props.initialHighlightedIndex,
1796
1796
  defaultHighlightedIndex = props.defaultHighlightedIndex,
1797
+ isItemDisabled = props.isItemDisabled,
1797
1798
  itemToKey = props.itemToKey;
1798
1799
  var selectedItem = state.selectedItem,
1799
1800
  highlightedIndex = state.highlightedIndex;
@@ -1802,10 +1803,10 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1802
1803
  }
1803
1804
 
1804
1805
  // initialHighlightedIndex will give value to highlightedIndex on initial state only.
1805
- if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
1806
+ if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex])) {
1806
1807
  return initialHighlightedIndex;
1807
1808
  }
1808
- if (defaultHighlightedIndex !== undefined) {
1809
+ if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex])) {
1809
1810
  return defaultHighlightedIndex;
1810
1811
  }
1811
1812
  if (selectedItem) {
@@ -1955,7 +1956,7 @@ function useA11yMessageStatus(getA11yStatusMessage, options, dependencyArray, en
1955
1956
  updateA11yStatus(status, document);
1956
1957
 
1957
1958
  // eslint-disable-next-line react-hooks/exhaustive-deps
1958
- }, [dependencyArray]);
1959
+ }, dependencyArray);
1959
1960
 
1960
1961
  // Cleanup the status message container.
1961
1962
  React.useEffect(function () {
@@ -3147,6 +3147,7 @@
3147
3147
  var items = props.items,
3148
3148
  initialHighlightedIndex = props.initialHighlightedIndex,
3149
3149
  defaultHighlightedIndex = props.defaultHighlightedIndex,
3150
+ isItemDisabled = props.isItemDisabled,
3150
3151
  itemToKey = props.itemToKey;
3151
3152
  var selectedItem = state.selectedItem,
3152
3153
  highlightedIndex = state.highlightedIndex;
@@ -3155,10 +3156,10 @@
3155
3156
  }
3156
3157
 
3157
3158
  // initialHighlightedIndex will give value to highlightedIndex on initial state only.
3158
- if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
3159
+ if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex && !isItemDisabled(items[initialHighlightedIndex])) {
3159
3160
  return initialHighlightedIndex;
3160
3161
  }
3161
- if (defaultHighlightedIndex !== undefined) {
3162
+ if (defaultHighlightedIndex !== undefined && !isItemDisabled(items[defaultHighlightedIndex])) {
3162
3163
  return defaultHighlightedIndex;
3163
3164
  }
3164
3165
  if (selectedItem) {
@@ -3308,7 +3309,7 @@
3308
3309
  updateA11yStatus(status, document);
3309
3310
 
3310
3311
  // eslint-disable-next-line react-hooks/exhaustive-deps
3311
- }, [dependencyArray]);
3312
+ }, dependencyArray);
3312
3313
 
3313
3314
  // Cleanup the status message container.
3314
3315
  React.useEffect(function () {