@fluentui/react-positioning 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230321-0440.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.json +9 -9
  2. package/CHANGELOG.md +7 -7
  3. package/lib/constants.js +4 -4
  4. package/lib/constants.js.map +1 -1
  5. package/lib/createArrowStyles.js +19 -19
  6. package/lib/createArrowStyles.js.map +1 -1
  7. package/lib/createPositionManager.js +13 -13
  8. package/lib/createPositionManager.js.map +1 -1
  9. package/lib/createVirtualElementFromClick.js +2 -1
  10. package/lib/createVirtualElementFromClick.js.map +1 -1
  11. package/lib/index.js +5 -5
  12. package/lib/index.js.map +1 -1
  13. package/lib/middleware/coverTarget.js +6 -6
  14. package/lib/middleware/coverTarget.js.map +1 -1
  15. package/lib/middleware/flip.js +4 -4
  16. package/lib/middleware/flip.js.map +1 -1
  17. package/lib/middleware/index.js +6 -6
  18. package/lib/middleware/index.js.map +1 -1
  19. package/lib/middleware/intersecting.js +2 -2
  20. package/lib/middleware/intersecting.js.map +1 -1
  21. package/lib/middleware/maxSize.js +8 -8
  22. package/lib/middleware/maxSize.js.map +1 -1
  23. package/lib/middleware/offset.js +2 -2
  24. package/lib/middleware/offset.js.map +1 -1
  25. package/lib/middleware/shift.js +5 -5
  26. package/lib/middleware/shift.js.map +1 -1
  27. package/lib/types.js +1 -1
  28. package/lib/types.js.map +1 -1
  29. package/lib/usePositioning.js +26 -20
  30. package/lib/usePositioning.js.map +1 -1
  31. package/lib/usePositioningMouseTarget.js +4 -4
  32. package/lib/usePositioningMouseTarget.js.map +1 -1
  33. package/lib/utils/debounce.js +2 -1
  34. package/lib/utils/debounce.js.map +1 -1
  35. package/lib/utils/fromFloatingUIPlacement.js +10 -10
  36. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  37. package/lib/utils/getBoundary.js +8 -8
  38. package/lib/utils/getBoundary.js.map +1 -1
  39. package/lib/utils/getFloatingUIOffset.js +2 -2
  40. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  41. package/lib/utils/getReactFiberFromNode.js +2 -3
  42. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  43. package/lib/utils/getScrollParent.js +10 -7
  44. package/lib/utils/getScrollParent.js.map +1 -1
  45. package/lib/utils/hasAutoFocusFilter.js +4 -3
  46. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  47. package/lib/utils/index.js +15 -15
  48. package/lib/utils/index.js.map +1 -1
  49. package/lib/utils/mergeArrowOffset.js +8 -6
  50. package/lib/utils/mergeArrowOffset.js.map +1 -1
  51. package/lib/utils/parseFloatingUIPlacement.js +3 -2
  52. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  53. package/lib/utils/resolvePositioningShorthand.js +33 -33
  54. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  55. package/lib/utils/toFloatingUIPadding.js +3 -3
  56. package/lib/utils/toFloatingUIPadding.js.map +1 -1
  57. package/lib/utils/toFloatingUIPlacement.js +11 -11
  58. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  59. package/lib/utils/toggleScrollListener.js +4 -4
  60. package/lib/utils/toggleScrollListener.js.map +1 -1
  61. package/lib/utils/useCallbackRef.js +2 -2
  62. package/lib/utils/useCallbackRef.js.map +1 -1
  63. package/lib/utils/writeArrowUpdates.js +2 -1
  64. package/lib/utils/writeArrowUpdates.js.map +1 -1
  65. package/lib/utils/writeContainerupdates.js +8 -7
  66. package/lib/utils/writeContainerupdates.js.map +1 -1
  67. package/lib-commonjs/constants.js +7 -18
  68. package/lib-commonjs/constants.js.map +1 -1
  69. package/lib-commonjs/createArrowStyles.js +88 -60
  70. package/lib-commonjs/createArrowStyles.js.map +1 -1
  71. package/lib-commonjs/createPositionManager.js +117 -103
  72. package/lib-commonjs/createPositionManager.js.map +1 -1
  73. package/lib-commonjs/createVirtualElementFromClick.js +26 -27
  74. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  75. package/lib-commonjs/index.js +51 -24
  76. package/lib-commonjs/index.js.map +1 -1
  77. package/lib-commonjs/middleware/coverTarget.js +37 -34
  78. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  79. package/lib-commonjs/middleware/flip.js +38 -31
  80. package/lib-commonjs/middleware/flip.js.map +1 -1
  81. package/lib-commonjs/middleware/index.js +9 -10
  82. package/lib-commonjs/middleware/index.js.map +1 -1
  83. package/lib-commonjs/middleware/intersecting.js +22 -24
  84. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  85. package/lib-commonjs/middleware/maxSize.js +40 -34
  86. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  87. package/lib-commonjs/middleware/offset.js +12 -11
  88. package/lib-commonjs/middleware/offset.js.map +1 -1
  89. package/lib-commonjs/middleware/shift.js +37 -29
  90. package/lib-commonjs/middleware/shift.js.map +1 -1
  91. package/lib-commonjs/types.js +2 -5
  92. package/lib-commonjs/types.js.map +1 -1
  93. package/lib-commonjs/usePositioning.js +164 -192
  94. package/lib-commonjs/usePositioning.js.map +1 -1
  95. package/lib-commonjs/usePositioningMouseTarget.js +37 -34
  96. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  97. package/lib-commonjs/utils/debounce.js +21 -22
  98. package/lib-commonjs/utils/debounce.js.map +1 -1
  99. package/lib-commonjs/utils/fromFloatingUIPlacement.js +35 -30
  100. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  101. package/lib-commonjs/utils/getBoundary.js +22 -21
  102. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  103. package/lib-commonjs/utils/getFloatingUIOffset.js +35 -23
  104. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  105. package/lib-commonjs/utils/getReactFiberFromNode.js +41 -45
  106. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  107. package/lib-commonjs/utils/getScrollParent.js +56 -50
  108. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  109. package/lib-commonjs/utils/hasAutoFocusFilter.js +17 -17
  110. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  111. package/lib-commonjs/utils/index.js +18 -19
  112. package/lib-commonjs/utils/index.js.map +1 -1
  113. package/lib-commonjs/utils/mergeArrowOffset.js +32 -32
  114. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  115. package/lib-commonjs/utils/parseFloatingUIPlacement.js +14 -15
  116. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  117. package/lib-commonjs/utils/resolvePositioningShorthand.js +61 -63
  118. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  119. package/lib-commonjs/utils/toFloatingUIPadding.js +25 -23
  120. package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
  121. package/lib-commonjs/utils/toFloatingUIPlacement.js +33 -31
  122. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  123. package/lib-commonjs/utils/toggleScrollListener.js +24 -20
  124. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  125. package/lib-commonjs/utils/useCallbackRef.js +53 -39
  126. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  127. package/lib-commonjs/utils/writeArrowUpdates.js +24 -19
  128. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  129. package/lib-commonjs/utils/writeContainerupdates.js +45 -36
  130. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  131. package/package.json +7 -6
  132. package/.swcrc +0 -39
@@ -1,5 +1,5 @@
1
- import { shift as baseShift, limitShift } from "@floating-ui/dom";
2
- import { getBoundary, toFloatingUIPadding } from "../utils/index";
1
+ import { shift as baseShift, limitShift } from '@floating-ui/dom';
2
+ import { getBoundary, toFloatingUIPadding } from '../utils/index';
3
3
  /**
4
4
  * Wraps the floating UI shift middleware for easier usage of our options
5
5
  */
@@ -14,12 +14,12 @@ export function shift(options) {
14
14
  } = options;
15
15
  return baseShift({
16
16
  ...(hasScrollableElement && {
17
- boundary: "clippingAncestors"
17
+ boundary: 'clippingAncestors'
18
18
  }),
19
19
  ...(disableTether && {
20
- crossAxis: disableTether === "all",
20
+ crossAxis: disableTether === 'all',
21
21
  limiter: limitShift({
22
- crossAxis: disableTether !== "all",
22
+ crossAxis: disableTether !== 'all',
23
23
  mainAxis: false
24
24
  })
25
25
  }),
@@ -1 +1 @@
1
- {"version":3,"names":["shift","baseShift","limitShift","getBoundary","toFloatingUIPadding","options","hasScrollableElement","disableTether","overflowBoundary","container","overflowBoundaryPadding","isRtl","boundary","crossAxis","limiter","mainAxis","padding","altBoundary"],"sources":["../../src/middleware/shift.ts"],"sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary, toFloatingUIPadding } from '../utils/index';\n\nexport interface ShiftMiddlewareOptions\n extends Pick<PositioningOptions, 'overflowBoundary' | 'overflowBoundaryPadding'> {\n hasScrollableElement?: boolean;\n disableTether?: PositioningOptions['unstable_disableTether'];\n container: HTMLElement | null;\n isRtl: boolean;\n}\n\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */\nexport function shift(options: ShiftMiddlewareOptions) {\n const { hasScrollableElement, disableTether, overflowBoundary, container, overflowBoundaryPadding, isRtl } = options;\n\n return baseShift({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({ crossAxis: disableTether !== 'all', mainAxis: false }),\n }),\n ...(overflowBoundaryPadding && { padding: toFloatingUIPadding(overflowBoundaryPadding, isRtl) }),\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n });\n}\n"],"mappings":"AAAA,SAASA,KAAA,IAASC,SAAS,EAAEC,UAAU,QAAQ;AAE/C,SAASC,WAAW,EAAEC,mBAAmB,QAAQ;AAUjD;;;AAGA,OAAO,SAASJ,MAAMK,OAA+B,EAAE;EACrD,MAAM;IAAEC,oBAAA;IAAsBC,aAAA;IAAeC,gBAAA;IAAkBC,SAAA;IAAWC,uBAAA;IAAyBC;EAAK,CAAE,GAAGN,OAAA;EAE7G,OAAOJ,SAAA,CAAU;IACf,IAAIK,oBAAA,IAAwB;MAAEM,QAAA,EAAU;IAAoB,CAAC;IAC7D,IAAIL,aAAA,IAAiB;MACnBM,SAAA,EAAWN,aAAA,KAAkB;MAC7BO,OAAA,EAASZ,UAAA,CAAW;QAAEW,SAAA,EAAWN,aAAA,KAAkB;QAAOQ,QAAA,EAAU;MAAM;IAC5E,CAAC;IACD,IAAIL,uBAAA,IAA2B;MAAEM,OAAA,EAASZ,mBAAA,CAAoBM,uBAAA,EAAyBC,KAAA;IAAO,CAAC;IAC/F,IAAIH,gBAAA,IAAoB;MAAES,WAAA,EAAa,IAAI;MAAEL,QAAA,EAAUT,WAAA,CAAYM,SAAA,EAAWD,gBAAA;IAAkB,CAAC;EACnG;AACF"}
1
+ {"version":3,"names":["shift","baseShift","limitShift","getBoundary","toFloatingUIPadding","options","hasScrollableElement","disableTether","overflowBoundary","container","overflowBoundaryPadding","isRtl","boundary","crossAxis","limiter","mainAxis","padding","altBoundary"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/shift.ts"],"sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary, toFloatingUIPadding } from '../utils/index';\n\nexport interface ShiftMiddlewareOptions\n extends Pick<PositioningOptions, 'overflowBoundary' | 'overflowBoundaryPadding'> {\n hasScrollableElement?: boolean;\n disableTether?: PositioningOptions['unstable_disableTether'];\n container: HTMLElement | null;\n isRtl: boolean;\n}\n\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */\nexport function shift(options: ShiftMiddlewareOptions) {\n const { hasScrollableElement, disableTether, overflowBoundary, container, overflowBoundaryPadding, isRtl } = options;\n\n return baseShift({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({ crossAxis: disableTether !== 'all', mainAxis: false }),\n }),\n ...(overflowBoundaryPadding && { padding: toFloatingUIPadding(overflowBoundaryPadding, isRtl) }),\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n });\n}\n"],"mappings":"AAAA,SAASA,KAAK,IAAIC,SAAS,EAAEC,UAAU,QAAQ,kBAAkB;AAEjE,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,gBAAgB;AAUjE;;;AAGA,OAAM,SAAUJ,KAAKA,CAACK,OAA+B;EACnD,MAAM;IAAEC,oBAAoB;IAAEC,aAAa;IAAEC,gBAAgB;IAAEC,SAAS;IAAEC,uBAAuB;IAAEC;EAAK,CAAE,GAAGN,OAAO;EAEpH,OAAOJ,SAAS,CAAC;IACf,IAAIK,oBAAoB,IAAI;MAAEM,QAAQ,EAAE;IAAmB,CAAE,CAAC;IAC9D,IAAIL,aAAa,IAAI;MACnBM,SAAS,EAAEN,aAAa,KAAK,KAAK;MAClCO,OAAO,EAAEZ,UAAU,CAAC;QAAEW,SAAS,EAAEN,aAAa,KAAK,KAAK;QAAEQ,QAAQ,EAAE;MAAK,CAAE;KAC5E,CAAC;IACF,IAAIL,uBAAuB,IAAI;MAAEM,OAAO,EAAEZ,mBAAmB,CAACM,uBAAuB,EAAEC,KAAK;IAAC,CAAE,CAAC;IAChG,IAAIH,gBAAgB,IAAI;MAAES,WAAW,EAAE,IAAI;MAAEL,QAAQ,EAAET,WAAW,CAACM,SAAS,EAAED,gBAAgB;IAAC,CAAE;GAClG,CAAC;AACJ"}
package/lib/types.js CHANGED
@@ -1,2 +1,2 @@
1
- import * as React from "react";
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["React"],"sources":["../src/types.ts"],"sourcesContent":["import * as React from 'react';\n\ntype Rect = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\n\nexport type OffsetFunctionParam = {\n positionedRect: Rect;\n targetRect: Rect;\n position: Position;\n alignment?: Alignment;\n};\n\nexport type TargetElement = HTMLElement | PositioningVirtualElement;\n\n/**\n * @internal\n */\nexport interface UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface PositionManager {\n updatePosition: () => void;\n dispose: () => void;\n}\n\nexport interface UsePositioningReturn {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n}\n\nexport type OffsetObject = { crossAxis?: number; mainAxis: number };\n\nexport type OffsetShorthand = number;\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;\n\nexport type Offset = OffsetFunction | OffsetObject | OffsetShorthand;\n\nexport type Position = 'above' | 'below' | 'before' | 'after';\nexport type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';\n\nexport type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;\n\nexport type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';\n\nexport type PositioningImperativeRef = {\n /**\n * Updates the position imperatively.\n * Useful when the position of the target changes from other factors than scrolling of window resize.\n */\n updatePosition: () => void;\n\n /**\n * Sets the target and updates positioning imperatively.\n * Useful for avoiding double renders with the target option.\n */\n setTarget: (target: TargetElement) => void;\n};\n\nexport type PositioningVirtualElement = {\n getBoundingClientRect: () => {\n x: number;\n y: number;\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n };\n contextElement?: Element;\n};\n\nexport type SetVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => void;\n\nexport interface PositioningOptions {\n /** Alignment for the component. Only has an effect if used with the @see position option */\n align?: Alignment;\n\n /** The element which will define the boundaries of the positioned element for the flip behavior. */\n flipBoundary?: Boundary | null;\n\n /** The element which will define the boundaries of the positioned element for the overflow behavior. */\n overflowBoundary?: Boundary | null;\n\n /**\n * Applies a padding to the overflow bounadry, so that overflow is detected earlier before the\n * positioned surface hits the overflow boundary.\n */\n overflowBoundaryPadding?: number | Partial<{ top: number; end: number; bottom: number; start: number }>;\n\n /**\n * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')\n * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'\n * and 'start' | 'end' respectively),\n * then provided value for 'align' will be ignored and 'center' will be used instead.\n */\n position?: Position;\n\n /**\n * Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')\n * @default false\n */\n positionFixed?: boolean;\n\n /**\n * Lets you displace a positioned element from its reference element.\n * This can be useful if you need to apply some margin between them or if you need to fine tune the\n * position according to some custom logic.\n */\n offset?: Offset;\n\n /**\n * Defines padding between the corner of the popup element and the arrow.\n * Use to prevent the arrow from overlapping a rounded corner, for example.\n */\n arrowPadding?: number;\n\n /**\n * Applies max-height and max-width on the positioned element to fit it within the available space in viewport.\n * true enables this for both width and height when overflow happens.\n * 'always' applies `max-height`/`max-width` regardless of overflow.\n * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`\n * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`\n */\n autoSize?: AutoSize;\n\n /**\n * Modifies position and alignment to cover the target\n */\n coverTarget?: boolean;\n\n /**\n * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and\n * `position` props, regardless of the size of the component, the reference element or the viewport.\n */\n pinned?: boolean;\n\n /**\n * When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.\n * \"all\" enables this behavior for all axis.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether?: boolean | 'all';\n\n /**\n * If flip fails to stop the positioned element from overflowing\n * its boundaries, use a specified fallback positions.\n */\n fallbackPositions?: PositioningShorthandValue[];\n}\n\nexport interface PositioningProps\n extends Pick<\n PositioningOptions,\n | 'align'\n | 'flipBoundary'\n | 'overflowBoundary'\n | 'overflowBoundaryPadding'\n | 'position'\n | 'offset'\n | 'arrowPadding'\n | 'autoSize'\n | 'coverTarget'\n | 'pinned'\n > {\n /** An imperative handle to Popper methods. */\n positioningRef?: React.Ref<PositioningImperativeRef>;\n\n /**\n * Manual override for the target element. Useful for scenarios where a component accepts user prop to override target\n */\n target?: TargetElement | null;\n}\n\nexport type PositioningShorthandValue =\n | 'above'\n | 'above-start'\n | 'above-end'\n | 'below'\n | 'below-start'\n | 'below-end'\n | 'before'\n | 'before-top'\n | 'before-bottom'\n | 'after'\n | 'after-top'\n | 'after-bottom';\n\nexport type PositioningShorthand = PositioningProps | PositioningShorthandValue;\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-positioning/src/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\ntype Rect = {\n width: number;\n height: number;\n x: number;\n y: number;\n};\n\nexport type OffsetFunctionParam = {\n positionedRect: Rect;\n targetRect: Rect;\n position: Position;\n alignment?: Alignment;\n};\n\nexport type TargetElement = HTMLElement | PositioningVirtualElement;\n\n/**\n * @internal\n */\nexport interface UsePositioningOptions extends PositioningProps {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface PositionManager {\n updatePosition: () => void;\n dispose: () => void;\n}\n\nexport interface UsePositioningReturn {\n // React refs are supposed to be contravariant\n // (allows a more general type to be passed rather than a more specific one)\n // However, Typescript currently can't infer that fact for refs\n // See https://github.com/microsoft/TypeScript/issues/30748 for more information\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n targetRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n containerRef: React.MutableRefObject<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n arrowRef: React.MutableRefObject<any>;\n}\n\nexport type OffsetObject = { crossAxis?: number; mainAxis: number };\n\nexport type OffsetShorthand = number;\n\nexport type OffsetFunction = (param: OffsetFunctionParam) => OffsetObject | OffsetShorthand;\n\nexport type Offset = OffsetFunction | OffsetObject | OffsetShorthand;\n\nexport type Position = 'above' | 'below' | 'before' | 'after';\nexport type Alignment = 'top' | 'bottom' | 'start' | 'end' | 'center';\n\nexport type AutoSize = 'height' | 'height-always' | 'width' | 'width-always' | 'always' | boolean;\n\nexport type Boundary = HTMLElement | Array<HTMLElement> | 'clippingParents' | 'scrollParent' | 'window';\n\nexport type PositioningImperativeRef = {\n /**\n * Updates the position imperatively.\n * Useful when the position of the target changes from other factors than scrolling of window resize.\n */\n updatePosition: () => void;\n\n /**\n * Sets the target and updates positioning imperatively.\n * Useful for avoiding double renders with the target option.\n */\n setTarget: (target: TargetElement) => void;\n};\n\nexport type PositioningVirtualElement = {\n getBoundingClientRect: () => {\n x: number;\n y: number;\n top: number;\n left: number;\n bottom: number;\n right: number;\n width: number;\n height: number;\n };\n contextElement?: Element;\n};\n\nexport type SetVirtualMouseTarget = (event: React.MouseEvent | MouseEvent | undefined | null) => void;\n\nexport interface PositioningOptions {\n /** Alignment for the component. Only has an effect if used with the @see position option */\n align?: Alignment;\n\n /** The element which will define the boundaries of the positioned element for the flip behavior. */\n flipBoundary?: Boundary | null;\n\n /** The element which will define the boundaries of the positioned element for the overflow behavior. */\n overflowBoundary?: Boundary | null;\n\n /**\n * Applies a padding to the overflow bounadry, so that overflow is detected earlier before the\n * positioned surface hits the overflow boundary.\n */\n overflowBoundaryPadding?: number | Partial<{ top: number; end: number; bottom: number; start: number }>;\n\n /**\n * Position for the component. Position has higher priority than align. If position is vertical ('above' | 'below')\n * and align is also vertical ('top' | 'bottom') or if both position and align are horizontal ('before' | 'after'\n * and 'start' | 'end' respectively),\n * then provided value for 'align' will be ignored and 'center' will be used instead.\n */\n position?: Position;\n\n /**\n * Enables the position element to be positioned with 'fixed' (default value is position: 'absolute')\n * @default false\n */\n positionFixed?: boolean;\n\n /**\n * Lets you displace a positioned element from its reference element.\n * This can be useful if you need to apply some margin between them or if you need to fine tune the\n * position according to some custom logic.\n */\n offset?: Offset;\n\n /**\n * Defines padding between the corner of the popup element and the arrow.\n * Use to prevent the arrow from overlapping a rounded corner, for example.\n */\n arrowPadding?: number;\n\n /**\n * Applies max-height and max-width on the positioned element to fit it within the available space in viewport.\n * true enables this for both width and height when overflow happens.\n * 'always' applies `max-height`/`max-width` regardless of overflow.\n * 'height' applies `max-height` when overflow happens, and 'width' for `max-width`\n * `height-always` applies `max-height` regardless of overflow, and 'width-always' for always applying `max-width`\n */\n autoSize?: AutoSize;\n\n /**\n * Modifies position and alignment to cover the target\n */\n coverTarget?: boolean;\n\n /**\n * Disables automatic repositioning of the component; it will always be placed according to the values of `align` and\n * `position` props, regardless of the size of the component, the reference element or the viewport.\n */\n pinned?: boolean;\n\n /**\n * When the reference element or the viewport is outside viewport allows a positioned element to be fully in viewport.\n * \"all\" enables this behavior for all axis.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether?: boolean | 'all';\n\n /**\n * If flip fails to stop the positioned element from overflowing\n * its boundaries, use a specified fallback positions.\n */\n fallbackPositions?: PositioningShorthandValue[];\n}\n\nexport interface PositioningProps\n extends Pick<\n PositioningOptions,\n | 'align'\n | 'flipBoundary'\n | 'overflowBoundary'\n | 'overflowBoundaryPadding'\n | 'position'\n | 'offset'\n | 'arrowPadding'\n | 'autoSize'\n | 'coverTarget'\n | 'pinned'\n > {\n /** An imperative handle to Popper methods. */\n positioningRef?: React.Ref<PositioningImperativeRef>;\n\n /**\n * Manual override for the target element. Useful for scenarios where a component accepts user prop to override target\n */\n target?: TargetElement | null;\n}\n\nexport type PositioningShorthandValue =\n | 'above'\n | 'above-start'\n | 'above-end'\n | 'below'\n | 'below-start'\n | 'below-end'\n | 'before'\n | 'before-top'\n | 'before-bottom'\n | 'after'\n | 'after-top'\n | 'after-bottom';\n\nexport type PositioningShorthand = PositioningProps | PositioningShorthandValue;\n"]}
@@ -1,10 +1,10 @@
1
- import { hide as hideMiddleware, arrow as arrowMiddleware } from "@floating-ui/dom";
2
- import { useFluent_unstable as useFluent } from "@fluentui/react-shared-contexts";
3
- import { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from "@fluentui/react-utilities";
4
- import * as React from "react";
5
- import { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from "./utils";
6
- import { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from "./middleware";
7
- import { createPositionManager } from "./createPositionManager";
1
+ import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';
2
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
+ import { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
4
+ import * as React from 'react';
5
+ import { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';
6
+ import { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from './middleware';
7
+ import { createPositionManager } from './createPositionManager';
8
8
  /**
9
9
  * @internal
10
10
  */
@@ -19,11 +19,12 @@ export function usePositioning(options) {
19
19
  } = options;
20
20
  const resolvePositioningOptions = usePositioningOptions(options);
21
21
  const updatePositionManager = React.useCallback(() => {
22
+ var _a;
22
23
  if (managerRef.current) {
23
24
  managerRef.current.dispose();
24
25
  }
25
26
  managerRef.current = null;
26
- const target = overrideTargetRef.current ?? targetRef.current;
27
+ const target = (_a = overrideTargetRef.current) !== null && _a !== void 0 ? _a : targetRef.current;
27
28
  if (enabled && canUseDOM() && target && containerRef.current) {
28
29
  managerRef.current = createPositionManager({
29
30
  container: containerRef.current,
@@ -38,12 +39,15 @@ export function usePositioning(options) {
38
39
  updatePositionManager();
39
40
  });
40
41
  React.useImperativeHandle(options.positioningRef, () => ({
41
- updatePosition: () => managerRef.current?.updatePosition(),
42
+ updatePosition: () => {
43
+ var _a;
44
+ return (_a = managerRef.current) === null || _a === void 0 ? void 0 : _a.updatePosition();
45
+ },
42
46
  setTarget: target => {
43
- if (options.target && process.env.NODE_ENV !== "production") {
47
+ if (options.target && process.env.NODE_ENV !== 'production') {
44
48
  const err = new Error();
45
49
  // eslint-disable-next-line no-console
46
- console.warn("Imperative setTarget should not be used at the same time as target option");
50
+ console.warn('Imperative setTarget should not be used at the same time as target option');
47
51
  // eslint-disable-next-line no-console
48
52
  console.warn(err.stack);
49
53
  }
@@ -51,26 +55,28 @@ export function usePositioning(options) {
51
55
  }
52
56
  }), [options.target, setOverrideTarget]);
53
57
  useIsomorphicLayoutEffect(() => {
54
- setOverrideTarget(options.target ?? null);
58
+ var _a;
59
+ setOverrideTarget((_a = options.target) !== null && _a !== void 0 ? _a : null);
55
60
  }, [options.target, setOverrideTarget]);
56
61
  useIsomorphicLayoutEffect(() => {
57
62
  updatePositionManager();
58
63
  }, [updatePositionManager]);
59
- if (process.env.NODE_ENV !== "production") {
64
+ if (process.env.NODE_ENV !== 'production') {
60
65
  // This checked should run only in development mode
61
66
  // eslint-disable-next-line react-hooks/rules-of-hooks
62
67
  React.useEffect(() => {
68
+ var _a;
63
69
  if (containerRef.current) {
64
70
  const contentNode = containerRef.current;
65
- const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {
71
+ const treeWalker = (_a = contentNode.ownerDocument) === null || _a === void 0 ? void 0 : _a.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {
66
72
  acceptNode: hasAutofocusFilter
67
73
  });
68
74
  while (treeWalker.nextNode()) {
69
75
  const node = treeWalker.currentNode;
70
76
  // eslint-disable-next-line no-console
71
- console.warn("<Popper>:", node);
77
+ console.warn('<Popper>:', node);
72
78
  // eslint-disable-next-line no-console
73
- console.warn(['<Popper>: ^ this node contains "autoFocus" prop on a React element. This can break the initial', "positioning of an element and cause a window jump effect. This issue occurs because React polyfills", '"autoFocus" behavior to solve inconsistencies between different browsers:', "https://github.com/facebook/react/issues/11851#issuecomment-351787078", "\n", 'However, ".focus()" in this case occurs before any other React effects will be executed', "(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really", 'want to use "autoFocus" please add "position: fixed" to styles of the element that is wrapped by', '"Popper".', `In general, it's not recommended to use "autoFocus" as it may break accessibility aspects:`, "https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md", "\n", 'We suggest to use the "trapFocus" prop on Fluent components or a catch "ref" and then use', '"ref.current.focus" in React.useEffect():', "https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element"].join(" "));
79
+ console.warn(['<Popper>: ^ this node contains "autoFocus" prop on a React element. This can break the initial', 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills', '"autoFocus" behavior to solve inconsistencies between different browsers:', 'https://github.com/facebook/react/issues/11851#issuecomment-351787078', '\n', 'However, ".focus()" in this case occurs before any other React effects will be executed', '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really', 'want to use "autoFocus" please add "position: fixed" to styles of the element that is wrapped by', '"Popper".', `In general, it's not recommended to use "autoFocus" as it may break accessibility aspects:`, 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md', '\n', 'We suggest to use the "trapFocus" prop on Fluent components or a catch "ref" and then use', '"ref.current.focus" in React.useEffect():', 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element'].join(' '));
74
80
  }
75
81
  }
76
82
  // We run this check once, no need to add deps here
@@ -122,8 +128,8 @@ function usePositioningOptions(options) {
122
128
  const {
123
129
  dir
124
130
  } = useFluent();
125
- const isRtl = dir === "rtl";
126
- const strategy = positionFixed ? "fixed" : "absolute";
131
+ const isRtl = dir === 'rtl';
132
+ const strategy = positionFixed ? 'fixed' : 'absolute';
127
133
  return React.useCallback((container, arrow) => {
128
134
  const hasScrollableElement = hasScrollParent(container);
129
135
  const middleware = [offset && offsetMiddleware(offset), coverTarget && coverTargetMiddleware(), !pinned && flipMiddleware({
@@ -146,9 +152,9 @@ function usePositioningOptions(options) {
146
152
  element: arrow,
147
153
  padding: arrowPadding
148
154
  }), hideMiddleware({
149
- strategy: "referenceHidden"
155
+ strategy: 'referenceHidden'
150
156
  }), hideMiddleware({
151
- strategy: "escaped"
157
+ strategy: 'escaped'
152
158
  })].filter(Boolean);
153
159
  const placement = toFloatingUIPlacement(align, position, isRtl);
154
160
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["hide","hideMiddleware","arrow","arrowMiddleware","useFluent_unstable","useFluent","canUseDOM","useEventCallback","useIsomorphicLayoutEffect","React","useCallbackRef","toFloatingUIPlacement","hasAutofocusFilter","hasScrollParent","shift","shiftMiddleware","flip","flipMiddleware","coverTarget","coverTargetMiddleware","maxSize","maxSizeMiddleware","offset","offsetMiddleware","intersecting","intersectingMiddleware","createPositionManager","usePositioning","options","managerRef","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","target","container","setOverrideTarget","useImperativeHandle","positioningRef","updatePosition","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useEffect","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","nextNode","node","currentNode","join","setContainer","setArrow","align","arrowPadding","autoSize","flipBoundary","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","overflowBoundaryPadding","fallbackPositions","dir","isRtl","strategy","hasScrollableElement","middleware","element","padding","filter","Boolean","placement"],"sources":["../src/usePositioning.ts"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = useEventCallback((target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\ninterface UsePositioningOptions extends PositioningProps, Pick<PositioningOptions, 'fallbackPositions' | 'pinned'> {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n overflowBoundaryPadding,\n fallbackPositions,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement, isRtl, fallbackPositions }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl,\n }),\n autoSize && maxSizeMiddleware(autoSize, { container, overflowBoundary }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n ],\n );\n}\n"],"mappings":"AAAA,SAASA,IAAA,IAAQC,cAAc,EAAEC,KAAA,IAASC,eAAe,QAAQ;AAEjE,SAASC,kBAAA,IAAsBC,SAAS,QAAQ;AAChD,SAASC,SAAS,EAAEC,gBAAgB,EAAEC,yBAAyB,QAAQ;AACvE,YAAYC,KAAA,MAAW;AAQvB,SAASC,cAAc,EAAEC,qBAAqB,EAAEC,kBAAkB,EAAEC,eAAe,QAAQ;AAC3F,SACEC,KAAA,IAASC,eAAe,EACxBC,IAAA,IAAQC,cAAc,EACtBC,WAAA,IAAeC,qBAAqB,EACpCC,OAAA,IAAWC,iBAAiB,EAC5BC,MAAA,IAAUC,gBAAgB,EAC1BC,YAAA,IAAgBC,sBAAsB,QACjC;AACP,SAASC,qBAAqB,QAAQ;AAEtC;;;AAGA,OAAO,SAASC,eAAeC,OAA8B,EAAwB;EACnF,MAAMC,UAAA,GAAapB,KAAA,CAAMqB,MAAM,CAAyB,IAAI;EAC5D,MAAMC,SAAA,GAAYtB,KAAA,CAAMqB,MAAM,CAAuB,IAAI;EACzD,MAAME,iBAAA,GAAoBvB,KAAA,CAAMqB,MAAM,CAAuB,IAAI;EACjE,MAAMG,YAAA,GAAexB,KAAA,CAAMqB,MAAM,CAAqB,IAAI;EAC1D,MAAMI,QAAA,GAAWzB,KAAA,CAAMqB,MAAM,CAAqB,IAAI;EAEtD,MAAM;IAAEK,OAAA,GAAU;EAAI,CAAE,GAAGP,OAAA;EAC3B,MAAMQ,yBAAA,GAA4BC,qBAAA,CAAsBT,OAAA;EACxD,MAAMU,qBAAA,GAAwB7B,KAAA,CAAM8B,WAAW,CAAC,MAAM;IACpD,IAAIV,UAAA,CAAWW,OAAO,EAAE;MACtBX,UAAA,C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,IACjEvE,cAAA,CAAe;MAAEoF,QAAA,EAAU;IAAkB,IAC7CpF,cAAA,CAAe;MAAEoF,QAAA,EAAU;IAAU,GACtC,CAACK,MAAM,CAACC,OAAA;IAET,MAAMC,SAAA,GAAYjF,qBAAA,CAAsB4D,KAAA,EAAOM,QAAA,EAAUO,KAAA;IAEzD,OAAO;MACLQ,SAAA;MACAL,UAAA;MACAF;IACF;EACF,GACA,CACEd,KAAA,EACAC,YAAA,EACAC,QAAA,EACAvD,WAAA,EACA6D,aAAA,EACAL,YAAA,EACAU,KAAA,EACA9D,MAAA,EACAqD,gBAAA,EACAC,MAAA,EACAC,QAAA,EACAQ,QAAA,EACAJ,uBAAA,EACAC,iBAAA,CACD;AAEL"}
1
+ {"version":3,"names":["hide","hideMiddleware","arrow","arrowMiddleware","useFluent_unstable","useFluent","canUseDOM","useEventCallback","useIsomorphicLayoutEffect","React","useCallbackRef","toFloatingUIPlacement","hasAutofocusFilter","hasScrollParent","shift","shiftMiddleware","flip","flipMiddleware","coverTarget","coverTargetMiddleware","maxSize","maxSizeMiddleware","offset","offsetMiddleware","intersecting","intersectingMiddleware","createPositionManager","usePositioning","options","managerRef","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","target","_a","container","setOverrideTarget","useImperativeHandle","positioningRef","updatePosition","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useEffect","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","nextNode","node","currentNode","join","setContainer","setArrow","align","arrowPadding","autoSize","flipBoundary","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","overflowBoundaryPadding","fallbackPositions","dir","isRtl","strategy","hasScrollableElement","middleware","element","padding","filter","Boolean","placement"],"sources":["../../../../../../../packages/react-components/react-positioning/src/usePositioning.ts"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = useEventCallback((target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\ninterface UsePositioningOptions extends PositioningProps, Pick<PositioningOptions, 'fallbackPositions' | 'pinned'> {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n overflowBoundaryPadding,\n fallbackPositions,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement, isRtl, fallbackPositions }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl,\n }),\n autoSize && maxSizeMiddleware(autoSize, { container, overflowBoundary }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n ],\n );\n}\n"],"mappings":"AAAA,SAASA,IAAI,IAAIC,cAAc,EAAEC,KAAK,IAAIC,eAAe,QAAQ,kBAAkB;AAEnF,SAASC,kBAAkB,IAAIC,SAAS,QAAQ,iCAAiC;AACjF,SAASC,SAAS,EAAEC,gBAAgB,EAAEC,yBAAyB,QAAQ,2BAA2B;AAClG,OAAO,KAAKC,KAAK,MAAM,OAAO;AAQ9B,SAASC,cAAc,EAAEC,qBAAqB,EAAEC,kBAAkB,EAAEC,eAAe,QAAQ,SAAS;AACpG,SACEC,KAAK,IAAIC,eAAe,EACxBC,IAAI,IAAIC,cAAc,EACtBC,WAAW,IAAIC,qBAAqB,EACpCC,OAAO,IAAIC,iBAAiB,EAC5BC,MAAM,IAAIC,gBAAgB,EAC1BC,YAAY,IAAIC,sBAAsB,QACjC,cAAc;AACrB,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;;AAGA,OAAM,SAAUC,cAAcA,CAACC,OAA8B;EAC3D,MAAMC,UAAU,GAAGpB,KAAK,CAACqB,MAAM,CAAyB,IAAI,CAAC;EAC7D,MAAMC,SAAS,GAAGtB,KAAK,CAACqB,MAAM,CAAuB,IAAI,CAAC;EAC1D,MAAME,iBAAiB,GAAGvB,KAAK,CAACqB,MAAM,CAAuB,IAAI,CAAC;EAClE,MAAMG,YAAY,GAAGxB,KAAK,CAACqB,MAAM,CAAqB,IAAI,CAAC;EAC3D,MAAMI,QAAQ,GAAGzB,KAAK,CAACqB,MAAM,CAAqB,IAAI,CAAC;EAEvD,MAAM;IAAEK,OAAO,GAAG;EAAI,CAAE,GAAGP,OAAO;EAClC,MAAMQ,yBAAyB,GAAGC,qBAAqB,CAACT,OAAO,CAAC;EAChE,MAAMU,qBAAqB,GAAG7B,KAAK,CAAC8B,WAAW,CAAC,MAAK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-1,5 +1,5 @@
1
- import * as React from "react";
2
- import { createVirtualElementFromClick } from "./createVirtualElementFromClick";
1
+ import * as React from 'react';
2
+ import { createVirtualElementFromClick } from './createVirtualElementFromClick';
3
3
  /**
4
4
  * @internal
5
5
  * A state hook that manages a popper virtual element from mouseevents.
@@ -22,9 +22,9 @@ export const usePositioningMouseTarget = initialState => {
22
22
  } else {
23
23
  mouseevent = event;
24
24
  }
25
- if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== "production") {
25
+ if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {
26
26
  // eslint-disable-next-line no-console
27
- console.error("usePositioningMouseTarget should only be used with MouseEvent");
27
+ console.error('usePositioningMouseTarget should only be used with MouseEvent');
28
28
  }
29
29
  const contextTarget = createVirtualElementFromClick(mouseevent);
30
30
  setVirtualElement(contextTarget);
@@ -1 +1 @@
1
- {"version":3,"names":["React","createVirtualElementFromClick","usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget"],"sources":["../src/usePositioningMouseTarget.ts"],"sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport { PositioningVirtualElement, SetVirtualMouseTarget } from './types';\n\n/**\n * @internal\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePositioningMouseTarget = (\n initialState?: PositioningVirtualElement | (() => PositioningVirtualElement),\n) => {\n const [virtualElement, setVirtualElement] = React.useState<PositioningVirtualElement | undefined>(initialState);\n\n const setVirtualMouseTarget: SetVirtualMouseTarget = event => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n\n let mouseevent: MouseEvent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePositioningMouseTarget should only be used with MouseEvent');\n }\n\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n\n return [virtualElement, setVirtualMouseTarget] as const;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,6BAA6B,QAAQ;AAG9C;;;;;;;;;AASA,OAAO,MAAMC,yBAAA,GACXC,YAAA,IACG;EACH,MAAM,CAACC,cAAA,EAAgBC,iBAAA,CAAkB,GAAGL,KAAA,CAAMM,QAAQ,CAAwCH,YAAA;EAElG,MAAMI,qBAAA,GAA+CC,KAAA,IAAS;IAC5D,IAAIA,KAAA,KAAUC,SAAA,IAAaD,KAAA,KAAU,IAAI,EAAE;MACzCH,iBAAA,CAAkBI,SAAA;MAClB;IACF;IAEA,IAAIC,UAAA;IACJ,IAAI,EAAEF,KAAA,YAAiBG,UAAS,GAAI;MAClCD,UAAA,GAAaF,KAAA,CAAMI,WAAW;IAChC,OAAO;MACLF,UAAA,GAAaF,KAAA;IACf;IAEA,IAAI,EAAEE,UAAA,YAAsBC,UAAS,KAAME,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;MAChF;MACAC,OAAA,CAAQC,KAAK,CAAC;IAChB;IAEA,MAAMC,aAAA,GAAgBjB,6BAAA,CAA8BS,UAAA;IACpDL,iBAAA,CAAkBa,aAAA;EACpB;EAEA,OAAO,CAACd,cAAA,EAAgBG,qBAAA,CAAsB;AAChD"}
1
+ {"version":3,"names":["React","createVirtualElementFromClick","usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget"],"sources":["../../../../../../../packages/react-components/react-positioning/src/usePositioningMouseTarget.ts"],"sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport { PositioningVirtualElement, SetVirtualMouseTarget } from './types';\n\n/**\n * @internal\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePositioningMouseTarget = (\n initialState?: PositioningVirtualElement | (() => PositioningVirtualElement),\n) => {\n const [virtualElement, setVirtualElement] = React.useState<PositioningVirtualElement | undefined>(initialState);\n\n const setVirtualMouseTarget: SetVirtualMouseTarget = event => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n\n let mouseevent: MouseEvent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePositioningMouseTarget should only be used with MouseEvent');\n }\n\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n\n return [virtualElement, setVirtualMouseTarget] as const;\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,6BAA6B,QAAQ,iCAAiC;AAG/E;;;;;;;;;AASA,OAAO,MAAMC,yBAAyB,GACpCC,YAA4E,IAC1E;EACF,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGL,KAAK,CAACM,QAAQ,CAAwCH,YAAY,CAAC;EAE/G,MAAMI,qBAAqB,GAA0BC,KAAK,IAAG;IAC3D,IAAIA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI,EAAE;MACzCH,iBAAiB,CAACI,SAAS,CAAC;MAC5B;;IAGF,IAAIC,UAAsB;IAC1B,IAAI,EAAEF,KAAK,YAAYG,UAAU,CAAC,EAAE;MAClCD,UAAU,GAAGF,KAAK,CAACI,WAAW;KAC/B,MAAM;MACLF,UAAU,GAAGF,KAAK;;IAGpB,IAAI,EAAEE,UAAU,YAAYC,UAAU,CAAC,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;MAChF;MACAC,OAAO,CAACC,KAAK,CAAC,+DAA+D,CAAC;;IAGhF,MAAMC,aAAa,GAAGjB,6BAA6B,CAACS,UAAU,CAAC;IAC/DL,iBAAiB,CAACa,aAAa,CAAC;EAClC,CAAC;EAED,OAAO,CAACd,cAAc,EAAEG,qBAAqB,CAAU;AACzD,CAAC"}
@@ -3,7 +3,8 @@
3
3
  * This is no longer exported in Floating UI (Popper.js v3)
4
4
  * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js
5
5
  * @param fn function that will be debounced
6
- */export function debounce(fn) {
6
+ */
7
+ export function debounce(fn) {
7
8
  let pending;
8
9
  return () => {
9
10
  if (!pending) {
@@ -1 +1 @@
1
- {"version":3,"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"sources":["../../src/utils/debounce.ts"],"sourcesContent":["/**\n * Promise microtask debouncer used by Popper.js v2\n * This is no longer exported in Floating UI (Popper.js v3)\n * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js\n * @param fn function that will be debounced\n */\nexport function debounce<T>(fn: Function): () => Promise<T> {\n let pending: Promise<T> | undefined;\n return () => {\n if (!pending) {\n pending = new Promise<T>(resolve => {\n Promise.resolve().then(() => {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}\n"],"mappings":"AAAA;;;;;GAMA,OAAO,SAASA,SAAYC,EAAY,EAAoB;EAC1D,IAAIC,OAAA;EACJ,OAAO,MAAM;IACX,IAAI,CAACA,OAAA,EAAS;MACZA,OAAA,GAAU,IAAIC,OAAA,CAAWC,OAAA,IAAW;QAClCD,OAAA,CAAQC,OAAO,GAAGC,IAAI,CAAC,MAAM;UAC3BH,OAAA,GAAUI,SAAA;UACVF,OAAA,CAAQH,EAAA;QACV;MACF;IACF;IAEA,OAAOC,OAAA;EACT;AACF"}
1
+ {"version":3,"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/debounce.ts"],"sourcesContent":["/**\n * Promise microtask debouncer used by Popper.js v2\n * This is no longer exported in Floating UI (Popper.js v3)\n * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js\n * @param fn function that will be debounced\n */\nexport function debounce<T>(fn: Function): () => Promise<T> {\n let pending: Promise<T> | undefined;\n return () => {\n if (!pending) {\n pending = new Promise<T>(resolve => {\n Promise.resolve().then(() => {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}\n"],"mappings":"AAAA;;;;;;AAMA,OAAM,SAAUA,QAAQA,CAAIC,EAAY;EACtC,IAAIC,OAA+B;EACnC,OAAO,MAAK;IACV,IAAI,CAACA,OAAO,EAAE;MACZA,OAAO,GAAG,IAAIC,OAAO,CAAIC,OAAO,IAAG;QACjCD,OAAO,CAACC,OAAO,EAAE,CAACC,IAAI,CAAC,MAAK;UAC1BH,OAAO,GAAGI,SAAS;UACnBF,OAAO,CAACH,EAAE,EAAE,CAAC;QACf,CAAC,CAAC;MACJ,CAAC,CAAC;;IAGJ,OAAOC,OAAO;EAChB,CAAC;AACH"}
@@ -1,22 +1,22 @@
1
- import { parseFloatingUIPlacement } from "./parseFloatingUIPlacement";
1
+ import { parseFloatingUIPlacement } from './parseFloatingUIPlacement';
2
2
  const getPositionMap = () => ({
3
- top: "above",
4
- bottom: "below",
5
- right: "after",
6
- left: "before"
3
+ top: 'above',
4
+ bottom: 'below',
5
+ right: 'after',
6
+ left: 'before'
7
7
  });
8
8
  // Floating UI automatically flips alignment
9
9
  // https://github.com/floating-ui/floating-ui/issues/1563
10
10
  const getAlignmentMap = position => {
11
- if (position === "above" || position === "below") {
11
+ if (position === 'above' || position === 'below') {
12
12
  return {
13
- start: "start",
14
- end: "end"
13
+ start: 'start',
14
+ end: 'end'
15
15
  };
16
16
  }
17
17
  return {
18
- start: "top",
19
- end: "bottom"
18
+ start: 'top',
19
+ end: 'bottom'
20
20
  };
21
21
  };
22
22
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["parseFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","fromFloatingUIPlacement","placement","side","alignment","floatingUIAlignment"],"sources":["../../src/utils/fromFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Alignment as FloatingUIAlignment, Placement } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\nimport { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\n\nconst getPositionMap = (): Record<Side, Position> => ({\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (position: Position): Record<FloatingUIAlignment, Alignment> => {\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end',\n };\n }\n\n return {\n start: 'top',\n end: 'bottom',\n };\n};\n\n/**\n * Maps Floating UI placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const fromFloatingUIPlacement = (placement: Placement): { position: Position; alignment?: Alignment } => {\n const { side, alignment: floatingUIAlignment } = parseFloatingUIPlacement(placement);\n const position = getPositionMap()[side];\n const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];\n\n return { position, alignment };\n};\n"],"mappings":"AAEA,SAASA,wBAAwB,QAAQ;AAEzC,MAAMC,cAAA,GAAiBA,CAAA,MAA+B;EACpDC,GAAA,EAAK;EACLC,MAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,IAAA,EAAM;AACR;AAEA;AACA;AACA,MAAMC,eAAA,GAAmBC,QAAA,IAA+D;EACtF,IAAIA,QAAA,KAAa,WAAWA,QAAA,KAAa,SAAS;IAChD,OAAO;MACLC,KAAA,EAAO;MACPC,GAAA,EAAK;IACP;EACF;EAEA,OAAO;IACLD,KAAA,EAAO;IACPC,GAAA,EAAK;EACP;AACF;AAEA;;;;AAIA,OAAO,MAAMC,uBAAA,GAA2BC,SAAA,IAAwE;EAC9G,MAAM;IAAEC,IAAA;IAAMC,SAAA,EAAWC;EAAmB,CAAE,GAAGd,wBAAA,CAAyBW,SAAA;EAC1E,MAAMJ,QAAA,GAAWN,cAAA,EAAgB,CAACW,IAAA,CAAK;EACvC,MAAMC,SAAA,GAAYC,mBAAA,IAAuBR,eAAA,CAAgBC,QAAA,CAAS,CAACO,mBAAA,CAAoB;EAEvF,OAAO;IAAEP,QAAA;IAAUM;EAAU;AAC/B"}
1
+ {"version":3,"names":["parseFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","fromFloatingUIPlacement","placement","side","alignment","floatingUIAlignment"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/fromFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Alignment as FloatingUIAlignment, Placement } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\nimport { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\n\nconst getPositionMap = (): Record<Side, Position> => ({\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (position: Position): Record<FloatingUIAlignment, Alignment> => {\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end',\n };\n }\n\n return {\n start: 'top',\n end: 'bottom',\n };\n};\n\n/**\n * Maps Floating UI placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const fromFloatingUIPlacement = (placement: Placement): { position: Position; alignment?: Alignment } => {\n const { side, alignment: floatingUIAlignment } = parseFloatingUIPlacement(placement);\n const position = getPositionMap()[side];\n const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];\n\n return { position, alignment };\n};\n"],"mappings":"AAEA,SAASA,wBAAwB,QAAQ,4BAA4B;AAErE,MAAMC,cAAc,GAAGA,CAAA,MAA+B;EACpDC,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,OAAO;EACfC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE;CACP,CAAC;AAEF;AACA;AACA,MAAMC,eAAe,GAAIC,QAAkB,IAA4C;EACrF,IAAIA,QAAQ,KAAK,OAAO,IAAIA,QAAQ,KAAK,OAAO,EAAE;IAChD,OAAO;MACLC,KAAK,EAAE,OAAO;MACdC,GAAG,EAAE;KACN;;EAGH,OAAO;IACLD,KAAK,EAAE,KAAK;IACZC,GAAG,EAAE;GACN;AACH,CAAC;AAED;;;;AAIA,OAAO,MAAMC,uBAAuB,GAAIC,SAAoB,IAAmD;EAC7G,MAAM;IAAEC,IAAI;IAAEC,SAAS,EAAEC;EAAmB,CAAE,GAAGd,wBAAwB,CAACW,SAAS,CAAC;EACpF,MAAMJ,QAAQ,GAAGN,cAAc,EAAE,CAACW,IAAI,CAAC;EACvC,MAAMC,SAAS,GAAGC,mBAAmB,IAAIR,eAAe,CAACC,QAAQ,CAAC,CAACO,mBAAmB,CAAC;EAEvF,OAAO;IAAEP,QAAQ;IAAEM;EAAS,CAAE;AAChC,CAAC"}
@@ -1,18 +1,18 @@
1
- import { getScrollParent } from "./getScrollParent";
1
+ import { getScrollParent } from './getScrollParent';
2
2
  /**
3
3
  * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
4
4
  */
5
5
  export function getBoundary(element, boundary) {
6
- if (boundary === "window") {
7
- return element?.ownerDocument.documentElement;
6
+ if (boundary === 'window') {
7
+ return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
8
8
  }
9
- if (boundary === "clippingParents") {
10
- return "clippingAncestors";
9
+ if (boundary === 'clippingParents') {
10
+ return 'clippingAncestors';
11
11
  }
12
- if (boundary === "scrollParent") {
12
+ if (boundary === 'scrollParent') {
13
13
  let boundariesNode = getScrollParent(element);
14
- if (boundariesNode.nodeName === "BODY") {
15
- boundariesNode = element?.ownerDocument.documentElement;
14
+ if (boundariesNode.nodeName === 'BODY') {
15
+ boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
16
16
  }
17
17
  return boundariesNode;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"sources":["../../src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } from '../types';\n\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */\nexport function getBoundary(element: HTMLElement | null, boundary?: Boundary): FloatingUIBoundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\n }\n\n if (boundary === 'clippingParents') {\n return 'clippingAncestors';\n }\n\n if (boundary === 'scrollParent') {\n let boundariesNode: HTMLElement | undefined = getScrollParent(element);\n\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = element?.ownerDocument!.documentElement;\n }\n\n return boundariesNode;\n }\n\n return boundary;\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ;AAGhC;;;AAGA,OAAO,SAASC,YAAYC,OAA2B,EAAEC,QAAmB,EAAkC;EAC5G,IAAIA,QAAA,KAAa,UAAU;IACzB,OAAOD,OAAA,EAASE,aAAA,CAAeC,eAAe;EAChD;EAEA,IAAIF,QAAA,KAAa,mBAAmB;IAClC,OAAO;EACT;EAEA,IAAIA,QAAA,KAAa,gBAAgB;IAC/B,IAAIG,cAAA,GAA0CN,eAAA,CAAgBE,OAAA;IAE9D,IAAII,cAAA,CAAeC,QAAQ,KAAK,QAAQ;MACtCD,cAAA,GAAiBJ,OAAA,EAASE,aAAA,CAAeC,eAAe;IAC1D;IAEA,OAAOC,cAAA;EACT;EAEA,OAAOH,QAAA;AACT"}
1
+ {"version":3,"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } from '../types';\n\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */\nexport function getBoundary(element: HTMLElement | null, boundary?: Boundary): FloatingUIBoundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\n }\n\n if (boundary === 'clippingParents') {\n return 'clippingAncestors';\n }\n\n if (boundary === 'scrollParent') {\n let boundariesNode: HTMLElement | undefined = getScrollParent(element);\n\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = element?.ownerDocument!.documentElement;\n }\n\n return boundariesNode;\n }\n\n return boundary;\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ,mBAAmB;AAGnD;;;AAGA,OAAM,SAAUC,WAAWA,CAACC,OAA2B,EAAEC,QAAmB;EAC1E,IAAIA,QAAQ,KAAK,QAAQ,EAAE;IACzB,OAAOD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,aAAa,CAAEC,eAAe;;EAGhD,IAAIF,QAAQ,KAAK,iBAAiB,EAAE;IAClC,OAAO,mBAAmB;;EAG5B,IAAIA,QAAQ,KAAK,cAAc,EAAE;IAC/B,IAAIG,cAAc,GAA4BN,eAAe,CAACE,OAAO,CAAC;IAEtE,IAAII,cAAc,CAACC,QAAQ,KAAK,MAAM,EAAE;MACtCD,cAAc,GAAGJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,aAAa,CAAEC,eAAe;;IAG1D,OAAOC,cAAc;;EAGvB,OAAOH,QAAQ;AACjB"}
@@ -1,4 +1,4 @@
1
- import { fromFloatingUIPlacement } from "./fromFloatingUIPlacement";
1
+ import { fromFloatingUIPlacement } from './fromFloatingUIPlacement';
2
2
  /**
3
3
  * Shim to transform offset values from this library to Floating UI
4
4
  * @param rawOffset Offset from this library
@@ -8,7 +8,7 @@ export function getFloatingUIOffset(rawOffset) {
8
8
  if (!rawOffset) {
9
9
  return rawOffset;
10
10
  }
11
- if (typeof rawOffset === "number" || typeof rawOffset === "object") {
11
+ if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {
12
12
  return rawOffset;
13
13
  }
14
14
  return ({
@@ -1 +1 @@
1
- {"version":3,"names":["fromFloatingUIPlacement","getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","positionedRect","targetRect"],"sources":["../../src/utils/getFloatingUIOffset.ts"],"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"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ;AAgCxC;;;;;AAKA,OAAO,SAASC,oBACdC,SAA6B,EACiC;EAC9D,IAAI,CAACA,SAAA,EAAW;IACd,OAAOA,SAAA;EACT;EAEA,IAAI,OAAOA,SAAA,KAAc,YAAY,OAAOA,SAAA,KAAc,UAAU;IAClE,OAAOA,SAAA;EACT;EAEA,OAAO,CAAC;IAAEC,KAAA,EAAO;MAAEC,QAAA;MAAUC;IAAS,CAAE;IAAEC;EAAS,CAAE,KAAK;IACxD,MAAM;MAAEC,QAAA;MAAUC;IAAS,CAAE,GAAGR,uBAAA,CAAwBM,SAAA;IACxD,OAAOJ,SAAA,CAAU;MAAEO,cAAA,EAAgBL,QAAA;MAAUM,UAAA,EAAYL,SAAA;MAAWE,QAAA;MAAUC;IAAU;EAC1F;AACF"}
1
+ {"version":3,"names":["fromFloatingUIPlacement","getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","positionedRect","targetRect"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getFloatingUIOffset.ts"],"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"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ,2BAA2B;AAgCnE;;;;;AAKA,OAAM,SAAUC,mBAAmBA,CACjCC,SAA6B;EAE7B,IAAI,CAACA,SAAS,EAAE;IACd,OAAOA,SAAS;;EAGlB,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IAClE,OAAOA,SAAS;;EAGlB,OAAO,CAAC;IAAEC,KAAK,EAAE;MAAEC,QAAQ;MAAEC;IAAS,CAAE;IAAEC;EAAS,CAAE,KAAI;IACvD,MAAM;MAAEC,QAAQ;MAAEC;IAAS,CAAE,GAAGR,uBAAuB,CAACM,SAAS,CAAC;IAClE,OAAOJ,SAAS,CAAC;MAAEO,cAAc,EAAEL,QAAQ;MAAEM,UAAU,EAAEL,SAAS;MAAEE,QAAQ;MAAEC;IAAS,CAAE,CAAC;EAC5F,CAAC;AACH"}
@@ -1,4 +1,3 @@
1
- import * as React from "react";
2
1
  var WorkTag;
3
2
  (function (WorkTag) {
4
3
  WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
@@ -32,12 +31,12 @@ export function getReactFiberFromNode(elm) {
32
31
  // React 16 uses "__reactInternalInstance$" prefix
33
32
  // React 17 uses "__reactFiber$" prefix
34
33
  // https://github.com/facebook/react/pull/18377
35
- if (k.indexOf("__reactInternalInstance$") === 0 || k.indexOf("__reactFiber$") === 0) {
34
+ if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
36
35
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
37
36
  // @ts-ignore
38
37
  return elm[k];
39
38
  }
40
39
  }
41
- throw new Error("getReactFiber(): Failed to find a React Fiber on a node");
40
+ throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
42
41
  }
43
42
  //# sourceMappingURL=getReactFiberFromNode.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"sources":["../../src/utils/getReactFiberFromNode.ts"],"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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;IAuEvBC,OAAA;WAAKA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IAAIC,CAAA,CAAEC,OAAO,CAAC,gCAAgC,KAAKD,CAAA,CAAEC,OAAO,CAAC,qBAAqB,GAAG;MACnF;MACA;MACA,OAAOF,GAAG,CAACC,CAAA,CAAE;IACf;EACF;EAEA,MAAM,IAAIE,KAAA,CAAM;AAClB"}
1
+ {"version":3,"names":["WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"sources":["../../../../../../../../packages/react-components/react-positioning/src/utils/getReactFiberFromNode.ts"],"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"],"mappings":"AAuEA,IAAKA,OAuBJ;AAvBD,WAAKA,OAAO;EACVA,OAAA,CAAAA,OAAA,gDAAqB;EACrBA,OAAA,CAAAA,OAAA,0CAAkB;EAClBA,OAAA,CAAAA,OAAA,0DAA0B;EAC1BA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,kCAAc;EACdA,OAAA,CAAAA,OAAA,wCAAiB;EACjBA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,sBAAQ;EACRA,OAAA,CAAAA,OAAA,4CAAmB;EACnBA,OAAA,CAAAA,OAAA,6CAAoB;EACpBA,OAAA,CAAAA,OAAA,mCAAe;EACfA,OAAA,CAAAA,OAAA,+BAAa;EACbA,OAAA,CAAAA,OAAA,iDAAsB;EACtBA,OAAA,CAAAA,OAAA,yCAAkB;EAClBA,OAAA,CAAAA,OAAA,qDAAwB;EACxBA,OAAA,CAAAA,OAAA,yCAAkB;EAClBA,OAAA,CAAAA,OAAA,+DAA6B;EAC7BA,OAAA,CAAAA,OAAA,mDAAuB;EACvBA,OAAA,CAAAA,OAAA,yDAA0B;EAC1BA,OAAA,CAAAA,OAAA,uDAAyB;EACzBA,OAAA,CAAAA,OAAA,2CAAmB;AACrB,CAAC,EAvBIA,OAAO,KAAPA,OAAO;AAsLZ,OAAM,SAAUC,qBAAqBA,CAACC,GAAqB;EACzD,IAAI,CAACA,GAAG,EAAE;IACR,OAAO,IAAI;;EAGb,KAAK,MAAMC,CAAC,IAAID,GAAG,EAAE;IACnB;IACA;IACA;IACA,IAAIC,CAAC,CAACC,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAID,CAAC,CAACC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;MACnF;MACA;MACA,OAAOF,GAAG,CAACC,CAAC,CAAC;;;EAIjB,MAAM,IAAIE,KAAK,CAAC,yDAAyD,CAAC;AAC5E"}
@@ -2,8 +2,9 @@
2
2
  * Returns the parent node or the host of the node argument.
3
3
  * @param node - DOM node.
4
4
  * @returns - parent DOM node.
5
- */export const getParentNode = node => {
6
- if (node.nodeName === "HTML") {
5
+ */
6
+ export const getParentNode = node => {
7
+ if (node.nodeName === 'HTML') {
7
8
  return node;
8
9
  }
9
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -15,10 +16,11 @@
15
16
  * @returns - CSS styles.
16
17
  */
17
18
  const getStyleComputedProperty = node => {
19
+ var _a;
18
20
  if (node.nodeType !== 1) {
19
21
  return {};
20
22
  }
21
- const window = node.ownerDocument?.defaultView;
23
+ const window = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
22
24
  return window.getComputedStyle(node, null);
23
25
  };
24
26
  /**
@@ -32,10 +34,10 @@ export const getScrollParent = node => {
32
34
  // eslint-disable-next-line
33
35
  if (!parentNode) return document.body;
34
36
  switch (parentNode.nodeName) {
35
- case "HTML":
36
- case "BODY":
37
+ case 'HTML':
38
+ case 'BODY':
37
39
  return parentNode.ownerDocument.body;
38
- case "#document":
40
+ case '#document':
39
41
  return parentNode.body;
40
42
  }
41
43
  // If any of the overflow props is defined for the node then we return it as the parent
@@ -50,7 +52,8 @@ export const getScrollParent = node => {
50
52
  return getScrollParent(parentNode);
51
53
  };
52
54
  export const hasScrollParent = node => {
55
+ var _a;
53
56
  const scrollParentElement = getScrollParent(node);
54
- return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;
57
+ return scrollParentElement ? scrollParentElement !== ((_a = scrollParentElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.body) : false;
55
58
  };
56
59
  //# sourceMappingURL=getScrollParent.js.map