downshift 9.0.1 → 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.
- package/dist/downshift.cjs.js +9 -5
- package/dist/downshift.esm.js +9 -5
- package/dist/downshift.native.cjs.js +9 -5
- package/dist/downshift.nativeweb.cjs.js +9 -5
- package/dist/downshift.umd.js +9 -5
- package/dist/downshift.umd.js.map +1 -1
- package/dist/downshift.umd.min.js +1 -1
- package/dist/downshift.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/preact/dist/downshift.cjs.js +9 -5
- package/preact/dist/downshift.esm.js +9 -5
- package/preact/dist/downshift.umd.js +9 -5
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +1 -1
- package/preact/dist/downshift.umd.min.js.map +1 -1
package/dist/downshift.cjs.js
CHANGED
|
@@ -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) {
|
|
@@ -1818,10 +1819,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
|
|
|
1818
1819
|
return itemToKey(selectedItem) === itemToKey(item);
|
|
1819
1820
|
});
|
|
1820
1821
|
}
|
|
1821
|
-
if (offset
|
|
1822
|
-
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;
|
|
1823
1827
|
}
|
|
1824
|
-
return
|
|
1828
|
+
return -1;
|
|
1825
1829
|
}
|
|
1826
1830
|
/**
|
|
1827
1831
|
* Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
|
package/dist/downshift.esm.js
CHANGED
|
@@ -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) {
|
|
@@ -1806,10 +1807,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
|
|
|
1806
1807
|
return itemToKey(selectedItem) === itemToKey(item);
|
|
1807
1808
|
});
|
|
1808
1809
|
}
|
|
1809
|
-
if (offset
|
|
1810
|
-
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;
|
|
1811
1815
|
}
|
|
1812
|
-
return
|
|
1816
|
+
return -1;
|
|
1813
1817
|
}
|
|
1814
1818
|
/**
|
|
1815
1819
|
* Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
|
|
@@ -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) {
|
|
@@ -1714,10 +1715,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
|
|
|
1714
1715
|
return itemToKey(selectedItem) === itemToKey(item);
|
|
1715
1716
|
});
|
|
1716
1717
|
}
|
|
1717
|
-
if (offset
|
|
1718
|
-
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;
|
|
1719
1723
|
}
|
|
1720
|
-
return
|
|
1724
|
+
return -1;
|
|
1721
1725
|
}
|
|
1722
1726
|
/**
|
|
1723
1727
|
* Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
|
|
@@ -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) {
|
|
@@ -1813,10 +1814,13 @@ function getHighlightedIndexOnOpen(props, state, offset) {
|
|
|
1813
1814
|
return itemToKey(selectedItem) === itemToKey(item);
|
|
1814
1815
|
});
|
|
1815
1816
|
}
|
|
1816
|
-
if (offset
|
|
1817
|
-
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;
|
|
1818
1822
|
}
|
|
1819
|
-
return
|
|
1823
|
+
return -1;
|
|
1820
1824
|
}
|
|
1821
1825
|
/**
|
|
1822
1826
|
* Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
|
package/dist/downshift.umd.js
CHANGED
|
@@ -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) {
|
|
@@ -3166,10 +3167,13 @@
|
|
|
3166
3167
|
return itemToKey(selectedItem) === itemToKey(item);
|
|
3167
3168
|
});
|
|
3168
3169
|
}
|
|
3169
|
-
if (offset
|
|
3170
|
-
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;
|
|
3171
3175
|
}
|
|
3172
|
-
return
|
|
3176
|
+
return -1;
|
|
3173
3177
|
}
|
|
3174
3178
|
/**
|
|
3175
3179
|
* Tracks mouse and touch events, such as mouseDown, touchMove and touchEnd.
|