downshift 7.1.1 → 7.1.3-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 +3 -3
- package/dist/downshift.esm.js +2 -2
- package/dist/downshift.native.cjs.js +3 -3
- package/dist/downshift.umd.js +2 -2
- 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 +2 -2
- package/preact/dist/downshift.cjs.js +3 -3
- package/preact/dist/downshift.esm.js +2 -2
- package/preact/dist/downshift.umd.js +2 -2
- 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.cjs.js
CHANGED
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var PropTypes = require('prop-types');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactIs = require('react-is');
|
|
8
|
-
var
|
|
8
|
+
var compute = require('compute-scroll-into-view');
|
|
9
9
|
var tslib = require('tslib');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
12
|
|
|
13
13
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
14
|
-
var
|
|
14
|
+
var compute__default = /*#__PURE__*/_interopDefaultLegacy(compute);
|
|
15
15
|
|
|
16
16
|
let idCounter = 0;
|
|
17
17
|
|
|
@@ -37,7 +37,7 @@ function scrollIntoView(node, menuNode) {
|
|
|
37
37
|
if (!node) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
const actions =
|
|
40
|
+
const actions = compute__default["default"](node, {
|
|
41
41
|
boundary: menuNode,
|
|
42
42
|
block: 'nearest',
|
|
43
43
|
scrollMode: 'if-needed'
|
package/dist/downshift.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import { Component, cloneElement, useRef, useEffect, useCallback, useLayoutEffect, useReducer, useMemo } from 'react';
|
|
3
3
|
import { isForwardRef } from 'react-is';
|
|
4
|
-
import
|
|
4
|
+
import compute from 'compute-scroll-into-view';
|
|
5
5
|
import { __assign } from 'tslib';
|
|
6
6
|
|
|
7
7
|
let idCounter = 0;
|
|
@@ -28,7 +28,7 @@ function scrollIntoView(node, menuNode) {
|
|
|
28
28
|
if (!node) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
const actions =
|
|
31
|
+
const actions = compute(node, {
|
|
32
32
|
boundary: menuNode,
|
|
33
33
|
block: 'nearest',
|
|
34
34
|
scrollMode: 'if-needed'
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var PropTypes = require('prop-types');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactIs = require('react-is');
|
|
8
|
-
var
|
|
8
|
+
var compute = require('compute-scroll-into-view');
|
|
9
9
|
var tslib = require('tslib');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
12
|
|
|
13
13
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
14
|
-
var
|
|
14
|
+
var compute__default = /*#__PURE__*/_interopDefaultLegacy(compute);
|
|
15
15
|
|
|
16
16
|
let idCounter = 0;
|
|
17
17
|
|
|
@@ -37,7 +37,7 @@ function scrollIntoView(node, menuNode) {
|
|
|
37
37
|
if (!node) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
const actions =
|
|
40
|
+
const actions = compute__default["default"](node, {
|
|
41
41
|
boundary: menuNode,
|
|
42
42
|
block: 'nearest',
|
|
43
43
|
scrollMode: 'if-needed'
|
package/dist/downshift.umd.js
CHANGED
|
@@ -1263,7 +1263,7 @@
|
|
|
1263
1263
|
reactIs.exports = reactIs_development;
|
|
1264
1264
|
}
|
|
1265
1265
|
|
|
1266
|
-
|
|
1266
|
+
let e=e=>"object"==typeof e&&null!=e&&1===e.nodeType,t=(e,t)=>(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e),n=(e,n)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let l=getComputedStyle(e,null);return t(l.overflowY,n)||t(l.overflowX,n)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return !!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return !1},l=(e,t,n,l,i,o,r,d)=>o<e&&r>t||o>e&&r<t?0:o<=e&&d<=n||r>=t&&d>=n?o-e-l:r>t&&d<n||o<e&&d>n?r-t+i:0,i=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var o=(t,o)=>{var r,d,h,f,u,s;if("undefined"==typeof document)return [];let{scrollMode:a,block:c,inline:g,boundary:m,skipOverflowHiddenElements:p}=o,w="function"==typeof m?m:e=>e!==m;if(!e(t))throw new TypeError("Invalid target");let W=document.scrollingElement||document.documentElement,H=[],b=t;for(;e(b)&&w(b);){if(b=i(b),b===W){H.push(b);break}null!=b&&b===document.body&&n(b)&&!n(document.documentElement)||null!=b&&n(b,p)&&H.push(b);}let v=null!=(d=null==(r=window.visualViewport)?void 0:r.width)?d:innerWidth,y=null!=(f=null==(h=window.visualViewport)?void 0:h.height)?f:innerHeight,E=null!=(u=window.scrollX)?u:pageXOffset,M=null!=(s=window.scrollY)?s:pageYOffset,{height:x,width:I,top:C,right:R,bottom:T,left:V}=t.getBoundingClientRect(),k="start"===c||"nearest"===c?C:"end"===c?T:C+x/2,B="center"===g?V+I/2:"end"===g?R:V,D=[];for(let e=0;e<H.length;e++){let t=H[e],{height:n,width:i,top:o,right:r,bottom:d,left:h}=t.getBoundingClientRect();if("if-needed"===a&&C>=0&&V>=0&&T<=y&&R<=v&&C>=o&&T<=d&&V>=h&&R<=r)return D;let f=getComputedStyle(t),u=parseInt(f.borderLeftWidth,10),s=parseInt(f.borderTopWidth,10),m=parseInt(f.borderRightWidth,10),p=parseInt(f.borderBottomWidth,10),w=0,b=0,O="offsetWidth"in t?t.offsetWidth-t.clientWidth-u-m:0,X="offsetHeight"in t?t.offsetHeight-t.clientHeight-s-p:0,Y="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,L="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(W===t)w="start"===c?k:"end"===c?k-y:"nearest"===c?l(M,M+y,y,s,p,M+k,M+k+x,x):k-y/2,b="start"===g?B:"center"===g?B-v/2:"end"===g?B-v:l(E,E+v,v,u,m,E+B,E+B+I,I),w=Math.max(0,w+M),b=Math.max(0,b+E);else {w="start"===c?k-o-s:"end"===c?k-d+p+X:"nearest"===c?l(o,d,n,s,p+X,k,k+x,x):k-(o+n/2)+X/2,b="start"===g?B-h-u:"center"===g?B-(h+i/2)+O/2:"end"===g?B-r+m+O:l(h,r,i,u,m+O,B,B+I,I);let{scrollLeft:e,scrollTop:f}=t;w=Math.max(0,Math.min(f+w/L,t.scrollHeight-n/L+X)),b=Math.max(0,Math.min(e+b/Y,t.scrollWidth-i/Y+O)),k+=f-w,B+=e-b;}D.push({el:t,top:w,left:b});}return D};
|
|
1267
1267
|
|
|
1268
1268
|
let idCounter = 0;
|
|
1269
1269
|
|
|
@@ -1289,7 +1289,7 @@
|
|
|
1289
1289
|
if (!node) {
|
|
1290
1290
|
return;
|
|
1291
1291
|
}
|
|
1292
|
-
const actions =
|
|
1292
|
+
const actions = o(node, {
|
|
1293
1293
|
boundary: menuNode,
|
|
1294
1294
|
block: 'nearest',
|
|
1295
1295
|
scrollMode: 'if-needed'
|