@fluentui/react-positioning 9.5.4 → 9.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +55 -1
  3. package/CHANGELOG.md +24 -2
  4. package/lib/constants.js.map +1 -1
  5. package/lib/createArrowStyles.js.map +1 -1
  6. package/lib/createPositionManager.js.map +1 -1
  7. package/lib/createVirtualElementFromClick.js +1 -2
  8. package/lib/createVirtualElementFromClick.js.map +1 -1
  9. package/lib/index.js.map +1 -1
  10. package/lib/middleware/coverTarget.js.map +1 -1
  11. package/lib/middleware/flip.js.map +1 -1
  12. package/lib/middleware/index.js.map +1 -1
  13. package/lib/middleware/intersecting.js.map +1 -1
  14. package/lib/middleware/maxSize.js.map +1 -1
  15. package/lib/middleware/offset.js.map +1 -1
  16. package/lib/middleware/shift.js.map +1 -1
  17. package/lib/types.js +1 -1
  18. package/lib/types.js.map +1 -1
  19. package/lib/usePositioning.js +23 -21
  20. package/lib/usePositioning.js.map +1 -1
  21. package/lib/usePositioningMouseTarget.js.map +1 -1
  22. package/lib/utils/debounce.js +1 -2
  23. package/lib/utils/debounce.js.map +1 -1
  24. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  25. package/lib/utils/getBoundary.js.map +1 -1
  26. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  27. package/lib/utils/getReactFiberFromNode.js +1 -0
  28. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  29. package/lib/utils/getScrollParent.js +5 -6
  30. package/lib/utils/getScrollParent.js.map +1 -1
  31. package/lib/utils/hasAutoFocusFilter.js +2 -2
  32. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  33. package/lib/utils/index.js.map +1 -1
  34. package/lib/utils/mergeArrowOffset.js +3 -4
  35. package/lib/utils/mergeArrowOffset.js.map +1 -1
  36. package/lib/utils/parseFloatingUIPlacement.js +1 -2
  37. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  38. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  39. package/lib/utils/toFloatingUIPadding.js.map +1 -1
  40. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  41. package/lib/utils/toggleScrollListener.js.map +1 -1
  42. package/lib/utils/useCallbackRef.js.map +1 -1
  43. package/lib/utils/writeArrowUpdates.js +1 -2
  44. package/lib/utils/writeArrowUpdates.js.map +1 -1
  45. package/lib/utils/writeContainerupdates.js +4 -4
  46. package/lib/utils/writeContainerupdates.js.map +1 -1
  47. package/lib-commonjs/constants.js +18 -7
  48. package/lib-commonjs/constants.js.map +1 -1
  49. package/lib-commonjs/createArrowStyles.js +60 -88
  50. package/lib-commonjs/createArrowStyles.js.map +1 -1
  51. package/lib-commonjs/createPositionManager.js +103 -117
  52. package/lib-commonjs/createPositionManager.js.map +1 -1
  53. package/lib-commonjs/createVirtualElementFromClick.js +27 -26
  54. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  55. package/lib-commonjs/index.js +24 -51
  56. package/lib-commonjs/index.js.map +1 -1
  57. package/lib-commonjs/middleware/coverTarget.js +34 -37
  58. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  59. package/lib-commonjs/middleware/flip.js +31 -38
  60. package/lib-commonjs/middleware/flip.js.map +1 -1
  61. package/lib-commonjs/middleware/index.js +10 -9
  62. package/lib-commonjs/middleware/index.js.map +1 -1
  63. package/lib-commonjs/middleware/intersecting.js +24 -22
  64. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  65. package/lib-commonjs/middleware/maxSize.js +34 -40
  66. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  67. package/lib-commonjs/middleware/offset.js +11 -12
  68. package/lib-commonjs/middleware/offset.js.map +1 -1
  69. package/lib-commonjs/middleware/shift.js +29 -37
  70. package/lib-commonjs/middleware/shift.js.map +1 -1
  71. package/lib-commonjs/types.js +5 -2
  72. package/lib-commonjs/types.js.map +1 -1
  73. package/lib-commonjs/usePositioning.js +200 -164
  74. package/lib-commonjs/usePositioning.js.map +1 -1
  75. package/lib-commonjs/usePositioningMouseTarget.js +34 -37
  76. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  77. package/lib-commonjs/utils/debounce.js +22 -21
  78. package/lib-commonjs/utils/debounce.js.map +1 -1
  79. package/lib-commonjs/utils/fromFloatingUIPlacement.js +30 -35
  80. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  81. package/lib-commonjs/utils/getBoundary.js +21 -22
  82. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  83. package/lib-commonjs/utils/getFloatingUIOffset.js +23 -35
  84. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  85. package/lib-commonjs/utils/getReactFiberFromNode.js +45 -41
  86. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  87. package/lib-commonjs/utils/getScrollParent.js +52 -56
  88. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  89. package/lib-commonjs/utils/hasAutoFocusFilter.js +18 -17
  90. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  91. package/lib-commonjs/utils/index.js +19 -18
  92. package/lib-commonjs/utils/index.js.map +1 -1
  93. package/lib-commonjs/utils/mergeArrowOffset.js +33 -32
  94. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  95. package/lib-commonjs/utils/parseFloatingUIPlacement.js +15 -14
  96. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  97. package/lib-commonjs/utils/resolvePositioningShorthand.js +63 -61
  98. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  99. package/lib-commonjs/utils/toFloatingUIPadding.js +23 -25
  100. package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
  101. package/lib-commonjs/utils/toFloatingUIPlacement.js +31 -33
  102. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  103. package/lib-commonjs/utils/toggleScrollListener.js +20 -24
  104. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  105. package/lib-commonjs/utils/useCallbackRef.js +39 -53
  106. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  107. package/lib-commonjs/utils/writeArrowUpdates.js +19 -24
  108. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  109. package/lib-commonjs/utils/writeContainerupdates.js +37 -45
  110. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  111. package/package.json +7 -6
  112. package/lib-amd/constants.js +0 -10
  113. package/lib-amd/constants.js.map +0 -1
  114. package/lib-amd/createArrowStyles.js +0 -62
  115. package/lib-amd/createArrowStyles.js.map +0 -1
  116. package/lib-amd/createPositionManager.js +0 -97
  117. package/lib-amd/createPositionManager.js.map +0 -1
  118. package/lib-amd/createVirtualElementFromClick.js +0 -32
  119. package/lib-amd/createVirtualElementFromClick.js.map +0 -1
  120. package/lib-amd/index.js +0 -13
  121. package/lib-amd/index.js.map +0 -1
  122. package/lib-amd/middleware/coverTarget.js +0 -32
  123. package/lib-amd/middleware/coverTarget.js.map +0 -1
  124. package/lib-amd/middleware/flip.js +0 -19
  125. package/lib-amd/middleware/flip.js.map +0 -1
  126. package/lib-amd/middleware/index.js +0 -11
  127. package/lib-amd/middleware/index.js.map +0 -1
  128. package/lib-amd/middleware/intersecting.js +0 -33
  129. package/lib-amd/middleware/intersecting.js.map +0 -1
  130. package/lib-amd/middleware/maxSize.js +0 -33
  131. package/lib-amd/middleware/maxSize.js.map +0 -1
  132. package/lib-amd/middleware/offset.js +0 -14
  133. package/lib-amd/middleware/offset.js.map +0 -1
  134. package/lib-amd/middleware/shift.js +0 -17
  135. package/lib-amd/middleware/shift.js.map +0 -1
  136. package/lib-amd/types.js +0 -5
  137. package/lib-amd/types.js.map +0 -1
  138. package/lib-amd/usePositioning.js +0 -161
  139. package/lib-amd/usePositioning.js.map +0 -1
  140. package/lib-amd/usePositioningMouseTarget.js +0 -39
  141. package/lib-amd/usePositioningMouseTarget.js.map +0 -1
  142. package/lib-amd/utils/debounce.js +0 -27
  143. package/lib-amd/utils/debounce.js.map +0 -1
  144. package/lib-amd/utils/fromFloatingUIPlacement.js +0 -37
  145. package/lib-amd/utils/fromFloatingUIPlacement.js.map +0 -1
  146. package/lib-amd/utils/getBoundary.js +0 -26
  147. package/lib-amd/utils/getBoundary.js.map +0 -1
  148. package/lib-amd/utils/getFloatingUIOffset.js +0 -25
  149. package/lib-amd/utils/getFloatingUIOffset.js.map +0 -1
  150. package/lib-amd/utils/getReactFiberFromNode.js +0 -48
  151. package/lib-amd/utils/getReactFiberFromNode.js.map +0 -1
  152. package/lib-amd/utils/getScrollParent.js +0 -64
  153. package/lib-amd/utils/getScrollParent.js.map +0 -1
  154. package/lib-amd/utils/hasAutoFocusFilter.js +0 -31
  155. package/lib-amd/utils/hasAutoFocusFilter.js.map +0 -1
  156. package/lib-amd/utils/index.js +0 -20
  157. package/lib-amd/utils/index.js.map +0 -1
  158. package/lib-amd/utils/mergeArrowOffset.js +0 -38
  159. package/lib-amd/utils/mergeArrowOffset.js.map +0 -1
  160. package/lib-amd/utils/parseFloatingUIPlacement.js +0 -20
  161. package/lib-amd/utils/parseFloatingUIPlacement.js.map +0 -1
  162. package/lib-amd/utils/resolvePositioningShorthand.js +0 -31
  163. package/lib-amd/utils/resolvePositioningShorthand.js.map +0 -1
  164. package/lib-amd/utils/toFloatingUIPadding.js +0 -25
  165. package/lib-amd/utils/toFloatingUIPadding.js.map +0 -1
  166. package/lib-amd/utils/toFloatingUIPlacement.js +0 -40
  167. package/lib-amd/utils/toFloatingUIPlacement.js.map +0 -1
  168. package/lib-amd/utils/toggleScrollListener.js +0 -26
  169. package/lib-amd/utils/toggleScrollListener.js.map +0 -1
  170. package/lib-amd/utils/useCallbackRef.js +0 -55
  171. package/lib-amd/utils/useCallbackRef.js.map +0 -1
  172. package/lib-amd/utils/writeArrowUpdates.js +0 -21
  173. package/lib-amd/utils/writeArrowUpdates.js.map +0 -1
  174. package/lib-amd/utils/writeContainerupdates.js +0 -41
  175. package/lib-amd/utils/writeContainerupdates.js.map +0 -1
@@ -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":["../src/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,42 @@ 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
+ }
40
+ var _offset_mainAxis;
37
41
  return {
38
- mainAxis: offset + arrowHeight
42
+ ...offset,
43
+ mainAxis: ((_offset_mainAxis = offset.mainAxis) !== null && _offset_mainAxis !== void 0 ? _offset_mainAxis : 0) + arrowHeight
39
44
  };
40
- }
41
- return {
42
- ...offset,
43
- mainAxis: ((_a = offset.mainAxis) !== null && _a !== void 0 ? _a : 0) + arrowHeight
44
- };
45
- };
45
+ }; //# sourceMappingURL=mergeArrowOffset.js.map
46
+
46
47
  //# sourceMappingURL=mergeArrowOffset.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","exports","_a"],"sources":["../src/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 var _offset_mainAxis;\n return {\n ...offset,\n mainAxis: ((_offset_mainAxis = offset.mainAxis) !== null && _offset_mainAxis !== void 0 ? _offset_mainAxis : 0) + arrowHeight\n };\n};\n//# sourceMappingURL=mergeArrowOffset.js.map"],"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","_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,IAAIK;IACJ,OAAO;QACL,GAAGF,MAAM;QACTC,UAAU,AAAC,CAAA,AAACC,CAAAA,mBAAmBF,OAAOC,QAAQ,AAAD,MAAO,IAAI,IAAIC,qBAAqB,KAAK,IAAIA,mBAAmB,CAAC,AAAD,IAAKL;IACpH;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":["../src/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":["../src/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
@@ -1 +1 @@
1
- {"version":3,"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right","exports"],"sources":["../src/packages/react-components/react-positioning/src/utils/toFloatingUIPadding.ts"],"sourcesContent":["import type { SideObject } from '@floating-ui/dom';\nimport { PositioningOptions } from '../types';\n\nexport function toFloatingUIPadding(\n padding: NonNullable<PositioningOptions['overflowBoundaryPadding']>,\n isRtl: boolean,\n): number | Partial<SideObject> {\n if (typeof padding === 'number') {\n return padding;\n }\n\n const { start, end, ...verticalPadding } = padding;\n\n const paddingObject: Partial<SideObject> = verticalPadding;\n\n const left = isRtl ? 'end' : 'start';\n const right = isRtl ? 'start' : 'end';\n\n // assign properties explicitly since undefined values are actually handled by floating UI\n // TODO create floating UI issue\n if (padding[left]) {\n paddingObject.left = padding[left];\n }\n\n if (padding[right]) {\n paddingObject.right = padding[right];\n }\n\n return paddingObject;\n}\n"],"mappings":";;;;;;AAGA,SAAgBA,mBAAmBA,CACjCC,OAAmE,EACnEC,KAAc;EAEd,IAAI,OAAOD,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOA,OAAO;;EAGhB,MAAM;IAAEE,KAAK;IAAEC,GAAG;IAAE,GAAGC;EAAe,CAAE,GAAGJ,OAAO;EAElD,MAAMK,aAAa,GAAwBD,eAAe;EAE1D,MAAME,IAAI,GAAGL,KAAK,GAAG,KAAK,GAAG,OAAO;EACpC,MAAMM,KAAK,GAAGN,KAAK,GAAG,OAAO,GAAG,KAAK;EAErC;EACA;EACA,IAAID,OAAO,CAACM,IAAI,CAAC,EAAE;IACjBD,aAAa,CAACC,IAAI,GAAGN,OAAO,CAACM,IAAI,CAAC;;EAGpC,IAAIN,OAAO,CAACO,KAAK,CAAC,EAAE;IAClBF,aAAa,CAACE,KAAK,GAAGP,OAAO,CAACO,KAAK,CAAC;;EAGtC,OAAOF,aAAa;AACtB;AA1BAG,OAAA,CAAAT,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/toFloatingUIPadding.js"],"sourcesContent":["export function toFloatingUIPadding(padding, isRtl) {\n if (typeof padding === 'number') {\n return padding;\n }\n const {\n start,\n end,\n ...verticalPadding\n } = padding;\n const paddingObject = verticalPadding;\n const left = isRtl ? 'end' : 'start';\n const right = isRtl ? 'start' : 'end';\n // assign properties explicitly since undefined values are actually handled by floating UI\n // TODO create floating UI issue\n if (padding[left]) {\n paddingObject.left = padding[left];\n }\n if (padding[right]) {\n paddingObject.right = padding[right];\n }\n return paddingObject;\n}\n//# sourceMappingURL=toFloatingUIPadding.js.map"],"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right"],"mappings":";;;;+BAAgBA;;aAAAA;;AAAT,SAASA,oBAAoBC,OAAO,EAAEC,KAAK,EAAE;IAClD,IAAI,OAAOD,YAAY,UAAU;QAC/B,OAAOA;IACT,CAAC;IACD,MAAM,EACJE,MAAK,EACLC,IAAG,EACH,GAAGC,iBACJ,GAAGJ;IACJ,MAAMK,gBAAgBD;IACtB,MAAME,OAAOL,QAAQ,QAAQ,OAAO;IACpC,MAAMM,QAAQN,QAAQ,UAAU,KAAK;IACrC,0FAA0F;IAC1F,gCAAgC;IAChC,IAAID,OAAO,CAACM,KAAK,EAAE;QACjBD,cAAcC,IAAI,GAAGN,OAAO,CAACM,KAAK;IACpC,CAAC;IACD,IAAIN,OAAO,CAACO,MAAM,EAAE;QAClBF,cAAcE,KAAK,GAAGP,OAAO,CAACO,MAAM;IACtC,CAAC;IACD,OAAOF;AACT,EACA,+CAA+C"}
@@ -1,41 +1,39 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.toFloatingUIPlacement = void 0;
7
- const getPositionMap = rtl => ({
8
- above: 'top',
9
- below: 'bottom',
10
- before: rtl ? 'right' : 'left',
11
- after: rtl ? 'left' : 'right'
5
+ Object.defineProperty(exports, "toFloatingUIPlacement", {
6
+ enumerable: true,
7
+ get: ()=>toFloatingUIPlacement
12
8
  });
9
+ const getPositionMap = (rtl)=>({
10
+ above: 'top',
11
+ below: 'bottom',
12
+ before: rtl ? 'right' : 'left',
13
+ after: rtl ? 'left' : 'right'
14
+ });
13
15
  // Floating UI automatically flips alignment
14
16
  // https://github.com/floating-ui/floating-ui/issues/1563
15
- const getAlignmentMap = () => ({
16
- start: 'start',
17
- end: 'end',
18
- top: 'start',
19
- bottom: 'end',
20
- center: undefined
21
- });
22
- const shouldAlignToCenter = (p, a) => {
23
- const positionedVertically = p === 'above' || p === 'below';
24
- const alignedVertically = a === 'top' || a === 'bottom';
25
- return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;
17
+ const getAlignmentMap = ()=>({
18
+ start: 'start',
19
+ end: 'end',
20
+ top: 'start',
21
+ bottom: 'end',
22
+ center: undefined
23
+ });
24
+ const shouldAlignToCenter = (p, a)=>{
25
+ const positionedVertically = p === 'above' || p === 'below';
26
+ const alignedVertically = a === 'top' || a === 'bottom';
27
+ return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;
26
28
  };
27
- /**
28
- * Maps internal positioning values to Floating UI placement
29
- * @see positioningHelper.test.ts for expected placement values
30
- */
31
- const toFloatingUIPlacement = (align, position, rtl) => {
32
- const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
33
- const computedPosition = position && getPositionMap(rtl)[position];
34
- const computedAlignment = alignment && getAlignmentMap()[alignment];
35
- if (computedPosition && computedAlignment) {
36
- return `${computedPosition}-${computedAlignment}`;
37
- }
38
- return computedPosition;
39
- };
40
- exports.toFloatingUIPlacement = toFloatingUIPlacement;
29
+ const toFloatingUIPlacement = (align, position, rtl)=>{
30
+ const alignment = shouldAlignToCenter(position, align) ? 'center' : align;
31
+ const computedPosition = position && getPositionMap(rtl)[position];
32
+ const computedAlignment = alignment && getAlignmentMap()[alignment];
33
+ if (computedPosition && computedAlignment) {
34
+ return `${computedPosition}-${computedAlignment}`;
35
+ }
36
+ return computedPosition;
37
+ }; //# sourceMappingURL=toFloatingUIPlacement.js.map
38
+
41
39
  //# sourceMappingURL=toFloatingUIPlacement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","toFloatingUIPlacement","align","position","alignment","computedPosition","computedAlignment","exports"],"sources":["../src/packages/react-components/react-positioning/src/utils/toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side, Alignment as FloatingUIAlignment } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\n\ntype PlacementPosition = Side;\ntype PlacementAlign = FloatingUIAlignment;\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (): Record<Alignment, PlacementAlign | undefined> => ({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined,\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const toFloatingUIPlacement = (align?: Alignment, position?: Position, rtl?: boolean): Placement | undefined => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}` as Placement;\n }\n\n return computedPosition;\n};\n"],"mappings":";;;;;;AAMA,MAAMA,cAAc,GAAIC,GAAa,KAA2C;EAC9EC,KAAK,EAAE,KAAK;EACZC,KAAK,EAAE,QAAQ;EACfC,MAAM,EAAEH,GAAG,GAAG,OAAO,GAAG,MAAM;EAC9BI,KAAK,EAAEJ,GAAG,GAAG,MAAM,GAAG;CACvB,CAAC;AAEF;AACA;AACA,MAAMK,eAAe,GAAGA,CAAA,MAAsD;EAC5EC,KAAK,EAAE,OAAO;EACdC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,KAAK;EACbC,MAAM,EAAEC;CACT,CAAC;AAEF,MAAMC,mBAAmB,GAAGA,CAACC,CAAY,EAAEC,CAAa,KAAa;EACnE,MAAMC,oBAAoB,GAAGF,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,OAAO;EAC3D,MAAMG,iBAAiB,GAAGF,CAAC,KAAK,KAAK,IAAIA,CAAC,KAAK,QAAQ;EAEvD,OAAQC,oBAAoB,IAAIC,iBAAiB,IAAM,CAACD,oBAAoB,IAAI,CAACC,iBAAkB;AACrG,CAAC;AAED;;;;AAIO,MAAMC,qBAAqB,GAAGA,CAACC,KAAiB,EAAEC,QAAmB,EAAEnB,GAAa,KAA2B;EACpH,MAAMoB,SAAS,GAAGR,mBAAmB,CAACO,QAAQ,EAAED,KAAK,CAAC,GAAG,QAAQ,GAAGA,KAAK;EAEzE,MAAMG,gBAAgB,GAAGF,QAAQ,IAAIpB,cAAc,CAACC,GAAG,CAAC,CAACmB,QAAQ,CAAC;EAClE,MAAMG,iBAAiB,GAAGF,SAAS,IAAIf,eAAe,EAAE,CAACe,SAAS,CAAC;EAEnE,IAAIC,gBAAgB,IAAIC,iBAAiB,EAAE;IACzC,OAAO,GAAGD,gBAAgB,IAAIC,iBAAiB,EAAe;;EAGhE,OAAOD,gBAAgB;AACzB,CAAC;AAXYE,OAAA,CAAAN,qBAAqB,GAAAA,qBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/toFloatingUIPlacement.js"],"sourcesContent":["const getPositionMap = rtl => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right'\n});\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = () => ({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined\n});\nconst shouldAlignToCenter = (p, a) => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n return positionedVertically && alignedVertically || !positionedVertically && !alignedVertically;\n};\n/**\n * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const toFloatingUIPlacement = (align, position, rtl) => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}`;\n }\n return computedPosition;\n};\n//# sourceMappingURL=toFloatingUIPlacement.js.map"],"names":["toFloatingUIPlacement","getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","align","position","alignment","computedPosition","computedAlignment"],"mappings":";;;;+BAwBaA;;aAAAA;;AAxBb,MAAMC,iBAAiBC,CAAAA,MAAQ,CAAA;QAC7BC,OAAO;QACPC,OAAO;QACPC,QAAQH,MAAM,UAAU,MAAM;QAC9BI,OAAOJ,MAAM,SAAS,OAAO;IAC/B,CAAA;AACA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMK,kBAAkB,IAAO,CAAA;QAC7BC,OAAO;QACPC,KAAK;QACLC,KAAK;QACLC,QAAQ;QACRC,QAAQC;IACV,CAAA;AACA,MAAMC,sBAAsB,CAACC,GAAGC,IAAM;IACpC,MAAMC,uBAAuBF,MAAM,WAAWA,MAAM;IACpD,MAAMG,oBAAoBF,MAAM,SAASA,MAAM;IAC/C,OAAOC,wBAAwBC,qBAAqB,CAACD,wBAAwB,CAACC;AAChF;AAKO,MAAMlB,wBAAwB,CAACmB,OAAOC,UAAUlB,MAAQ;IAC7D,MAAMmB,YAAYP,oBAAoBM,UAAUD,SAAS,WAAWA,KAAK;IACzE,MAAMG,mBAAmBF,YAAYnB,eAAeC,IAAI,CAACkB,SAAS;IAClE,MAAMG,oBAAoBF,aAAad,iBAAiB,CAACc,UAAU;IACnE,IAAIC,oBAAoBC,mBAAmB;QACzC,OAAO,CAAC,EAAED,iBAAiB,CAAC,EAAEC,kBAAkB,CAAC;IACnD,CAAC;IACD,OAAOD;AACT,GACA,iDAAiD"}
@@ -1,29 +1,25 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "toggleScrollListener", {
6
+ enumerable: true,
7
+ get: ()=>toggleScrollListener
5
8
  });
6
- exports.toggleScrollListener = void 0;
7
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
8
- const getScrollParent_1 = /*#__PURE__*/require("./getScrollParent");
9
- /**
10
- * Toggles event listeners for scroll parent.
11
- * Cleans up the event listeners for the previous element and adds them for the new scroll parent.
12
- * @param next Next element
13
- * @param prev Previous element
14
- */
9
+ const _reactUtilities = require("@fluentui/react-utilities");
10
+ const _getScrollParent = require("./getScrollParent");
15
11
  function toggleScrollListener(next, prev, handler) {
16
- if (next === prev) {
17
- return;
18
- }
19
- if (react_utilities_1.isHTMLElement(prev)) {
20
- const prevScrollParent = getScrollParent_1.getScrollParent(prev);
21
- prevScrollParent.removeEventListener('scroll', handler);
22
- }
23
- if (react_utilities_1.isHTMLElement(next)) {
24
- const scrollParent = getScrollParent_1.getScrollParent(next);
25
- scrollParent.addEventListener('scroll', handler);
26
- }
27
- }
28
- exports.toggleScrollListener = toggleScrollListener;
12
+ if (next === prev) {
13
+ return;
14
+ }
15
+ if ((0, _reactUtilities.isHTMLElement)(prev)) {
16
+ const prevScrollParent = (0, _getScrollParent.getScrollParent)(prev);
17
+ prevScrollParent.removeEventListener('scroll', handler);
18
+ }
19
+ if ((0, _reactUtilities.isHTMLElement)(next)) {
20
+ const scrollParent = (0, _getScrollParent.getScrollParent)(next);
21
+ scrollParent.addEventListener('scroll', handler);
22
+ }
23
+ } //# sourceMappingURL=toggleScrollListener.js.map
24
+
29
25
  //# sourceMappingURL=toggleScrollListener.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["react_utilities_1","require","getScrollParent_1","toggleScrollListener","next","prev","handler","isHTMLElement","prevScrollParent","getScrollParent","removeEventListener","scrollParent","addEventListener","exports"],"sources":["../src/packages/react-components/react-positioning/src/utils/toggleScrollListener.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PositioningVirtualElement } from '../types';\nimport { getScrollParent } from './getScrollParent';\n\n/**\n * Toggles event listeners for scroll parent.\n * Cleans up the event listeners for the previous element and adds them for the new scroll parent.\n * @param next Next element\n * @param prev Previous element\n */\nexport function toggleScrollListener(\n next: HTMLElement | PositioningVirtualElement | null,\n prev: HTMLElement | PositioningVirtualElement | null,\n handler: EventListener,\n) {\n if (next === prev) {\n return;\n }\n\n if (isHTMLElement(prev)) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (isHTMLElement(next)) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"],"mappings":";;;;;;AAAA,MAAAA,iBAAA,gBAAAC,OAAA;AAEA,MAAAC,iBAAA,gBAAAD,OAAA;AAEA;;;;;;AAMA,SAAgBE,oBAAoBA,CAClCC,IAAoD,EACpDC,IAAoD,EACpDC,OAAsB;EAEtB,IAAIF,IAAI,KAAKC,IAAI,EAAE;IACjB;;EAGF,IAAIL,iBAAA,CAAAO,aAAa,CAACF,IAAI,CAAC,EAAE;IACvB,MAAMG,gBAAgB,GAAGN,iBAAA,CAAAO,eAAe,CAACJ,IAAI,CAAC;IAC9CG,gBAAgB,CAACE,mBAAmB,CAAC,QAAQ,EAAEJ,OAAO,CAAC;;EAEzD,IAAIN,iBAAA,CAAAO,aAAa,CAACH,IAAI,CAAC,EAAE;IACvB,MAAMO,YAAY,GAAGT,iBAAA,CAAAO,eAAe,CAACL,IAAI,CAAC;IAC1CO,YAAY,CAACC,gBAAgB,CAAC,QAAQ,EAAEN,OAAO,CAAC;;AAEpD;AAjBAO,OAAA,CAAAV,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/toggleScrollListener.js"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport { getScrollParent } from './getScrollParent';\n/**\n * Toggles event listeners for scroll parent.\n * Cleans up the event listeners for the previous element and adds them for the new scroll parent.\n * @param next Next element\n * @param prev Previous element\n */\nexport function toggleScrollListener(next, prev, handler) {\n if (next === prev) {\n return;\n }\n if (isHTMLElement(prev)) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (isHTMLElement(next)) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n//# sourceMappingURL=toggleScrollListener.js.map"],"names":["toggleScrollListener","next","prev","handler","isHTMLElement","prevScrollParent","getScrollParent","removeEventListener","scrollParent","addEventListener"],"mappings":";;;;+BAQgBA;;aAAAA;;gCARc;iCACE;AAOzB,SAASA,qBAAqBC,IAAI,EAAEC,IAAI,EAAEC,OAAO,EAAE;IACxD,IAAIF,SAASC,MAAM;QACjB;IACF,CAAC;IACD,IAAIE,IAAAA,6BAAa,EAACF,OAAO;QACvB,MAAMG,mBAAmBC,IAAAA,gCAAe,EAACJ;QACzCG,iBAAiBE,mBAAmB,CAAC,UAAUJ;IACjD,CAAC;IACD,IAAIC,IAAAA,6BAAa,EAACH,OAAO;QACvB,MAAMO,eAAeF,IAAAA,gCAAe,EAACL;QACrCO,aAAaC,gBAAgB,CAAC,UAAUN;IAC1C,CAAC;AACH,EACA,gDAAgD"}