@fluentui/react-positioning 9.5.5 → 9.5.6

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 (175) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +40 -1
  3. package/CHANGELOG.md +15 -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,25 +0,0 @@
1
- define(["require", "exports", "./fromFloatingUIPlacement"], function (require, exports, fromFloatingUIPlacement_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getFloatingUIOffset = void 0;
5
- /**
6
- * Shim to transform offset values from this library to Floating UI
7
- * @param rawOffset Offset from this library
8
- * @returns An offset value compatible with Floating UI
9
- */
10
- function getFloatingUIOffset(rawOffset) {
11
- if (!rawOffset) {
12
- return rawOffset;
13
- }
14
- if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {
15
- return rawOffset;
16
- }
17
- return function (_a) {
18
- var _b = _a.rects, floating = _b.floating, reference = _b.reference, placement = _a.placement;
19
- var _c = fromFloatingUIPlacement_1.fromFloatingUIPlacement(placement), position = _c.position, alignment = _c.alignment;
20
- return rawOffset({ positionedRect: floating, targetRect: reference, position: position, alignment: alignment });
21
- };
22
- }
23
- exports.getFloatingUIOffset = getFloatingUIOffset;
24
- });
25
- //# sourceMappingURL=getFloatingUIOffset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFloatingUIOffset.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getFloatingUIOffset.ts"],"names":[],"mappings":";;;;IAkCA;;;;OAIG;IACH,SAAgB,mBAAmB,CACjC,SAA6B;QAE7B,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YAClE,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,UAAC,EAA6C;gBAA3C,aAA8B,EAArB,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAI,SAAS,eAAA;YAC3C,IAAA,KAA0B,iDAAuB,CAAC,SAAS,CAAC,EAA1D,QAAQ,cAAA,EAAE,SAAS,eAAuC,CAAC;YACnE,OAAO,SAAS,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,UAAA,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;QAC7F,CAAC,CAAC;IACJ,CAAC;IAfD,kDAeC","sourcesContent":["import type { Offset } from '../types';\nimport type { MiddlewareArguments } from '@floating-ui/dom';\nimport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetValue =\n | number\n | {\n /**\n * The axis that runs along the side of the floating element.\n * @default 0\n */\n mainAxis?: number;\n /**\n * The axis that runs along the alignment of the floating element.\n * @default 0\n */\n crossAxis?: number;\n /**\n * When set to a number, overrides the `crossAxis` value for aligned\n * (non-centered/base) placements and works logically. A positive number\n * will move the floating element in the direction of the opposite edge\n * to the one that is aligned, while a negative number the reverse.\n * @default null\n */\n alignmentAxis?: number | null;\n };\n\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetFunction = (args: MiddlewareArguments) => FloatingUIOffsetValue;\n\n/**\n * Shim to transform offset values from this library to Floating UI\n * @param rawOffset Offset from this library\n * @returns An offset value compatible with Floating UI\n */\nexport function getFloatingUIOffset(\n rawOffset: Offset | undefined,\n): FloatingUIOffsetValue | FloatingUIOffsetFunction | undefined {\n if (!rawOffset) {\n return rawOffset;\n }\n\n if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {\n return rawOffset;\n }\n\n return ({ rects: { floating, reference }, placement }) => {\n const { position, alignment } = fromFloatingUIPlacement(placement);\n return rawOffset({ positionedRect: floating, targetRect: reference, position, alignment });\n };\n}\n"]}
@@ -1,48 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getReactFiberFromNode = void 0;
5
- var WorkTag;
6
- (function (WorkTag) {
7
- WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
8
- WorkTag[WorkTag["ClassComponent"] = 1] = "ClassComponent";
9
- WorkTag[WorkTag["IndeterminateComponent"] = 2] = "IndeterminateComponent";
10
- WorkTag[WorkTag["HostRoot"] = 3] = "HostRoot";
11
- WorkTag[WorkTag["HostPortal"] = 4] = "HostPortal";
12
- WorkTag[WorkTag["HostComponent"] = 5] = "HostComponent";
13
- WorkTag[WorkTag["HostText"] = 6] = "HostText";
14
- WorkTag[WorkTag["Fragment"] = 7] = "Fragment";
15
- WorkTag[WorkTag["Mode"] = 8] = "Mode";
16
- WorkTag[WorkTag["ContextConsumer"] = 9] = "ContextConsumer";
17
- WorkTag[WorkTag["ContextProvider"] = 10] = "ContextProvider";
18
- WorkTag[WorkTag["ForwardRef"] = 11] = "ForwardRef";
19
- WorkTag[WorkTag["Profiler"] = 12] = "Profiler";
20
- WorkTag[WorkTag["SuspenseComponent"] = 13] = "SuspenseComponent";
21
- WorkTag[WorkTag["MemoComponent"] = 14] = "MemoComponent";
22
- WorkTag[WorkTag["SimpleMemoComponent"] = 15] = "SimpleMemoComponent";
23
- WorkTag[WorkTag["LazyComponent"] = 16] = "LazyComponent";
24
- WorkTag[WorkTag["IncompleteClassComponent"] = 17] = "IncompleteClassComponent";
25
- WorkTag[WorkTag["DehydratedFragment"] = 18] = "DehydratedFragment";
26
- WorkTag[WorkTag["SuspenseListComponent"] = 19] = "SuspenseListComponent";
27
- WorkTag[WorkTag["FundamentalComponent"] = 20] = "FundamentalComponent";
28
- WorkTag[WorkTag["ScopeComponent"] = 21] = "ScopeComponent";
29
- })(WorkTag || (WorkTag = {}));
30
- function getReactFiberFromNode(elm) {
31
- if (!elm) {
32
- return null;
33
- }
34
- for (var k in elm) {
35
- // React 16 uses "__reactInternalInstance$" prefix
36
- // React 17 uses "__reactFiber$" prefix
37
- // https://github.com/facebook/react/pull/18377
38
- if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
39
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
40
- // @ts-ignore
41
- return elm[k];
42
- }
43
- }
44
- throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
45
- }
46
- exports.getReactFiberFromNode = getReactFiberFromNode;
47
- });
48
- //# sourceMappingURL=getReactFiberFromNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getReactFiberFromNode.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getReactFiberFromNode.ts"],"names":[],"mappings":";;;;IAuEA,IAAK,OAuBJ;IAvBD,WAAK,OAAO;QACV,+DAAqB,CAAA;QACrB,yDAAkB,CAAA;QAClB,yEAA0B,CAAA;QAC1B,6CAAY,CAAA;QACZ,iDAAc,CAAA;QACd,uDAAiB,CAAA;QACjB,6CAAY,CAAA;QACZ,6CAAY,CAAA;QACZ,qCAAQ,CAAA;QACR,2DAAmB,CAAA;QACnB,4DAAoB,CAAA;QACpB,kDAAe,CAAA;QACf,8CAAa,CAAA;QACb,gEAAsB,CAAA;QACtB,wDAAkB,CAAA;QAClB,oEAAwB,CAAA;QACxB,wDAAkB,CAAA;QAClB,8EAA6B,CAAA;QAC7B,kEAAuB,CAAA;QACvB,wEAA0B,CAAA;QAC1B,sEAAyB,CAAA;QACzB,0DAAmB,CAAA;IACrB,CAAC,EAvBI,OAAO,KAAP,OAAO,QAuBX;IA+JD,SAAgB,qBAAqB,CAAC,GAAqB;QACzD,IAAI,CAAC,GAAG,EAAE;YACR,OAAO,IAAI,CAAC;SACb;QAED,KAAK,IAAM,CAAC,IAAI,GAAG,EAAE;YACnB,kDAAkD;YAClD,uCAAuC;YACvC,+CAA+C;YAC/C,IAAI,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;gBACnF,6DAA6D;gBAC7D,aAAa;gBACb,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;aACf;SACF;QAED,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAjBD,sDAiBC","sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"]}
@@ -1,64 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.hasScrollParent = exports.getScrollParent = exports.getParentNode = void 0;
5
- /**
6
- * Returns the parent node or the host of the node argument.
7
- * @param node - DOM node.
8
- * @returns - parent DOM node.
9
- */
10
- var getParentNode = function (node) {
11
- if (node.nodeName === 'HTML') {
12
- return node;
13
- }
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- return node.parentNode || node.host;
16
- };
17
- exports.getParentNode = getParentNode;
18
- /**
19
- * Returns CSS styles of the given node.
20
- * @param node - DOM node.
21
- * @returns - CSS styles.
22
- */
23
- var getStyleComputedProperty = function (node) {
24
- var _a;
25
- if (node.nodeType !== 1) {
26
- return {};
27
- }
28
- var window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
29
- return window.getComputedStyle(node, null);
30
- };
31
- /**
32
- * Returns the first scrollable parent of the given element.
33
- * @param node - DOM node.
34
- * @returns - the first scrollable parent.
35
- */
36
- var getScrollParent = function (node) {
37
- // Return body, `getScroll` will take care to get the correct `scrollTop` from it
38
- var parentNode = node && exports.getParentNode(node);
39
- // eslint-disable-next-line
40
- if (!parentNode)
41
- return document.body;
42
- switch (parentNode.nodeName) {
43
- case 'HTML':
44
- case 'BODY':
45
- return parentNode.ownerDocument.body;
46
- case '#document':
47
- return parentNode.body;
48
- }
49
- // If any of the overflow props is defined for the node then we return it as the parent
50
- var _a = getStyleComputedProperty(parentNode), overflow = _a.overflow, overflowX = _a.overflowX, overflowY = _a.overflowY;
51
- if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
52
- return parentNode;
53
- }
54
- return exports.getScrollParent(parentNode);
55
- };
56
- exports.getScrollParent = getScrollParent;
57
- var hasScrollParent = function (node) {
58
- var _a;
59
- var scrollParentElement = exports.getScrollParent(node);
60
- return scrollParentElement ? scrollParentElement !== ((_a = scrollParentElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.body) : false;
61
- };
62
- exports.hasScrollParent = hasScrollParent;
63
- });
64
- //# sourceMappingURL=getScrollParent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getScrollParent.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getScrollParent.ts"],"names":[],"mappings":";;;;IAAA;;;;OAIG;IACI,IAAM,aAAa,GAAG,UAAC,IAAiB;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,EAAE;YAC5B,OAAO,IAAI,CAAC;SACb;QACD,8DAA8D;QAC9D,OAAO,IAAI,CAAC,UAAU,IAAK,IAAY,CAAC,IAAI,CAAC;IAC/C,CAAC,CAAC;IANW,QAAA,aAAa,iBAMxB;IAEF;;;;OAIG;IACH,IAAM,wBAAwB,GAAG,UAAC,IAAiB;;QACjD,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE;YACvB,OAAO,EAAE,CAAC;SACX;QAED,IAAM,MAAM,GAAG,MAAA,IAAI,CAAC,aAAa,0CAAE,WAAW,CAAC;QAC/C,OAAO,MAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC;IAEF;;;;OAIG;IACI,IAAM,eAAe,GAAG,UAAC,IAAmC;QACjE,iFAAiF;QACjF,IAAM,UAAU,GAAG,IAAI,IAAI,qBAAa,CAAC,IAAmB,CAAC,CAAC;QAC9D,2BAA2B;QAC3B,IAAI,CAAC,UAAU;YAAE,OAAO,QAAQ,CAAC,IAAI,CAAC;QAEtC,QAAQ,UAAU,CAAC,QAAQ,EAAE;YAC3B,KAAK,MAAM,CAAC;YACZ,KAAK,MAAM;gBACT,OAAO,UAAU,CAAC,aAAc,CAAC,IAAI,CAAC;YACxC,KAAK,WAAW;gBACd,OAAQ,UAAkC,CAAC,IAAI,CAAC;SACnD;QAED,uFAAuF;QACjF,IAAA,KAAqC,wBAAwB,CAAC,UAAU,CAAC,EAAvE,QAAQ,cAAA,EAAE,SAAS,eAAA,EAAE,SAAS,eAAyC,CAAC;QAChF,IAAI,uBAAuB,CAAC,IAAI,CAAC,QAAS,GAAG,SAAU,GAAG,SAAS,CAAC,EAAE;YACpE,OAAO,UAAU,CAAC;SACnB;QAED,OAAO,uBAAe,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC,CAAC;IArBW,QAAA,eAAe,mBAqB1B;IAEK,IAAM,eAAe,GAAG,UAAC,IAAmC;;QACjE,IAAM,mBAAmB,GAAgB,uBAAe,CAAC,IAAI,CAAC,CAAC;QAC/D,OAAO,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,MAAK,MAAA,mBAAmB,CAAC,aAAa,0CAAE,IAAI,CAAA,CAAC,CAAC,CAAC,KAAK,CAAC;IACvG,CAAC,CAAC;IAHW,QAAA,eAAe,mBAG1B","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"]}
@@ -1,31 +0,0 @@
1
- //
2
- // Dev utils to detect if nodes have "autoFocus" props.
3
- //
4
- define(["require", "exports", "./getReactFiberFromNode"], function (require, exports, getReactFiberFromNode_1) {
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.hasAutofocusFilter = void 0;
8
- /**
9
- * Detects if a passed HTML node has "autoFocus" prop on a React's fiber. Is needed as React handles autofocus behavior
10
- * in React DOM and will not pass "autoFocus" to an actual HTML.
11
- *
12
- * @param node
13
- */
14
- function hasAutofocusProp(node) {
15
- var _a;
16
- // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
17
- var isAutoFocusableElement = node.nodeName === 'BUTTON' ||
18
- node.nodeName === 'INPUT' ||
19
- node.nodeName === 'SELECT' ||
20
- 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;
25
- }
26
- function hasAutofocusFilter(node) {
27
- return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
28
- }
29
- exports.hasAutofocusFilter = hasAutofocusFilter;
30
- });
31
- //# sourceMappingURL=hasAutoFocusFilter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hasAutoFocusFilter.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/hasAutoFocusFilter.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,uDAAuD;AACvD,EAAE;;;;;IAIF;;;;;OAKG;IACH,SAAS,gBAAgB,CAAC,IAAU;;QAClC,gJAAgJ;QAChJ,IAAM,sBAAsB,GAC1B,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAC1B,IAAI,CAAC,QAAQ,KAAK,OAAO;YACzB,IAAI,CAAC,QAAQ,KAAK,QAAQ;YAC1B,IAAI,CAAC,QAAQ,KAAK,UAAU,CAAC;QAE/B,IAAI,sBAAsB,EAAE;YAC1B,OAAO,CAAC,CAAC,CAAA,MAAA,6CAAqB,CAAC,IAAI,CAAC,0CAAE,YAAY,CAAC,SAAS,CAAA,CAAC;SAC9D;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAgB,kBAAkB,CAAC,IAAU;QAC3C,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;IACpF,CAAC;IAFD,gDAEC","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"]}
@@ -1,20 +0,0 @@
1
- define(["require", "exports", "tslib", "./parseFloatingUIPlacement", "./getBoundary", "./getReactFiberFromNode", "./getScrollParent", "./mergeArrowOffset", "./toFloatingUIPadding", "./toFloatingUIPlacement", "./fromFloatingUIPlacement", "./resolvePositioningShorthand", "./useCallbackRef", "./debounce", "./toggleScrollListener", "./hasAutoFocusFilter", "./writeArrowUpdates", "./writeContainerupdates"], function (require, exports, tslib_1, parseFloatingUIPlacement_1, getBoundary_1, getReactFiberFromNode_1, getScrollParent_1, mergeArrowOffset_1, toFloatingUIPadding_1, toFloatingUIPlacement_1, fromFloatingUIPlacement_1, resolvePositioningShorthand_1, useCallbackRef_1, debounce_1, toggleScrollListener_1, hasAutoFocusFilter_1, writeArrowUpdates_1, writeContainerupdates_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(parseFloatingUIPlacement_1, exports);
5
- tslib_1.__exportStar(getBoundary_1, exports);
6
- tslib_1.__exportStar(getReactFiberFromNode_1, exports);
7
- tslib_1.__exportStar(getScrollParent_1, exports);
8
- tslib_1.__exportStar(mergeArrowOffset_1, exports);
9
- tslib_1.__exportStar(toFloatingUIPadding_1, exports);
10
- tslib_1.__exportStar(toFloatingUIPlacement_1, exports);
11
- tslib_1.__exportStar(fromFloatingUIPlacement_1, exports);
12
- tslib_1.__exportStar(resolvePositioningShorthand_1, exports);
13
- tslib_1.__exportStar(useCallbackRef_1, exports);
14
- tslib_1.__exportStar(debounce_1, exports);
15
- tslib_1.__exportStar(toggleScrollListener_1, exports);
16
- tslib_1.__exportStar(hasAutoFocusFilter_1, exports);
17
- tslib_1.__exportStar(writeArrowUpdates_1, exports);
18
- tslib_1.__exportStar(writeContainerupdates_1, exports);
19
- });
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/index.ts"],"names":[],"mappings":";;;IAAA,0DAA2C;IAC3C,6CAA8B;IAC9B,uDAAwC;IACxC,iDAAkC;IAClC,kDAAmC;IACnC,qDAAsC;IACtC,uDAAwC;IACxC,yDAA0C;IAC1C,6DAA8C;IAC9C,gDAAiC;IACjC,0CAA2B;IAC3B,sDAAuC;IACvC,oDAAqC;IACrC,mDAAoC;IACpC,uDAAwC","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"]}
@@ -1,38 +0,0 @@
1
- define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.mergeArrowOffset = void 0;
5
- /**
6
- * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the
7
- * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset
8
- *
9
- * @internal
10
- * @param userOffset - The offset provided by the user
11
- * @param arrowHeight - The height of the arrow in px
12
- * @returns User offset augmented with arrow height
13
- */
14
- function mergeArrowOffset(userOffset, arrowHeight) {
15
- if (typeof userOffset === 'number') {
16
- return addArrowOffset(userOffset, arrowHeight);
17
- }
18
- if (typeof userOffset === 'object' && userOffset !== null) {
19
- return addArrowOffset(userOffset, arrowHeight);
20
- }
21
- if (typeof userOffset === 'function') {
22
- return function (offsetParams) {
23
- var offset = userOffset(offsetParams);
24
- return addArrowOffset(offset, arrowHeight);
25
- };
26
- }
27
- return { mainAxis: arrowHeight };
28
- }
29
- exports.mergeArrowOffset = mergeArrowOffset;
30
- var addArrowOffset = function (offset, arrowHeight) {
31
- var _a;
32
- if (typeof offset === 'number') {
33
- return { mainAxis: offset + arrowHeight };
34
- }
35
- return tslib_1.__assign(tslib_1.__assign({}, offset), { mainAxis: ((_a = offset.mainAxis) !== null && _a !== void 0 ? _a : 0) + arrowHeight });
36
- };
37
- });
38
- //# sourceMappingURL=mergeArrowOffset.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeArrowOffset.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/mergeArrowOffset.ts"],"names":[],"mappings":";;;;IAEA;;;;;;;;OAQG;IACH,SAAgB,gBAAgB,CAAC,UAAqC,EAAE,WAAmB;QACzF,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAClC,OAAO,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;SAChD;QAED,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,IAAI,EAAE;YACzD,OAAO,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;SAChD;QAED,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;YACpC,OAAO,UAAA,YAAY;gBACjB,IAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;gBACxC,OAAO,cAAc,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YAC7C,CAAC,CAAC;SACH;QAED,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;IACnC,CAAC;IAjBD,4CAiBC;IAED,IAAM,cAAc,GAAG,UAAC,MAA6B,EAAE,WAAmB;;QACxE,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;SAC3C;QAED,6CAAY,MAAM,KAAE,QAAQ,EAAE,CAAC,MAAA,MAAM,CAAC,QAAQ,mCAAI,CAAC,CAAC,GAAG,WAAW,IAAG;IACvE,CAAC,CAAC","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"]}
@@ -1,20 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.parseFloatingUIPlacement = void 0;
5
- /**
6
- * Parses Floating UI placement and returns the different components
7
- * @param placement - the floating ui placement (i.e. bottom-start)
8
- *
9
- * @returns side and alignment components of the placement
10
- */
11
- function parseFloatingUIPlacement(placement) {
12
- var tokens = placement.split('-');
13
- return {
14
- side: tokens[0],
15
- alignment: tokens[1],
16
- };
17
- }
18
- exports.parseFloatingUIPlacement = parseFloatingUIPlacement;
19
- });
20
- //# sourceMappingURL=parseFloatingUIPlacement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseFloatingUIPlacement.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/parseFloatingUIPlacement.ts"],"names":[],"mappings":";;;;IAEA;;;;;OAKG;IACH,SAAgB,wBAAwB,CAAC,SAAoB;QAC3D,IAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,CAAC,CAAS;YACvB,SAAS,EAAE,MAAM,CAAC,CAAC,CAAc;SAClC,CAAC;IACJ,CAAC;IAND,4DAMC","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"]}
@@ -1,31 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.resolvePositioningShorthand = void 0;
5
- // Look up table for shorthand to avoid parsing strings
6
- var shorthandLookup = {
7
- above: { position: 'above', align: 'center' },
8
- 'above-start': { position: 'above', align: 'start' },
9
- 'above-end': { position: 'above', align: 'end' },
10
- below: { position: 'below', align: 'center' },
11
- 'below-start': { position: 'below', align: 'start' },
12
- 'below-end': { position: 'below', align: 'end' },
13
- before: { position: 'before', align: 'center' },
14
- 'before-top': { position: 'before', align: 'top' },
15
- 'before-bottom': { position: 'before', align: 'bottom' },
16
- after: { position: 'after', align: 'center' },
17
- 'after-top': { position: 'after', align: 'top' },
18
- 'after-bottom': { position: 'after', align: 'bottom' },
19
- };
20
- function resolvePositioningShorthand(shorthand) {
21
- if (shorthand === undefined || shorthand === null) {
22
- return {};
23
- }
24
- if (typeof shorthand === 'string') {
25
- return shorthandLookup[shorthand];
26
- }
27
- return shorthand;
28
- }
29
- exports.resolvePositioningShorthand = resolvePositioningShorthand;
30
- });
31
- //# sourceMappingURL=resolvePositioningShorthand.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolvePositioningShorthand.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/resolvePositioningShorthand.ts"],"names":[],"mappings":";;;;IAEA,uDAAuD;IACvD,IAAM,eAAe,GAAoF;QACvG,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC7C,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QACpD,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;QAChD,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC7C,aAAa,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QACpD,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;QAChD,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC/C,YAAY,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;QAClD,eAAe,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACxD,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC7C,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;QAChD,cAAc,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE;KACvD,CAAC;IAEF,SAAgB,2BAA2B,CACzC,SAAkD;QAElD,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE;YACjD,OAAO,EAAE,CAAC;SACX;QAED,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACjC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;SACnC;QAED,OAAO,SAAuC,CAAC;IACjD,CAAC;IAZD,kEAYC","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"]}
@@ -1,25 +0,0 @@
1
- define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.toFloatingUIPadding = void 0;
5
- function toFloatingUIPadding(padding, isRtl) {
6
- if (typeof padding === 'number') {
7
- return padding;
8
- }
9
- var start = padding.start, end = padding.end, verticalPadding = tslib_1.__rest(padding, ["start", "end"]);
10
- var paddingObject = verticalPadding;
11
- var left = isRtl ? 'end' : 'start';
12
- var right = isRtl ? 'start' : 'end';
13
- // assign properties explicitly since undefined values are actually handled by floating UI
14
- // TODO create floating UI issue
15
- if (padding[left]) {
16
- paddingObject.left = padding[left];
17
- }
18
- if (padding[right]) {
19
- paddingObject.right = padding[right];
20
- }
21
- return paddingObject;
22
- }
23
- exports.toFloatingUIPadding = toFloatingUIPadding;
24
- });
25
- //# sourceMappingURL=toFloatingUIPadding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toFloatingUIPadding.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/toFloatingUIPadding.ts"],"names":[],"mappings":";;;;IAGA,SAAgB,mBAAmB,CACjC,OAAmE,EACnE,KAAc;QAEd,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,OAAO,OAAO,CAAC;SAChB;QAEO,IAAA,KAAK,GAA8B,OAAO,MAArC,EAAE,GAAG,GAAyB,OAAO,IAAhC,EAAK,eAAe,kBAAK,OAAO,EAA5C,gBAAkC,CAAF,CAAa;QAEnD,IAAM,aAAa,GAAwB,eAAe,CAAC;QAE3D,IAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QACrC,IAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAEtC,0FAA0F;QAC1F,gCAAgC;QAChC,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;YACjB,aAAa,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;SACpC;QAED,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;YAClB,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;SACtC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;IA1BD,kDA0BC","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"]}
@@ -1,40 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.toFloatingUIPlacement = void 0;
5
- var getPositionMap = function (rtl) { return ({
6
- above: 'top',
7
- below: 'bottom',
8
- before: rtl ? 'right' : 'left',
9
- after: rtl ? 'left' : 'right',
10
- }); };
11
- // Floating UI automatically flips alignment
12
- // https://github.com/floating-ui/floating-ui/issues/1563
13
- var getAlignmentMap = function () { return ({
14
- start: 'start',
15
- end: 'end',
16
- top: 'start',
17
- bottom: 'end',
18
- center: undefined,
19
- }); };
20
- var shouldAlignToCenter = function (p, a) {
21
- var positionedVertically = p === 'above' || p === 'below';
22
- var alignedVertically = a === 'top' || a === 'bottom';
23
- return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);
24
- };
25
- /**
26
- * Maps internal positioning values to Floating UI placement
27
- * @see positioningHelper.test.ts for expected placement values
28
- */
29
- var toFloatingUIPlacement = function (align, position, rtl) {
30
- var alignment = shouldAlignToCenter(position, align) ? 'center' : align;
31
- var computedPosition = position && getPositionMap(rtl)[position];
32
- var computedAlignment = alignment && getAlignmentMap()[alignment];
33
- if (computedPosition && computedAlignment) {
34
- return computedPosition + "-" + computedAlignment;
35
- }
36
- return computedPosition;
37
- };
38
- exports.toFloatingUIPlacement = toFloatingUIPlacement;
39
- });
40
- //# sourceMappingURL=toFloatingUIPlacement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toFloatingUIPlacement.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/toFloatingUIPlacement.ts"],"names":[],"mappings":";;;;IAMA,IAAM,cAAc,GAAG,UAAC,GAAa,IAA0C,OAAA,CAAC;QAC9E,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;QAC9B,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;KAC9B,CAAC,EAL6E,CAK7E,CAAC;IAEH,4CAA4C;IAC5C,yDAAyD;IACzD,IAAM,eAAe,GAAG,cAAqD,OAAA,CAAC;QAC5E,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,OAAO;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,SAAS;KAClB,CAAC,EAN2E,CAM3E,CAAC;IAEH,IAAM,mBAAmB,GAAG,UAAC,CAAY,EAAE,CAAa;QACtD,IAAM,oBAAoB,GAAG,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,OAAO,CAAC;QAC5D,IAAM,iBAAiB,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,QAAQ,CAAC;QAExD,OAAO,CAAC,oBAAoB,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,oBAAoB,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACtG,CAAC,CAAC;IAEF;;;OAGG;IACI,IAAM,qBAAqB,GAAG,UAAC,KAAiB,EAAE,QAAmB,EAAE,GAAa;QACzF,IAAM,SAAS,GAAG,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;QAE1E,IAAM,gBAAgB,GAAG,QAAQ,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;QACnE,IAAM,iBAAiB,GAAG,SAAS,IAAI,eAAe,EAAE,CAAC,SAAS,CAAC,CAAC;QAEpE,IAAI,gBAAgB,IAAI,iBAAiB,EAAE;YACzC,OAAU,gBAAgB,SAAI,iBAAgC,CAAC;SAChE;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC,CAAC;IAXW,QAAA,qBAAqB,yBAWhC","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"]}
@@ -1,26 +0,0 @@
1
- define(["require", "exports", "@fluentui/react-utilities", "./getScrollParent"], function (require, exports, react_utilities_1, getScrollParent_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.toggleScrollListener = void 0;
5
- /**
6
- * Toggles event listeners for scroll parent.
7
- * Cleans up the event listeners for the previous element and adds them for the new scroll parent.
8
- * @param next Next element
9
- * @param prev Previous element
10
- */
11
- function toggleScrollListener(next, prev, handler) {
12
- if (next === prev) {
13
- return;
14
- }
15
- if (react_utilities_1.isHTMLElement(prev)) {
16
- var prevScrollParent = getScrollParent_1.getScrollParent(prev);
17
- prevScrollParent.removeEventListener('scroll', handler);
18
- }
19
- if (react_utilities_1.isHTMLElement(next)) {
20
- var scrollParent = getScrollParent_1.getScrollParent(next);
21
- scrollParent.addEventListener('scroll', handler);
22
- }
23
- }
24
- exports.toggleScrollListener = toggleScrollListener;
25
- });
26
- //# sourceMappingURL=toggleScrollListener.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toggleScrollListener.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/toggleScrollListener.ts"],"names":[],"mappings":";;;;IAIA;;;;;OAKG;IACH,SAAgB,oBAAoB,CAClC,IAAoD,EACpD,IAAoD,EACpD,OAAsB;QAEtB,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,OAAO;SACR;QAED,IAAI,+BAAa,CAAC,IAAI,CAAC,EAAE;YACvB,IAAM,gBAAgB,GAAG,iCAAe,CAAC,IAAI,CAAC,CAAC;YAC/C,gBAAgB,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SACzD;QACD,IAAI,+BAAa,CAAC,IAAI,CAAC,EAAE;YACvB,IAAM,YAAY,GAAG,iCAAe,CAAC,IAAI,CAAC,CAAC;YAC3C,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;SAClD;IACH,CAAC;IAjBD,oDAiBC","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"]}
@@ -1,55 +0,0 @@
1
- define(["require", "exports", "react", "@fluentui/react-utilities"], function (require, exports, React, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useCallbackRef = void 0;
5
- /**
6
- * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content
7
- * changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via
8
- * React.useState(), but it will cause re-renders always.
9
- *
10
- * https://reactjs.org/docs/hooks-reference.html#useref
11
- * https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref
12
- *
13
- * @param initialValue - initial ref value
14
- * @param callback - a callback to run when value changes
15
- * @param skipInitialResolve - a flag to skip an initial ref report
16
- *
17
- * @example
18
- * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);
19
- * ref.current = 1;
20
- * // prints 0 -> 1
21
- */
22
- function useCallbackRef(initialValue, callback, skipInitialResolve) {
23
- var isFirst = React.useRef(true);
24
- var ref = React.useState(function () { return ({
25
- // value
26
- value: initialValue,
27
- // last callback
28
- callback: callback,
29
- // "memoized" public interface
30
- facade: {
31
- get current() {
32
- return ref.value;
33
- },
34
- set current(value) {
35
- var last = ref.value;
36
- if (last !== value) {
37
- ref.value = value;
38
- if (skipInitialResolve && isFirst.current) {
39
- return;
40
- }
41
- ref.callback(value, last);
42
- }
43
- },
44
- },
45
- }); })[0];
46
- react_utilities_1.useIsomorphicLayoutEffect(function () {
47
- isFirst.current = false;
48
- }, []);
49
- // update callback
50
- ref.callback = callback;
51
- return ref.facade;
52
- }
53
- exports.useCallbackRef = useCallbackRef;
54
- });
55
- //# sourceMappingURL=useCallbackRef.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCallbackRef.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/useCallbackRef.ts"],"names":[],"mappings":";;;;IAGA;;;;;;;;;;;;;;;;OAgBG;IACH,SAAgB,cAAc,CAC5B,YAAsB,EACtB,QAA2D,EAC3D,kBAA4B;QAE5B,IAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAA,GAAG,GAAI,KAAK,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;YAClC,QAAQ;YACR,KAAK,EAAE,YAAY;YACnB,gBAAgB;YAChB,QAAQ,UAAA;YACR,8BAA8B;YAC9B,MAAM,EAAE;gBACN,IAAI,OAAO;oBACT,OAAO,GAAG,CAAC,KAAK,CAAC;gBACnB,CAAC;gBACD,IAAI,OAAO,CAAC,KAAK;oBACf,IAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC;oBAEvB,IAAI,IAAI,KAAK,KAAK,EAAE;wBAClB,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;wBAElB,IAAI,kBAAkB,IAAI,OAAO,CAAC,OAAO,EAAE;4BACzC,OAAO;yBACR;wBAED,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;qBAC3B;gBACH,CAAC;aACF;SACF,CAAC,EAxBiC,CAwBjC,CAAC,GAxBO,CAwBN;QAEJ,2CAAyB,CAAC;YACxB,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,kBAAkB;QAClB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAExB,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IAxCD,wCAwCC","sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n/**\n * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content\n * changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via\n * React.useState(), but it will cause re-renders always.\n *\n * https://reactjs.org/docs/hooks-reference.html#useref\n * https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n *\n * @param initialValue - initial ref value\n * @param callback - a callback to run when value changes\n * @param skipInitialResolve - a flag to skip an initial ref report\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n */\nexport function useCallbackRef<T>(\n initialValue: T | null,\n callback: (newValue: T | null, lastValue: T | null) => void,\n skipInitialResolve?: boolean,\n): React.MutableRefObject<T | null> {\n const isFirst = React.useRef(true);\n const [ref] = React.useState(() => ({\n // value\n value: initialValue,\n // last callback\n callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n const last = ref.value;\n\n if (last !== value) {\n ref.value = value;\n\n if (skipInitialResolve && isFirst.current) {\n return;\n }\n\n ref.callback(value, last);\n }\n },\n },\n }));\n\n useIsomorphicLayoutEffect(() => {\n isFirst.current = false;\n }, []);\n\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n"]}
@@ -1,21 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.writeArrowUpdates = void 0;
5
- /**
6
- * Writes all DOM element updates after position is computed
7
- */
8
- function writeArrowUpdates(options) {
9
- var arrow = options.arrow, middlewareData = options.middlewareData;
10
- if (!middlewareData.arrow || !arrow) {
11
- return;
12
- }
13
- var _a = middlewareData.arrow, arrowX = _a.x, arrowY = _a.y;
14
- Object.assign(arrow.style, {
15
- left: arrowX + "px",
16
- top: arrowY + "px",
17
- });
18
- }
19
- exports.writeArrowUpdates = writeArrowUpdates;
20
- });
21
- //# sourceMappingURL=writeArrowUpdates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"writeArrowUpdates.js","sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/writeArrowUpdates.ts"],"names":[],"mappings":";;;;IAEA;;OAEG;IACH,SAAgB,iBAAiB,CAAC,OAAsE;QAC9F,IAAA,KAAK,GAAqB,OAAO,MAA5B,EAAE,cAAc,GAAK,OAAO,eAAZ,CAAa;QAC1C,IAAI,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE;YACnC,OAAO;SACR;QAEK,IAAA,KAA2B,cAAc,CAAC,KAAK,EAA1C,MAAM,OAAA,EAAK,MAAM,OAAyB,CAAC;QAEtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;YACzB,IAAI,EAAK,MAAM,OAAI;YACnB,GAAG,EAAK,MAAM,OAAI;SACnB,CAAC,CAAC;IACL,CAAC;IAZD,8CAYC","sourcesContent":["import { MiddlewareData } from '@floating-ui/dom';\n\n/**\n * Writes all DOM element updates after position is computed\n */\nexport function writeArrowUpdates(options: { arrow: HTMLElement | null; middlewareData: MiddlewareData }) {\n const { arrow, middlewareData } = options;\n if (!middlewareData.arrow || !arrow) {\n return;\n }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(arrow.style, {\n left: `${arrowX}px`,\n top: `${arrowY}px`,\n });\n}\n"]}
@@ -1,41 +0,0 @@
1
- define(["require", "exports", "../constants"], function (require, exports, constants_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.writeContainerUpdates = void 0;
5
- /**
6
- * Writes all container element position updates after the position is computed
7
- */
8
- function writeContainerUpdates(options) {
9
- var _a, _b, _c;
10
- var container = options.container, placement = options.placement, middlewareData = options.middlewareData, strategy = options.strategy, lowPPI = options.lowPPI, coordinates = options.coordinates;
11
- if (!container) {
12
- return;
13
- }
14
- container.setAttribute(constants_1.DATA_POSITIONING_PLACEMENT, placement);
15
- container.removeAttribute(constants_1.DATA_POSITIONING_INTERSECTING);
16
- if (middlewareData.intersectionObserver.intersecting) {
17
- container.setAttribute(constants_1.DATA_POSITIONING_INTERSECTING, '');
18
- }
19
- container.removeAttribute(constants_1.DATA_POSITIONING_ESCAPED);
20
- if ((_a = middlewareData.hide) === null || _a === void 0 ? void 0 : _a.escaped) {
21
- container.setAttribute(constants_1.DATA_POSITIONING_ESCAPED, '');
22
- }
23
- container.removeAttribute(constants_1.DATA_POSITIONING_HIDDEN);
24
- if ((_b = middlewareData.hide) === null || _b === void 0 ? void 0 : _b.referenceHidden) {
25
- container.setAttribute(constants_1.DATA_POSITIONING_HIDDEN, '');
26
- }
27
- // Round so that the coordinates land on device pixels.
28
- // This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like
29
- // `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.
30
- // See https://github.com/microsoft/fluentui/issues/26764 for more info.
31
- var devicePixelRatio = ((_c = container.ownerDocument.defaultView) === null || _c === void 0 ? void 0 : _c.devicePixelRatio) || 1;
32
- var x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;
33
- var y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;
34
- Object.assign(container.style, {
35
- transform: lowPPI ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)",
36
- position: strategy,
37
- });
38
- }
39
- exports.writeContainerUpdates = writeContainerUpdates;
40
- });
41
- //# sourceMappingURL=writeContainerupdates.js.map