downshift 9.0.2 → 9.0.3

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.
@@ -1819,10 +1819,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1819
1819
  return itemToKey(selectedItem) === itemToKey(item);
1820
1820
  });
1821
1821
  }
1822
- if (offset === 0) {
1823
- return -1;
1822
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
1823
+ return items.length - 1;
1824
+ }
1825
+ if (offset > 0 && !isItemDisabled(items[0])) {
1826
+ return 0;
1824
1827
  }
1825
- return offset < 0 ? items.length - 1 : 0;
1828
+ return -1;
1826
1829
  }
1827
1830
  /**
1828
1831
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
@@ -1807,10 +1807,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1807
1807
  return itemToKey(selectedItem) === itemToKey(item);
1808
1808
  });
1809
1809
  }
1810
- if (offset === 0) {
1811
- return -1;
1810
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
1811
+ return items.length - 1;
1812
+ }
1813
+ if (offset > 0 && !isItemDisabled(items[0])) {
1814
+ return 0;
1812
1815
  }
1813
- return offset < 0 ? items.length - 1 : 0;
1816
+ return -1;
1814
1817
  }
1815
1818
  /**
1816
1819
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
@@ -1715,10 +1715,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1715
1715
  return itemToKey(selectedItem) === itemToKey(item);
1716
1716
  });
1717
1717
  }
1718
- if (offset === 0) {
1719
- return -1;
1718
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
1719
+ return items.length - 1;
1720
+ }
1721
+ if (offset > 0 && !isItemDisabled(items[0])) {
1722
+ return 0;
1720
1723
  }
1721
- return offset < 0 ? items.length - 1 : 0;
1724
+ return -1;
1722
1725
  }
1723
1726
  /**
1724
1727
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
@@ -1814,10 +1814,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
1814
1814
  return itemToKey(selectedItem) === itemToKey(item);
1815
1815
  });
1816
1816
  }
1817
- if (offset === 0) {
1818
- return -1;
1817
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
1818
+ return items.length - 1;
1819
+ }
1820
+ if (offset > 0 && !isItemDisabled(items[0])) {
1821
+ return 0;
1819
1822
  }
1820
- return offset < 0 ? items.length - 1 : 0;
1823
+ return -1;
1821
1824
  }
1822
1825
  /**
1823
1826
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
@@ -3167,10 +3167,13 @@
3167
3167
  return itemToKey(selectedItem) === itemToKey(item);
3168
3168
  });
3169
3169
  }
3170
- if (offset === 0) {
3171
- return -1;
3170
+ if (offset < 0 && !isItemDisabled(items[items.length - 1])) {
3171
+ return items.length - 1;
3172
+ }
3173
+ if (offset > 0 && !isItemDisabled(items[0])) {
3174
+ return 0;
3172
3175
  }
3173
- return offset < 0 ? items.length - 1 : 0;
3176
+ return -1;
3174
3177
  }
3175
3178
  /**
3176
3179
  * Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.