@fluentui/react-positioning 0.0.0-nightly-20230316-0427.1 → 0.0.0-nightly-20230317-1454.1

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.
Files changed (132) hide show
  1. package/.swcrc +39 -0
  2. package/CHANGELOG.json +24 -9
  3. package/CHANGELOG.md +16 -7
  4. package/lib/constants.js +4 -4
  5. package/lib/constants.js.map +1 -1
  6. package/lib/createArrowStyles.js +19 -19
  7. package/lib/createArrowStyles.js.map +1 -1
  8. package/lib/createPositionManager.js +13 -13
  9. package/lib/createPositionManager.js.map +1 -1
  10. package/lib/createVirtualElementFromClick.js +1 -2
  11. package/lib/createVirtualElementFromClick.js.map +1 -1
  12. package/lib/index.js +5 -5
  13. package/lib/index.js.map +1 -1
  14. package/lib/middleware/coverTarget.js +6 -6
  15. package/lib/middleware/coverTarget.js.map +1 -1
  16. package/lib/middleware/flip.js +4 -4
  17. package/lib/middleware/flip.js.map +1 -1
  18. package/lib/middleware/index.js +6 -6
  19. package/lib/middleware/index.js.map +1 -1
  20. package/lib/middleware/intersecting.js +2 -2
  21. package/lib/middleware/intersecting.js.map +1 -1
  22. package/lib/middleware/maxSize.js +8 -8
  23. package/lib/middleware/maxSize.js.map +1 -1
  24. package/lib/middleware/offset.js +2 -2
  25. package/lib/middleware/offset.js.map +1 -1
  26. package/lib/middleware/shift.js +5 -5
  27. package/lib/middleware/shift.js.map +1 -1
  28. package/lib/types.js +1 -1
  29. package/lib/types.js.map +1 -1
  30. package/lib/usePositioning.js +20 -26
  31. package/lib/usePositioning.js.map +1 -1
  32. package/lib/usePositioningMouseTarget.js +4 -4
  33. package/lib/usePositioningMouseTarget.js.map +1 -1
  34. package/lib/utils/debounce.js +1 -2
  35. package/lib/utils/debounce.js.map +1 -1
  36. package/lib/utils/fromFloatingUIPlacement.js +10 -10
  37. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  38. package/lib/utils/getBoundary.js +8 -8
  39. package/lib/utils/getBoundary.js.map +1 -1
  40. package/lib/utils/getFloatingUIOffset.js +2 -2
  41. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  42. package/lib/utils/getReactFiberFromNode.js +3 -2
  43. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  44. package/lib/utils/getScrollParent.js +7 -10
  45. package/lib/utils/getScrollParent.js.map +1 -1
  46. package/lib/utils/hasAutoFocusFilter.js +3 -4
  47. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  48. package/lib/utils/index.js +15 -15
  49. package/lib/utils/index.js.map +1 -1
  50. package/lib/utils/mergeArrowOffset.js +6 -8
  51. package/lib/utils/mergeArrowOffset.js.map +1 -1
  52. package/lib/utils/parseFloatingUIPlacement.js +2 -3
  53. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  54. package/lib/utils/resolvePositioningShorthand.js +33 -33
  55. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  56. package/lib/utils/toFloatingUIPadding.js +3 -3
  57. package/lib/utils/toFloatingUIPadding.js.map +1 -1
  58. package/lib/utils/toFloatingUIPlacement.js +11 -11
  59. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  60. package/lib/utils/toggleScrollListener.js +4 -4
  61. package/lib/utils/toggleScrollListener.js.map +1 -1
  62. package/lib/utils/useCallbackRef.js +2 -2
  63. package/lib/utils/useCallbackRef.js.map +1 -1
  64. package/lib/utils/writeArrowUpdates.js +1 -2
  65. package/lib/utils/writeArrowUpdates.js.map +1 -1
  66. package/lib/utils/writeContainerupdates.js +7 -8
  67. package/lib/utils/writeContainerupdates.js.map +1 -1
  68. package/lib-commonjs/constants.js +18 -7
  69. package/lib-commonjs/constants.js.map +1 -1
  70. package/lib-commonjs/createArrowStyles.js +60 -88
  71. package/lib-commonjs/createArrowStyles.js.map +1 -1
  72. package/lib-commonjs/createPositionManager.js +103 -117
  73. package/lib-commonjs/createPositionManager.js.map +1 -1
  74. package/lib-commonjs/createVirtualElementFromClick.js +27 -26
  75. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  76. package/lib-commonjs/index.js +24 -51
  77. package/lib-commonjs/index.js.map +1 -1
  78. package/lib-commonjs/middleware/coverTarget.js +34 -37
  79. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  80. package/lib-commonjs/middleware/flip.js +31 -38
  81. package/lib-commonjs/middleware/flip.js.map +1 -1
  82. package/lib-commonjs/middleware/index.js +10 -9
  83. package/lib-commonjs/middleware/index.js.map +1 -1
  84. package/lib-commonjs/middleware/intersecting.js +24 -22
  85. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  86. package/lib-commonjs/middleware/maxSize.js +34 -40
  87. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  88. package/lib-commonjs/middleware/offset.js +11 -12
  89. package/lib-commonjs/middleware/offset.js.map +1 -1
  90. package/lib-commonjs/middleware/shift.js +29 -37
  91. package/lib-commonjs/middleware/shift.js.map +1 -1
  92. package/lib-commonjs/types.js +5 -2
  93. package/lib-commonjs/types.js.map +1 -1
  94. package/lib-commonjs/usePositioning.js +192 -164
  95. package/lib-commonjs/usePositioning.js.map +1 -1
  96. package/lib-commonjs/usePositioningMouseTarget.js +34 -37
  97. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  98. package/lib-commonjs/utils/debounce.js +22 -21
  99. package/lib-commonjs/utils/debounce.js.map +1 -1
  100. package/lib-commonjs/utils/fromFloatingUIPlacement.js +30 -35
  101. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  102. package/lib-commonjs/utils/getBoundary.js +21 -22
  103. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  104. package/lib-commonjs/utils/getFloatingUIOffset.js +23 -35
  105. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  106. package/lib-commonjs/utils/getReactFiberFromNode.js +45 -41
  107. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  108. package/lib-commonjs/utils/getScrollParent.js +50 -56
  109. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  110. package/lib-commonjs/utils/hasAutoFocusFilter.js +17 -17
  111. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  112. package/lib-commonjs/utils/index.js +19 -18
  113. package/lib-commonjs/utils/index.js.map +1 -1
  114. package/lib-commonjs/utils/mergeArrowOffset.js +32 -32
  115. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  116. package/lib-commonjs/utils/parseFloatingUIPlacement.js +15 -14
  117. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  118. package/lib-commonjs/utils/resolvePositioningShorthand.js +63 -61
  119. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  120. package/lib-commonjs/utils/toFloatingUIPadding.js +23 -25
  121. package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
  122. package/lib-commonjs/utils/toFloatingUIPlacement.js +31 -33
  123. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  124. package/lib-commonjs/utils/toggleScrollListener.js +20 -24
  125. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  126. package/lib-commonjs/utils/useCallbackRef.js +39 -53
  127. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  128. package/lib-commonjs/utils/writeArrowUpdates.js +19 -24
  129. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  130. package/lib-commonjs/utils/writeContainerupdates.js +36 -45
  131. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  132. package/package.json +6 -6
@@ -1,68 +1,62 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.hasScrollParent = exports.getScrollParent = exports.getParentNode = void 0;
7
1
  /**
8
2
  * Returns the parent node or the host of the node argument.
9
3
  * @param node - DOM node.
10
4
  * @returns - parent DOM node.
11
- */
12
- const getParentNode = node => {
13
- if (node.nodeName === 'HTML') {
14
- return node;
15
- }
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- return node.parentNode || node.host;
5
+ */ "use strict";
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ function _export(target, all) {
10
+ for(var name in all)Object.defineProperty(target, name, {
11
+ enumerable: true,
12
+ get: all[name]
13
+ });
14
+ }
15
+ _export(exports, {
16
+ getParentNode: ()=>getParentNode,
17
+ getScrollParent: ()=>getScrollParent,
18
+ hasScrollParent: ()=>hasScrollParent
19
+ });
20
+ const getParentNode = (node)=>{
21
+ if (node.nodeName === "HTML") {
22
+ return node;
23
+ }
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ return node.parentNode || node.host;
18
26
  };
19
- exports.getParentNode = getParentNode;
20
27
  /**
21
28
  * Returns CSS styles of the given node.
22
29
  * @param node - DOM node.
23
30
  * @returns - CSS styles.
24
- */
25
- const getStyleComputedProperty = node => {
26
- var _a;
27
- if (node.nodeType !== 1) {
28
- return {};
29
- }
30
- const window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
31
- return window.getComputedStyle(node, null);
31
+ */ const getStyleComputedProperty = (node)=>{
32
+ if (node.nodeType !== 1) {
33
+ return {};
34
+ }
35
+ const window = node.ownerDocument?.defaultView;
36
+ return window.getComputedStyle(node, null);
32
37
  };
33
- /**
34
- * Returns the first scrollable parent of the given element.
35
- * @param node - DOM node.
36
- * @returns - the first scrollable parent.
37
- */
38
- const getScrollParent = node => {
39
- // Return body, `getScroll` will take care to get the correct `scrollTop` from it
40
- const parentNode = node && exports.getParentNode(node);
41
- // eslint-disable-next-line
42
- if (!parentNode) return document.body;
43
- switch (parentNode.nodeName) {
44
- case 'HTML':
45
- case 'BODY':
46
- return parentNode.ownerDocument.body;
47
- case '#document':
48
- return parentNode.body;
49
- }
50
- // If any of the overflow props is defined for the node then we return it as the parent
51
- const {
52
- overflow,
53
- overflowX,
54
- overflowY
55
- } = getStyleComputedProperty(parentNode);
56
- if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
57
- return parentNode;
58
- }
59
- return exports.getScrollParent(parentNode);
38
+ const getScrollParent = (node)=>{
39
+ // Return body, `getScroll` will take care to get the correct `scrollTop` from it
40
+ const parentNode = node && getParentNode(node);
41
+ // eslint-disable-next-line
42
+ if (!parentNode) return document.body;
43
+ switch(parentNode.nodeName){
44
+ case "HTML":
45
+ case "BODY":
46
+ return parentNode.ownerDocument.body;
47
+ case "#document":
48
+ return parentNode.body;
49
+ }
50
+ // If any of the overflow props is defined for the node then we return it as the parent
51
+ const { overflow , overflowX , overflowY } = getStyleComputedProperty(parentNode);
52
+ if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
53
+ return parentNode;
54
+ }
55
+ return getScrollParent(parentNode);
60
56
  };
61
- exports.getScrollParent = getScrollParent;
62
- const hasScrollParent = node => {
63
- var _a;
64
- const scrollParentElement = exports.getScrollParent(node);
65
- return scrollParentElement ? scrollParentElement !== ((_a = scrollParentElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.body) : false;
66
- };
67
- exports.hasScrollParent = hasScrollParent;
57
+ const hasScrollParent = (node)=>{
58
+ const scrollParentElement = getScrollParent(node);
59
+ return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;
60
+ }; //# sourceMappingURL=getScrollParent.js.map
61
+
68
62
  //# sourceMappingURL=getScrollParent.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getParentNode","node","nodeName","parentNode","host","exports","getStyleComputedProperty","nodeType","window","_a","ownerDocument","defaultView","getComputedStyle","getScrollParent","document","body","overflow","overflowX","overflowY","test","hasScrollParent","scrollParentElement"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"mappings":";;;;;;AAAA;;;;;AAKO,MAAMA,aAAa,GAAIC,IAAiB,IAAiB;EAC9D,IAAIA,IAAI,CAACC,QAAQ,KAAK,MAAM,EAAE;IAC5B,OAAOD,IAAI;;EAEb;EACA,OAAOA,IAAI,CAACE,UAAU,IAAKF,IAAY,CAACG,IAAI;AAC9C,CAAC;AANYC,OAAA,CAAAL,aAAa,GAAAA,aAAA;AAQ1B;;;;;AAKA,MAAMM,wBAAwB,GAAIL,IAAiB,IAAkC;;EACnF,IAAIA,IAAI,CAACM,QAAQ,KAAK,CAAC,EAAE;IACvB,OAAO,EAAE;;EAGX,MAAMC,MAAM,GAAG,CAAAC,EAAA,GAAAR,IAAI,CAACS,aAAa,cAAAD,EAAA,uBAAAA,EAAA,CAAEE,WAAW;EAC9C,OAAOH,MAAO,CAACI,gBAAgB,CAACX,IAAI,EAAE,IAAI,CAAC;AAC7C,CAAC;AAED;;;;;AAKO,MAAMY,eAAe,GAAIZ,IAAmC,IAAiB;EAClF;EACA,MAAME,UAAU,GAAGF,IAAI,IAAII,OAAA,CAAAL,aAAa,CAACC,IAAmB,CAAC;EAC7D;EACA,IAAI,CAACE,UAAU,EAAE,OAAOW,QAAQ,CAACC,IAAI;EAErC,QAAQZ,UAAU,CAACD,QAAQ;IACzB,KAAK,MAAM;IACX,KAAK,MAAM;MACT,OAAOC,UAAU,CAACO,aAAc,CAACK,IAAI;IACvC,KAAK,WAAW;MACd,OAAQZ,UAAkC,CAACY,IAAI;EAAC;EAGpD;EACA,MAAM;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAS,CAAE,GAAGZ,wBAAwB,CAACH,UAAU,CAAC;EAC/E,IAAI,uBAAuB,CAACgB,IAAI,CAACH,QAAS,GAAGE,SAAU,GAAGD,SAAS,CAAC,EAAE;IACpE,OAAOd,UAAU;;EAGnB,OAAOE,OAAA,CAAAQ,eAAe,CAACV,UAAU,CAAC;AACpC,CAAC;AArBYE,OAAA,CAAAQ,eAAe,GAAAA,eAAA;AAuBrB,MAAMO,eAAe,GAAInB,IAAmC,IAAa;;EAC9E,MAAMoB,mBAAmB,GAAgBhB,OAAA,CAAAQ,eAAe,CAACZ,IAAI,CAAC;EAC9D,OAAOoB,mBAAmB,GAAGA,mBAAmB,MAAK,CAAAZ,EAAA,GAAAY,mBAAmB,CAACX,aAAa,cAAAD,EAAA,uBAAAA,EAAA,CAAEM,IAAI,IAAG,KAAK;AACtG,CAAC;AAHYV,OAAA,CAAAe,eAAe,GAAAA,eAAA"}
1
+ {"version":3,"sources":["../../lib/utils/getScrollParent.js"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */export const getParentNode = node => {\n if (node.nodeName === \"HTML\") {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || node.host;\n};\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = node => {\n if (node.nodeType !== 1) {\n return {};\n }\n const window = node.ownerDocument?.defaultView;\n return window.getComputedStyle(node, null);\n};\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = node => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n switch (parentNode.nodeName) {\n case \"HTML\":\n case \"BODY\":\n return parentNode.ownerDocument.body;\n case \"#document\":\n return parentNode.body;\n }\n // If any of the overflow props is defined for the node then we return it as the parent\n const {\n overflow,\n overflowX,\n overflowY\n } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {\n return parentNode;\n }\n return getScrollParent(parentNode);\n};\nexport const hasScrollParent = node => {\n const scrollParentElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n//# sourceMappingURL=getScrollParent.js.map"],"names":["getParentNode","getScrollParent","hasScrollParent","node","nodeName","parentNode","host","getStyleComputedProperty","nodeType","window","ownerDocument","defaultView","getComputedStyle","document","body","overflow","overflowX","overflowY","test","scrollParentElement"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;IAAeA,aAAa,MAAbA;IAwBHC,eAAe,MAAfA;IAuBAC,eAAe,MAAfA;;AA/CH,MAAMF,gBAAgBG,CAAAA,OAAQ;IACtC,IAAIA,KAAKC,QAAQ,KAAK,QAAQ;QAC5B,OAAOD;IACT,CAAC;IACD,8DAA8D;IAC9D,OAAOA,KAAKE,UAAU,IAAIF,KAAKG,IAAI;AACrC;AACA;;;;CAIC,GACD,MAAMC,2BAA2BJ,CAAAA,OAAQ;IACvC,IAAIA,KAAKK,QAAQ,KAAK,GAAG;QACvB,OAAO,CAAC;IACV,CAAC;IACD,MAAMC,SAASN,KAAKO,aAAa,EAAEC;IACnC,OAAOF,OAAOG,gBAAgB,CAACT,MAAM,IAAI;AAC3C;AAMO,MAAMF,kBAAkBE,CAAAA,OAAQ;IACrC,iFAAiF;IACjF,MAAME,aAAaF,QAAQH,cAAcG;IACzC,2BAA2B;IAC3B,IAAI,CAACE,YAAY,OAAOQ,SAASC,IAAI;IACrC,OAAQT,WAAWD,QAAQ;QACzB,KAAK;QACL,KAAK;YACH,OAAOC,WAAWK,aAAa,CAACI,IAAI;QACtC,KAAK;YACH,OAAOT,WAAWS,IAAI;IAC1B;IACA,uFAAuF;IACvF,MAAM,EACJC,SAAQ,EACRC,UAAS,EACTC,UAAS,EACV,GAAGV,yBAAyBF;IAC7B,IAAI,wBAAwBa,IAAI,CAACH,WAAWE,YAAYD,YAAY;QAClE,OAAOX;IACT,CAAC;IACD,OAAOJ,gBAAgBI;AACzB;AACO,MAAMH,kBAAkBC,CAAAA,OAAQ;IACrC,MAAMgB,sBAAsBlB,gBAAgBE;IAC5C,OAAOgB,sBAAsBA,wBAAwBA,oBAAoBT,aAAa,EAAEI,OAAO,KAAK;AACtG,GACA,2CAA2C"}
@@ -1,30 +1,30 @@
1
- "use strict";
2
-
3
1
  //
4
2
  // Dev utils to detect if nodes have "autoFocus" props.
5
3
  //
4
+ "use strict";
6
5
  Object.defineProperty(exports, "__esModule", {
7
- value: true
6
+ value: true
8
7
  });
9
- exports.hasAutofocusFilter = void 0;
10
- const getReactFiberFromNode_1 = /*#__PURE__*/require("./getReactFiberFromNode");
8
+ Object.defineProperty(exports, "hasAutofocusFilter", {
9
+ enumerable: true,
10
+ get: ()=>hasAutofocusFilter
11
+ });
12
+ const _getReactFiberFromNode = require("./getReactFiberFromNode");
11
13
  /**
12
14
  * Detects if a passed HTML node has "autoFocus" prop on a React's fiber. Is needed as React handles autofocus behavior
13
15
  * in React DOM and will not pass "autoFocus" to an actual HTML.
14
16
  *
15
17
  * @param node
16
- */
17
- function hasAutofocusProp(node) {
18
- var _a;
19
- // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
20
- const isAutoFocusableElement = node.nodeName === 'BUTTON' || node.nodeName === 'INPUT' || node.nodeName === 'SELECT' || node.nodeName === 'TEXTAREA';
21
- if (isAutoFocusableElement) {
22
- return !!((_a = getReactFiberFromNode_1.getReactFiberFromNode(node)) === null || _a === void 0 ? void 0 : _a.pendingProps.autoFocus);
23
- }
24
- return false;
18
+ */ function hasAutofocusProp(node) {
19
+ // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
20
+ const isAutoFocusableElement = node.nodeName === "BUTTON" || node.nodeName === "INPUT" || node.nodeName === "SELECT" || node.nodeName === "TEXTAREA";
21
+ if (isAutoFocusableElement) {
22
+ return !!(0, _getReactFiberFromNode.getReactFiberFromNode)(node)?.pendingProps.autoFocus;
23
+ }
24
+ return false;
25
25
  }
26
26
  function hasAutofocusFilter(node) {
27
- return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
28
- }
29
- exports.hasAutofocusFilter = hasAutofocusFilter;
27
+ return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
28
+ } //# sourceMappingURL=hasAutoFocusFilter.js.map
29
+
30
30
  //# sourceMappingURL=hasAutoFocusFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getReactFiberFromNode_1","require","hasAutofocusProp","node","isAutoFocusableElement","nodeName","_a","getReactFiberFromNode","pendingProps","autoFocus","hasAutofocusFilter","NodeFilter","FILTER_ACCEPT","FILTER_SKIP","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/hasAutoFocusFilter.ts"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n *\n * @param node\n */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nexport function hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"],"mappings":";;AAAA;AACA;AACA;;;;;AAEA,MAAAA,uBAAA,gBAAAC,OAAA;AAEA;;;;;;AAMA,SAASC,gBAAgBA,CAACC,IAAU;;EAClC;EACA,MAAMC,sBAAsB,GAC1BD,IAAI,CAACE,QAAQ,KAAK,QAAQ,IAC1BF,IAAI,CAACE,QAAQ,KAAK,OAAO,IACzBF,IAAI,CAACE,QAAQ,KAAK,QAAQ,IAC1BF,IAAI,CAACE,QAAQ,KAAK,UAAU;EAE9B,IAAID,sBAAsB,EAAE;IAC1B,OAAO,CAAC,EAAC,CAAAE,EAAA,GAAAN,uBAAA,CAAAO,qBAAqB,CAACJ,IAAI,CAAC,cAAAG,EAAA,uBAAAA,EAAA,CAAEE,YAAY,CAACC,SAAS;;EAG9D,OAAO,KAAK;AACd;AAEA,SAAgBC,kBAAkBA,CAACP,IAAU;EAC3C,OAAOD,gBAAgB,CAACC,IAAI,CAAC,GAAGQ,UAAU,CAACC,aAAa,GAAGD,UAAU,CAACE,WAAW;AACnF;AAFAC,OAAA,CAAAJ,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/hasAutoFocusFilter.js"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\nimport { getReactFiberFromNode } from \"./getReactFiberFromNode\";\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n *\n * @param node\n */\nfunction hasAutofocusProp(node) {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement = node.nodeName === \"BUTTON\" || node.nodeName === \"INPUT\" || node.nodeName === \"SELECT\" || node.nodeName === \"TEXTAREA\";\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n return false;\n}\nexport function hasAutofocusFilter(node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n//# sourceMappingURL=hasAutoFocusFilter.js.map"],"names":["hasAutofocusFilter","hasAutofocusProp","node","isAutoFocusableElement","nodeName","getReactFiberFromNode","pendingProps","autoFocus","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"mappings":"AAAA,EAAE;AACF,uDAAuD;AACvD,EAAE;;;;;+BAgBcA;;aAAAA;;uCAfsB;AACtC;;;;;CAKC,GACD,SAASC,iBAAiBC,IAAI,EAAE;IAC9B,gJAAgJ;IAChJ,MAAMC,yBAAyBD,KAAKE,QAAQ,KAAK,YAAYF,KAAKE,QAAQ,KAAK,WAAWF,KAAKE,QAAQ,KAAK,YAAYF,KAAKE,QAAQ,KAAK;IAC1I,IAAID,wBAAwB;QAC1B,OAAO,CAAC,CAACE,IAAAA,4CAAqB,EAACH,OAAOI,aAAaC,SAAS;IAC9D,CAAC;IACD,OAAO,KAAK;AACd;AACO,SAASP,mBAAmBE,IAAI,EAAE;IACvC,OAAOD,iBAAiBC,QAAQM,WAAWC,aAAa,GAAGD,WAAWE,WAAW;AACnF,EACA,8CAA8C"}
@@ -1,22 +1,23 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./parseFloatingUIPlacement"), exports);
8
- tslib_1.__exportStar(require("./getBoundary"), exports);
9
- tslib_1.__exportStar(require("./getReactFiberFromNode"), exports);
10
- tslib_1.__exportStar(require("./getScrollParent"), exports);
11
- tslib_1.__exportStar(require("./mergeArrowOffset"), exports);
12
- tslib_1.__exportStar(require("./toFloatingUIPadding"), exports);
13
- tslib_1.__exportStar(require("./toFloatingUIPlacement"), exports);
14
- tslib_1.__exportStar(require("./fromFloatingUIPlacement"), exports);
15
- tslib_1.__exportStar(require("./resolvePositioningShorthand"), exports);
16
- tslib_1.__exportStar(require("./useCallbackRef"), exports);
17
- tslib_1.__exportStar(require("./debounce"), exports);
18
- tslib_1.__exportStar(require("./toggleScrollListener"), exports);
19
- tslib_1.__exportStar(require("./hasAutoFocusFilter"), exports);
20
- tslib_1.__exportStar(require("./writeArrowUpdates"), exports);
21
- tslib_1.__exportStar(require("./writeContainerupdates"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./parseFloatingUIPlacement"), exports);
7
+ _exportStar(require("./getBoundary"), exports);
8
+ _exportStar(require("./getReactFiberFromNode"), exports);
9
+ _exportStar(require("./getScrollParent"), exports);
10
+ _exportStar(require("./mergeArrowOffset"), exports);
11
+ _exportStar(require("./toFloatingUIPadding"), exports);
12
+ _exportStar(require("./toFloatingUIPlacement"), exports);
13
+ _exportStar(require("./fromFloatingUIPlacement"), exports);
14
+ _exportStar(require("./resolvePositioningShorthand"), exports);
15
+ _exportStar(require("./useCallbackRef"), exports);
16
+ _exportStar(require("./debounce"), exports);
17
+ _exportStar(require("./toggleScrollListener"), exports);
18
+ _exportStar(require("./hasAutoFocusFilter"), exports);
19
+ _exportStar(require("./writeArrowUpdates"), exports);
20
+ _exportStar(require("./writeContainerupdates"), exports);
21
+ //# sourceMappingURL=index.js.map
22
+
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/index.ts"],"sourcesContent":["export * from './parseFloatingUIPlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './toFloatingUIPadding';\nexport * from './toFloatingUIPlacement';\nexport * from './fromFloatingUIPlacement';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\nexport * from './debounce';\nexport * from './toggleScrollListener';\nexport * from './hasAutoFocusFilter';\nexport * from './writeArrowUpdates';\nexport * from './writeContainerupdates';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,gCAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,6BAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,uBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,wBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,2BAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,6BAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,+BAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,mCAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,sBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,gBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,4BAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,0BAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,6BAAAC,OAAA"}
1
+ {"version":3,"sources":["../../lib/utils/index.js"],"sourcesContent":["export * from \"./parseFloatingUIPlacement\";\nexport * from \"./getBoundary\";\nexport * from \"./getReactFiberFromNode\";\nexport * from \"./getScrollParent\";\nexport * from \"./mergeArrowOffset\";\nexport * from \"./toFloatingUIPadding\";\nexport * from \"./toFloatingUIPlacement\";\nexport * from \"./fromFloatingUIPlacement\";\nexport * from \"./resolvePositioningShorthand\";\nexport * from \"./useCallbackRef\";\nexport * from \"./debounce\";\nexport * from \"./toggleScrollListener\";\nexport * from \"./hasAutoFocusFilter\";\nexport * from \"./writeArrowUpdates\";\nexport * from \"./writeContainerupdates\";\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.mergeArrowOffset = void 0;
7
1
  /**
8
2
  * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the
9
3
  * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset
@@ -12,35 +6,41 @@ exports.mergeArrowOffset = void 0;
12
6
  * @param userOffset - The offset provided by the user
13
7
  * @param arrowHeight - The height of the arrow in px
14
8
  * @returns User offset augmented with arrow height
15
- */
9
+ */ "use strict";
10
+ Object.defineProperty(exports, "__esModule", {
11
+ value: true
12
+ });
13
+ Object.defineProperty(exports, "mergeArrowOffset", {
14
+ enumerable: true,
15
+ get: ()=>mergeArrowOffset
16
+ });
16
17
  function mergeArrowOffset(userOffset, arrowHeight) {
17
- if (typeof userOffset === 'number') {
18
- return addArrowOffset(userOffset, arrowHeight);
19
- }
20
- if (typeof userOffset === 'object' && userOffset !== null) {
21
- return addArrowOffset(userOffset, arrowHeight);
22
- }
23
- if (typeof userOffset === 'function') {
24
- return offsetParams => {
25
- const offset = userOffset(offsetParams);
26
- return addArrowOffset(offset, arrowHeight);
18
+ if (typeof userOffset === "number") {
19
+ return addArrowOffset(userOffset, arrowHeight);
20
+ }
21
+ if (typeof userOffset === "object" && userOffset !== null) {
22
+ return addArrowOffset(userOffset, arrowHeight);
23
+ }
24
+ if (typeof userOffset === "function") {
25
+ return (offsetParams)=>{
26
+ const offset = userOffset(offsetParams);
27
+ return addArrowOffset(offset, arrowHeight);
28
+ };
29
+ }
30
+ return {
31
+ mainAxis: arrowHeight
27
32
  };
28
- }
29
- return {
30
- mainAxis: arrowHeight
31
- };
32
33
  }
33
- exports.mergeArrowOffset = mergeArrowOffset;
34
- const addArrowOffset = (offset, arrowHeight) => {
35
- var _a;
36
- if (typeof offset === 'number') {
34
+ const addArrowOffset = (offset, arrowHeight)=>{
35
+ if (typeof offset === "number") {
36
+ return {
37
+ mainAxis: offset + arrowHeight
38
+ };
39
+ }
37
40
  return {
38
- mainAxis: offset + arrowHeight
41
+ ...offset,
42
+ mainAxis: (offset.mainAxis ?? 0) + arrowHeight
39
43
  };
40
- }
41
- return {
42
- ...offset,
43
- mainAxis: ((_a = offset.mainAxis) !== null && _a !== void 0 ? _a : 0) + arrowHeight
44
- };
45
- };
44
+ }; //# sourceMappingURL=mergeArrowOffset.js.map
45
+
46
46
  //# sourceMappingURL=mergeArrowOffset.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","exports","_a"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/mergeArrowOffset.ts"],"sourcesContent":["import type { Offset, OffsetObject } from '../types';\n\n/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @internal\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"],"mappings":";;;;;;AAEA;;;;;;;;;AASA,SAAgBA,gBAAgBA,CAACC,UAAqC,EAAEC,WAAmB;EACzF,IAAI,OAAOD,UAAU,KAAK,QAAQ,EAAE;IAClC,OAAOE,cAAc,CAACF,UAAU,EAAEC,WAAW,CAAC;;EAGhD,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIA,UAAU,KAAK,IAAI,EAAE;IACzD,OAAOE,cAAc,CAACF,UAAU,EAAEC,WAAW,CAAC;;EAGhD,IAAI,OAAOD,UAAU,KAAK,UAAU,EAAE;IACpC,OAAOG,YAAY,IAAG;MACpB,MAAMC,MAAM,GAAGJ,UAAU,CAACG,YAAY,CAAC;MACvC,OAAOD,cAAc,CAACE,MAAM,EAAEH,WAAW,CAAC;IAC5C,CAAC;;EAGH,OAAO;IAAEI,QAAQ,EAAEJ;EAAW,CAAE;AAClC;AAjBAK,OAAA,CAAAP,gBAAA,GAAAA,gBAAA;AAmBA,MAAMG,cAAc,GAAGA,CAACE,MAA6B,EAAEH,WAAmB,KAAkB;;EAC1F,IAAI,OAAOG,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAO;MAAEC,QAAQ,EAAED,MAAM,GAAGH;IAAW,CAAE;;EAG3C,OAAO;IAAE,GAAGG,MAAM;IAAEC,QAAQ,EAAE,CAAC,CAAAE,EAAA,GAAAH,MAAM,CAACC,QAAQ,cAAAE,EAAA,cAAAA,EAAA,GAAI,CAAC,IAAIN;EAAW,CAAE;AACtE,CAAC"}
1
+ {"version":3,"sources":["../../lib/utils/mergeArrowOffset.js"],"sourcesContent":["/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @internal\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */export function mergeArrowOffset(userOffset, arrowHeight) {\n if (typeof userOffset === \"number\") {\n return addArrowOffset(userOffset, arrowHeight);\n }\n if (typeof userOffset === \"object\" && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n if (typeof userOffset === \"function\") {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n return {\n mainAxis: arrowHeight\n };\n}\nconst addArrowOffset = (offset, arrowHeight) => {\n if (typeof offset === \"number\") {\n return {\n mainAxis: offset + arrowHeight\n };\n }\n return {\n ...offset,\n mainAxis: (offset.mainAxis ?? 0) + arrowHeight\n };\n};\n//# sourceMappingURL=mergeArrowOffset.js.map"],"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis"],"mappings":"AAAA;;;;;;;;CAQC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,iBAAiBC,UAAU,EAAEC,WAAW,EAAE;IAC3D,IAAI,OAAOD,eAAe,UAAU;QAClC,OAAOE,eAAeF,YAAYC;IACpC,CAAC;IACD,IAAI,OAAOD,eAAe,YAAYA,eAAe,IAAI,EAAE;QACzD,OAAOE,eAAeF,YAAYC;IACpC,CAAC;IACD,IAAI,OAAOD,eAAe,YAAY;QACpC,OAAOG,CAAAA,eAAgB;YACrB,MAAMC,SAASJ,WAAWG;YAC1B,OAAOD,eAAeE,QAAQH;QAChC;IACF,CAAC;IACD,OAAO;QACLI,UAAUJ;IACZ;AACF;AACA,MAAMC,iBAAiB,CAACE,QAAQH,cAAgB;IAC9C,IAAI,OAAOG,WAAW,UAAU;QAC9B,OAAO;YACLC,UAAUD,SAASH;QACrB;IACF,CAAC;IACD,OAAO;QACL,GAAGG,MAAM;QACTC,UAAU,AAACD,CAAAA,OAAOC,QAAQ,IAAI,CAAA,IAAKJ;IACrC;AACF,GACA,4CAA4C"}
@@ -1,21 +1,22 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parseFloatingUIPlacement = void 0;
7
1
  /**
8
2
  * Parses Floating UI placement and returns the different components
9
3
  * @param placement - the floating ui placement (i.e. bottom-start)
10
4
  *
11
5
  * @returns side and alignment components of the placement
12
- */
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ Object.defineProperty(exports, "parseFloatingUIPlacement", {
11
+ enumerable: true,
12
+ get: ()=>parseFloatingUIPlacement
13
+ });
13
14
  function parseFloatingUIPlacement(placement) {
14
- const tokens = placement.split('-');
15
- return {
16
- side: tokens[0],
17
- alignment: tokens[1]
18
- };
19
- }
20
- exports.parseFloatingUIPlacement = parseFloatingUIPlacement;
15
+ const tokens = placement.split("-");
16
+ return {
17
+ side: tokens[0],
18
+ alignment: tokens[1]
19
+ };
20
+ } //# sourceMappingURL=parseFloatingUIPlacement.js.map
21
+
21
22
  //# sourceMappingURL=parseFloatingUIPlacement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/parseFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Placement, Alignment } from '@floating-ui/dom';\n\n/**\n * Parses Floating UI placement and returns the different components\n * @param placement - the floating ui placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parseFloatingUIPlacement(placement: Placement): { side: Side; alignment: Alignment } {\n const tokens = placement.split('-');\n return {\n side: tokens[0] as Side,\n alignment: tokens[1] as Alignment,\n };\n}\n"],"mappings":";;;;;;AAEA;;;;;;AAMA,SAAgBA,wBAAwBA,CAACC,SAAoB;EAC3D,MAAMC,MAAM,GAAGD,SAAS,CAACE,KAAK,CAAC,GAAG,CAAC;EACnC,OAAO;IACLC,IAAI,EAAEF,MAAM,CAAC,CAAC,CAAS;IACvBG,SAAS,EAAEH,MAAM,CAAC,CAAC;GACpB;AACH;AANAI,OAAA,CAAAN,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/parseFloatingUIPlacement.js"],"sourcesContent":["/**\n * Parses Floating UI placement and returns the different components\n * @param placement - the floating ui placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */export function parseFloatingUIPlacement(placement) {\n const tokens = placement.split(\"-\");\n return {\n side: tokens[0],\n alignment: tokens[1]\n };\n}\n//# sourceMappingURL=parseFloatingUIPlacement.js.map"],"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment"],"mappings":"AAAA;;;;;CAKC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,yBAAyBC,SAAS,EAAE;IACrD,MAAMC,SAASD,UAAUE,KAAK,CAAC;IAC/B,OAAO;QACLC,MAAMF,MAAM,CAAC,EAAE;QACfG,WAAWH,MAAM,CAAC,EAAE;IACtB;AACF,EACA,oDAAoD"}
@@ -1,68 +1,70 @@
1
+ // Look up table for shorthand to avoid parsing strings
1
2
  "use strict";
2
-
3
3
  Object.defineProperty(exports, "__esModule", {
4
- value: true
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "resolvePositioningShorthand", {
7
+ enumerable: true,
8
+ get: ()=>resolvePositioningShorthand
5
9
  });
6
- exports.resolvePositioningShorthand = void 0;
7
- // Look up table for shorthand to avoid parsing strings
8
10
  const shorthandLookup = {
9
- above: {
10
- position: 'above',
11
- align: 'center'
12
- },
13
- 'above-start': {
14
- position: 'above',
15
- align: 'start'
16
- },
17
- 'above-end': {
18
- position: 'above',
19
- align: 'end'
20
- },
21
- below: {
22
- position: 'below',
23
- align: 'center'
24
- },
25
- 'below-start': {
26
- position: 'below',
27
- align: 'start'
28
- },
29
- 'below-end': {
30
- position: 'below',
31
- align: 'end'
32
- },
33
- before: {
34
- position: 'before',
35
- align: 'center'
36
- },
37
- 'before-top': {
38
- position: 'before',
39
- align: 'top'
40
- },
41
- 'before-bottom': {
42
- position: 'before',
43
- align: 'bottom'
44
- },
45
- after: {
46
- position: 'after',
47
- align: 'center'
48
- },
49
- 'after-top': {
50
- position: 'after',
51
- align: 'top'
52
- },
53
- 'after-bottom': {
54
- position: 'after',
55
- align: 'bottom'
56
- }
11
+ above: {
12
+ position: "above",
13
+ align: "center"
14
+ },
15
+ "above-start": {
16
+ position: "above",
17
+ align: "start"
18
+ },
19
+ "above-end": {
20
+ position: "above",
21
+ align: "end"
22
+ },
23
+ below: {
24
+ position: "below",
25
+ align: "center"
26
+ },
27
+ "below-start": {
28
+ position: "below",
29
+ align: "start"
30
+ },
31
+ "below-end": {
32
+ position: "below",
33
+ align: "end"
34
+ },
35
+ before: {
36
+ position: "before",
37
+ align: "center"
38
+ },
39
+ "before-top": {
40
+ position: "before",
41
+ align: "top"
42
+ },
43
+ "before-bottom": {
44
+ position: "before",
45
+ align: "bottom"
46
+ },
47
+ after: {
48
+ position: "after",
49
+ align: "center"
50
+ },
51
+ "after-top": {
52
+ position: "after",
53
+ align: "top"
54
+ },
55
+ "after-bottom": {
56
+ position: "after",
57
+ align: "bottom"
58
+ }
57
59
  };
58
60
  function resolvePositioningShorthand(shorthand) {
59
- if (shorthand === undefined || shorthand === null) {
60
- return {};
61
- }
62
- if (typeof shorthand === 'string') {
63
- return shorthandLookup[shorthand];
64
- }
65
- return shorthand;
66
- }
67
- exports.resolvePositioningShorthand = resolvePositioningShorthand;
61
+ if (shorthand === undefined || shorthand === null) {
62
+ return {};
63
+ }
64
+ if (typeof shorthand === "string") {
65
+ return shorthandLookup[shorthand];
66
+ }
67
+ return shorthand;
68
+ } //# sourceMappingURL=resolvePositioningShorthand.js.map
69
+
68
70
  //# sourceMappingURL=resolvePositioningShorthand.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["shorthandLookup","above","position","align","below","before","after","resolvePositioningShorthand","shorthand","undefined","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/resolvePositioningShorthand.ts"],"sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"],"mappings":";;;;;;AAEA;AACA,MAAMA,eAAe,GAAoF;EACvGC,KAAK,EAAE;IAAEC,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,aAAa,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAO,CAAE;EACpD,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChDC,KAAK,EAAE;IAAEF,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,aAAa,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAO,CAAE;EACpD,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChDE,MAAM,EAAE;IAAEH,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC/C,YAAY,EAAE;IAAED,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAK,CAAE;EAClD,eAAe,EAAE;IAAED,QAAQ,EAAE,QAAQ;IAAEC,KAAK,EAAE;EAAQ,CAAE;EACxDG,KAAK,EAAE;IAAEJ,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ,CAAE;EAC7C,WAAW,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAK,CAAE;EAChD,cAAc,EAAE;IAAED,QAAQ,EAAE,OAAO;IAAEC,KAAK,EAAE;EAAQ;CACrD;AAED,SAAgBI,2BAA2BA,CACzCC,SAAkD;EAElD,IAAIA,SAAS,KAAKC,SAAS,IAAID,SAAS,KAAK,IAAI,EAAE;IACjD,OAAO,EAAE;;EAGX,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IACjC,OAAOR,eAAe,CAACQ,SAAS,CAAC;;EAGnC,OAAOA,SAAuC;AAChD;AAZAE,OAAA,CAAAH,2BAAA,GAAAA,2BAAA"}
1
+ {"version":3,"sources":["../../lib/utils/resolvePositioningShorthand.js"],"sourcesContent":["// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup = {\n above: {\n position: \"above\",\n align: \"center\"\n },\n \"above-start\": {\n position: \"above\",\n align: \"start\"\n },\n \"above-end\": {\n position: \"above\",\n align: \"end\"\n },\n below: {\n position: \"below\",\n align: \"center\"\n },\n \"below-start\": {\n position: \"below\",\n align: \"start\"\n },\n \"below-end\": {\n position: \"below\",\n align: \"end\"\n },\n before: {\n position: \"before\",\n align: \"center\"\n },\n \"before-top\": {\n position: \"before\",\n align: \"top\"\n },\n \"before-bottom\": {\n position: \"before\",\n align: \"bottom\"\n },\n after: {\n position: \"after\",\n align: \"center\"\n },\n \"after-top\": {\n position: \"after\",\n align: \"top\"\n },\n \"after-bottom\": {\n position: \"after\",\n align: \"bottom\"\n }\n};\nexport function resolvePositioningShorthand(shorthand) {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n if (typeof shorthand === \"string\") {\n return shorthandLookup[shorthand];\n }\n return shorthand;\n}\n//# sourceMappingURL=resolvePositioningShorthand.js.map"],"names":["resolvePositioningShorthand","shorthandLookup","above","position","align","below","before","after","shorthand","undefined"],"mappings":"AAAA,uDAAuD;;;;;+BAmDvCA;;aAAAA;;AAlDhB,MAAMC,kBAAkB;IACtBC,OAAO;QACLC,UAAU;QACVC,OAAO;IACT;IACA,eAAe;QACbD,UAAU;QACVC,OAAO;IACT;IACA,aAAa;QACXD,UAAU;QACVC,OAAO;IACT;IACAC,OAAO;QACLF,UAAU;QACVC,OAAO;IACT;IACA,eAAe;QACbD,UAAU;QACVC,OAAO;IACT;IACA,aAAa;QACXD,UAAU;QACVC,OAAO;IACT;IACAE,QAAQ;QACNH,UAAU;QACVC,OAAO;IACT;IACA,cAAc;QACZD,UAAU;QACVC,OAAO;IACT;IACA,iBAAiB;QACfD,UAAU;QACVC,OAAO;IACT;IACAG,OAAO;QACLJ,UAAU;QACVC,OAAO;IACT;IACA,aAAa;QACXD,UAAU;QACVC,OAAO;IACT;IACA,gBAAgB;QACdD,UAAU;QACVC,OAAO;IACT;AACF;AACO,SAASJ,4BAA4BQ,SAAS,EAAE;IACrD,IAAIA,cAAcC,aAAaD,cAAc,IAAI,EAAE;QACjD,OAAO,CAAC;IACV,CAAC;IACD,IAAI,OAAOA,cAAc,UAAU;QACjC,OAAOP,eAAe,CAACO,UAAU;IACnC,CAAC;IACD,OAAOA;AACT,EACA,uDAAuD"}
@@ -1,30 +1,28 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "toFloatingUIPadding", {
6
+ enumerable: true,
7
+ get: ()=>toFloatingUIPadding
5
8
  });
6
- exports.toFloatingUIPadding = void 0;
7
9
  function toFloatingUIPadding(padding, isRtl) {
8
- if (typeof padding === 'number') {
9
- return padding;
10
- }
11
- const {
12
- start,
13
- end,
14
- ...verticalPadding
15
- } = padding;
16
- const paddingObject = verticalPadding;
17
- const left = isRtl ? 'end' : 'start';
18
- const right = isRtl ? 'start' : 'end';
19
- // assign properties explicitly since undefined values are actually handled by floating UI
20
- // TODO create floating UI issue
21
- if (padding[left]) {
22
- paddingObject.left = padding[left];
23
- }
24
- if (padding[right]) {
25
- paddingObject.right = padding[right];
26
- }
27
- return paddingObject;
28
- }
29
- exports.toFloatingUIPadding = toFloatingUIPadding;
10
+ if (typeof padding === "number") {
11
+ return padding;
12
+ }
13
+ const { start , end , ...verticalPadding } = padding;
14
+ const paddingObject = verticalPadding;
15
+ const left = isRtl ? "end" : "start";
16
+ const right = isRtl ? "start" : "end";
17
+ // assign properties explicitly since undefined values are actually handled by floating UI
18
+ // TODO create floating UI issue
19
+ if (padding[left]) {
20
+ paddingObject.left = padding[left];
21
+ }
22
+ if (padding[right]) {
23
+ paddingObject.right = padding[right];
24
+ }
25
+ return paddingObject;
26
+ } //# sourceMappingURL=toFloatingUIPadding.js.map
27
+
30
28
  //# sourceMappingURL=toFloatingUIPadding.js.map