downshift 9.0.7-alpha.2 → 9.0.7
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 +220 -230
- package/dist/downshift.esm.js +59 -60
- package/dist/downshift.native.cjs.js +220 -230
- package/dist/downshift.nativeweb.cjs.js +220 -230
- package/dist/downshift.umd.js +116 -137
- 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 +182 -192
- package/preact/dist/downshift.esm.js +59 -60
- package/preact/dist/downshift.umd.js +170 -192
- package/preact/dist/downshift.umd.js.map +1 -1
- package/preact/dist/downshift.umd.min.js +2 -2
- package/preact/dist/downshift.umd.min.js.map +1 -1
package/dist/downshift.esm.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';
|
|
2
2
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
3
|
-
import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
4
3
|
import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
|
-
import React, { cloneElement, Component, useRef, useEffect,
|
|
5
|
+
import React, { cloneElement, Component, useRef, useEffect, useLayoutEffect, useCallback, useReducer, useMemo } from 'react';
|
|
7
6
|
import { isForwardRef } from 'react-is';
|
|
8
7
|
import { compute } from 'compute-scroll-into-view';
|
|
9
8
|
import { __assign } from 'tslib';
|
|
@@ -471,23 +470,23 @@ var touchEnd = process.env.NODE_ENV !== "production" ? '__autocomplete_touchend_
|
|
|
471
470
|
|
|
472
471
|
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
|
|
473
472
|
__proto__: null,
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
blurButton: blurButton,
|
|
474
|
+
blurInput: blurInput,
|
|
475
|
+
changeInput: changeInput,
|
|
476
|
+
clickButton: clickButton,
|
|
477
|
+
clickItem: clickItem,
|
|
478
|
+
controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
|
|
476
479
|
itemMouseEnter: itemMouseEnter,
|
|
477
|
-
keyDownArrowUp: keyDownArrowUp,
|
|
478
480
|
keyDownArrowDown: keyDownArrowDown,
|
|
479
|
-
|
|
481
|
+
keyDownArrowUp: keyDownArrowUp,
|
|
482
|
+
keyDownEnd: keyDownEnd,
|
|
480
483
|
keyDownEnter: keyDownEnter,
|
|
484
|
+
keyDownEscape: keyDownEscape,
|
|
481
485
|
keyDownHome: keyDownHome,
|
|
482
|
-
keyDownEnd: keyDownEnd,
|
|
483
|
-
clickItem: clickItem,
|
|
484
|
-
blurInput: blurInput,
|
|
485
|
-
changeInput: changeInput,
|
|
486
486
|
keyDownSpaceButton: keyDownSpaceButton,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
touchEnd: touchEnd
|
|
487
|
+
mouseUp: mouseUp,
|
|
488
|
+
touchEnd: touchEnd,
|
|
489
|
+
unknown: unknown
|
|
491
490
|
});
|
|
492
491
|
|
|
493
492
|
var _excluded$3 = ["refKey", "ref"],
|
|
@@ -497,7 +496,6 @@ var _excluded$3 = ["refKey", "ref"],
|
|
|
497
496
|
_excluded5 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
498
497
|
var Downshift = /*#__PURE__*/function () {
|
|
499
498
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
500
|
-
_inheritsLoose(Downshift, _Component);
|
|
501
499
|
function Downshift(_props) {
|
|
502
500
|
var _this;
|
|
503
501
|
_this = _Component.call(this, _props) || this;
|
|
@@ -864,7 +862,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
864
862
|
_this.buttonHandleKeyDown = function (event) {
|
|
865
863
|
var key = normalizeArrowKey(event);
|
|
866
864
|
if (_this.buttonKeyDownHandlers[key]) {
|
|
867
|
-
_this.buttonKeyDownHandlers[key].call(
|
|
865
|
+
_this.buttonKeyDownHandlers[key].call(_this, event);
|
|
868
866
|
}
|
|
869
867
|
};
|
|
870
868
|
_this.buttonHandleClick = function (event) {
|
|
@@ -960,7 +958,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
960
958
|
_this.inputHandleKeyDown = function (event) {
|
|
961
959
|
var key = normalizeArrowKey(event);
|
|
962
960
|
if (key && _this.inputKeyDownHandlers[key]) {
|
|
963
|
-
_this.inputKeyDownHandlers[key].call(
|
|
961
|
+
_this.inputKeyDownHandlers[key].call(_this, event);
|
|
964
962
|
}
|
|
965
963
|
};
|
|
966
964
|
_this.inputHandleChange = function (event) {
|
|
@@ -1164,6 +1162,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1164
1162
|
_this.state = _state;
|
|
1165
1163
|
return _this;
|
|
1166
1164
|
}
|
|
1165
|
+
_inheritsLoose(Downshift, _Component);
|
|
1167
1166
|
var _proto = Downshift.prototype;
|
|
1168
1167
|
/**
|
|
1169
1168
|
* Clear all running timeouts
|
|
@@ -2239,28 +2238,28 @@ var FunctionReset$2 = process.env.NODE_ENV !== "production" ? '__function_reset_
|
|
|
2239
2238
|
|
|
2240
2239
|
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
|
|
2241
2240
|
__proto__: null,
|
|
2241
|
+
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2242
|
+
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2243
|
+
FunctionReset: FunctionReset$2,
|
|
2244
|
+
FunctionSelectItem: FunctionSelectItem$1,
|
|
2245
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2246
|
+
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2247
|
+
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2248
|
+
ItemClick: ItemClick$1,
|
|
2249
|
+
ItemMouseMove: ItemMouseMove$1,
|
|
2250
|
+
MenuMouseLeave: MenuMouseLeave$1,
|
|
2251
|
+
ToggleButtonBlur: ToggleButtonBlur,
|
|
2242
2252
|
ToggleButtonClick: ToggleButtonClick$1,
|
|
2243
2253
|
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
|
|
2244
2254
|
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
|
|
2245
2255
|
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
|
|
2246
|
-
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2247
|
-
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2248
2256
|
ToggleButtonKeyDownEnd: ToggleButtonKeyDownEnd,
|
|
2249
2257
|
ToggleButtonKeyDownEnter: ToggleButtonKeyDownEnter,
|
|
2250
|
-
|
|
2251
|
-
|
|
2258
|
+
ToggleButtonKeyDownEscape: ToggleButtonKeyDownEscape,
|
|
2259
|
+
ToggleButtonKeyDownHome: ToggleButtonKeyDownHome,
|
|
2252
2260
|
ToggleButtonKeyDownPageDown: ToggleButtonKeyDownPageDown,
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
ItemMouseMove: ItemMouseMove$1,
|
|
2256
|
-
ItemClick: ItemClick$1,
|
|
2257
|
-
FunctionToggleMenu: FunctionToggleMenu$1,
|
|
2258
|
-
FunctionOpenMenu: FunctionOpenMenu$1,
|
|
2259
|
-
FunctionCloseMenu: FunctionCloseMenu$1,
|
|
2260
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
|
|
2261
|
-
FunctionSelectItem: FunctionSelectItem$1,
|
|
2262
|
-
FunctionSetInputValue: FunctionSetInputValue$1,
|
|
2263
|
-
FunctionReset: FunctionReset$2
|
|
2261
|
+
ToggleButtonKeyDownPageUp: ToggleButtonKeyDownPageUp,
|
|
2262
|
+
ToggleButtonKeyDownSpaceButton: ToggleButtonKeyDownSpaceButton
|
|
2264
2263
|
});
|
|
2265
2264
|
|
|
2266
2265
|
/* eslint-disable complexity */
|
|
@@ -2469,7 +2468,7 @@ function useSelect(userProps) {
|
|
|
2469
2468
|
}
|
|
2470
2469
|
}, [dispatch, latest]), useMemo(function () {
|
|
2471
2470
|
return [menuRef, toggleButtonRef];
|
|
2472
|
-
}, []));
|
|
2471
|
+
}, [menuRef.current, toggleButtonRef.current]));
|
|
2473
2472
|
var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps');
|
|
2474
2473
|
// Reset itemRefs on close.
|
|
2475
2474
|
useEffect(function () {
|
|
@@ -2793,29 +2792,29 @@ var ControlledPropUpdatedSelectedItem = process.env.NODE_ENV !== "production" ?
|
|
|
2793
2792
|
|
|
2794
2793
|
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
|
|
2795
2794
|
__proto__: null,
|
|
2795
|
+
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem,
|
|
2796
|
+
FunctionCloseMenu: FunctionCloseMenu,
|
|
2797
|
+
FunctionOpenMenu: FunctionOpenMenu,
|
|
2798
|
+
FunctionReset: FunctionReset$1,
|
|
2799
|
+
FunctionSelectItem: FunctionSelectItem,
|
|
2800
|
+
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
2801
|
+
FunctionSetInputValue: FunctionSetInputValue,
|
|
2802
|
+
FunctionToggleMenu: FunctionToggleMenu,
|
|
2803
|
+
InputBlur: InputBlur,
|
|
2804
|
+
InputChange: InputChange,
|
|
2805
|
+
InputClick: InputClick,
|
|
2796
2806
|
InputKeyDownArrowDown: InputKeyDownArrowDown,
|
|
2797
2807
|
InputKeyDownArrowUp: InputKeyDownArrowUp,
|
|
2808
|
+
InputKeyDownEnd: InputKeyDownEnd,
|
|
2809
|
+
InputKeyDownEnter: InputKeyDownEnter,
|
|
2798
2810
|
InputKeyDownEscape: InputKeyDownEscape,
|
|
2799
2811
|
InputKeyDownHome: InputKeyDownHome,
|
|
2800
|
-
InputKeyDownEnd: InputKeyDownEnd,
|
|
2801
|
-
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
2802
2812
|
InputKeyDownPageDown: InputKeyDownPageDown,
|
|
2803
|
-
|
|
2804
|
-
InputChange: InputChange,
|
|
2805
|
-
InputBlur: InputBlur,
|
|
2806
|
-
InputClick: InputClick,
|
|
2807
|
-
MenuMouseLeave: MenuMouseLeave,
|
|
2808
|
-
ItemMouseMove: ItemMouseMove,
|
|
2813
|
+
InputKeyDownPageUp: InputKeyDownPageUp,
|
|
2809
2814
|
ItemClick: ItemClick,
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
FunctionCloseMenu: FunctionCloseMenu,
|
|
2814
|
-
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
|
|
2815
|
-
FunctionSelectItem: FunctionSelectItem,
|
|
2816
|
-
FunctionSetInputValue: FunctionSetInputValue,
|
|
2817
|
-
FunctionReset: FunctionReset$1,
|
|
2818
|
-
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
|
|
2815
|
+
ItemMouseMove: ItemMouseMove,
|
|
2816
|
+
MenuMouseLeave: MenuMouseLeave,
|
|
2817
|
+
ToggleButtonClick: ToggleButtonClick
|
|
2819
2818
|
});
|
|
2820
2819
|
|
|
2821
2820
|
function getInitialState$1(props) {
|
|
@@ -3091,7 +3090,7 @@ function useCombobox(userProps) {
|
|
|
3091
3090
|
}
|
|
3092
3091
|
}, [dispatch, latest]), useMemo(function () {
|
|
3093
3092
|
return [menuRef, toggleButtonRef, inputRef];
|
|
3094
|
-
}, []));
|
|
3093
|
+
}, [menuRef.current, toggleButtonRef.current, inputRef.current]));
|
|
3095
3094
|
var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getMenuProps');
|
|
3096
3095
|
// Reset itemRefs on close.
|
|
3097
3096
|
useEffect(function () {
|
|
@@ -3540,19 +3539,19 @@ var FunctionReset = process.env.NODE_ENV !== "production" ? '__function_reset__'
|
|
|
3540
3539
|
|
|
3541
3540
|
var stateChangeTypes = /*#__PURE__*/Object.freeze({
|
|
3542
3541
|
__proto__: null,
|
|
3543
|
-
SelectedItemClick: SelectedItemClick,
|
|
3544
|
-
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3545
|
-
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3546
|
-
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3547
|
-
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
|
|
3548
|
-
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3549
|
-
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3550
3542
|
DropdownClick: DropdownClick,
|
|
3543
|
+
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
|
|
3544
|
+
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
|
|
3551
3545
|
FunctionAddSelectedItem: FunctionAddSelectedItem,
|
|
3552
3546
|
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
|
|
3553
|
-
|
|
3547
|
+
FunctionReset: FunctionReset,
|
|
3554
3548
|
FunctionSetActiveIndex: FunctionSetActiveIndex,
|
|
3555
|
-
|
|
3549
|
+
FunctionSetSelectedItems: FunctionSetSelectedItems,
|
|
3550
|
+
SelectedItemClick: SelectedItemClick,
|
|
3551
|
+
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
|
|
3552
|
+
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
|
|
3553
|
+
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
|
|
3554
|
+
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious
|
|
3556
3555
|
});
|
|
3557
3556
|
|
|
3558
3557
|
/* eslint-disable complexity */
|