@fluentui/react-positioning 0.0.0-nightly8faa94d11420211118.1 → 0.0.0-nightlya0ab3454ed20211208.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/CHANGELOG.json +75 -10
  2. package/CHANGELOG.md +24 -8
  3. package/dist/react-positioning.d.ts +3 -3
  4. package/lib/createArrowStyles.d.ts +3 -3
  5. package/lib/createArrowStyles.js +48 -50
  6. package/lib/createArrowStyles.js.map +1 -1
  7. package/lib/createVirtualElementFromClick.js +17 -15
  8. package/lib/createVirtualElementFromClick.js.map +1 -1
  9. package/lib/usePopper.js +362 -312
  10. package/lib/usePopper.js.map +1 -1
  11. package/lib/usePopperMouseTarget.js +28 -22
  12. package/lib/usePopperMouseTarget.js.map +1 -1
  13. package/lib/utils/getBasePlacement.js +1 -1
  14. package/lib/utils/getBasePlacement.js.map +1 -1
  15. package/lib/utils/getBoundary.js +15 -10
  16. package/lib/utils/getBoundary.js.map +1 -1
  17. package/lib/utils/getReactFiberFromNode.js +39 -35
  18. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  19. package/lib/utils/getScrollParent.js +46 -32
  20. package/lib/utils/getScrollParent.js.map +1 -1
  21. package/lib/utils/mergeArrowOffset.js +29 -24
  22. package/lib/utils/mergeArrowOffset.js.map +1 -1
  23. package/lib/utils/positioningHelper.d.ts +1 -1
  24. package/lib/utils/positioningHelper.js +38 -30
  25. package/lib/utils/positioningHelper.js.map +1 -1
  26. package/lib/utils/resolvePositioningShorthand.js +57 -19
  27. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  28. package/lib/utils/useCallbackRef.js +35 -29
  29. package/lib/utils/useCallbackRef.js.map +1 -1
  30. package/lib-commonjs/createArrowStyles.d.ts +3 -3
  31. package/lib-commonjs/createArrowStyles.js +55 -51
  32. package/lib-commonjs/createArrowStyles.js.map +1 -1
  33. package/lib-commonjs/createVirtualElementFromClick.js +23 -16
  34. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  35. package/lib-commonjs/index.js +26 -5
  36. package/lib-commonjs/index.js.map +1 -1
  37. package/lib-commonjs/types.js +4 -1
  38. package/lib-commonjs/types.js.map +1 -1
  39. package/lib-commonjs/usePopper.js +376 -316
  40. package/lib-commonjs/usePopper.js.map +1 -1
  41. package/lib-commonjs/usePopperMouseTarget.js +38 -25
  42. package/lib-commonjs/usePopperMouseTarget.js.map +1 -1
  43. package/lib-commonjs/utils/getBasePlacement.js +7 -2
  44. package/lib-commonjs/utils/getBasePlacement.js.map +1 -1
  45. package/lib-commonjs/utils/getBoundary.js +23 -12
  46. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  47. package/lib-commonjs/utils/getReactFiberFromNode.js +44 -36
  48. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  49. package/lib-commonjs/utils/getScrollParent.js +53 -33
  50. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  51. package/lib-commonjs/utils/index.js +14 -2
  52. package/lib-commonjs/utils/index.js.map +1 -1
  53. package/lib-commonjs/utils/mergeArrowOffset.js +35 -25
  54. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  55. package/lib-commonjs/utils/positioningHelper.d.ts +1 -1
  56. package/lib-commonjs/utils/positioningHelper.js +46 -31
  57. package/lib-commonjs/utils/positioningHelper.js.map +1 -1
  58. package/lib-commonjs/utils/resolvePositioningShorthand.js +65 -22
  59. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  60. package/lib-commonjs/utils/useCallbackRef.js +45 -32
  61. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  62. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"usePopper.js","sourceRoot":"","sources":["../src/usePopper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,gB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5B,IAA4B,EAAA,KAAA,KAAA,CAA5B,GAA4B,KAAA,CAA5B,GAA4B,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
- export const usePopperMouseTarget = (initialState) => {
12
- const [virtualElement, setVirtualElement] = React.useState(initialState);
13
- const setVirtualMouseTarget = (event) => {
14
- if (event === undefined || event === null) {
15
- setVirtualElement(undefined);
16
- return;
17
- }
18
- let mouseevent;
19
- if (!(event instanceof MouseEvent)) {
20
- mouseevent = event.nativeEvent;
21
- }
22
- else {
23
- mouseevent = event;
24
- }
25
- if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {
26
- // eslint-disable-next-line no-console
27
- console.error('usePopperMouseTarget should only be used with MouseEvent');
28
- }
29
- const contextTarget = createVirtualElementFromClick(mouseevent);
30
- setVirtualElement(contextTarget);
31
- };
32
- return [virtualElement, setVirtualMouseTarget];
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,"file":"usePopperMouseTarget.js","sourceRoot":"","sources":["../src/usePopperMouseTarget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAGhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,YAAwE,EAAE,EAAE;IAC/G,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAsC,YAAY,CAAC,CAAC;IAE9G,MAAM,qBAAqB,GAAG,CAAC,KAAuD,EAAE,EAAE;QACxF,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;YACzC,i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R,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":""}
@@ -5,6 +5,6 @@
5
5
  * @returns bottom-start -> bottom
6
6
  */
7
7
  export function getBasePlacement(placement) {
8
- return placement.split('-')[0];
8
+ return placement.split('-')[0];
9
9
  }
10
10
  //# sourceMappingURL=getBasePlacement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getBasePlacement.js","sourceRoot":"","sources":["../../src/utils/getBasePlacement.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAA6B;IAC5D,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAA2B,CAAC;AAC3D,CAAC"}
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":""}
@@ -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
- if (boundary === 'window') {
7
- return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
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
- if (boundary === 'scrollParent') {
10
- let boundariesNode = getScrollParent(element);
11
- if (boundariesNode.nodeName === 'BODY') {
12
- boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
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,"file":"getBoundary.js","sourceRoot":"","sources":["../../src/utils/getBoundary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAA2B,EAAE,QAAmB;IAC1E,IAAI,QAAQ,KAAK,QAAQ,EAAE;QACzB,OAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAE,eAAe,CAAC;KAChD;IAED,IAAI,QAAQ,KAAK,cAAc,EAAE;QAC/B,IAAI,cAAc,GAA4B,eAAe,CAAC,OAAO,CAAC,CAAC;QAEvE,IAAI,cAAc,CAAC,QAAQ,KAAK,MAAM,EAAE;YACtC,cAAc,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAE,eAAe,CAAC;SAC1D;QAED,OAAO,cAAc,CAAC;KACvB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
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
- WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
4
- WorkTag[WorkTag["ClassComponent"] = 1] = "ClassComponent";
5
- WorkTag[WorkTag["IndeterminateComponent"] = 2] = "IndeterminateComponent";
6
- WorkTag[WorkTag["HostRoot"] = 3] = "HostRoot";
7
- WorkTag[WorkTag["HostPortal"] = 4] = "HostPortal";
8
- WorkTag[WorkTag["HostComponent"] = 5] = "HostComponent";
9
- WorkTag[WorkTag["HostText"] = 6] = "HostText";
10
- WorkTag[WorkTag["Fragment"] = 7] = "Fragment";
11
- WorkTag[WorkTag["Mode"] = 8] = "Mode";
12
- WorkTag[WorkTag["ContextConsumer"] = 9] = "ContextConsumer";
13
- WorkTag[WorkTag["ContextProvider"] = 10] = "ContextProvider";
14
- WorkTag[WorkTag["ForwardRef"] = 11] = "ForwardRef";
15
- WorkTag[WorkTag["Profiler"] = 12] = "Profiler";
16
- WorkTag[WorkTag["SuspenseComponent"] = 13] = "SuspenseComponent";
17
- WorkTag[WorkTag["MemoComponent"] = 14] = "MemoComponent";
18
- WorkTag[WorkTag["SimpleMemoComponent"] = 15] = "SimpleMemoComponent";
19
- WorkTag[WorkTag["LazyComponent"] = 16] = "LazyComponent";
20
- WorkTag[WorkTag["IncompleteClassComponent"] = 17] = "IncompleteClassComponent";
21
- WorkTag[WorkTag["DehydratedFragment"] = 18] = "DehydratedFragment";
22
- WorkTag[WorkTag["SuspenseListComponent"] = 19] = "SuspenseListComponent";
23
- WorkTag[WorkTag["FundamentalComponent"] = 20] = "FundamentalComponent";
24
- WorkTag[WorkTag["ScopeComponent"] = 21] = "ScopeComponent";
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
- if (!elm) {
28
- return null;
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
- for (const k in elm) {
31
- // React 16 uses "__reactInternalInstance$" prefix
32
- // React 17 uses "__reactFiber$" prefix
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,"file":"getReactFiberFromNode.js","sourceRoot":"","sources":["../../src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":"AAuEA,IAAK,OAuBJ;AAvBD,WAAK,OAAO;IACV,+DAAqB,CAAA;IACrB,yDAAkB,CAAA;IAClB,yEAA0B,CAAA;IAC1B,6CAAY,CAAA;IACZ,iDAAc,CAAA;IACd,uDAAiB,CAAA;IACjB,6CAAY,CAAA;IACZ,6CAAY,CAAA;IACZ,qCAAQ,CAAA;IACR,2DAAmB,CAAA;IACnB,4DAAoB,CAAA;IACpB,kDAAe,CAAA;IACf,8CAAa,CAAA;IACb,gEAAsB,CAAA;IACtB,wDAAkB,CAAA;IAClB,oEAAwB,CAAA;IACxB,wDAAkB,CAAA;IAClB,8EAA6B,CAAA;IAC7B,kEAAuB,CAAA;I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BAAV,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 = (node) => {
7
- if (node.nodeName === 'HTML') {
8
- return node;
9
- }
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- return node.parentNode || node.host;
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
- const getStyleComputedProperty = (node) => {
19
- var _a;
20
- if (node.nodeType !== 1) {
21
- return {};
22
- }
23
- const window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
24
- return window.getComputedStyle(node, null);
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
- export const getScrollParent = (node) => {
32
- // Return body, `getScroll` will take care to get the correct `scrollTop` from it
33
- const parentNode = node && getParentNode(node);
34
- // eslint-disable-next-line
35
- if (!parentNode)
36
- return document.body;
37
- switch (parentNode.nodeName) {
38
- case 'HTML':
39
- case 'BODY':
40
- return parentNode.ownerDocument.body;
41
- case '#document':
42
- return parentNode.body;
43
- }
44
- // If any of the overflow props is defined for the node then we return it as the parent
45
- const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);
46
- if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
47
- return parentNode;
48
- }
49
- return getScrollParent(parentNode);
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,"file":"getScrollParent.js","sourceRoot":"","sources":["../../src/utils/getScrollParent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAiB,EAAe,EAAE;IAC9D,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IACD,8DAA8D;IAC9D,OAAO,IAAI,CAAC,UAAU,IAAK,IAAY,CAAC,IAAI,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,C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P;;;;AAIG;;AACH,MAAM,wBAAwB,GAAI,IAAD,IAAoD;;;AACnF,MAAI,IAAI,CAAC,QAAL,KAAkB,CAAtB,EAAyB;AACvB,WAAO,EAAP;AACD;;AAED,QAAM,MAAM,GAAA,CAAA,EAAA,GAAG,IAAI,CAAC,aAAR,MAAqB,IAArB,IAAqB,EAAA,KAAA,KAAA,CAArB,GAAqB,KAAA,CAArB,GAAqB,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
- let offsetWithArrow = userOffset;
11
- if (!userOffset) {
12
- return [0, arrowHeight];
13
- }
14
- if (Array.isArray(offsetWithArrow)) {
15
- setArrowOffset(offsetWithArrow, arrowHeight);
16
- return offsetWithArrow;
17
- }
18
- if (typeof offsetWithArrow === 'function') {
19
- const userOffsetFn = offsetWithArrow;
20
- offsetWithArrow = offsetParams => {
21
- const offset = userOffsetFn(offsetParams);
22
- setArrowOffset(offset, arrowHeight);
23
- return offset;
24
- };
25
- }
26
- // This should never happen
27
- return [0, 0];
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
- if (offset[1] !== null && offset[1] !== undefined) {
31
- offset[1] += arrowHeight;
32
- }
33
- else {
34
- offset[1] = arrowHeight;
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,"file":"mergeArrowOffset.js","sourceRoot":"","sources":["../../src/utils/mergeArrowOffset.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAqC,EAAE,WAAmB;IACzF,IAAI,eAAe,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;KACzB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;QAClC,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QAC7C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T,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":""}
@@ -3,5 +3,5 @@ import type { Offset } from '../types';
3
3
  /**
4
4
  * @see positioninHelper.test.ts for expected placement values
5
5
  */
6
- export declare const getPlacement: (align?: "bottom" | "top" | "center" | "start" | "end" | undefined, position?: "above" | "below" | "before" | "after" | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
6
+ export declare const getPlacement: (align?: "bottom" | "top" | "center" | "end" | "start" | undefined, position?: "after" | "above" | "below" | "before" | undefined, rtl?: boolean | undefined) => PopperJs.Placement;
7
7
  export declare const applyRtlToOffset: (offset: Offset | undefined) => Offset | undefined;
@@ -1,41 +1,49 @@
1
- const getPositionMap = (rtl) => ({
2
- above: 'top',
3
- below: 'bottom',
4
- before: rtl ? 'right' : 'left',
5
- after: rtl ? 'left' : 'right',
1
+ const getPositionMap = rtl => ({
2
+ above: 'top',
3
+ below: 'bottom',
4
+ before: rtl ? 'right' : 'left',
5
+ after: rtl ? 'left' : 'right'
6
6
  });
7
- const getAlignmentMap = (rtl) => ({
8
- start: rtl ? 'end' : 'start',
9
- end: rtl ? 'start' : 'end',
10
- top: 'start',
11
- bottom: 'end',
12
- center: '',
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
- const positionedVertically = p === 'above' || p === 'below';
16
- const alignedVertically = a === 'top' || a === 'bottom';
17
- return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);
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
- const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
24
- const computedPosition = position && getPositionMap(rtl)[position];
25
- const computedAlignmnent = alignment && getAlignmentMap(rtl)[alignment];
26
- if (computedPosition && computedAlignmnent) {
27
- return `${computedPosition}-${computedAlignmnent}`;
28
- }
29
- return computedPosition || 'auto';
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 = (offset) => {
32
- if (typeof offset === 'undefined') {
33
- return undefined;
34
- }
35
- if (Array.isArray(offset)) {
36
- offset[0] = offset[0] * -1;
37
- return offset;
38
- }
39
- return ((param) => applyRtlToOffset(offset(param)));
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,"file":"positioningHelper.js","sourceRoot":"","sources":["../../src/utils/positioningHelper.ts"],"names":[],"mappings":"AA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