downshift 9.0.0-alpha.0 → 9.0.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 +3 -5
- package/dist/downshift.esm.js +3 -4
- package/dist/downshift.native.cjs.js +3 -5
- package/dist/downshift.nativeweb.cjs.js +3 -5
- package/dist/downshift.umd.js +5 -12
- 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 +3 -5
- package/preact/dist/downshift.esm.js +3 -4
- package/preact/dist/downshift.umd.js +5 -12
- 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.cjs.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
|
-
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
8
7
|
var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
|
|
9
8
|
var PropTypes = require('prop-types');
|
|
10
9
|
var React = require('react');
|
|
@@ -16,7 +15,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
15
|
|
|
17
16
|
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
18
17
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
19
|
-
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
20
18
|
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
|
|
21
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
@@ -510,7 +508,6 @@ var _excluded$3 = ["refKey", "ref"],
|
|
|
510
508
|
_excluded5 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
511
509
|
var Downshift = /*#__PURE__*/function () {
|
|
512
510
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
513
|
-
_inheritsLoose__default["default"](Downshift, _Component);
|
|
514
511
|
function Downshift(_props) {
|
|
515
512
|
var _this;
|
|
516
513
|
_this = _Component.call(this, _props) || this;
|
|
@@ -877,7 +874,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
877
874
|
_this.buttonHandleKeyDown = function (event) {
|
|
878
875
|
var key = normalizeArrowKey(event);
|
|
879
876
|
if (_this.buttonKeyDownHandlers[key]) {
|
|
880
|
-
_this.buttonKeyDownHandlers[key].call(
|
|
877
|
+
_this.buttonKeyDownHandlers[key].call(_this, event);
|
|
881
878
|
}
|
|
882
879
|
};
|
|
883
880
|
_this.buttonHandleClick = function (event) {
|
|
@@ -973,7 +970,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
973
970
|
_this.inputHandleKeyDown = function (event) {
|
|
974
971
|
var key = normalizeArrowKey(event);
|
|
975
972
|
if (key && _this.inputKeyDownHandlers[key]) {
|
|
976
|
-
_this.inputKeyDownHandlers[key].call(
|
|
973
|
+
_this.inputKeyDownHandlers[key].call(_this, event);
|
|
977
974
|
}
|
|
978
975
|
};
|
|
979
976
|
_this.inputHandleChange = function (event) {
|
|
@@ -1177,6 +1174,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1177
1174
|
_this.state = _state;
|
|
1178
1175
|
return _this;
|
|
1179
1176
|
}
|
|
1177
|
+
_inheritsLoose__default["default"](Downshift, _Component);
|
|
1180
1178
|
var _proto = Downshift.prototype;
|
|
1181
1179
|
/**
|
|
1182
1180
|
* Clear all running timeouts
|
package/dist/downshift.esm.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
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
5
|
import React, { cloneElement, Component, useRef, useEffect, useCallback, useLayoutEffect, useReducer, useMemo } from 'react';
|
|
@@ -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
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
|
-
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
8
7
|
var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
|
|
9
8
|
var PropTypes = require('prop-types');
|
|
10
9
|
var React = require('react');
|
|
@@ -16,7 +15,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
15
|
|
|
17
16
|
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
18
17
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
19
|
-
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
20
18
|
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
|
|
21
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
@@ -480,7 +478,6 @@ var _excluded$3 = ["refKey", "ref"],
|
|
|
480
478
|
_excluded5 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
481
479
|
var Downshift = /*#__PURE__*/function () {
|
|
482
480
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
483
|
-
_inheritsLoose__default["default"](Downshift, _Component);
|
|
484
481
|
function Downshift(_props) {
|
|
485
482
|
var _this;
|
|
486
483
|
_this = _Component.call(this, _props) || this;
|
|
@@ -845,7 +842,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
845
842
|
_this.buttonHandleKeyDown = function (event) {
|
|
846
843
|
var key = normalizeArrowKey(event);
|
|
847
844
|
if (_this.buttonKeyDownHandlers[key]) {
|
|
848
|
-
_this.buttonKeyDownHandlers[key].call(
|
|
845
|
+
_this.buttonKeyDownHandlers[key].call(_this, event);
|
|
849
846
|
}
|
|
850
847
|
};
|
|
851
848
|
_this.buttonHandleClick = function (event) {
|
|
@@ -945,7 +942,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
945
942
|
_this.inputHandleKeyDown = function (event) {
|
|
946
943
|
var key = normalizeArrowKey(event);
|
|
947
944
|
if (key && _this.inputKeyDownHandlers[key]) {
|
|
948
|
-
_this.inputKeyDownHandlers[key].call(
|
|
945
|
+
_this.inputKeyDownHandlers[key].call(_this, event);
|
|
949
946
|
}
|
|
950
947
|
};
|
|
951
948
|
_this.inputHandleChange = function (event) {
|
|
@@ -1149,6 +1146,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1149
1146
|
_this.state = _state;
|
|
1150
1147
|
return _this;
|
|
1151
1148
|
}
|
|
1149
|
+
_inheritsLoose__default["default"](Downshift, _Component);
|
|
1152
1150
|
var _proto = Downshift.prototype;
|
|
1153
1151
|
/**
|
|
1154
1152
|
* Clear all running timeouts
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
6
6
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
7
|
-
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
8
7
|
var _inheritsLoose = require('@babel/runtime/helpers/inheritsLoose');
|
|
9
8
|
var PropTypes = require('prop-types');
|
|
10
9
|
var React = require('react');
|
|
@@ -16,7 +15,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
15
|
|
|
17
16
|
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
18
17
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
19
|
-
var _assertThisInitialized__default = /*#__PURE__*/_interopDefaultLegacy(_assertThisInitialized);
|
|
20
18
|
var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
|
|
21
19
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
22
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
@@ -510,7 +508,6 @@ var _excluded$3 = ["refKey", "ref"],
|
|
|
510
508
|
_excluded5 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
511
509
|
var Downshift = /*#__PURE__*/function () {
|
|
512
510
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
513
|
-
_inheritsLoose__default["default"](Downshift, _Component);
|
|
514
511
|
function Downshift(_props) {
|
|
515
512
|
var _this;
|
|
516
513
|
_this = _Component.call(this, _props) || this;
|
|
@@ -875,7 +872,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
875
872
|
_this.buttonHandleKeyDown = function (event) {
|
|
876
873
|
var key = normalizeArrowKey(event);
|
|
877
874
|
if (_this.buttonKeyDownHandlers[key]) {
|
|
878
|
-
_this.buttonKeyDownHandlers[key].call(
|
|
875
|
+
_this.buttonKeyDownHandlers[key].call(_this, event);
|
|
879
876
|
}
|
|
880
877
|
};
|
|
881
878
|
_this.buttonHandleClick = function (event) {
|
|
@@ -971,7 +968,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
971
968
|
_this.inputHandleKeyDown = function (event) {
|
|
972
969
|
var key = normalizeArrowKey(event);
|
|
973
970
|
if (key && _this.inputKeyDownHandlers[key]) {
|
|
974
|
-
_this.inputKeyDownHandlers[key].call(
|
|
971
|
+
_this.inputKeyDownHandlers[key].call(_this, event);
|
|
975
972
|
}
|
|
976
973
|
};
|
|
977
974
|
_this.inputHandleChange = function (event) {
|
|
@@ -1175,6 +1172,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1175
1172
|
_this.state = _state;
|
|
1176
1173
|
return _this;
|
|
1177
1174
|
}
|
|
1175
|
+
_inheritsLoose__default["default"](Downshift, _Component);
|
|
1178
1176
|
var _proto = Downshift.prototype;
|
|
1179
1177
|
/**
|
|
1180
1178
|
* Clear all running timeouts
|
package/dist/downshift.umd.js
CHANGED
|
@@ -36,13 +36,6 @@
|
|
|
36
36
|
return _extends.apply(this, arguments);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function _assertThisInitialized(self) {
|
|
40
|
-
if (self === void 0) {
|
|
41
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
42
|
-
}
|
|
43
|
-
return self;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
39
|
function _setPrototypeOf(o, p) {
|
|
47
40
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
48
41
|
o.__proto__ = p;
|
|
@@ -1379,7 +1372,7 @@
|
|
|
1379
1372
|
|
|
1380
1373
|
var reactIsExports = reactIs.exports;
|
|
1381
1374
|
|
|
1382
|
-
const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o=(t,e,n,o,
|
|
1375
|
+
const t=t=>"object"==typeof t&&null!=t&&1===t.nodeType,e=(t,e)=>(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t),n=(t,n)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)||(t=>{const e=(t=>{if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}})(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)})(t)}return !1},o=(t,e,n,o,l,r,i,s)=>r<t&&i>e||r>t&&i<e?0:r<=t&&s<=n||i>=e&&s>=n?r-t-o:i>e&&s<n||r<t&&s>n?i-e+l:0,l=t=>{const e=t.parentElement;return null==e?t.getRootNode().host||null:e},r=(e,r)=>{var i,s,d,h;if("undefined"==typeof document)return [];const{scrollMode:c,block:f,inline:u,boundary:a,skipOverflowHiddenElements:g}=r,p="function"==typeof a?a:t=>t!==a;if(!t(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,w=[];let W=e;for(;t(W)&&p(W);){if(W=l(W),W===m){w.push(W);break}null!=W&&W===document.body&&n(W)&&!n(document.documentElement)||null!=W&&n(W,g)&&w.push(W);}const b=null!=(s=null==(i=window.visualViewport)?void 0:i.width)?s:innerWidth,H=null!=(h=null==(d=window.visualViewport)?void 0:d.height)?h:innerHeight,{scrollX:y,scrollY:M}=window,{height:v,width:E,top:x,right:C,bottom:I,left:R}=e.getBoundingClientRect(),{top:T,right:B,bottom:F,left:V}=(t=>{const e=window.getComputedStyle(t);return {top:parseFloat(e.scrollMarginTop)||0,right:parseFloat(e.scrollMarginRight)||0,bottom:parseFloat(e.scrollMarginBottom)||0,left:parseFloat(e.scrollMarginLeft)||0}})(e);let k="start"===f||"nearest"===f?x-T:"end"===f?I+F:x+v/2-T+F,D="center"===u?R+E/2-V+B:"end"===u?C+B:R-V;const L=[];for(let t=0;t<w.length;t++){const e=w[t],{height:n,width:l,top:r,right:i,bottom:s,left:d}=e.getBoundingClientRect();if("if-needed"===c&&x>=0&&R>=0&&I<=H&&C<=b&&x>=r&&I<=s&&R>=d&&C<=i)return L;const h=getComputedStyle(e),a=parseInt(h.borderLeftWidth,10),g=parseInt(h.borderTopWidth,10),p=parseInt(h.borderRightWidth,10),W=parseInt(h.borderBottomWidth,10);let T=0,B=0;const F="offsetWidth"in e?e.offsetWidth-e.clientWidth-a-p:0,V="offsetHeight"in e?e.offsetHeight-e.clientHeight-g-W:0,S="offsetWidth"in e?0===e.offsetWidth?0:l/e.offsetWidth:0,X="offsetHeight"in e?0===e.offsetHeight?0:n/e.offsetHeight:0;if(m===e)T="start"===f?k:"end"===f?k-H:"nearest"===f?o(M,M+H,H,g,W,M+k,M+k+v,v):k-H/2,B="start"===u?D:"center"===u?D-b/2:"end"===u?D-b:o(y,y+b,b,a,p,y+D,y+D+E,E),T=Math.max(0,T+M),B=Math.max(0,B+y);else {T="start"===f?k-r-g:"end"===f?k-s+W+V:"nearest"===f?o(r,s,n,g,W+V,k,k+v,v):k-(r+n/2)+V/2,B="start"===u?D-d-a:"center"===u?D-(d+l/2)+F/2:"end"===u?D-i+p+F:o(d,i,l,a,p+F,D,D+E,E);const{scrollLeft:t,scrollTop:h}=e;T=0===X?0:Math.max(0,Math.min(h+T/X,e.scrollHeight-n/X+V)),B=0===S?0:Math.max(0,Math.min(t+B/S,e.scrollWidth-l/S+F)),k+=h-T,D+=t-B;}L.push({el:e,top:T,left:B});}return L};
|
|
1383
1376
|
|
|
1384
1377
|
var idCounter = 0;
|
|
1385
1378
|
|
|
@@ -1405,7 +1398,7 @@
|
|
|
1405
1398
|
if (!node) {
|
|
1406
1399
|
return;
|
|
1407
1400
|
}
|
|
1408
|
-
var actions =
|
|
1401
|
+
var actions = r(node, {
|
|
1409
1402
|
boundary: menuNode,
|
|
1410
1403
|
block: 'nearest',
|
|
1411
1404
|
scrollMode: 'if-needed'
|
|
@@ -1870,7 +1863,6 @@
|
|
|
1870
1863
|
_excluded5 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
|
|
1871
1864
|
var Downshift = /*#__PURE__*/function () {
|
|
1872
1865
|
var Downshift = /*#__PURE__*/function (_Component) {
|
|
1873
|
-
_inheritsLoose(Downshift, _Component);
|
|
1874
1866
|
function Downshift(_props) {
|
|
1875
1867
|
var _this;
|
|
1876
1868
|
_this = _Component.call(this, _props) || this;
|
|
@@ -2237,7 +2229,7 @@
|
|
|
2237
2229
|
_this.buttonHandleKeyDown = function (event) {
|
|
2238
2230
|
var key = normalizeArrowKey(event);
|
|
2239
2231
|
if (_this.buttonKeyDownHandlers[key]) {
|
|
2240
|
-
_this.buttonKeyDownHandlers[key].call(
|
|
2232
|
+
_this.buttonKeyDownHandlers[key].call(_this, event);
|
|
2241
2233
|
}
|
|
2242
2234
|
};
|
|
2243
2235
|
_this.buttonHandleClick = function (event) {
|
|
@@ -2329,7 +2321,7 @@
|
|
|
2329
2321
|
_this.inputHandleKeyDown = function (event) {
|
|
2330
2322
|
var key = normalizeArrowKey(event);
|
|
2331
2323
|
if (key && _this.inputKeyDownHandlers[key]) {
|
|
2332
|
-
_this.inputKeyDownHandlers[key].call(
|
|
2324
|
+
_this.inputKeyDownHandlers[key].call(_this, event);
|
|
2333
2325
|
}
|
|
2334
2326
|
};
|
|
2335
2327
|
_this.inputHandleChange = function (event) {
|
|
@@ -2533,6 +2525,7 @@
|
|
|
2533
2525
|
_this.state = _state;
|
|
2534
2526
|
return _this;
|
|
2535
2527
|
}
|
|
2528
|
+
_inheritsLoose(Downshift, _Component);
|
|
2536
2529
|
var _proto = Downshift.prototype;
|
|
2537
2530
|
/**
|
|
2538
2531
|
* Clear all running timeouts
|