@fluentui/react-positioning 0.0.0-nightlyc9ccb6f37d20211122.1 → 0.0.0-nightlycc44f3625c20211220.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +75 -10
- package/CHANGELOG.md +24 -8
- package/dist/react-positioning.d.ts +3 -3
- package/lib/createArrowStyles.d.ts +3 -3
- package/lib/createArrowStyles.js +48 -50
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +17 -15
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/usePopper.js +362 -312
- package/lib/usePopper.js.map +1 -1
- package/lib/usePopperMouseTarget.js +28 -22
- package/lib/usePopperMouseTarget.js.map +1 -1
- package/lib/utils/getBasePlacement.js +1 -1
- package/lib/utils/getBasePlacement.js.map +1 -1
- package/lib/utils/getBoundary.js +15 -10
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +39 -35
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +46 -32
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +29 -24
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/positioningHelper.d.ts +2 -2
- package/lib/utils/positioningHelper.js +38 -30
- package/lib/utils/positioningHelper.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js +57 -19
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/useCallbackRef.js +35 -29
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/createArrowStyles.d.ts +3 -3
- package/lib-commonjs/createArrowStyles.js +55 -51
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +23 -16
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +26 -5
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js +4 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePopper.js +376 -316
- package/lib-commonjs/usePopper.js.map +1 -1
- package/lib-commonjs/usePopperMouseTarget.js +38 -25
- package/lib-commonjs/usePopperMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/getBasePlacement.js +7 -2
- package/lib-commonjs/utils/getBasePlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +23 -12
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +44 -36
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +53 -33
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/index.js +14 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +35 -25
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/positioningHelper.d.ts +2 -2
- package/lib-commonjs/utils/positioningHelper.js +46 -31
- package/lib-commonjs/utils/positioningHelper.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +65 -22
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +45 -32
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/package.json +8 -8
package/lib/usePopper.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/usePopper.ts"],"names":[],"mappings":"AAAA,SAAS,gBAAT,EAA2B,yBAA3B,EAAsD,aAAtD,EAAqE,SAArE,QAAsF,2BAAtF;AACA,SAAS,SAAT,QAA0B,iCAA1B;AACA,SACE,eADF,EAEE,gBAFF,EAGE,YAHF,EAIE,qBAJF,EAKE,WALF,EAME,cANF,EAOE,gBAPF,QAQO,eARP;AASA,OAAO,KAAK,QAAZ,MAA0B,gBAA1B;AACA,OAAO,KAAK,KAAZ,MAAuB,OAAvB,C,CA4BA;AACA;AAC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AAY,CAAC,OAAjB,EAA0B;AACxB,cAAM,WAAW,GAAG,YAAY,CAAC,OAAjC;AACA,cAAM,UAAU,GAAG,CAAA,EAAA,GAAA,WAAW,CAAC,aAAZ,MAAyB,IAAzB,IAAyB,EAAA,KAAA,KAAA,CAAzB,GAAyB,KAAA,CAAzB,GAAyB,EAAA,CAAE,gBAAF,CAAmB,WAAnB,EAAgC,UAAU,CAAC,YAA3C,EAAyD;AACnG,UAAA,UAAU,EAAE;AADuF,SAAzD,CAA5C;;AAIA,eAAO,UAAU,KAAA,IAAV,IAAA,UAAU,KAAA,KAAA,CAAV,GAAU,KAAA,CAAV,GAAA,UAAU,CAAE,QAAZ,EAAP,EAA+B;AAC7B,gBAAM,IAAI,GAAG,UAAU,CAAC,WAAxB,CAD6B,CAE7B;;AACA,UAAA,OAAO,CAAC,IAAR,CAAa,WAAb,EAA0B,IAA1B,EAH6B,CAI7B;;AACA,UAAA,OAAO,CAAC,IAAR,CACE,CACE,gGADF,EAEE,qGAFF,EAGE,2EAHF,EAIE,uEAJF,EAKE,IALF,EAME,yFANF,EAOE,oGAPF,EAQE,kGARF,EASE,WATF,EAUE,4FAVF,EAWE,6FAXF,EAYE,IAZF,EAaE,2FAbF,EAcE,2CAdF,EAeE,8EAfF,EAgBE,IAhBF,CAgBO,GAhBP,CADF;AAmBD;AACF,OAhCkB,CAiCnB;AACA;AACA;;AACD,KApCD,EAoCG,EApCH;AAqCD;;AAED,SAAO;AAAE,IAAA,SAAF;AAAa,IAAA,YAAb;AAA2B,IAAA;AAA3B,GAAP;AACD","sourceRoot":""}
|
@@ -8,27 +8,33 @@ import { createVirtualElementFromClick } from './createVirtualElementFromClick';
|
|
8
8
|
* @param initialState - initializes a user provided state similare to useState
|
9
9
|
* @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
|
10
10
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
11
|
+
|
12
|
+
export const usePopperMouseTarget = initialState => {
|
13
|
+
const [virtualElement, setVirtualElement] = React.useState(initialState);
|
14
|
+
|
15
|
+
const setVirtualMouseTarget = event => {
|
16
|
+
if (event === undefined || event === null) {
|
17
|
+
setVirtualElement(undefined);
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
|
21
|
+
let mouseevent;
|
22
|
+
|
23
|
+
if (!(event instanceof MouseEvent)) {
|
24
|
+
mouseevent = event.nativeEvent;
|
25
|
+
} else {
|
26
|
+
mouseevent = event;
|
27
|
+
}
|
28
|
+
|
29
|
+
if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {
|
30
|
+
// eslint-disable-next-line no-console
|
31
|
+
console.error('usePopperMouseTarget should only be used with MouseEvent');
|
32
|
+
}
|
33
|
+
|
34
|
+
const contextTarget = createVirtualElementFromClick(mouseevent);
|
35
|
+
setVirtualElement(contextTarget);
|
36
|
+
};
|
37
|
+
|
38
|
+
return [virtualElement, setVirtualMouseTarget];
|
33
39
|
};
|
34
40
|
//# sourceMappingURL=usePopperMouseTarget.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../src/usePopperMouseTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,6BAAT,QAA8C,iCAA9C;AAGA;;;;;;;AAOG;;AACH,OAAO,MAAM,oBAAoB,GAAI,YAAD,IAA6E;AAC/G,QAAM,CAAC,cAAD,EAAiB,iBAAjB,IAAsC,KAAK,CAAC,QAAN,CAAoD,YAApD,CAA5C;;AAEA,QAAM,qBAAqB,GAAI,KAAD,IAA4D;AACxF,QAAI,KAAK,KAAK,SAAV,IAAuB,KAAK,KAAK,IAArC,EAA2C;AACzC,MAAA,iBAAiB,CAAC,SAAD,CAAjB;AACA;AACD;;AAED,QAAI,UAAJ;;AACA,QAAI,EAAE,KAAK,YAAY,UAAnB,CAAJ,EAAoC;AAClC,MAAA,UAAU,GAAG,KAAK,CAAC,WAAnB;AACD,KAFD,MAEO;AACL,MAAA,UAAU,GAAG,KAAb;AACD;;AAED,QAAI,EAAE,UAAU,YAAY,UAAxB,KAAuC,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAApE,EAAkF;AAChF;AACA,MAAA,OAAO,CAAC,KAAR,CAAc,0DAAd;AACD;;AAED,UAAM,aAAa,GAAG,6BAA6B,CAAC,UAAD,CAAnD;AACA,IAAA,iBAAiB,CAAC,aAAD,CAAjB;AACD,GApBD;;AAsBA,SAAO,CAAC,cAAD,EAAiB,qBAAjB,CAAP;AACD,CA1BM","sourceRoot":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/utils/getBasePlacement.ts"],"names":[],"mappings":"AAEA;;;;;AAKG;AACH,OAAM,SAAU,gBAAV,CAA2B,SAA3B,EAAwD;AAC5D,SAAO,SAAS,CAAC,KAAV,CAAgB,GAAhB,EAAqB,CAArB,CAAP;AACD","sourceRoot":""}
|
package/lib/utils/getBoundary.js
CHANGED
@@ -2,17 +2,22 @@ import { getScrollParent } from './getScrollParent';
|
|
2
2
|
/**
|
3
3
|
* Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
|
4
4
|
*/
|
5
|
+
|
5
6
|
export function getBoundary(element, boundary) {
|
6
|
-
|
7
|
-
|
7
|
+
if (boundary === 'window') {
|
8
|
+
return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
9
|
+
}
|
10
|
+
|
11
|
+
if (boundary === 'scrollParent') {
|
12
|
+
let boundariesNode = getScrollParent(element);
|
13
|
+
|
14
|
+
if (boundariesNode.nodeName === 'BODY') {
|
15
|
+
boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
8
16
|
}
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return boundariesNode;
|
15
|
-
}
|
16
|
-
return boundary;
|
17
|
+
|
18
|
+
return boundariesNode;
|
19
|
+
}
|
20
|
+
|
21
|
+
return boundary;
|
17
22
|
}
|
18
23
|
//# sourceMappingURL=getBoundary.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/utils/getBoundary.ts"],"names":[],"mappings":"AAEA,SAAS,eAAT,QAAgC,mBAAhC;AAGA;;AAEG;;AACH,OAAM,SAAU,WAAV,CAAsB,OAAtB,EAAmD,QAAnD,EAAsE;AAC1E,MAAI,QAAQ,KAAK,QAAjB,EAA2B;AACzB,WAAO,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAA/B;AACD;;AAED,MAAI,QAAQ,KAAK,cAAjB,EAAiC;AAC/B,QAAI,cAAc,GAA4B,eAAe,CAAC,OAAD,CAA7D;;AAEA,QAAI,cAAc,CAAC,QAAf,KAA4B,MAAhC,EAAwC;AACtC,MAAA,cAAc,GAAG,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAE,aAAT,CAAwB,eAAzC;AACD;;AAED,WAAO,cAAP;AACD;;AAED,SAAO,QAAP;AACD","sourceRoot":""}
|
@@ -1,42 +1,46 @@
|
|
1
1
|
var WorkTag;
|
2
|
+
|
2
3
|
(function (WorkTag) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
4
|
+
WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
|
5
|
+
WorkTag[WorkTag["ClassComponent"] = 1] = "ClassComponent";
|
6
|
+
WorkTag[WorkTag["IndeterminateComponent"] = 2] = "IndeterminateComponent";
|
7
|
+
WorkTag[WorkTag["HostRoot"] = 3] = "HostRoot";
|
8
|
+
WorkTag[WorkTag["HostPortal"] = 4] = "HostPortal";
|
9
|
+
WorkTag[WorkTag["HostComponent"] = 5] = "HostComponent";
|
10
|
+
WorkTag[WorkTag["HostText"] = 6] = "HostText";
|
11
|
+
WorkTag[WorkTag["Fragment"] = 7] = "Fragment";
|
12
|
+
WorkTag[WorkTag["Mode"] = 8] = "Mode";
|
13
|
+
WorkTag[WorkTag["ContextConsumer"] = 9] = "ContextConsumer";
|
14
|
+
WorkTag[WorkTag["ContextProvider"] = 10] = "ContextProvider";
|
15
|
+
WorkTag[WorkTag["ForwardRef"] = 11] = "ForwardRef";
|
16
|
+
WorkTag[WorkTag["Profiler"] = 12] = "Profiler";
|
17
|
+
WorkTag[WorkTag["SuspenseComponent"] = 13] = "SuspenseComponent";
|
18
|
+
WorkTag[WorkTag["MemoComponent"] = 14] = "MemoComponent";
|
19
|
+
WorkTag[WorkTag["SimpleMemoComponent"] = 15] = "SimpleMemoComponent";
|
20
|
+
WorkTag[WorkTag["LazyComponent"] = 16] = "LazyComponent";
|
21
|
+
WorkTag[WorkTag["IncompleteClassComponent"] = 17] = "IncompleteClassComponent";
|
22
|
+
WorkTag[WorkTag["DehydratedFragment"] = 18] = "DehydratedFragment";
|
23
|
+
WorkTag[WorkTag["SuspenseListComponent"] = 19] = "SuspenseListComponent";
|
24
|
+
WorkTag[WorkTag["FundamentalComponent"] = 20] = "FundamentalComponent";
|
25
|
+
WorkTag[WorkTag["ScopeComponent"] = 21] = "ScopeComponent";
|
25
26
|
})(WorkTag || (WorkTag = {}));
|
27
|
+
|
26
28
|
export function getReactFiberFromNode(elm) {
|
27
|
-
|
28
|
-
|
29
|
+
if (!elm) {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
|
33
|
+
for (const k in elm) {
|
34
|
+
// React 16 uses "__reactInternalInstance$" prefix
|
35
|
+
// React 17 uses "__reactFiber$" prefix
|
36
|
+
// https://github.com/facebook/react/pull/18377
|
37
|
+
if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
|
38
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
39
|
+
// @ts-ignore
|
40
|
+
return elm[k];
|
29
41
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
// https://github.com/facebook/react/pull/18377
|
34
|
-
if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
|
35
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
36
|
-
// @ts-ignore
|
37
|
-
return elm[k];
|
38
|
-
}
|
39
|
-
}
|
40
|
-
throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
|
42
|
+
}
|
43
|
+
|
44
|
+
throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
|
41
45
|
}
|
42
46
|
//# sourceMappingURL=getReactFiberFromNode.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":"AAuEA,IAAK,OAAL;;AAAA,CAAA,UAAK,OAAL,EAAY;AACV,EAAA,OAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,mBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,wBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,wBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,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AAA,OAAA,CAAA,sBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,sBAAA;AACA,EAAA,OAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,GAAA,EAAA,CAAA,GAAA,gBAAA;AACD,CAvBD,EAAK,OAAO,KAAP,OAAO,GAAA,EAAA,CAAZ;;AAsLA,OAAM,SAAU,qBAAV,CAAgC,GAAhC,EAAqD;AACzD,MAAI,CAAC,GAAL,EAAU;AACR,WAAO,IAAP;AACD;;AAED,OAAK,MAAM,CAAX,IAAgB,GAAhB,EAAqB;AACnB;AACA;AACA;AACA,QAAI,CAAC,CAAC,OAAF,CAAU,0BAAV,MAA0C,CAA1C,IAA+C,CAAC,CAAC,OAAF,CAAU,eAAV,MAA+B,CAAlF,EAAqF;AACnF;AACA;AACA,aAAO,GAAG,CAAC,CAAD,CAAV;AACD;AACF;;AAED,QAAM,IAAI,KAAJ,CAAU,yDAAV,CAAN;AACD","sourceRoot":""}
|
@@ -3,49 +3,63 @@
|
|
3
3
|
* @param node - DOM node.
|
4
4
|
* @returns - parent DOM node.
|
5
5
|
*/
|
6
|
-
export const getParentNode =
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
export const getParentNode = node => {
|
7
|
+
if (node.nodeName === 'HTML') {
|
8
|
+
return node;
|
9
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
|
+
|
11
|
+
|
12
|
+
return node.parentNode || node.host;
|
12
13
|
};
|
13
14
|
/**
|
14
15
|
* Returns CSS styles of the given node.
|
15
16
|
* @param node - DOM node.
|
16
17
|
* @returns - CSS styles.
|
17
18
|
*/
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
|
20
|
+
const getStyleComputedProperty = node => {
|
21
|
+
var _a;
|
22
|
+
|
23
|
+
if (node.nodeType !== 1) {
|
24
|
+
return {};
|
25
|
+
}
|
26
|
+
|
27
|
+
const window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
|
28
|
+
return window.getComputedStyle(node, null);
|
25
29
|
};
|
26
30
|
/**
|
27
31
|
* Returns the first scrollable parent of the given element.
|
28
32
|
* @param node - DOM node.
|
29
33
|
* @returns - the first scrollable parent.
|
30
34
|
*/
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
35
|
+
|
36
|
+
|
37
|
+
export const getScrollParent = node => {
|
38
|
+
// Return body, `getScroll` will take care to get the correct `scrollTop` from it
|
39
|
+
const parentNode = node && getParentNode(node); // eslint-disable-next-line
|
40
|
+
|
41
|
+
if (!parentNode) return document.body;
|
42
|
+
|
43
|
+
switch (parentNode.nodeName) {
|
44
|
+
case 'HTML':
|
45
|
+
case 'BODY':
|
46
|
+
return parentNode.ownerDocument.body;
|
47
|
+
|
48
|
+
case '#document':
|
49
|
+
return parentNode.body;
|
50
|
+
} // If any of the overflow props is defined for the node then we return it as the parent
|
51
|
+
|
52
|
+
|
53
|
+
const {
|
54
|
+
overflow,
|
55
|
+
overflowX,
|
56
|
+
overflowY
|
57
|
+
} = getStyleComputedProperty(parentNode);
|
58
|
+
|
59
|
+
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
60
|
+
return parentNode;
|
61
|
+
}
|
62
|
+
|
63
|
+
return getScrollParent(parentNode);
|
50
64
|
};
|
51
65
|
//# sourceMappingURL=getScrollParent.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/utils/getScrollParent.ts"],"names":[],"mappings":"AAAA;;;;AAIG;AACH,OAAO,MAAM,aAAa,GAAI,IAAD,IAAmC;AAC9D,MAAI,IAAI,CAAC,QAAL,KAAkB,MAAtB,EAA8B;AAC5B,WAAO,IAAP;AACD,GAH6D,CAI9D;;;AACA,SAAO,IAAI,CAAC,UAAL,IAAoB,IAAY,CAAC,IAAxC;AACD,CANM;AAQP;;;;AAIG;;AACH,MAAM,wBAAwB,GAAI,IAAD,IAAoD;;;AACnF,MAAI,IAAI,CAAC,QAAL,KAAkB,CAAtB,EAAyB;AACvB,WAAO,EAAP;AACD;;AAED,QAAM,MAAM,GAAG,CAAA,EAAA,GAAA,IAAI,CAAC,aAAL,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,KAAA,CAAlB,GAAkB,EAAA,CAAE,WAAnC;AACA,SAAO,MAAO,CAAC,gBAAR,CAAyB,IAAzB,EAA+B,IAA/B,CAAP;AACD,CAPD;AASA;;;;AAIG;;;AACH,OAAO,MAAM,eAAe,GAAI,IAAD,IAAqD;AAClF;AACA,QAAM,UAAU,GAAG,IAAI,IAAI,aAAa,CAAC,IAAD,CAAxC,CAFkF,CAGlF;;AACA,MAAI,CAAC,UAAL,EAAiB,OAAO,QAAQ,CAAC,IAAhB;;AAEjB,UAAQ,UAAU,CAAC,QAAnB;AACE,SAAK,MAAL;AACA,SAAK,MAAL;AACE,aAAO,UAAU,CAAC,aAAX,CAA0B,IAAjC;;AACF,SAAK,WAAL;AACE,aAAS,UAAmC,CAAC,IAA7C;AALJ,GANkF,CAclF;;;AACA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,SAAZ;AAAuB,IAAA;AAAvB,MAAqC,wBAAwB,CAAC,UAAD,CAAnE;;AACA,MAAI,wBAAwB,IAAxB,CAA6B,QAAS,GAAG,SAAZ,GAAyB,SAAtD,CAAJ,EAAsE;AACpE,WAAO,UAAP;AACD;;AAED,SAAO,eAAe,CAAC,UAAD,CAAtB;AACD,CArBM","sourceRoot":""}
|
@@ -7,31 +7,36 @@
|
|
7
7
|
* @returns User offset augmented with arrow height
|
8
8
|
*/
|
9
9
|
export function mergeArrowOffset(userOffset, arrowHeight) {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
10
|
+
let offsetWithArrow = userOffset;
|
11
|
+
|
12
|
+
if (!userOffset) {
|
13
|
+
return [0, arrowHeight];
|
14
|
+
}
|
15
|
+
|
16
|
+
if (Array.isArray(offsetWithArrow)) {
|
17
|
+
setArrowOffset(offsetWithArrow, arrowHeight);
|
18
|
+
return offsetWithArrow;
|
19
|
+
}
|
20
|
+
|
21
|
+
if (typeof offsetWithArrow === 'function') {
|
22
|
+
const userOffsetFn = offsetWithArrow;
|
23
|
+
|
24
|
+
offsetWithArrow = offsetParams => {
|
25
|
+
const offset = userOffsetFn(offsetParams);
|
26
|
+
setArrowOffset(offset, arrowHeight);
|
27
|
+
return offset;
|
28
|
+
};
|
29
|
+
} // This should never happen
|
30
|
+
|
31
|
+
|
32
|
+
return [0, 0];
|
28
33
|
}
|
34
|
+
|
29
35
|
const setArrowOffset = (offset, arrowHeight) => {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
+
if (offset[1] !== null && offset[1] !== undefined) {
|
37
|
+
offset[1] += arrowHeight;
|
38
|
+
} else {
|
39
|
+
offset[1] = arrowHeight;
|
40
|
+
}
|
36
41
|
};
|
37
42
|
//# sourceMappingURL=mergeArrowOffset.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/utils/mergeArrowOffset.ts"],"names":[],"mappings":"AAEA;;;;;;;AAOG;AACH,OAAM,SAAU,gBAAV,CAA2B,UAA3B,EAAkE,WAAlE,EAAqF;AACzF,MAAI,eAAe,GAAG,UAAtB;;AACA,MAAI,CAAC,UAAL,EAAiB;AACf,WAAO,CAAC,CAAD,EAAI,WAAJ,CAAP;AACD;;AAED,MAAI,KAAK,CAAC,OAAN,CAAc,eAAd,CAAJ,EAAoC;AAClC,IAAA,cAAc,CAAC,eAAD,EAAkB,WAAlB,CAAd;AACA,WAAO,eAAP;AACD;;AAED,MAAI,OAAO,eAAP,KAA2B,UAA/B,EAA2C;AACzC,UAAM,YAAY,GAAG,eAArB;;AACA,IAAA,eAAe,GAAG,YAAY,IAAG;AAC/B,YAAM,MAAM,GAAG,YAAY,CAAC,YAAD,CAA3B;AACA,MAAA,cAAc,CAAC,MAAD,EAAS,WAAT,CAAd;AACA,aAAO,MAAP;AACD,KAJD;AAKD,GAlBwF,CAoBzF;;;AACA,SAAO,CAAC,CAAD,EAAI,CAAJ,CAAP;AACD;;AAED,MAAM,cAAc,GAAG,CAAC,MAAD,EAAiE,WAAjE,KAAwF;AAC7G,MAAI,MAAM,CAAC,CAAD,CAAN,KAAc,IAAd,IAAsB,MAAM,CAAC,CAAD,CAAN,KAAc,SAAxC,EAAmD;AACjD,IAAA,MAAM,CAAC,CAAD,CAAN,IAAa,WAAb;AACD,GAFD,MAEO;AACL,IAAA,MAAM,CAAC,CAAD,CAAN,GAAY,WAAZ;AACD;AACF,CAND","sourceRoot":""}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as PopperJs from '@popperjs/core';
|
2
|
-
import type { Offset } from '../types';
|
2
|
+
import type { Alignment, Offset, Position } from '../types';
|
3
3
|
/**
|
4
4
|
* @see positioninHelper.test.ts for expected placement values
|
5
5
|
*/
|
6
|
-
export declare const getPlacement: (align?:
|
6
|
+
export declare const getPlacement: (align?: Alignment | undefined, position?: Position | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
|
7
7
|
export declare const applyRtlToOffset: (offset: Offset | undefined) => Offset | undefined;
|
@@ -1,41 +1,49 @@
|
|
1
|
-
const getPositionMap =
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
const getPositionMap = rtl => ({
|
2
|
+
above: 'top',
|
3
|
+
below: 'bottom',
|
4
|
+
before: rtl ? 'right' : 'left',
|
5
|
+
after: rtl ? 'left' : 'right'
|
6
6
|
});
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
|
8
|
+
const getAlignmentMap = rtl => ({
|
9
|
+
start: rtl ? 'end' : 'start',
|
10
|
+
end: rtl ? 'start' : 'end',
|
11
|
+
top: 'start',
|
12
|
+
bottom: 'end',
|
13
|
+
center: ''
|
13
14
|
});
|
15
|
+
|
14
16
|
const shouldAlignToCenter = (p, a) => {
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
const positionedVertically = p === 'above' || p === 'below';
|
18
|
+
const alignedVertically = a === 'top' || a === 'bottom';
|
19
|
+
return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;
|
18
20
|
};
|
19
21
|
/**
|
20
22
|
* @see positioninHelper.test.ts for expected placement values
|
21
23
|
*/
|
24
|
+
|
25
|
+
|
22
26
|
export const getPlacement = (align, position, rtl) => {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
|
27
|
+
const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
|
28
|
+
const computedPosition = position && getPositionMap(rtl)[position];
|
29
|
+
const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];
|
30
|
+
|
31
|
+
if (computedPosition && computedAlignmnent) {
|
32
|
+
return `${computedPosition}-${computedAlignmnent}`;
|
33
|
+
}
|
34
|
+
|
35
|
+
return computedPosition || 'auto';
|
30
36
|
};
|
31
|
-
export const applyRtlToOffset =
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
export const applyRtlToOffset = offset => {
|
38
|
+
if (typeof offset === 'undefined') {
|
39
|
+
return undefined;
|
40
|
+
}
|
41
|
+
|
42
|
+
if (Array.isArray(offset)) {
|
43
|
+
offset[0] = offset[0] * -1;
|
44
|
+
return offset;
|
45
|
+
}
|
46
|
+
|
47
|
+
return param => applyRtlToOffset(offset(param));
|
40
48
|
};
|
41
49
|
//# sourceMappingURL=positioningHelper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../src/utils/positioningHelper.ts"],"names":[],"mappings":"AAMA,MAAM,cAAc,GAAI,GAAD,KAAyD;AAC9E,EAAA,KAAK,EAAE,KADuE;AAE9E,EAAA,KAAK,EAAE,QAFuE;AAG9E,EAAA,MAAM,EAAE,GAAG,GAAG,OAAH,GAAa,MAHsD;AAI9E,EAAA,KAAK,EAAE,GAAG,GAAG,MAAH,GAAY;AAJwD,CAAzD,CAAvB;;AAOA,MAAM,eAAe,GAAI,GAAD,KAAuD;AAC7E,EAAA,KAAK,EAAE,GAAG,GAAG,KAAH,GAAW,OADwD;AAE7E,EAAA,GAAG,EAAE,GAAG,GAAG,OAAH,GAAa,KAFwD;AAG7E,EAAA,GAAG,EAAE,OAHwE;AAI7E,EAAA,MAAM,EAAE,KAJqE;AAK7E,EAAA,MAAM,EAAE;AALqE,CAAvD,CAAxB;;AAQA,MAAM,mBAAmB,GAAG,CAAC,CAAD,EAAe,CAAf,KAAyC;AACnE,QAAM,oBAAoB,GAAG,CAAC,KAAK,OAAN,IAAiB,CAAC,KAAK,OAApD;AACA,QAAM,iBAAiB,GAAG,CAAC,KAAK,KAAN,IAAe,CAAC,KAAK,QAA/C;AAEA,SAAQ,oBAAoB,IAAI,iBAAzB,IAAgD,CAAC,oBAAD,IAAyB,CAAC,iBAAjF;AACD,CALD;AAOA;;AAEG;;;AACH,OAAO,MAAM,YAAY,GAAG,CAAC,KAAD,EAAoB,QAApB,EAAyC,GAAzC,KAA8E;AACxG,QAAM,SAAS,GAAG,mBAAmB,CAAC,QAAD,EAAW,KAAX,CAAnB,GAAuC,QAAvC,GAAkD,KAApE;AAEA,QAAM,gBAAgB,GAAG,QAAQ,IAAI,cAAc,CAAC,GAAD,CAAd,CAAoB,QAApB,CAArC;AACA,QAAM,kBAA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