downshift 9.0.8 → 9.0.10
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 +10 -11
- package/dist/downshift.esm.js +10 -11
- package/dist/downshift.native.cjs.js +12 -24
- package/dist/downshift.nativeweb.cjs.js +10 -11
- package/dist/downshift.umd.js +13 -17
- 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 +13 -1
- package/preact/dist/downshift.cjs.js +10 -11
- package/preact/dist/downshift.esm.js +10 -11
- package/preact/dist/downshift.umd.js +13 -17
- 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/typings/index.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "downshift",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.10",
|
|
4
4
|
"description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.",
|
|
5
5
|
"main": "dist/downshift.cjs.js",
|
|
6
6
|
"react-native": "dist/downshift.native.cjs.js",
|
|
@@ -47,6 +47,18 @@
|
|
|
47
47
|
"preact",
|
|
48
48
|
"flow-typed"
|
|
49
49
|
],
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"import": "./dist/downshift.esm.js",
|
|
53
|
+
"require": "./dist/downshift.cjs.js",
|
|
54
|
+
"types": "./typings/index.d.ts",
|
|
55
|
+
"default": "./dist/downshift.esm.js"
|
|
56
|
+
},
|
|
57
|
+
"./react-native": {
|
|
58
|
+
"require": "./dist/downshift.native.cjs.js",
|
|
59
|
+
"types": "./typings/index.d.ts"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
50
62
|
"keywords": [
|
|
51
63
|
"enhanced input",
|
|
52
64
|
"react",
|
|
@@ -1297,7 +1297,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1297
1297
|
_proto.componentDidMount = function componentDidMount() {
|
|
1298
1298
|
var _this4 = this;
|
|
1299
1299
|
/* istanbul ignore if (react-native) */
|
|
1300
|
-
if (process.env.NODE_ENV !== 'production' &&
|
|
1300
|
+
if (process.env.NODE_ENV !== 'production' && true && this.getMenuProps.called && !this.getMenuProps.suppressRefError) {
|
|
1301
1301
|
validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);
|
|
1302
1302
|
}
|
|
1303
1303
|
|
|
@@ -1368,10 +1368,10 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
1370
1370
|
_proto.shouldScroll = function shouldScroll(prevState, prevProps) {
|
|
1371
|
-
var
|
|
1372
|
-
currentHighlightedIndex =
|
|
1373
|
-
var
|
|
1374
|
-
prevHighlightedIndex =
|
|
1371
|
+
var _ref0 = this.props.highlightedIndex === undefined ? this.getState() : this.props,
|
|
1372
|
+
currentHighlightedIndex = _ref0.highlightedIndex;
|
|
1373
|
+
var _ref1 = prevProps.highlightedIndex === undefined ? prevState : prevProps,
|
|
1374
|
+
prevHighlightedIndex = _ref1.highlightedIndex;
|
|
1375
1375
|
var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
|
|
1376
1376
|
var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
|
|
1377
1377
|
return scrollWhenOpen || scrollWhenNavigating;
|
|
@@ -1485,16 +1485,15 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1485
1485
|
Downshift.stateChangeTypes = stateChangeTypes$3;
|
|
1486
1486
|
return Downshift;
|
|
1487
1487
|
}();
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
var refKey = _ref12.refKey;
|
|
1488
|
+
function validateGetMenuPropsCalledCorrectly(node, _ref10) {
|
|
1489
|
+
var refKey = _ref10.refKey;
|
|
1491
1490
|
if (!node) {
|
|
1492
1491
|
// eslint-disable-next-line no-console
|
|
1493
1492
|
console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
|
|
1494
1493
|
}
|
|
1495
1494
|
}
|
|
1496
|
-
function validateGetRootPropsCalledCorrectly(element,
|
|
1497
|
-
var refKey =
|
|
1495
|
+
function validateGetRootPropsCalledCorrectly(element, _ref11) {
|
|
1496
|
+
var refKey = _ref11.refKey;
|
|
1498
1497
|
var refKeySpecified = refKey !== 'ref';
|
|
1499
1498
|
var isComposite = !isDOMElement(element);
|
|
1500
1499
|
if (isComposite && !refKeySpecified && !reactIs.isForwardRef(element)) {
|
|
@@ -3834,7 +3833,7 @@ function useMultipleSelection(userProps) {
|
|
|
3834
3833
|
};
|
|
3835
3834
|
}
|
|
3836
3835
|
|
|
3837
|
-
exports.default = Downshift
|
|
3836
|
+
exports.default = Downshift;
|
|
3838
3837
|
exports.resetIdCounter = resetIdCounter;
|
|
3839
3838
|
exports.useCombobox = useCombobox;
|
|
3840
3839
|
exports.useMultipleSelection = useMultipleSelection;
|
|
@@ -1293,7 +1293,7 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1293
1293
|
_proto.componentDidMount = function componentDidMount() {
|
|
1294
1294
|
var _this4 = this;
|
|
1295
1295
|
/* istanbul ignore if (react-native) */
|
|
1296
|
-
if (process.env.NODE_ENV !== 'production' &&
|
|
1296
|
+
if (process.env.NODE_ENV !== 'production' && true && this.getMenuProps.called && !this.getMenuProps.suppressRefError) {
|
|
1297
1297
|
validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);
|
|
1298
1298
|
}
|
|
1299
1299
|
|
|
@@ -1364,10 +1364,10 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
};
|
|
1366
1366
|
_proto.shouldScroll = function shouldScroll(prevState, prevProps) {
|
|
1367
|
-
var
|
|
1368
|
-
currentHighlightedIndex =
|
|
1369
|
-
var
|
|
1370
|
-
prevHighlightedIndex =
|
|
1367
|
+
var _ref0 = this.props.highlightedIndex === undefined ? this.getState() : this.props,
|
|
1368
|
+
currentHighlightedIndex = _ref0.highlightedIndex;
|
|
1369
|
+
var _ref1 = prevProps.highlightedIndex === undefined ? prevState : prevProps,
|
|
1370
|
+
prevHighlightedIndex = _ref1.highlightedIndex;
|
|
1371
1371
|
var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
|
|
1372
1372
|
var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
|
|
1373
1373
|
return scrollWhenOpen || scrollWhenNavigating;
|
|
@@ -1481,16 +1481,15 @@ var Downshift = /*#__PURE__*/function () {
|
|
|
1481
1481
|
Downshift.stateChangeTypes = stateChangeTypes$3;
|
|
1482
1482
|
return Downshift;
|
|
1483
1483
|
}();
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
var refKey = _ref12.refKey;
|
|
1484
|
+
function validateGetMenuPropsCalledCorrectly(node, _ref10) {
|
|
1485
|
+
var refKey = _ref10.refKey;
|
|
1487
1486
|
if (!node) {
|
|
1488
1487
|
// eslint-disable-next-line no-console
|
|
1489
1488
|
console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
|
|
1490
1489
|
}
|
|
1491
1490
|
}
|
|
1492
|
-
function validateGetRootPropsCalledCorrectly(element,
|
|
1493
|
-
var refKey =
|
|
1491
|
+
function validateGetRootPropsCalledCorrectly(element, _ref11) {
|
|
1492
|
+
var refKey = _ref11.refKey;
|
|
1494
1493
|
var refKeySpecified = refKey !== 'ref';
|
|
1495
1494
|
var isComposite = !isDOMElement(element);
|
|
1496
1495
|
if (isComposite && !refKeySpecified && !isForwardRef(element)) {
|
|
@@ -3830,4 +3829,4 @@ function useMultipleSelection(userProps) {
|
|
|
3830
3829
|
};
|
|
3831
3830
|
}
|
|
3832
3831
|
|
|
3833
|
-
export { Downshift
|
|
3832
|
+
export { Downshift as default, resetIdCounter, useCombobox, useMultipleSelection, useSelect };
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
if (null == r) return {};
|
|
9
9
|
var t = {};
|
|
10
10
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
11
|
-
if (e.
|
|
11
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
12
12
|
t[n] = r[n];
|
|
13
13
|
}
|
|
14
14
|
return t;
|
|
@@ -271,7 +271,7 @@
|
|
|
271
271
|
|
|
272
272
|
var reactIsExports = reactIs.exports;
|
|
273
273
|
|
|
274
|
-
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
|
|
274
|
+
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 false},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{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,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=x-T,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:l,width:r,top:i,right:s,bottom:d,left:h}=e.getBoundingClientRect();if(x>=0&&R>=0&&I<=H&&C<=b&&(e===m&&!n(e)||x>=i&&I<=d&&R>=h&&C<=s))return L;const a=getComputedStyle(e),g=parseInt(a.borderLeftWidth,10),p=parseInt(a.borderTopWidth,10),W=parseInt(a.borderRightWidth,10),T=parseInt(a.borderBottomWidth,10);let B=0,F=0;const V="offsetWidth"in e?e.offsetWidth-e.clientWidth-g-W:0,S="offsetHeight"in e?e.offsetHeight-e.clientHeight-p-T:0,X="offsetWidth"in e?0===e.offsetWidth?0:r/e.offsetWidth:0,Y="offsetHeight"in e?0===e.offsetHeight?0:l/e.offsetHeight:0;if(m===e)B=o(M,M+H,H,p,T,M+k,M+k+v,v),F="start"===u?D:"center"===u?D-b/2:"end"===u?D-b:o(y,y+b,b,g,W,y+D,y+D+E,E),B=Math.max(0,B+M),F=Math.max(0,F+y);else {B=o(i,d,l,p,T+S,k,k+v,v),F="start"===u?D-h-g:"center"===u?D-(h+r/2)+V/2:"end"===u?D-s+W+V:o(h,s,r,g,W+V,D,D+E,E);const{scrollLeft:t,scrollTop:n}=e;B=0===Y?0:Math.max(0,Math.min(n+B/Y,e.scrollHeight-l/Y+S)),F=0===X?0:Math.max(0,Math.min(t+F/X,e.scrollWidth-r/X+V)),k+=n-B,D+=t-F;}L.push({el:e,top:B,left:F});}return L};
|
|
275
275
|
|
|
276
276
|
var idCounter = 0;
|
|
277
277
|
|
|
@@ -298,10 +298,7 @@
|
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
var actions = r(node, {
|
|
301
|
-
boundary: menuNode
|
|
302
|
-
block: 'nearest',
|
|
303
|
-
scrollMode: 'if-needed'
|
|
304
|
-
});
|
|
301
|
+
boundary: menuNode});
|
|
305
302
|
actions.forEach(function (_ref) {
|
|
306
303
|
var el = _ref.el,
|
|
307
304
|
top = _ref.top,
|
|
@@ -1626,10 +1623,10 @@
|
|
|
1626
1623
|
}
|
|
1627
1624
|
};
|
|
1628
1625
|
_proto.shouldScroll = function shouldScroll(prevState, prevProps) {
|
|
1629
|
-
var
|
|
1630
|
-
currentHighlightedIndex =
|
|
1631
|
-
var
|
|
1632
|
-
prevHighlightedIndex =
|
|
1626
|
+
var _ref0 = this.props.highlightedIndex === undefined ? this.getState() : this.props,
|
|
1627
|
+
currentHighlightedIndex = _ref0.highlightedIndex;
|
|
1628
|
+
var _ref1 = prevProps.highlightedIndex === undefined ? prevState : prevProps,
|
|
1629
|
+
prevHighlightedIndex = _ref1.highlightedIndex;
|
|
1633
1630
|
var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
|
|
1634
1631
|
var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
|
|
1635
1632
|
return scrollWhenOpen || scrollWhenNavigating;
|
|
@@ -1740,16 +1737,15 @@
|
|
|
1740
1737
|
Downshift.stateChangeTypes = stateChangeTypes$3;
|
|
1741
1738
|
return Downshift;
|
|
1742
1739
|
}();
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
var refKey = _ref12.refKey;
|
|
1740
|
+
function validateGetMenuPropsCalledCorrectly(node, _ref10) {
|
|
1741
|
+
var refKey = _ref10.refKey;
|
|
1746
1742
|
if (!node) {
|
|
1747
1743
|
// eslint-disable-next-line no-console
|
|
1748
1744
|
console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
|
|
1749
1745
|
}
|
|
1750
1746
|
}
|
|
1751
|
-
function validateGetRootPropsCalledCorrectly(element,
|
|
1752
|
-
var refKey =
|
|
1747
|
+
function validateGetRootPropsCalledCorrectly(element, _ref11) {
|
|
1748
|
+
var refKey = _ref11.refKey;
|
|
1753
1749
|
var refKeySpecified = refKey !== 'ref';
|
|
1754
1750
|
var isComposite = !isDOMElement(element);
|
|
1755
1751
|
if (isComposite && !refKeySpecified && !reactIsExports.isForwardRef(element)) {
|
|
@@ -2418,7 +2414,7 @@
|
|
|
2418
2414
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2419
2415
|
PERFORMANCE OF THIS SOFTWARE.
|
|
2420
2416
|
***************************************************************************** */
|
|
2421
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
2417
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
2422
2418
|
|
|
2423
2419
|
|
|
2424
2420
|
var __assign = function() {
|
|
@@ -4122,7 +4118,7 @@
|
|
|
4122
4118
|
};
|
|
4123
4119
|
}
|
|
4124
4120
|
|
|
4125
|
-
exports.default = Downshift
|
|
4121
|
+
exports.default = Downshift;
|
|
4126
4122
|
exports.resetIdCounter = resetIdCounter;
|
|
4127
4123
|
exports.useCombobox = useCombobox;
|
|
4128
4124
|
exports.useMultipleSelection = useMultipleSelection;
|