downshift 9.0.1 → 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) {
@@ -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) {
@@ -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) {
@@ -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) {
@@ -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) {