downshift 7.2.1 → 7.2.2-alpha.0
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 +21 -39
- package/dist/downshift.esm.js +21 -39
- package/dist/downshift.native.cjs.js +22 -56
- package/dist/downshift.umd.js +21 -39
- 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 +21 -39
- package/preact/dist/downshift.esm.js +21 -39
- package/preact/dist/downshift.umd.js +21 -39
- 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/CHANGELOG.md +0 -5
package/dist/downshift.umd.js
CHANGED
|
@@ -1803,18 +1803,9 @@
|
|
|
1803
1803
|
};
|
|
1804
1804
|
_this.input = null;
|
|
1805
1805
|
_this.items = [];
|
|
1806
|
-
// itemCount can be changed asynchronously
|
|
1807
|
-
// from within downshift (so it can't come from a prop)
|
|
1808
|
-
// this is why we store it as an instance and use
|
|
1809
|
-
// getItemCount rather than just use items.length
|
|
1810
|
-
// (to support windowing + async)
|
|
1811
1806
|
_this.itemCount = null;
|
|
1812
1807
|
_this.previousResultCount = 0;
|
|
1813
1808
|
_this.timeoutIds = [];
|
|
1814
|
-
/**
|
|
1815
|
-
* @param {Function} fn the function to call after the time
|
|
1816
|
-
* @param {Number} time the time to wait
|
|
1817
|
-
*/
|
|
1818
1809
|
_this.internalSetTimeout = function (fn, time) {
|
|
1819
1810
|
var id = setTimeout(function () {
|
|
1820
1811
|
_this.timeoutIds = _this.timeoutIds.filter(function (i) {
|
|
@@ -1869,14 +1860,6 @@
|
|
|
1869
1860
|
_this.selectHighlightedItem = function (otherStateToSet, cb) {
|
|
1870
1861
|
return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
|
|
1871
1862
|
};
|
|
1872
|
-
// any piece of our state can live in two places:
|
|
1873
|
-
// 1. Uncontrolled: it's internal (this.state)
|
|
1874
|
-
// We will call this.setState to update that state
|
|
1875
|
-
// 2. Controlled: it's external (this.props)
|
|
1876
|
-
// We will call this.props.onStateChange to update that state
|
|
1877
|
-
//
|
|
1878
|
-
// In addition, we'll call this.props.onChange if the
|
|
1879
|
-
// selectedItem is changed.
|
|
1880
1863
|
_this.internalSetState = function (stateToSet, cb) {
|
|
1881
1864
|
var isItemSelected, onChangeArg;
|
|
1882
1865
|
var onStateChangeArg = {};
|
|
@@ -1959,7 +1942,6 @@
|
|
|
1959
1942
|
_this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
|
|
1960
1943
|
});
|
|
1961
1944
|
};
|
|
1962
|
-
//////////////////////////// ROOT
|
|
1963
1945
|
_this.rootRef = function (node) {
|
|
1964
1946
|
return _this._rootNode = node;
|
|
1965
1947
|
};
|
|
@@ -1982,7 +1964,6 @@
|
|
|
1982
1964
|
isOpen = _this$getState.isOpen;
|
|
1983
1965
|
return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
|
|
1984
1966
|
};
|
|
1985
|
-
//\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT
|
|
1986
1967
|
_this.keyDownHandlers = {
|
|
1987
1968
|
ArrowDown: function ArrowDown(event) {
|
|
1988
1969
|
var _this2 = this;
|
|
@@ -2067,7 +2048,6 @@
|
|
|
2067
2048
|
}));
|
|
2068
2049
|
}
|
|
2069
2050
|
};
|
|
2070
|
-
//////////////////////////// BUTTON
|
|
2071
2051
|
_this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
|
|
2072
2052
|
' ': function _(event) {
|
|
2073
2053
|
event.preventDefault();
|
|
@@ -2187,16 +2167,12 @@
|
|
|
2187
2167
|
}
|
|
2188
2168
|
});
|
|
2189
2169
|
};
|
|
2190
|
-
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON
|
|
2191
|
-
/////////////////////////////// LABEL
|
|
2192
2170
|
_this.getLabelProps = function (props) {
|
|
2193
2171
|
return _extends({
|
|
2194
2172
|
htmlFor: _this.inputId,
|
|
2195
2173
|
id: _this.labelId
|
|
2196
2174
|
}, props);
|
|
2197
2175
|
};
|
|
2198
|
-
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL
|
|
2199
|
-
/////////////////////////////// INPUT
|
|
2200
2176
|
_this.getInputProps = function (_temp4) {
|
|
2201
2177
|
var _ref4 = _temp4 === void 0 ? {} : _temp4,
|
|
2202
2178
|
onKeyDown = _ref4.onKeyDown,
|
|
@@ -2257,8 +2233,6 @@
|
|
|
2257
2233
|
}
|
|
2258
2234
|
});
|
|
2259
2235
|
};
|
|
2260
|
-
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT
|
|
2261
|
-
/////////////////////////////// MENU
|
|
2262
2236
|
_this.menuRef = function (node) {
|
|
2263
2237
|
_this._menuNode = node;
|
|
2264
2238
|
};
|
|
@@ -2277,8 +2251,6 @@
|
|
|
2277
2251
|
_this.getMenuProps.suppressRefError = suppressRefError;
|
|
2278
2252
|
return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
|
|
2279
2253
|
};
|
|
2280
|
-
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU
|
|
2281
|
-
/////////////////////////////// ITEM
|
|
2282
2254
|
_this.getItemProps = function (_temp7) {
|
|
2283
2255
|
var _enabledEventHandlers;
|
|
2284
2256
|
var _ref7 = _temp7 === void 0 ? {} : _temp7,
|
|
@@ -2342,7 +2314,6 @@
|
|
|
2342
2314
|
'aria-selected': _this.getState().highlightedIndex === index
|
|
2343
2315
|
}, eventHandlers, rest);
|
|
2344
2316
|
};
|
|
2345
|
-
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM
|
|
2346
2317
|
_this.clearItems = function () {
|
|
2347
2318
|
_this.items = [];
|
|
2348
2319
|
};
|
|
@@ -2550,7 +2521,10 @@
|
|
|
2550
2521
|
isOpen: isOpen,
|
|
2551
2522
|
selectedItem: selectedItem
|
|
2552
2523
|
};
|
|
2553
|
-
}
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
//////////////////////////// ROOT
|
|
2527
|
+
;
|
|
2554
2528
|
_proto.componentDidMount = function componentDidMount() {
|
|
2555
2529
|
var _this7 = this;
|
|
2556
2530
|
/* istanbul ignore if (react-native) */
|
|
@@ -3554,8 +3528,8 @@
|
|
|
3554
3528
|
/* eslint-enable complexity */
|
|
3555
3529
|
|
|
3556
3530
|
var _excluded$2 = ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"],
|
|
3557
|
-
_excluded2$2 = ["onBlur", "onClick", "onKeyDown", "refKey", "ref"],
|
|
3558
|
-
_excluded3$1 = ["item", "index", "onMouseMove", "onClick", "refKey", "ref", "disabled"];
|
|
3531
|
+
_excluded2$2 = ["onBlur", "onClick", "onPress", "onKeyDown", "refKey", "ref"],
|
|
3532
|
+
_excluded3$1 = ["item", "index", "onMouseMove", "onClick", "onPress", "refKey", "ref", "disabled"];
|
|
3559
3533
|
useSelect.stateChangeTypes = stateChangeTypes$2;
|
|
3560
3534
|
function useSelect(userProps) {
|
|
3561
3535
|
if (userProps === void 0) {
|
|
@@ -3845,8 +3819,9 @@
|
|
|
3845
3819
|
var _extends3;
|
|
3846
3820
|
var _ref3 = _temp3 === void 0 ? {} : _temp3,
|
|
3847
3821
|
onBlur = _ref3.onBlur,
|
|
3848
|
-
onClick = _ref3.onClick
|
|
3849
|
-
|
|
3822
|
+
onClick = _ref3.onClick;
|
|
3823
|
+
_ref3.onPress;
|
|
3824
|
+
var onKeyDown = _ref3.onKeyDown,
|
|
3850
3825
|
_ref3$refKey = _ref3.refKey,
|
|
3851
3826
|
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
|
|
3852
3827
|
ref = _ref3.ref,
|
|
@@ -3883,8 +3858,11 @@
|
|
|
3883
3858
|
toggleButtonRef.current = toggleButtonNode;
|
|
3884
3859
|
}), _extends3['aria-activedescendant'] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : '', _extends3['aria-controls'] = elementIds.menuId, _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-labelledby'] = "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = 'combobox', _extends3.tabIndex = 0, _extends3.onBlur = callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest);
|
|
3885
3860
|
if (!rest.disabled) {
|
|
3886
|
-
|
|
3887
|
-
|
|
3861
|
+
/* istanbul ignore if (react-native) */
|
|
3862
|
+
{
|
|
3863
|
+
toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
|
|
3864
|
+
toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
|
|
3865
|
+
}
|
|
3888
3866
|
}
|
|
3889
3867
|
setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
|
|
3890
3868
|
return toggleProps;
|
|
@@ -3895,8 +3873,9 @@
|
|
|
3895
3873
|
itemProp = _ref5.item,
|
|
3896
3874
|
indexProp = _ref5.index,
|
|
3897
3875
|
onMouseMove = _ref5.onMouseMove,
|
|
3898
|
-
onClick = _ref5.onClick
|
|
3899
|
-
_ref5
|
|
3876
|
+
onClick = _ref5.onClick;
|
|
3877
|
+
_ref5.onPress;
|
|
3878
|
+
var _ref5$refKey = _ref5.refKey,
|
|
3900
3879
|
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
|
|
3901
3880
|
ref = _ref5.ref,
|
|
3902
3881
|
disabled = _ref5.disabled,
|
|
@@ -3938,7 +3917,10 @@
|
|
|
3938
3917
|
}
|
|
3939
3918
|
}), _extends4), rest);
|
|
3940
3919
|
if (!disabled) {
|
|
3941
|
-
|
|
3920
|
+
/* istanbul ignore next (react-native) */
|
|
3921
|
+
{
|
|
3922
|
+
itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
|
|
3923
|
+
}
|
|
3942
3924
|
}
|
|
3943
3925
|
itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
|
|
3944
3926
|
return itemProps;
|