@fluentui/react-positioning 9.15.10 → 9.15.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/lib/constants.js.map +1 -1
  3. package/lib/createArrowStyles.js.map +1 -1
  4. package/lib/createPositionManager.js.map +1 -1
  5. package/lib/createSlideStyles.js.map +1 -1
  6. package/lib/createVirtualElementFromClick.js.map +1 -1
  7. package/lib/index.js.map +1 -1
  8. package/lib/middleware/coverTarget.js.map +1 -1
  9. package/lib/middleware/flip.js.map +1 -1
  10. package/lib/middleware/index.js.map +1 -1
  11. package/lib/middleware/intersecting.js.map +1 -1
  12. package/lib/middleware/matchTargetSize.js.map +1 -1
  13. package/lib/middleware/maxSize.js.map +1 -1
  14. package/lib/middleware/offset.js.map +1 -1
  15. package/lib/middleware/shift.js.map +1 -1
  16. package/lib/types.js.map +1 -1
  17. package/lib/usePositioning.js.map +1 -1
  18. package/lib/usePositioningMouseTarget.js.map +1 -1
  19. package/lib/utils/createResizeObserver.js.map +1 -1
  20. package/lib/utils/debounce.js.map +1 -1
  21. package/lib/utils/devtools.js.map +1 -1
  22. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  23. package/lib/utils/getBoundary.js.map +1 -1
  24. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  25. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  26. package/lib/utils/getScrollParent.js.map +1 -1
  27. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  28. package/lib/utils/index.js.map +1 -1
  29. package/lib/utils/listScrollParents.js.map +1 -1
  30. package/lib/utils/mergeArrowOffset.js.map +1 -1
  31. package/lib/utils/normalizeAutoSize.js.map +1 -1
  32. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  33. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  34. package/lib/utils/toFloatingUIPadding.js.map +1 -1
  35. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  36. package/lib/utils/toggleScrollListener.js.map +1 -1
  37. package/lib/utils/useCallbackRef.js.map +1 -1
  38. package/lib/utils/writeArrowUpdates.js.map +1 -1
  39. package/lib/utils/writeContainerupdates.js.map +1 -1
  40. package/lib-commonjs/constants.js.map +1 -1
  41. package/lib-commonjs/createArrowStyles.js.map +1 -1
  42. package/lib-commonjs/createPositionManager.js.map +1 -1
  43. package/lib-commonjs/createSlideStyles.js.map +1 -1
  44. package/lib-commonjs/createVirtualElementFromClick.js +1 -4
  45. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  46. package/lib-commonjs/index.js.map +1 -1
  47. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  48. package/lib-commonjs/middleware/flip.js.map +1 -1
  49. package/lib-commonjs/middleware/index.js.map +1 -1
  50. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  51. package/lib-commonjs/middleware/matchTargetSize.js.map +1 -1
  52. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  53. package/lib-commonjs/middleware/offset.js.map +1 -1
  54. package/lib-commonjs/middleware/shift.js.map +1 -1
  55. package/lib-commonjs/types.js.map +1 -1
  56. package/lib-commonjs/usePositioning.js +4 -2
  57. package/lib-commonjs/usePositioning.js.map +1 -1
  58. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  59. package/lib-commonjs/utils/createResizeObserver.js.map +1 -1
  60. package/lib-commonjs/utils/debounce.js.map +1 -1
  61. package/lib-commonjs/utils/devtools.js.map +1 -1
  62. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  63. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  64. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  65. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  66. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  67. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  68. package/lib-commonjs/utils/index.js.map +1 -1
  69. package/lib-commonjs/utils/listScrollParents.js.map +1 -1
  70. package/lib-commonjs/utils/mergeArrowOffset.js +1 -9
  71. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  72. package/lib-commonjs/utils/normalizeAutoSize.js +1 -5
  73. package/lib-commonjs/utils/normalizeAutoSize.js.map +1 -1
  74. package/lib-commonjs/utils/parseFloatingUIPlacement.js +1 -6
  75. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  76. package/lib-commonjs/utils/resolvePositioningShorthand.js +1 -1
  77. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  78. package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
  79. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  80. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  81. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  82. package/lib-commonjs/utils/writeArrowUpdates.js +1 -3
  83. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  84. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  85. package/package.json +5 -18
@@ -1 +1 @@
1
- {"version":3,"sources":["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, normalizeAutoSize } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n resetMaxSize as resetMaxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n matchTargetSize as matchTargetSizeMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\nimport { devtools } from '@floating-ui/devtools';\nimport { devtoolsCallback } from './utils/devtools';\nimport { POSITIONING_END_EVENT } from './constants';\n\n/**\n * @internal\n */\nexport function usePositioning(options: PositioningProps & PositioningOptions): UsePositioningReturn {\n 'use no memo';\n\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 | null) => {\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 }, []);\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 onPositioningEnd = useEventCallback(() => options.onPositioningEnd?.());\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current?.removeEventListener(POSITIONING_END_EVENT, onPositioningEnd);\n container?.addEventListener(POSITIONING_END_EVENT, onPositioningEnd);\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\nfunction usePositioningOptions(options: PositioningOptions) {\n 'use no memo';\n\n const {\n align,\n arrowPadding,\n autoSize: rawAutoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n // eslint-disable-next-line deprecation/deprecation\n positionFixed,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n disableUpdateOnResize = false,\n } = options;\n\n const { dir, targetDocument } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy: Strategy = strategy ?? positionFixed ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n matchTargetSize && matchTargetSizeMiddleware(),\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, overflowBoundaryPadding, isRtl }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n process.env.NODE_ENV !== 'production' && targetDocument && devtools(targetDocument, devtoolsCallback(options)),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform,\n disableUpdateOnResize,\n };\n },\n // Options is missing here, but it's not required\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n targetDocument,\n disableUpdateOnResize,\n ],\n );\n}\n"],"names":["usePositioning","options","managerRef","React","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","target","canUseDOM","createPositionManager","container","arrow","setOverrideTarget","useEventCallback","useImperativeHandle","positioningRef","updatePosition","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useIsomorphicLayoutEffect","useEffect","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","hasAutofocusFilter","nextNode","node","currentNode","join","useCallbackRef","onPositioningEnd","setContainer","removeEventListener","POSITIONING_END_EVENT","addEventListener","setArrow","align","arrowPadding","autoSize","rawAutoSize","coverTarget","flipBoundary","offset","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","matchTargetSize","disableUpdateOnResize","dir","targetDocument","useFluent","isRtl","positionStrategy","normalizeAutoSize","hasScrollableElement","hasScrollParent","middleware","resetMaxSizeMiddleware","matchTargetSizeMiddleware","offsetMiddleware","coverTargetMiddleware","flipMiddleware","shiftMiddleware","maxSizeMiddleware","intersectingMiddleware","arrowMiddleware","element","padding","hideMiddleware","devtools","devtoolsCallback","filter","Boolean","placement","toFloatingUIPlacement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AK,gBAAgB+C,kBAAkBoB,IAAAA,kBAAAA,EAASpB,gBAAgBqB,IAAAA,2BAAAA,EAAiBhG;SACtG,CAACiG,MAAM,CAACC;QAET,MAAMC,YAAYC,IAAAA,4BAAAA,EAAsB7C,OAAOS,UAAUa;QAEzD,OAAO;YACLsB;YACAjB;YACAd,UAAUU;YACVP;YACAE;QACF;IACF,GAEA,uDAAuD;IACvD;QACElB;QACAC;QACAC;QACAE;QACAO;QACAN;QACAiB;QACAhB;QACAC;QACAC;QACAC;QACAc;QACAT;QACAC;QACAC;QACAC;QACAG;QACAF;KACD;AAEL"}
1
+ {"version":3,"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, normalizeAutoSize } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n resetMaxSize as resetMaxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n matchTargetSize as matchTargetSizeMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\nimport { devtools } from '@floating-ui/devtools';\nimport { devtoolsCallback } from './utils/devtools';\nimport { POSITIONING_END_EVENT } from './constants';\n\n/**\n * @internal\n */\nexport function usePositioning(options: PositioningProps & PositioningOptions): UsePositioningReturn {\n 'use no memo';\n\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 | null) => {\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 }, []);\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 onPositioningEnd = useEventCallback(() => options.onPositioningEnd?.());\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current?.removeEventListener(POSITIONING_END_EVENT, onPositioningEnd);\n container?.addEventListener(POSITIONING_END_EVENT, onPositioningEnd);\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\nfunction usePositioningOptions(options: PositioningOptions) {\n 'use no memo';\n\n const {\n align,\n arrowPadding,\n autoSize: rawAutoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n // eslint-disable-next-line deprecation/deprecation\n positionFixed,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n disableUpdateOnResize = false,\n } = options;\n\n const { dir, targetDocument } = useFluent();\n const isRtl = dir === 'rtl';\n const positionStrategy: Strategy = strategy ?? positionFixed ? 'fixed' : 'absolute';\n const autoSize = normalizeAutoSize(rawAutoSize);\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n autoSize && resetMaxSizeMiddleware(autoSize),\n matchTargetSize && matchTargetSizeMiddleware(),\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, overflowBoundaryPadding, isRtl }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n process.env.NODE_ENV !== 'production' && targetDocument && devtools(targetDocument, devtoolsCallback(options)),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy: positionStrategy,\n useTransform,\n disableUpdateOnResize,\n };\n },\n // Options is missing here, but it's not required\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n positionStrategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n targetDocument,\n disableUpdateOnResize,\n ],\n );\n}\n"],"names":["usePositioning","options","managerRef","React","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","target","canUseDOM","createPositionManager","container","arrow","setOverrideTarget","useEventCallback","useImperativeHandle","positioningRef","updatePosition","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useIsomorphicLayoutEffect","useEffect","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","hasAutofocusFilter","nextNode","node","currentNode","join","useCallbackRef","onPositioningEnd","setContainer","removeEventListener","POSITIONING_END_EVENT","addEventListener","setArrow","align","arrowPadding","autoSize","rawAutoSize","coverTarget","flipBoundary","offset","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","matchTargetSize","disableUpdateOnResize","dir","targetDocument","useFluent","isRtl","positionStrategy","normalizeAutoSize","hasScrollableElement","hasScrollParent","middleware","resetMaxSizeMiddleware","matchTargetSizeMiddleware","offsetMiddleware","coverTargetMiddleware","flipMiddleware","shiftMiddleware","maxSizeMiddleware","intersectingMiddleware","arrowMiddleware","element","padding","hideMiddleware","devtools","devtoolsCallback","filter","Boolean","placement","toFloatingUIPlacement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA+BgBA;;;eAAAA;;;;qBA/BiD;qCAEjB;gCACuB;iEAChD;uBAQuF;4BAUvG;uCAC+B;0BACb;2BACQ;2BACK;AAK/B,SAASA,eAAeC,OAA8C;IAC3E;IAEA,MAAMC,aAAaC,OAAMC,MAAM,CAAyB;IACxD,MAAMC,YAAYF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AAY0B,IAAAA,wBAAsB,EAAC1B;YACnCe,mBAAmBY,IAAAA,2BAAyB;YAC5CvB,UAAUwB,IAAAA,kBAAgB,EAACxB;YAC3BF,eAAe2B,IAAAA,uBAAqB;YACpC,CAACvB,UAAUwB,IAAAA,gBAAc,EAAC;gBAAErE;gBAAW0C;gBAAcoB;gBAAsBH;gBAAOP;YAAkB;YACpGkB,IAAAA,iBAAe,EAAC;gBACdtE;gBACA8D;gBACAlB;gBACAI;gBACAG;gBACAQ;YACF;YACApB,YAAYgC,IAAAA,mBAAiB,EAAChC,UAAU;gBAAEvC;gBAAW4C;gBAAkBO;gBAAyBQ;YAAM;YACtGa,IAAAA,wBAAsB;YACtBvE,SAASwE,IAAAA,UAAe,EAAC;gBAAEC,SAASzE;gBAAO0E,SAASrC;YAAa;YACjEsC,IAAAA,SAAc,EAAC;gBAAE1B,UAAU;YAAkB;YAC7C0B,IAAAA,SAAc,EAAC;gBAAE1B,UAAU;YAAU;YACrC1C,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB+C,kBAAkBoB,IAAAA,kBAAQ,EAACpB,gBAAgBqB,IAAAA,2BAAgB,EAAChG;SACtG,CAACiG,MAAM,CAACC;QAET,MAAMC,YAAYC,IAAAA,4BAAqB,EAAC7C,OAAOS,UAAUa;QAEzD,OAAO;YACLsB;YACAjB;YACAd,UAAUU;YACVP;YACAE;QACF;IACF,GACA,iDAAiD;IACjD,uDAAuD;IACvD;QACElB;QACAC;QACAC;QACAE;QACAO;QACAN;QACAiB;QACAhB;QACAC;QACAC;QACAC;QACAc;QACAT;QACAC;QACAC;QACAC;QACAG;QACAF;KACD;AAEL"}
@@ -1 +1 @@
1
- {"version":3,"sources":["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"],"names":["usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","React","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget","createVirtualElementFromClick"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;;iEAbU;+CACuB;AAYvC,MAAMA,4BAA4B,CACvCC;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,OAAMC,QAAQ,CAAwCJ;IAElG,MAAMK,wBAA+CC,CAAAA;QACnD,IAAIA,UAAUC,aAAaD,UAAU,MAAM;YACzCJ,kBAAkBK;YAClB;QACF;QAEA,IAAIC;QACJ,IAAI,CAAEF,CAAAA,iBAAiBG,UAAAA,GAAa;YAClCD,aAAaF,MAAMI,WAAW;QAChC,OAAO;YACLF,aAAaF;QACf;QAEA,IAAI,CAAEE,CAAAA,sBAAsBC,UAAAA,KAAeE,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YAChF,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;QAChB;QAEA,MAAMC,gBAAgBC,IAAAA,4DAAAA,EAA8BT;QACpDN,kBAAkBc;IACpB;IAEA,OAAO;QAACf;QAAgBI;KAAsB;AAChD"}
1
+ {"version":3,"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"],"names":["usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","React","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget","createVirtualElementFromClick"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;;iEAbU;+CACuB;AAYvC,MAAMA,4BAA4B,CACvCC;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,OAAMC,QAAQ,CAAwCJ;IAElG,MAAMK,wBAA+CC,CAAAA;QACnD,IAAIA,UAAUC,aAAaD,UAAU,MAAM;YACzCJ,kBAAkBK;YAClB;QACF;QAEA,IAAIC;QACJ,IAAI,CAAEF,CAAAA,iBAAiBG,UAAS,GAAI;YAClCD,aAAaF,MAAMI,WAAW;QAChC,OAAO;YACLF,aAAaF;QACf;QAEA,IAAI,CAAEE,CAAAA,sBAAsBC,UAAS,KAAME,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YAChF,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;QAChB;QAEA,MAAMC,gBAAgBC,IAAAA,4DAA6B,EAACT;QACpDN,kBAAkBc;IACpB;IAEA,OAAO;QAACf;QAAgBI;KAAsB;AAChD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["createResizeObserver.ts"],"sourcesContent":["export function createResizeObserver(targetWindow: Window & typeof globalThis, callback: ResizeObserverCallback) {\n // https://github.com/jsdom/jsdom/issues/3368\n // Add the polyfill here so it is not needed for all unit tests that leverage positioning\n if (process.env.NODE_ENV === 'test') {\n targetWindow.ResizeObserver = class ResizeObserver {\n public observe() {\n // do nothing\n }\n public unobserve() {\n // do nothing\n }\n public disconnect() {\n // do nothing\n }\n };\n }\n\n return new targetWindow.ResizeObserver(callback);\n}\n"],"names":["createResizeObserver","targetWindow","callback","process","env","NODE_ENV","ResizeObserver","observe","unobserve","disconnect"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,qBAAqBC,YAAwC,EAAEC,QAAgC;IAC7G,6CAA6C;IAC7C,yFAAyF;IACzF,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,QAAQ;QACnCJ,aAAaK,cAAc,GAAG,MAAMA;YAC3BC,UAAU;YACf,aAAa;YACf;YACOC,YAAY;YACjB,aAAa;YACf;YACOC,aAAa;YAClB,aAAa;YACf;QACF;IACF;IAEA,OAAO,IAAIR,aAAaK,cAAc,CAACJ;AACzC"}
1
+ {"version":3,"sources":["../src/utils/createResizeObserver.ts"],"sourcesContent":["export function createResizeObserver(targetWindow: Window & typeof globalThis, callback: ResizeObserverCallback) {\n // https://github.com/jsdom/jsdom/issues/3368\n // Add the polyfill here so it is not needed for all unit tests that leverage positioning\n if (process.env.NODE_ENV === 'test') {\n targetWindow.ResizeObserver = class ResizeObserver {\n public observe() {\n // do nothing\n }\n public unobserve() {\n // do nothing\n }\n public disconnect() {\n // do nothing\n }\n };\n }\n\n return new targetWindow.ResizeObserver(callback);\n}\n"],"names":["createResizeObserver","targetWindow","callback","process","env","NODE_ENV","ResizeObserver","observe","unobserve","disconnect"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,qBAAqBC,YAAwC,EAAEC,QAAgC;IAC7G,6CAA6C;IAC7C,yFAAyF;IACzF,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,QAAQ;QACnCJ,aAAaK,cAAc,GAAG,MAAMA;YAC3BC,UAAU;YACf,aAAa;YACf;YACOC,YAAY;YACjB,aAAa;YACf;YACOC,aAAa;YAClB,aAAa;YACf;QACF;IACF;IAEA,OAAO,IAAIR,aAAaK,cAAc,CAACJ;AACzC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["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"],"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;CAKC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,SAAYC,EAAY;IACtC,IAAIC;IACJ,OAAO;QACL,IAAI,CAACA,SAAS;YACZA,UAAU,IAAIC,QAAWC,CAAAA;gBACvBD,QAAQC,OAAO,GAAGC,IAAI,CAAC;oBACrBH,UAAUI;oBACVF,QAAQH;gBACV;YACF;QACF;QAEA,OAAOC;IACT;AACF"}
1
+ {"version":3,"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"],"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;CAKC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,SAAYC,EAAY;IACtC,IAAIC;IACJ,OAAO;QACL,IAAI,CAACA,SAAS;YACZA,UAAU,IAAIC,QAAWC,CAAAA;gBACvBD,QAAQC,OAAO,GAAGC,IAAI,CAAC;oBACrBH,UAAUI;oBACVF,QAAQH;gBACV;YACF;QACF;QAEA,OAAOC;IACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["devtools.ts"],"sourcesContent":["import type { MiddlewareArguments } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport { listScrollParents } from './listScrollParents';\nimport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\n\nexport const devtoolsCallback = (options: PositioningOptions) => (middlewareState: MiddlewareArguments) => {\n const {\n elements: { floating, reference },\n } = middlewareState;\n const scrollParentsSet = new Set<HTMLElement>();\n if (isHTMLElement(reference)) {\n listScrollParents(reference).forEach(scrollParent => scrollParentsSet.add(scrollParent));\n }\n listScrollParents(floating).forEach(scrollParent => scrollParentsSet.add(scrollParent));\n const flipBoundaries: HTMLElement[] = Array.isArray(options.flipBoundary)\n ? options.flipBoundary\n : isHTMLElement(options.flipBoundary)\n ? [options.flipBoundary]\n : [];\n const overflowBoundaries: HTMLElement[] = Array.isArray(options.overflowBoundary)\n ? options.overflowBoundary\n : isHTMLElement(options.overflowBoundary)\n ? [options.overflowBoundary]\n : [];\n return {\n type: 'FluentUIMiddleware',\n middlewareState,\n options,\n initialPlacement: fromFloatingUIPlacement(middlewareState.initialPlacement),\n placement: fromFloatingUIPlacement(middlewareState.placement),\n flipBoundaries,\n overflowBoundaries,\n scrollParents: Array.from(scrollParentsSet),\n } as const;\n};\n"],"names":["devtoolsCallback","options","middlewareState","elements","floating","reference","scrollParentsSet","Set","isHTMLElement","listScrollParents","forEach","scrollParent","add","flipBoundaries","Array","isArray","flipBoundary","overflowBoundaries","overflowBoundary","type","initialPlacement","fromFloatingUIPlacement","placement","scrollParents","from"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAMaA;;;eAAAA;;;gCAJiB;mCACI;yCACM;AAEjC,MAAMA,mBAAmB,CAACC,UAAgC,CAACC;QAChE,MAAM,EACJC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAE,EAClC,GAAGH;QACJ,MAAMI,mBAAmB,IAAIC;QAC7B,IAAIC,IAAAA,6BAAAA,EAAcH,YAAY;YAC5BI,IAAAA,oCAAAA,EAAkBJ,WAAWK,OAAO,CAACC,CAAAA,eAAgBL,iBAAiBM,GAAG,CAACD;QAC5E;QACAF,IAAAA,oCAAAA,EAAkBL,UAAUM,OAAO,CAACC,CAAAA,eAAgBL,iBAAiBM,GAAG,CAACD;QACzE,MAAME,iBAAgCC,MAAMC,OAAO,CAACd,QAAQe,YAAY,IACpEf,QAAQe,YAAY,GACpBR,IAAAA,6BAAAA,EAAcP,QAAQe,YAAY,IAClC;YAACf,QAAQe,YAAY;SAAC,GACtB,EAAE;QACN,MAAMC,qBAAoCH,MAAMC,OAAO,CAACd,QAAQiB,gBAAgB,IAC5EjB,QAAQiB,gBAAgB,GACxBV,IAAAA,6BAAAA,EAAcP,QAAQiB,gBAAgB,IACtC;YAACjB,QAAQiB,gBAAgB;SAAC,GAC1B,EAAE;QACN,OAAO;YACLC,MAAM;YACNjB;YACAD;YACAmB,kBAAkBC,IAAAA,gDAAAA,EAAwBnB,gBAAgBkB,gBAAgB;YAC1EE,WAAWD,IAAAA,gDAAAA,EAAwBnB,gBAAgBoB,SAAS;YAC5DT;YACAI;YACAM,eAAeT,MAAMU,IAAI,CAAClB;QAC5B;IACF"}
1
+ {"version":3,"sources":["../src/utils/devtools.ts"],"sourcesContent":["import type { MiddlewareArguments } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { isHTMLElement } from '@fluentui/react-utilities';\nimport { listScrollParents } from './listScrollParents';\nimport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\n\nexport const devtoolsCallback = (options: PositioningOptions) => (middlewareState: MiddlewareArguments) => {\n const {\n elements: { floating, reference },\n } = middlewareState;\n const scrollParentsSet = new Set<HTMLElement>();\n if (isHTMLElement(reference)) {\n listScrollParents(reference).forEach(scrollParent => scrollParentsSet.add(scrollParent));\n }\n listScrollParents(floating).forEach(scrollParent => scrollParentsSet.add(scrollParent));\n const flipBoundaries: HTMLElement[] = Array.isArray(options.flipBoundary)\n ? options.flipBoundary\n : isHTMLElement(options.flipBoundary)\n ? [options.flipBoundary]\n : [];\n const overflowBoundaries: HTMLElement[] = Array.isArray(options.overflowBoundary)\n ? options.overflowBoundary\n : isHTMLElement(options.overflowBoundary)\n ? [options.overflowBoundary]\n : [];\n return {\n type: 'FluentUIMiddleware',\n middlewareState,\n options,\n initialPlacement: fromFloatingUIPlacement(middlewareState.initialPlacement),\n placement: fromFloatingUIPlacement(middlewareState.placement),\n flipBoundaries,\n overflowBoundaries,\n scrollParents: Array.from(scrollParentsSet),\n } as const;\n};\n"],"names":["devtoolsCallback","options","middlewareState","elements","floating","reference","scrollParentsSet","Set","isHTMLElement","listScrollParents","forEach","scrollParent","add","flipBoundaries","Array","isArray","flipBoundary","overflowBoundaries","overflowBoundary","type","initialPlacement","fromFloatingUIPlacement","placement","scrollParents","from"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAMaA;;;eAAAA;;;gCAJiB;mCACI;yCACM;AAEjC,MAAMA,mBAAmB,CAACC,UAAgC,CAACC;QAChE,MAAM,EACJC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAE,EAClC,GAAGH;QACJ,MAAMI,mBAAmB,IAAIC;QAC7B,IAAIC,IAAAA,6BAAa,EAACH,YAAY;YAC5BI,IAAAA,oCAAiB,EAACJ,WAAWK,OAAO,CAACC,CAAAA,eAAgBL,iBAAiBM,GAAG,CAACD;QAC5E;QACAF,IAAAA,oCAAiB,EAACL,UAAUM,OAAO,CAACC,CAAAA,eAAgBL,iBAAiBM,GAAG,CAACD;QACzE,MAAME,iBAAgCC,MAAMC,OAAO,CAACd,QAAQe,YAAY,IACpEf,QAAQe,YAAY,GACpBR,IAAAA,6BAAa,EAACP,QAAQe,YAAY,IAClC;YAACf,QAAQe,YAAY;SAAC,GACtB,EAAE;QACN,MAAMC,qBAAoCH,MAAMC,OAAO,CAACd,QAAQiB,gBAAgB,IAC5EjB,QAAQiB,gBAAgB,GACxBV,IAAAA,6BAAa,EAACP,QAAQiB,gBAAgB,IACtC;YAACjB,QAAQiB,gBAAgB;SAAC,GAC1B,EAAE;QACN,OAAO;YACLC,MAAM;YACNjB;YACAD;YACAmB,kBAAkBC,IAAAA,gDAAuB,EAACnB,gBAAgBkB,gBAAgB;YAC1EE,WAAWD,IAAAA,gDAAuB,EAACnB,gBAAgBoB,SAAS;YAC5DT;YACAI;YACAM,eAAeT,MAAMU,IAAI,CAAClB;QAC5B;IACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["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"],"names":["fromFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","placement","side","alignment","floatingUIAlignment","parseFloatingUIPlacement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA+BaA;;;eAAAA;;;0CA7B4B;AAEzC,MAAMC,iBAAiB,IAA+B,CAAA;QACpDC,KAAK;QACLC,QAAQ;QACRC,OAAO;QACPC,MAAM;IACR,CAAA;AAEA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMC,kBAAkB,CAACC;IACvB,IAAIA,aAAa,WAAWA,aAAa,SAAS;QAChD,OAAO;YACLC,OAAO;YACPC,KAAK;QACP;IACF;IAEA,OAAO;QACLD,OAAO;QACPC,KAAK;IACP;AACF;AAMO,MAAMT,0BAA0B,CAACU;IACtC,MAAM,EAAEC,IAAI,EAAEC,WAAWC,mBAAmB,EAAE,GAAGC,IAAAA,kDAAAA,EAAyBJ;IAC1E,MAAMH,WAAWN,gBAAgB,CAACU,KAAK;IACvC,MAAMC,YAAYC,uBAAuBP,gBAAgBC,SAAS,CAACM,oBAAoB;IAEvF,OAAO;QAAEN;QAAUK;IAAU;AAC/B"}
1
+ {"version":3,"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"],"names":["fromFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","placement","side","alignment","floatingUIAlignment","parseFloatingUIPlacement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA+BaA;;;eAAAA;;;0CA7B4B;AAEzC,MAAMC,iBAAiB,IAA+B,CAAA;QACpDC,KAAK;QACLC,QAAQ;QACRC,OAAO;QACPC,MAAM;IACR,CAAA;AAEA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMC,kBAAkB,CAACC;IACvB,IAAIA,aAAa,WAAWA,aAAa,SAAS;QAChD,OAAO;YACLC,OAAO;YACPC,KAAK;QACP;IACF;IAEA,OAAO;QACLD,OAAO;QACPC,KAAK;IACP;AACF;AAMO,MAAMT,0BAA0B,CAACU;IACtC,MAAM,EAAEC,IAAI,EAAEC,WAAWC,mBAAmB,EAAE,GAAGC,IAAAA,kDAAwB,EAACJ;IAC1E,MAAMH,WAAWN,gBAAgB,CAACU,KAAK;IACvC,MAAMC,YAAYC,uBAAuBP,gBAAgBC,SAAS,CAACM,oBAAoB;IAEvF,OAAO;QAAEN;QAAUK;IAAU;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["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"],"names":["getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","getScrollParent","nodeName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;iCANgB;AAMzB,SAASA,YAAYC,OAA2B,EAAEC,QAAmB;IAC1E,IAAIA,aAAa,UAAU;QACzB,OAAOD,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASE,aAAa,CAAEC,eAAe;IAChD;IAEA,IAAIF,aAAa,mBAAmB;QAClC,OAAO;IACT;IAEA,IAAIA,aAAa,gBAAgB;QAC/B,IAAIG,iBAA0CC,IAAAA,gCAAAA,EAAgBL;QAE9D,IAAII,eAAeE,QAAQ,KAAK,QAAQ;YACtCF,iBAAiBJ,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASE,aAAa,CAAEC,eAAe;QAC1D;QAEA,OAAOC;IACT;IAEA,OAAOH;AACT"}
1
+ {"version":3,"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"],"names":["getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","getScrollParent","nodeName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;iCANgB;AAMzB,SAASA,YAAYC,OAA2B,EAAEC,QAAmB;IAC1E,IAAIA,aAAa,UAAU;QACzB,OAAOD,oBAAAA,8BAAAA,QAASE,aAAa,CAAEC,eAAe;IAChD;IAEA,IAAIF,aAAa,mBAAmB;QAClC,OAAO;IACT;IAEA,IAAIA,aAAa,gBAAgB;QAC/B,IAAIG,iBAA0CC,IAAAA,gCAAe,EAACL;QAE9D,IAAII,eAAeE,QAAQ,KAAK,QAAQ;YACtCF,iBAAiBJ,oBAAAA,8BAAAA,QAASE,aAAa,CAAEC,eAAe;QAC1D;QAEA,OAAOC;IACT;IAEA,OAAOH;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["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"],"names":["getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","fromFloatingUIPlacement","positionedRect","targetRect"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuCgBA;;;eAAAA;;;yCArCwB;AAqCjC,SAASA,oBACdC,SAA6B;IAE7B,IAAI,CAACA,WAAW;QACd,OAAOA;IACT;IAEA,IAAI,OAAOA,cAAc,YAAY,OAAOA,cAAc,UAAU;QAClE,OAAOA;IACT;IAEA,OAAO,CAAC,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,SAAS,EAAE,EAAEC,SAAS,EAAE;QACnD,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,IAAAA,gDAAAA,EAAwBH;QACxD,OAAOJ,UAAU;YAAEQ,gBAAgBN;YAAUO,YAAYN;YAAWE;YAAUC;QAAU;IAC1F;AACF"}
1
+ {"version":3,"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"],"names":["getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","fromFloatingUIPlacement","positionedRect","targetRect"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAuCgBA;;;eAAAA;;;yCArCwB;AAqCjC,SAASA,oBACdC,SAA6B;IAE7B,IAAI,CAACA,WAAW;QACd,OAAOA;IACT;IAEA,IAAI,OAAOA,cAAc,YAAY,OAAOA,cAAc,UAAU;QAClE,OAAOA;IACT;IAEA,OAAO,CAAC,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,SAAS,EAAE,EAAEC,SAAS,EAAE;QACnD,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,IAAAA,gDAAuB,EAACH;QACxD,OAAOJ,UAAU;YAAEQ,gBAAgBN;YAAUO,YAAYN;YAAWE;YAAUC;QAAU;IAC1F;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["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"],"names":["getReactFiberFromNode","WorkTag","elm","k","indexOf","Error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA6PgBA;;;eAAAA;;;;iEA7PO;;UAuElBC,OAAAA;;;;;;;;;;;;;;;;;;;;;;;GAAAA,WAAAA,CAAAA,UAAAA,CAAAA,CAAAA;AAsLE,SAASD,sBAAsBE,GAAqB;IACzD,IAAI,CAACA,KAAK;QACR,OAAO;IACT;IAEA,IAAK,MAAMC,KAAKD,IAAK;QACnB,kDAAkD;QAClD,uCAAuC;QACvC,+CAA+C;QAC/C,IAAIC,EAAEC,OAAO,CAAC,gCAAgC,KAAKD,EAAEC,OAAO,CAAC,qBAAqB,GAAG;YACnF,6DAA6D;YAC7D,aAAa;YACb,OAAOF,GAAG,CAACC,EAAE;QACf;IACF;IAEA,MAAM,IAAIE,MAAM;AAClB"}
1
+ {"version":3,"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"],"names":["getReactFiberFromNode","WorkTag","elm","k","indexOf","Error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA6PgBA;;;eAAAA;;;;iEA7PO;;UAuElBC;;;;;;;;;;;;;;;;;;;;;;;GAAAA,YAAAA;AAsLE,SAASD,sBAAsBE,GAAqB;IACzD,IAAI,CAACA,KAAK;QACR,OAAO;IACT;IAEA,IAAK,MAAMC,KAAKD,IAAK;QACnB,kDAAkD;QAClD,uCAAuC;QACvC,+CAA+C;QAC/C,IAAIC,EAAEC,OAAO,CAAC,gCAAgC,KAAKD,EAAEC,OAAO,CAAC,qBAAqB,GAAG;YACnF,6DAA6D;YAC7D,aAAa;YACb,OAAOF,GAAG,CAACC,EAAE;QACf;IACF;IAEA,MAAM,IAAIE,MAAM;AAClB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"names":["getParentNode","getScrollParent","hasScrollParent","node","nodeName","parentNode","host","getStyleComputedProperty","nodeType","window","ownerDocument","defaultView","getComputedStyle","document","body","overflow","overflowX","overflowY","test","scrollParentElement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;CAIC;;;;;;;;;;;IACYA,aAAAA;eAAAA;;IA2BAC,eAAAA;eAAAA;;IAuBAC,eAAAA;eAAAA;;;AAlDN,MAAMF,gBAAgB,CAACG;IAC5B,IAAIA,KAAKC,QAAQ,KAAK,QAAQ;QAC5B,OAAOD;IACT;IACA,8DAA8D;IAC9D,OAAOA,KAAKE,UAAU,IAAIF,KAAcG,IAAI;AAC9C;AAEA;;;;CAIC,GACD,MAAMC,2BAA2B,CAACJ;QAKjBA;IAJf,IAAIA,KAAKK,QAAQ,KAAK,GAAG;QACvB,OAAO,CAAC;IACV;IAEA,MAAMC,SAAAA,AAASN,CAAAA,sBAAAA,KAAKO,aAAa,AAAbA,MAAa,QAAlBP,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAoBQ,WAAW;IAC9C,OAAOF,OAAQG,gBAAgB,CAACT,MAAM;AACxC;AAOO,MAAMF,kBAAkB,CAACE;IAC9B,iFAAiF;IACjF,MAAME,aAAaF,QAAQH,cAAcG;IACzC,2BAA2B;IAC3B,IAAI,CAACE,YAAY,OAAOQ,SAASC,IAAI;IAErC,OAAQT,WAAWD,QAAQ;QACzB,KAAK;QACL,KAAK;YACH,OAAOC,WAAWK,aAAa,CAAEI,IAAI;QACvC,KAAK;YACH,OAAOT,WAAoCS,IAAI;IACnD;IAEA,uFAAuF;IACvF,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGV,yBAAyBF;IACpE,IAAI,wBAAwBa,IAAI,CAACH,WAAYE,YAAaD,YAAY;QACpE,OAAOX;IACT;IAEA,OAAOJ,gBAAgBI;AACzB;AAEO,MAAMH,kBAAkB,CAACC;QAEuBgB;IADrD,MAAMA,sBAAmClB,gBAAgBE;IACzD,OAAOgB,sBAAsBA,wBAAAA,CAAAA,AAAwBA,CAAAA,qCAAAA,oBAAoBT,aAAa,AAAbA,MAAa,QAAjCS,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCL,IAAI,AAAJA,IAAO;AACjG"}
1
+ {"version":3,"sources":["../src/utils/getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"names":["getParentNode","getScrollParent","hasScrollParent","node","nodeName","parentNode","host","getStyleComputedProperty","nodeType","window","ownerDocument","defaultView","getComputedStyle","document","body","overflow","overflowX","overflowY","test","scrollParentElement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;CAIC;;;;;;;;;;;IACYA,aAAa;eAAbA;;IA2BAC,eAAe;eAAfA;;IAuBAC,eAAe;eAAfA;;;AAlDN,MAAMF,gBAAgB,CAACG;IAC5B,IAAIA,KAAKC,QAAQ,KAAK,QAAQ;QAC5B,OAAOD;IACT;IACA,8DAA8D;IAC9D,OAAOA,KAAKE,UAAU,IAAI,AAACF,KAAaG,IAAI;AAC9C;AAEA;;;;CAIC,GACD,MAAMC,2BAA2B,CAACJ;QAKjBA;IAJf,IAAIA,KAAKK,QAAQ,KAAK,GAAG;QACvB,OAAO,CAAC;IACV;IAEA,MAAMC,UAASN,sBAAAA,KAAKO,aAAa,cAAlBP,0CAAAA,oBAAoBQ,WAAW;IAC9C,OAAOF,OAAQG,gBAAgB,CAACT,MAAM;AACxC;AAOO,MAAMF,kBAAkB,CAACE;IAC9B,iFAAiF;IACjF,MAAME,aAAaF,QAAQH,cAAcG;IACzC,2BAA2B;IAC3B,IAAI,CAACE,YAAY,OAAOQ,SAASC,IAAI;IAErC,OAAQT,WAAWD,QAAQ;QACzB,KAAK;QACL,KAAK;YACH,OAAOC,WAAWK,aAAa,CAAEI,IAAI;QACvC,KAAK;YACH,OAAO,AAACT,WAAmCS,IAAI;IACnD;IAEA,uFAAuF;IACvF,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGV,yBAAyBF;IACpE,IAAI,wBAAwBa,IAAI,CAACH,WAAYE,YAAaD,YAAY;QACpE,OAAOX;IACT;IAEA,OAAOJ,gBAAgBI;AACzB;AAEO,MAAMH,kBAAkB,CAACC;QAEuBgB;IADrD,MAAMA,sBAAmClB,gBAAgBE;IACzD,OAAOgB,sBAAsBA,0BAAwBA,qCAAAA,oBAAoBT,aAAa,cAAjCS,yDAAAA,mCAAmCL,IAAI,IAAG;AACjG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["hasAutoFocusFilter.ts"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n *\n * @param node\n */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nexport function hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"],"names":["hasAutofocusFilter","hasAutofocusProp","node","isAutoFocusableElement","nodeName","getReactFiberFromNode","pendingProps","autoFocus","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,EAAE;AACF,uDAAuD;AACvD,EAAE;;;;;+BAyBcA;;;eAAAA;;;uCAvBsB;AAEtC;;;;;CAKC,GACD,SAASC,iBAAiBC,IAAU;IAClC,gJAAgJ;IAChJ,MAAMC,yBACJD,KAAKE,QAAQ,KAAK,YAClBF,KAAKE,QAAQ,KAAK,WAClBF,KAAKE,QAAQ,KAAK,YAClBF,KAAKE,QAAQ,KAAK;IAEpB,IAAID,wBAAwB;YACjBE;QAAT,OAAO,CAAC,CAAA,CAAA,AAACA,CAAAA,0BAAAA,IAAAA,4CAAAA,EAAsBH,KAAAA,MAAAA,QAAtBG,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAA6BC,YAAY,CAACC,SAAS,AAATA;IACrD;IAEA,OAAO;AACT;AAEO,SAASP,mBAAmBE,IAAU;IAC3C,OAAOD,iBAAiBC,QAAQM,WAAWC,aAAa,GAAGD,WAAWE,WAAW;AACnF"}
1
+ {"version":3,"sources":["../src/utils/hasAutoFocusFilter.ts"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n *\n * @param node\n */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nexport function hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"],"names":["hasAutofocusFilter","hasAutofocusProp","node","isAutoFocusableElement","nodeName","getReactFiberFromNode","pendingProps","autoFocus","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,EAAE;AACF,uDAAuD;AACvD,EAAE;;;;;+BAyBcA;;;eAAAA;;;uCAvBsB;AAEtC;;;;;CAKC,GACD,SAASC,iBAAiBC,IAAU;IAClC,gJAAgJ;IAChJ,MAAMC,yBACJD,KAAKE,QAAQ,KAAK,YAClBF,KAAKE,QAAQ,KAAK,WAClBF,KAAKE,QAAQ,KAAK,YAClBF,KAAKE,QAAQ,KAAK;IAEpB,IAAID,wBAAwB;YACjBE;QAAT,OAAO,CAAC,GAACA,0BAAAA,IAAAA,4CAAqB,EAACH,mBAAtBG,8CAAAA,wBAA6BC,YAAY,CAACC,SAAS;IAC9D;IAEA,OAAO;AACT;AAEO,SAASP,mBAAmBE,IAAU;IAC3C,OAAOD,iBAAiBC,QAAQM,WAAWC,aAAa,GAAGD,WAAWE,WAAW;AACnF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './parseFloatingUIPlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './toFloatingUIPadding';\nexport * from './toFloatingUIPlacement';\nexport * from './fromFloatingUIPlacement';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\nexport * from './debounce';\nexport * from './toggleScrollListener';\nexport * from './hasAutoFocusFilter';\nexport * from './writeArrowUpdates';\nexport * from './writeContainerupdates';\nexport * from './normalizeAutoSize';\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
1
+ {"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export * from './parseFloatingUIPlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './toFloatingUIPadding';\nexport * from './toFloatingUIPlacement';\nexport * from './fromFloatingUIPlacement';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\nexport * from './debounce';\nexport * from './toggleScrollListener';\nexport * from './hasAutoFocusFilter';\nexport * from './writeArrowUpdates';\nexport * from './writeContainerupdates';\nexport * from './normalizeAutoSize';\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["listScrollParents.ts"],"sourcesContent":["import { getScrollParent } from './getScrollParent';\n\nexport function listScrollParents(node: HTMLElement): HTMLElement[] {\n const scrollParents: HTMLElement[] = [];\n\n let cur: HTMLElement | null = node;\n while (cur) {\n const scrollParent = getScrollParent(cur);\n\n if (node.ownerDocument.body === scrollParent) {\n scrollParents.push(scrollParent);\n break;\n }\n\n if (scrollParent.nodeName === 'BODY' && scrollParent !== node.ownerDocument.body) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n '@fluentui/react-positioning: You are comparing two different documents! This is an unexpected error, please report this as a bug to the Fluent UI team ',\n );\n }\n break;\n }\n\n scrollParents.push(scrollParent);\n cur = scrollParent;\n }\n\n return scrollParents;\n}\n"],"names":["listScrollParents","node","scrollParents","cur","scrollParent","getScrollParent","ownerDocument","body","push","nodeName","process","env","NODE_ENV","console","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;iCAFgB;AAEzB,SAASA,kBAAkBC,IAAiB;IACjD,MAAMC,gBAA+B,EAAE;IAEvC,IAAIC,MAA0BF;IAC9B,MAAOE,IAAK;QACV,MAAMC,eAAeC,IAAAA,gCAAAA,EAAgBF;QAErC,IAAIF,KAAKK,aAAa,CAACC,IAAI,KAAKH,cAAc;YAC5CF,cAAcM,IAAI,CAACJ;YACnB;QACF;QAEA,IAAIA,aAAaK,QAAQ,KAAK,UAAUL,iBAAiBH,KAAKK,aAAa,CAACC,IAAI,EAAE;YAChF,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQC,KAAK,CACX;YAEJ;YACA;QACF;QAEAZ,cAAcM,IAAI,CAACJ;QACnBD,MAAMC;IACR;IAEA,OAAOF;AACT"}
1
+ {"version":3,"sources":["../src/utils/listScrollParents.ts"],"sourcesContent":["import { getScrollParent } from './getScrollParent';\n\nexport function listScrollParents(node: HTMLElement): HTMLElement[] {\n const scrollParents: HTMLElement[] = [];\n\n let cur: HTMLElement | null = node;\n while (cur) {\n const scrollParent = getScrollParent(cur);\n\n if (node.ownerDocument.body === scrollParent) {\n scrollParents.push(scrollParent);\n break;\n }\n\n if (scrollParent.nodeName === 'BODY' && scrollParent !== node.ownerDocument.body) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error(\n '@fluentui/react-positioning: You are comparing two different documents! This is an unexpected error, please report this as a bug to the Fluent UI team ',\n );\n }\n break;\n }\n\n scrollParents.push(scrollParent);\n cur = scrollParent;\n }\n\n return scrollParents;\n}\n"],"names":["listScrollParents","node","scrollParents","cur","scrollParent","getScrollParent","ownerDocument","body","push","nodeName","process","env","NODE_ENV","console","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;iCAFgB;AAEzB,SAASA,kBAAkBC,IAAiB;IACjD,MAAMC,gBAA+B,EAAE;IAEvC,IAAIC,MAA0BF;IAC9B,MAAOE,IAAK;QACV,MAAMC,eAAeC,IAAAA,gCAAe,EAACF;QAErC,IAAIF,KAAKK,aAAa,CAACC,IAAI,KAAKH,cAAc;YAC5CF,cAAcM,IAAI,CAACJ;YACnB;QACF;QAEA,IAAIA,aAAaK,QAAQ,KAAK,UAAUL,iBAAiBH,KAAKK,aAAa,CAACC,IAAI,EAAE;YAChF,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQC,KAAK,CACX;YAEJ;YACA;QACF;QAEAZ,cAAcM,IAAI,CAACJ;QACnBD,MAAMC;IACR;IAEA,OAAOF;AACT"}
@@ -1,12 +1,4 @@
1
- /**
2
- * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the
3
- * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset
4
- *
5
- * @internal
6
- * @param userOffset - The offset provided by the user
7
- * @param arrowHeight - The height of the arrow in px
8
- * @returns User offset augmented with arrow height
9
- */ "use strict";
1
+ "use strict";
10
2
  Object.defineProperty(exports, "__esModule", {
11
3
  value: true
12
4
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["mergeArrowOffset.ts"],"sourcesContent":["import type { Offset, OffsetObject } from '../types';\n\n/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @internal\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"],"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA;;;;;;;;CAQC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,iBAAiBC,UAAqC,EAAEC,WAAmB;IACzF,IAAI,OAAOD,eAAe,UAAU;QAClC,OAAOE,eAAeF,YAAYC;IACpC;IAEA,IAAI,OAAOD,eAAe,YAAYA,eAAe,MAAM;QACzD,OAAOE,eAAeF,YAAYC;IACpC;IAEA,IAAI,OAAOD,eAAe,YAAY;QACpC,OAAOG,CAAAA;YACL,MAAMC,SAASJ,WAAWG;YAC1B,OAAOD,eAAeE,QAAQH;QAChC;IACF;IAEA,OAAO;QAAEI,UAAUJ;IAAY;AACjC;AAEA,MAAMC,iBAAiB,CAACE,QAA+BH;IACrD,IAAI,OAAOG,WAAW,UAAU;QAC9B,OAAO;YAAEC,UAAUD,SAASH;QAAY;IAC1C;QAE+BG;IAA/B,OAAO;QAAE,GAAGA,MAAM;QAAEC,UAAU,AAACD,CAAAA,CAAAA,mBAAAA,OAAOC,QAAQ,AAARA,MAAQ,QAAfD,qBAAAA,KAAAA,IAAAA,mBAAmB,CAAA,IAAKH;IAAY;AACrE"}
1
+ {"version":3,"sources":["../src/utils/mergeArrowOffset.ts"],"sourcesContent":["import type { Offset, OffsetObject } from '../types';\n\n/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @internal\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"],"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWgBA;;;eAAAA;;;AAAT,SAASA,iBAAiBC,UAAqC,EAAEC,WAAmB;IACzF,IAAI,OAAOD,eAAe,UAAU;QAClC,OAAOE,eAAeF,YAAYC;IACpC;IAEA,IAAI,OAAOD,eAAe,YAAYA,eAAe,MAAM;QACzD,OAAOE,eAAeF,YAAYC;IACpC;IAEA,IAAI,OAAOD,eAAe,YAAY;QACpC,OAAOG,CAAAA;YACL,MAAMC,SAASJ,WAAWG;YAC1B,OAAOD,eAAeE,QAAQH;QAChC;IACF;IAEA,OAAO;QAAEI,UAAUJ;IAAY;AACjC;AAEA,MAAMC,iBAAiB,CAACE,QAA+BH;IACrD,IAAI,OAAOG,WAAW,UAAU;QAC9B,OAAO;YAAEC,UAAUD,SAASH;QAAY;IAC1C;QAE+BG;IAA/B,OAAO;QAAE,GAAGA,MAAM;QAAEC,UAAU,AAACD,CAAAA,CAAAA,mBAAAA,OAAOC,QAAQ,cAAfD,8BAAAA,mBAAmB,CAAA,IAAKH;IAAY;AACrE"}
@@ -1,8 +1,4 @@
1
- /**
2
- * AutoSizes contains many options from historic implementation.
3
- * Now options 'always'/'height-always'/'width-always' are obsolete.
4
- * This function maps them to true/'height'/'width'
5
- */ "use strict";
1
+ "use strict";
6
2
  Object.defineProperty(exports, "__esModule", {
7
3
  value: true
8
4
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["normalizeAutoSize.ts"],"sourcesContent":["import type { NormalizedAutoSize, PositioningOptions } from '../types';\n\n/**\n * AutoSizes contains many options from historic implementation.\n * Now options 'always'/'height-always'/'width-always' are obsolete.\n * This function maps them to true/'height'/'width'\n */\nexport const normalizeAutoSize = (autoSize?: PositioningOptions['autoSize']): NormalizedAutoSize | false => {\n switch (autoSize) {\n case 'always':\n case true:\n return {\n applyMaxWidth: true,\n applyMaxHeight: true,\n };\n\n case 'width-always':\n case 'width':\n return {\n applyMaxWidth: true,\n applyMaxHeight: false,\n };\n\n case 'height-always':\n case 'height':\n return {\n applyMaxWidth: false,\n applyMaxHeight: true,\n };\n\n default:\n return false;\n }\n};\n"],"names":["normalizeAutoSize","autoSize","applyMaxWidth","applyMaxHeight"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA;;;;CAIC;;;;+BACYA;;;eAAAA;;;AAAN,MAAMA,oBAAoB,CAACC;IAChC,OAAQA;QACN,KAAK;QACL,KAAK;YACH,OAAO;gBACLC,eAAe;gBACfC,gBAAgB;YAClB;QAEF,KAAK;QACL,KAAK;YACH,OAAO;gBACLD,eAAe;gBACfC,gBAAgB;YAClB;QAEF,KAAK;QACL,KAAK;YACH,OAAO;gBACLD,eAAe;gBACfC,gBAAgB;YAClB;QAEF;YACE,OAAO;IACX;AACF"}
1
+ {"version":3,"sources":["../src/utils/normalizeAutoSize.ts"],"sourcesContent":["import type { NormalizedAutoSize, PositioningOptions } from '../types';\n\n/**\n * AutoSizes contains many options from historic implementation.\n * Now options 'always'/'height-always'/'width-always' are obsolete.\n * This function maps them to true/'height'/'width'\n */\nexport const normalizeAutoSize = (autoSize?: PositioningOptions['autoSize']): NormalizedAutoSize | false => {\n switch (autoSize) {\n case 'always':\n case true:\n return {\n applyMaxWidth: true,\n applyMaxHeight: true,\n };\n\n case 'width-always':\n case 'width':\n return {\n applyMaxWidth: true,\n applyMaxHeight: false,\n };\n\n case 'height-always':\n case 'height':\n return {\n applyMaxWidth: false,\n applyMaxHeight: true,\n };\n\n default:\n return false;\n }\n};\n"],"names":["normalizeAutoSize","autoSize","applyMaxWidth","applyMaxHeight"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;AAAN,MAAMA,oBAAoB,CAACC;IAChC,OAAQA;QACN,KAAK;QACL,KAAK;YACH,OAAO;gBACLC,eAAe;gBACfC,gBAAgB;YAClB;QAEF,KAAK;QACL,KAAK;YACH,OAAO;gBACLD,eAAe;gBACfC,gBAAgB;YAClB;QAEF,KAAK;QACL,KAAK;YACH,OAAO;gBACLD,eAAe;gBACfC,gBAAgB;YAClB;QAEF;YACE,OAAO;IACX;AACF"}
@@ -1,9 +1,4 @@
1
- /**
2
- * Parses Floating UI placement and returns the different components
3
- * @param placement - the floating ui placement (i.e. bottom-start)
4
- *
5
- * @returns side and alignment components of the placement
6
- */ "use strict";
1
+ "use strict";
7
2
  Object.defineProperty(exports, "__esModule", {
8
3
  value: true
9
4
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["parseFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Placement, Alignment } from '@floating-ui/dom';\n\n/**\n * Parses Floating UI placement and returns the different components\n * @param placement - the floating ui placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parseFloatingUIPlacement(placement: Placement): { side: Side; alignment: Alignment } {\n const tokens = placement.split('-');\n return {\n side: tokens[0] as Side,\n alignment: tokens[1] as Alignment,\n };\n}\n"],"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA;;;;;CAKC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,yBAAyBC,SAAoB;IAC3D,MAAMC,SAASD,UAAUE,KAAK,CAAC;IAC/B,OAAO;QACLC,MAAMF,MAAM,CAAC,EAAE;QACfG,WAAWH,MAAM,CAAC,EAAE;IACtB;AACF"}
1
+ {"version":3,"sources":["../src/utils/parseFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Placement, Alignment } from '@floating-ui/dom';\n\n/**\n * Parses Floating UI placement and returns the different components\n * @param placement - the floating ui placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parseFloatingUIPlacement(placement: Placement): { side: Side; alignment: Alignment } {\n const tokens = placement.split('-');\n return {\n side: tokens[0] as Side,\n alignment: tokens[1] as Alignment,\n };\n}\n"],"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":";;;;+BAQgBA;;;eAAAA;;;AAAT,SAASA,yBAAyBC,SAAoB;IAC3D,MAAMC,SAASD,UAAUE,KAAK,CAAC;IAC/B,OAAO;QACLC,MAAMF,MAAM,CAAC,EAAE;QACfG,WAAWH,MAAM,CAAC,EAAE;IACtB;AACF"}
@@ -1,4 +1,3 @@
1
- // Look up table for shorthand to avoid parsing strings
2
1
  "use strict";
3
2
  Object.defineProperty(exports, "__esModule", {
4
3
  value: true
@@ -9,6 +8,7 @@ Object.defineProperty(exports, "resolvePositioningShorthand", {
9
8
  return resolvePositioningShorthand;
10
9
  }
11
10
  });
11
+ // Look up table for shorthand to avoid parsing strings
12
12
  const shorthandLookup = {
13
13
  above: {
14
14
  position: 'above',
@@ -1 +1 @@
1
- {"version":3,"sources":["resolvePositioningShorthand.ts"],"sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"],"names":["resolvePositioningShorthand","shorthandLookup","above","position","align","below","before","after","shorthand","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,uDAAuD;;;;;+BAgBvCA;;;eAAAA;;;AAfhB,MAAMC,kBAAmG;IACvGC,OAAO;QAAEC,UAAU;QAASC,OAAO;IAAS;IAC5C,eAAe;QAAED,UAAU;QAASC,OAAO;IAAQ;IACnD,aAAa;QAAED,UAAU;QAASC,OAAO;IAAM;IAC/CC,OAAO;QAAEF,UAAU;QAASC,OAAO;IAAS;IAC5C,eAAe;QAAED,UAAU;QAASC,OAAO;IAAQ;IACnD,aAAa;QAAED,UAAU;QAASC,OAAO;IAAM;IAC/CE,QAAQ;QAAEH,UAAU;QAAUC,OAAO;IAAS;IAC9C,cAAc;QAAED,UAAU;QAAUC,OAAO;IAAM;IACjD,iBAAiB;QAAED,UAAU;QAAUC,OAAO;IAAS;IACvDG,OAAO;QAAEJ,UAAU;QAASC,OAAO;IAAS;IAC5C,aAAa;QAAED,UAAU;QAASC,OAAO;IAAM;IAC/C,gBAAgB;QAAED,UAAU;QAASC,OAAO;IAAS;AACvD;AAEO,SAASJ,4BACdQ,SAAkD;IAElD,IAAIA,cAAcC,aAAaD,cAAc,MAAM;QACjD,OAAO,CAAC;IACV;IAEA,IAAI,OAAOA,cAAc,UAAU;QACjC,OAAOP,eAAe,CAACO,UAAU;IACnC;IAEA,OAAOA;AACT"}
1
+ {"version":3,"sources":["../src/utils/resolvePositioningShorthand.ts"],"sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"],"names":["resolvePositioningShorthand","shorthandLookup","above","position","align","below","before","after","shorthand","undefined"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkBgBA;;;eAAAA;;;AAhBhB,uDAAuD;AACvD,MAAMC,kBAAmG;IACvGC,OAAO;QAAEC,UAAU;QAASC,OAAO;IAAS;IAC5C,eAAe;QAAED,UAAU;QAASC,OAAO;IAAQ;IACnD,aAAa;QAAED,UAAU;QAASC,OAAO;IAAM;IAC/CC,OAAO;QAAEF,UAAU;QAASC,OAAO;IAAS;IAC5C,eAAe;QAAED,UAAU;QAASC,OAAO;IAAQ;IACnD,aAAa;QAAED,UAAU;QAASC,OAAO;IAAM;IAC/CE,QAAQ;QAAEH,UAAU;QAAUC,OAAO;IAAS;IAC9C,cAAc;QAAED,UAAU;QAAUC,OAAO;IAAM;IACjD,iBAAiB;QAAED,UAAU;QAAUC,OAAO;IAAS;IACvDG,OAAO;QAAEJ,UAAU;QAASC,OAAO;IAAS;IAC5C,aAAa;QAAED,UAAU;QAASC,OAAO;IAAM;IAC/C,gBAAgB;QAAED,UAAU;QAASC,OAAO;IAAS;AACvD;AAEO,SAASJ,4BACdQ,SAAkD;IAElD,IAAIA,cAAcC,aAAaD,cAAc,MAAM;QACjD,OAAO,CAAC;IACV;IAEA,IAAI,OAAOA,cAAc,UAAU;QACjC,OAAOP,eAAe,CAACO,UAAU;IACnC;IAEA,OAAOA;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["toFloatingUIPadding.ts"],"sourcesContent":["import type { SideObject } from '@floating-ui/dom';\nimport { PositioningOptions } from '../types';\n\nexport function toFloatingUIPadding(\n padding: NonNullable<PositioningOptions['overflowBoundaryPadding']>,\n isRtl: boolean,\n): number | Partial<SideObject> {\n if (typeof padding === 'number') {\n return padding;\n }\n\n const { start, end, ...verticalPadding } = padding;\n\n const paddingObject: Partial<SideObject> = verticalPadding;\n\n const left = isRtl ? 'end' : 'start';\n const right = isRtl ? 'start' : 'end';\n\n // assign properties explicitly since undefined values are actually handled by floating UI\n // TODO create floating UI issue\n if (padding[left]) {\n paddingObject.left = padding[left];\n }\n\n if (padding[right]) {\n paddingObject.right = padding[right];\n }\n\n return paddingObject;\n}\n"],"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGgBA;;;eAAAA;;;AAAT,SAASA,oBACdC,OAAmE,EACnEC,KAAc;IAEd,IAAI,OAAOD,YAAY,UAAU;QAC/B,OAAOA;IACT;IAEA,MAAM,EAAEE,KAAK,EAAEC,GAAG,EAAE,GAAGC,iBAAiB,GAAGJ;IAE3C,MAAMK,gBAAqCD;IAE3C,MAAME,OAAOL,QAAQ,QAAQ;IAC7B,MAAMM,QAAQN,QAAQ,UAAU;IAEhC,0FAA0F;IAC1F,gCAAgC;IAChC,IAAID,OAAO,CAACM,KAAK,EAAE;QACjBD,cAAcC,IAAI,GAAGN,OAAO,CAACM,KAAK;IACpC;IAEA,IAAIN,OAAO,CAACO,MAAM,EAAE;QAClBF,cAAcE,KAAK,GAAGP,OAAO,CAACO,MAAM;IACtC;IAEA,OAAOF;AACT"}
1
+ {"version":3,"sources":["../src/utils/toFloatingUIPadding.ts"],"sourcesContent":["import type { SideObject } from '@floating-ui/dom';\nimport { PositioningOptions } from '../types';\n\nexport function toFloatingUIPadding(\n padding: NonNullable<PositioningOptions['overflowBoundaryPadding']>,\n isRtl: boolean,\n): number | Partial<SideObject> {\n if (typeof padding === 'number') {\n return padding;\n }\n\n const { start, end, ...verticalPadding } = padding;\n\n const paddingObject: Partial<SideObject> = verticalPadding;\n\n const left = isRtl ? 'end' : 'start';\n const right = isRtl ? 'start' : 'end';\n\n // assign properties explicitly since undefined values are actually handled by floating UI\n // TODO create floating UI issue\n if (padding[left]) {\n paddingObject.left = padding[left];\n }\n\n if (padding[right]) {\n paddingObject.right = padding[right];\n }\n\n return paddingObject;\n}\n"],"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAGgBA;;;eAAAA;;;AAAT,SAASA,oBACdC,OAAmE,EACnEC,KAAc;IAEd,IAAI,OAAOD,YAAY,UAAU;QAC/B,OAAOA;IACT;IAEA,MAAM,EAAEE,KAAK,EAAEC,GAAG,EAAE,GAAGC,iBAAiB,GAAGJ;IAE3C,MAAMK,gBAAqCD;IAE3C,MAAME,OAAOL,QAAQ,QAAQ;IAC7B,MAAMM,QAAQN,QAAQ,UAAU;IAEhC,0FAA0F;IAC1F,gCAAgC;IAChC,IAAID,OAAO,CAACM,KAAK,EAAE;QACjBD,cAAcC,IAAI,GAAGN,OAAO,CAACM,KAAK;IACpC;IAEA,IAAIN,OAAO,CAACO,MAAM,EAAE;QAClBF,cAAcE,KAAK,GAAGP,OAAO,CAACO,MAAM;IACtC;IAEA,OAAOF;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side, Alignment as FloatingUIAlignment } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\n\ntype PlacementPosition = Side;\ntype PlacementAlign = FloatingUIAlignment;\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (): Record<Alignment, PlacementAlign | undefined> => ({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined,\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const toFloatingUIPlacement = (align?: Alignment, position?: Position, rtl?: boolean): Placement | undefined => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}` as Placement;\n }\n\n return computedPosition;\n};\n"],"names":["toFloatingUIPlacement","getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","align","position","alignment","computedPosition","computedAlignment"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkCaA;;;eAAAA;;;AA5Bb,MAAMC,iBAAiB,CAACC,MAAwD,CAAA;QAC9EC,OAAO;QACPC,OAAO;QACPC,QAAQH,MAAM,UAAU;QACxBI,OAAOJ,MAAM,SAAS;IACxB,CAAA;AAEA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMK,kBAAkB,IAAsD,CAAA;QAC5EC,OAAO;QACPC,KAAK;QACLC,KAAK;QACLC,QAAQ;QACRC,QAAQC;IACV,CAAA;AAEA,MAAMC,sBAAsB,CAACC,GAAcC;IACzC,MAAMC,uBAAuBF,MAAM,WAAWA,MAAM;IACpD,MAAMG,oBAAoBF,MAAM,SAASA,MAAM;IAE/C,OAAOC,wBAAyBC,qBAAuB,CAACD,wBAAwB,CAACC;AACnF;AAMO,MAAMlB,wBAAwB,CAACmB,OAAmBC,UAAqBlB;IAC5E,MAAMmB,YAAYP,oBAAoBM,UAAUD,SAAS,WAAWA;IAEpE,MAAMG,mBAAmBF,YAAYnB,eAAeC,IAAI,CAACkB,SAAS;IAClE,MAAMG,oBAAoBF,aAAad,iBAAiB,CAACc,UAAU;IAEnE,IAAIC,oBAAoBC,mBAAmB;QACzC,OAAO,CAAC,EAAED,iBAAiB,CAAC,EAAEC,kBAAkB,CAAC;IACnD;IAEA,OAAOD;AACT"}
1
+ {"version":3,"sources":["../src/utils/toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side, Alignment as FloatingUIAlignment } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\n\ntype PlacementPosition = Side;\ntype PlacementAlign = FloatingUIAlignment;\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (): Record<Alignment, PlacementAlign | undefined> => ({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined,\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const toFloatingUIPlacement = (align?: Alignment, position?: Position, rtl?: boolean): Placement | undefined => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}` as Placement;\n }\n\n return computedPosition;\n};\n"],"names":["toFloatingUIPlacement","getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","align","position","alignment","computedPosition","computedAlignment"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAkCaA;;;eAAAA;;;AA5Bb,MAAMC,iBAAiB,CAACC,MAAwD,CAAA;QAC9EC,OAAO;QACPC,OAAO;QACPC,QAAQH,MAAM,UAAU;QACxBI,OAAOJ,MAAM,SAAS;IACxB,CAAA;AAEA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMK,kBAAkB,IAAsD,CAAA;QAC5EC,OAAO;QACPC,KAAK;QACLC,KAAK;QACLC,QAAQ;QACRC,QAAQC;IACV,CAAA;AAEA,MAAMC,sBAAsB,CAACC,GAAcC;IACzC,MAAMC,uBAAuBF,MAAM,WAAWA,MAAM;IACpD,MAAMG,oBAAoBF,MAAM,SAASA,MAAM;IAE/C,OAAO,AAACC,wBAAwBC,qBAAuB,CAACD,wBAAwB,CAACC;AACnF;AAMO,MAAMlB,wBAAwB,CAACmB,OAAmBC,UAAqBlB;IAC5E,MAAMmB,YAAYP,oBAAoBM,UAAUD,SAAS,WAAWA;IAEpE,MAAMG,mBAAmBF,YAAYnB,eAAeC,IAAI,CAACkB,SAAS;IAClE,MAAMG,oBAAoBF,aAAad,iBAAiB,CAACc,UAAU;IAEnE,IAAIC,oBAAoBC,mBAAmB;QACzC,OAAO,CAAC,EAAED,iBAAiB,CAAC,EAAEC,kBAAkB,CAAC;IACnD;IAEA,OAAOD;AACT"}
@@ -1 +1 @@
1
- {"version":3,"sources":["toggleScrollListener.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PositioningVirtualElement } from '../types';\nimport { getScrollParent } from './getScrollParent';\n\n/**\n * Toggles event listeners for scroll parent.\n * Cleans up the event listeners for the previous element and adds them for the new scroll parent.\n * @param next Next element\n * @param prev Previous element\n */\nexport function toggleScrollListener(\n next: HTMLElement | PositioningVirtualElement | null,\n prev: HTMLElement | PositioningVirtualElement | null,\n handler: EventListener,\n) {\n if (next === prev) {\n return;\n }\n\n if (isHTMLElement(prev)) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (isHTMLElement(next)) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"],"names":["toggleScrollListener","next","prev","handler","isHTMLElement","prevScrollParent","getScrollParent","removeEventListener","scrollParent","addEventListener"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUgBA;;;eAAAA;;;gCAVc;iCAEE;AAQzB,SAASA,qBACdC,IAAoD,EACpDC,IAAoD,EACpDC,OAAsB;IAEtB,IAAIF,SAASC,MAAM;QACjB;IACF;IAEA,IAAIE,IAAAA,6BAAAA,EAAcF,OAAO;QACvB,MAAMG,mBAAmBC,IAAAA,gCAAAA,EAAgBJ;QACzCG,iBAAiBE,mBAAmB,CAAC,UAAUJ;IACjD;IACA,IAAIC,IAAAA,6BAAAA,EAAcH,OAAO;QACvB,MAAMO,eAAeF,IAAAA,gCAAAA,EAAgBL;QACrCO,aAAaC,gBAAgB,CAAC,UAAUN;IAC1C;AACF"}
1
+ {"version":3,"sources":["../src/utils/toggleScrollListener.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PositioningVirtualElement } from '../types';\nimport { getScrollParent } from './getScrollParent';\n\n/**\n * Toggles event listeners for scroll parent.\n * Cleans up the event listeners for the previous element and adds them for the new scroll parent.\n * @param next Next element\n * @param prev Previous element\n */\nexport function toggleScrollListener(\n next: HTMLElement | PositioningVirtualElement | null,\n prev: HTMLElement | PositioningVirtualElement | null,\n handler: EventListener,\n) {\n if (next === prev) {\n return;\n }\n\n if (isHTMLElement(prev)) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (isHTMLElement(next)) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"],"names":["toggleScrollListener","next","prev","handler","isHTMLElement","prevScrollParent","getScrollParent","removeEventListener","scrollParent","addEventListener"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUgBA;;;eAAAA;;;gCAVc;iCAEE;AAQzB,SAASA,qBACdC,IAAoD,EACpDC,IAAoD,EACpDC,OAAsB;IAEtB,IAAIF,SAASC,MAAM;QACjB;IACF;IAEA,IAAIE,IAAAA,6BAAa,EAACF,OAAO;QACvB,MAAMG,mBAAmBC,IAAAA,gCAAe,EAACJ;QACzCG,iBAAiBE,mBAAmB,CAAC,UAAUJ;IACjD;IACA,IAAIC,IAAAA,6BAAa,EAACH,OAAO;QACvB,MAAMO,eAAeF,IAAAA,gCAAe,EAACL;QACrCO,aAAaC,gBAAgB,CAAC,UAAUN;IAC1C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["useCallbackRef.ts"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n/**\n * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content\n * changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via\n * React.useState(), but it will cause re-renders always.\n *\n * https://reactjs.org/docs/hooks-reference.html#useref\n * https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n *\n * @param initialValue - initial ref value\n * @param callback - a callback to run when value changes\n * @param skipInitialResolve - a flag to skip an initial ref report\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n */\nexport function useCallbackRef<T>(\n initialValue: T | null,\n callback: (newValue: T | null, lastValue: T | null) => void,\n skipInitialResolve?: boolean,\n): React.MutableRefObject<T | null> {\n const isFirst = React.useRef(true);\n const [ref] = React.useState(() => ({\n // value\n value: initialValue,\n // last callback\n callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n const last = ref.value;\n\n if (last !== value) {\n ref.value = value;\n\n if (skipInitialResolve && isFirst.current) {\n return;\n }\n\n ref.callback(value, last);\n }\n },\n },\n }));\n\n useIsomorphicLayoutEffect(() => {\n isFirst.current = false;\n }, []);\n\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n"],"names":["useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","React","useRef","ref","useState","value","facade","current","last","useIsomorphicLayoutEffect"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBgBA;;;eAAAA;;;;iEApBO;gCACmB;AAmBnC,SAASA,eACdC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B;IAE5B,MAAMC,UAAUC,OAAMC,MAAM,CAAC;IAC7B,MAAM,CAACC,IAAI,GAAGF,OAAMG,QAAQ,CAAC,IAAO,CAAA;YAClC,QAAQ;YACRC,OAAOR;YACP,gBAAgB;YAChBC;YACA,8BAA8B;YAC9BQ,QAAQ;gBACN,IAAIC,WAAU;oBACZ,OAAOJ,IAAIE,KAAK;gBAClB;gBACA,IAAIE,SAAQF,MAAO;oBACjB,MAAMG,OAAOL,IAAIE,KAAK;oBAEtB,IAAIG,SAASH,OAAO;wBAClBF,IAAIE,KAAK,GAAGA;wBAEZ,IAAIN,sBAAsBC,QAAQO,OAAO,EAAE;4BACzC;wBACF;wBAEAJ,IAAIL,QAAQ,CAACO,OAAOG;oBACtB;gBACF;YACF;QACF,CAAA;IAEAC,IAAAA,yCAAAA,EAA0B;QACxBT,QAAQO,OAAO,GAAG;IACpB,GAAG,EAAE;IAEL,kBAAkB;IAClBJ,IAAIL,QAAQ,GAAGA;IAEf,OAAOK,IAAIG,MAAM;AACnB"}
1
+ {"version":3,"sources":["../src/utils/useCallbackRef.ts"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n/**\n * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content\n * changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via\n * React.useState(), but it will cause re-renders always.\n *\n * https://reactjs.org/docs/hooks-reference.html#useref\n * https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n *\n * @param initialValue - initial ref value\n * @param callback - a callback to run when value changes\n * @param skipInitialResolve - a flag to skip an initial ref report\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n */\nexport function useCallbackRef<T>(\n initialValue: T | null,\n callback: (newValue: T | null, lastValue: T | null) => void,\n skipInitialResolve?: boolean,\n): React.MutableRefObject<T | null> {\n const isFirst = React.useRef(true);\n const [ref] = React.useState(() => ({\n // value\n value: initialValue,\n // last callback\n callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n const last = ref.value;\n\n if (last !== value) {\n ref.value = value;\n\n if (skipInitialResolve && isFirst.current) {\n return;\n }\n\n ref.callback(value, last);\n }\n },\n },\n }));\n\n useIsomorphicLayoutEffect(() => {\n isFirst.current = false;\n }, []);\n\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n"],"names":["useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","React","useRef","ref","useState","value","facade","current","last","useIsomorphicLayoutEffect"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAoBgBA;;;eAAAA;;;;iEApBO;gCACmB;AAmBnC,SAASA,eACdC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B;IAE5B,MAAMC,UAAUC,OAAMC,MAAM,CAAC;IAC7B,MAAM,CAACC,IAAI,GAAGF,OAAMG,QAAQ,CAAC,IAAO,CAAA;YAClC,QAAQ;YACRC,OAAOR;YACP,gBAAgB;YAChBC;YACA,8BAA8B;YAC9BQ,QAAQ;gBACN,IAAIC,WAAU;oBACZ,OAAOJ,IAAIE,KAAK;gBAClB;gBACA,IAAIE,SAAQF,MAAO;oBACjB,MAAMG,OAAOL,IAAIE,KAAK;oBAEtB,IAAIG,SAASH,OAAO;wBAClBF,IAAIE,KAAK,GAAGA;wBAEZ,IAAIN,sBAAsBC,QAAQO,OAAO,EAAE;4BACzC;wBACF;wBAEAJ,IAAIL,QAAQ,CAACO,OAAOG;oBACtB;gBACF;YACF;QACF,CAAA;IAEAC,IAAAA,yCAAyB,EAAC;QACxBT,QAAQO,OAAO,GAAG;IACpB,GAAG,EAAE;IAEL,kBAAkB;IAClBJ,IAAIL,QAAQ,GAAGA;IAEf,OAAOK,IAAIG,MAAM;AACnB"}
@@ -1,6 +1,4 @@
1
- /**
2
- * Writes all DOM element updates after position is computed
3
- */ "use strict";
1
+ "use strict";
4
2
  Object.defineProperty(exports, "__esModule", {
5
3
  value: true
6
4
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["writeArrowUpdates.ts"],"sourcesContent":["import { MiddlewareData } from '@floating-ui/dom';\n\n/**\n * Writes all DOM element updates after position is computed\n */\nexport function writeArrowUpdates(options: { arrow: HTMLElement | null; middlewareData: MiddlewareData }) {\n const { arrow, middlewareData } = options;\n if (!middlewareData.arrow || !arrow) {\n return;\n }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(arrow.style, {\n left: `${arrowX}px`,\n top: `${arrowY}px`,\n });\n}\n"],"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","top"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA;;CAEC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,OAAsE;IACtG,MAAM,EAAEC,KAAK,EAAEC,cAAc,EAAE,GAAGF;IAClC,IAAI,CAACE,eAAeD,KAAK,IAAI,CAACA,OAAO;QACnC;IACF;IAEA,MAAM,EAAEE,GAAGC,MAAM,EAAEC,GAAGC,MAAM,EAAE,GAAGJ,eAAeD,KAAK;IAErDM,OAAOC,MAAM,CAACP,MAAMQ,KAAK,EAAE;QACzBC,MAAM,CAAC,EAAEN,OAAO,EAAE,CAAC;QACnBO,KAAK,CAAC,EAAEL,OAAO,EAAE,CAAC;IACpB;AACF"}
1
+ {"version":3,"sources":["../src/utils/writeArrowUpdates.ts"],"sourcesContent":["import { MiddlewareData } from '@floating-ui/dom';\n\n/**\n * Writes all DOM element updates after position is computed\n */\nexport function writeArrowUpdates(options: { arrow: HTMLElement | null; middlewareData: MiddlewareData }) {\n const { arrow, middlewareData } = options;\n if (!middlewareData.arrow || !arrow) {\n return;\n }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(arrow.style, {\n left: `${arrowX}px`,\n top: `${arrowY}px`,\n });\n}\n"],"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","top"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAKgBA;;;eAAAA;;;AAAT,SAASA,kBAAkBC,OAAsE;IACtG,MAAM,EAAEC,KAAK,EAAEC,cAAc,EAAE,GAAGF;IAClC,IAAI,CAACE,eAAeD,KAAK,IAAI,CAACA,OAAO;QACnC;IACF;IAEA,MAAM,EAAEE,GAAGC,MAAM,EAAEC,GAAGC,MAAM,EAAE,GAAGJ,eAAeD,KAAK;IAErDM,OAAOC,MAAM,CAACP,MAAMQ,KAAK,EAAE;QACzBC,MAAM,CAAC,EAAEN,OAAO,EAAE,CAAC;QACnBO,KAAK,CAAC,EAAEL,OAAO,EAAE,CAAC;IACpB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["writeContainerupdates.ts"],"sourcesContent":["import type { Placement, MiddlewareData, Strategy, Coords } from '@floating-ui/dom';\nimport {\n DATA_POSITIONING_ESCAPED,\n DATA_POSITIONING_HIDDEN,\n DATA_POSITIONING_INTERSECTING,\n DATA_POSITIONING_PLACEMENT,\n} from '../constants';\n\n/**\n * Writes all container element position updates after the position is computed\n */\nexport function writeContainerUpdates(options: {\n container: HTMLElement | null;\n placement: Placement;\n middlewareData: MiddlewareData;\n /**\n * Layer acceleration can disable subpixel rendering which causes slightly\n * blurry text on low PPI displays, so we want to use 2D transforms\n * instead\n */\n lowPPI: boolean;\n strategy: Strategy;\n coordinates: Coords;\n useTransform?: boolean;\n}) {\n const { container, placement, middlewareData, strategy, lowPPI, coordinates, useTransform = true } = options;\n if (!container) {\n return;\n }\n container.setAttribute(DATA_POSITIONING_PLACEMENT, placement);\n container.removeAttribute(DATA_POSITIONING_INTERSECTING);\n if (middlewareData.intersectionObserver.intersecting) {\n container.setAttribute(DATA_POSITIONING_INTERSECTING, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_ESCAPED);\n if (middlewareData.hide?.escaped) {\n container.setAttribute(DATA_POSITIONING_ESCAPED, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_HIDDEN);\n if (middlewareData.hide?.referenceHidden) {\n container.setAttribute(DATA_POSITIONING_HIDDEN, '');\n }\n\n // Round so that the coordinates land on device pixels.\n // This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like\n // `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.\n // See https://github.com/microsoft/fluentui/issues/26764 for more info.\n const devicePixelRatio = container.ownerDocument.defaultView?.devicePixelRatio || 1;\n const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;\n const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;\n\n Object.assign(container.style, {\n position: strategy,\n });\n\n if (useTransform) {\n Object.assign(container.style, {\n transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`,\n });\n return;\n }\n\n Object.assign(container.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n}\n"],"names":["writeContainerUpdates","options","middlewareData","container","placement","strategy","lowPPI","coordinates","useTransform","setAttribute","DATA_POSITIONING_PLACEMENT","removeAttribute","DATA_POSITIONING_INTERSECTING","intersectionObserver","intersecting","DATA_POSITIONING_ESCAPED","hide","escaped","DATA_POSITIONING_HIDDEN","referenceHidden","devicePixelRatio","ownerDocument","defaultView","x","Math","round","y","Object","assign","style","position","transform","left","top"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWgBA;;;eAAAA;;;2BALT;AAKA,SAASA,sBAAsBC,OAarC;QAYKC,sBAKAA,uBAQqBC;IAxBzB,MAAM,EAAEA,SAAS,EAAEC,SAAS,EAAEF,cAAc,EAAEG,QAAQ,EAAEC,MAAM,EAAEC,WAAW,EAAEC,eAAe,IAAI,EAAE,GAAGP;IACrG,IAAI,CAACE,WAAW;QACd;IACF;IACAA,UAAUM,YAAY,CAACC,qCAAAA,EAA4BN;IACnDD,UAAUQ,eAAe,CAACC,wCAAAA;IAC1B,IAAIV,eAAeW,oBAAoB,CAACC,YAAY,EAAE;QACpDX,UAAUM,YAAY,CAACG,wCAAAA,EAA+B;IACxD;IAEAT,UAAUQ,eAAe,CAACI,mCAAAA;IAC1B,IAAA,AAAIb,CAAAA,uBAAAA,eAAec,IAAI,AAAJA,MAAI,QAAnBd,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAqBe,OAAO,EAAE;QAChCd,UAAUM,YAAY,CAACM,mCAAAA,EAA0B;IACnD;IAEAZ,UAAUQ,eAAe,CAACO,kCAAAA;IAC1B,IAAA,AAAIhB,CAAAA,wBAAAA,eAAec,IAAI,AAAJA,MAAI,QAAnBd,0BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,sBAAqBiB,eAAe,EAAE;QACxChB,UAAUM,YAAY,CAACS,kCAAAA,EAAyB;IAClD;IAEA,uDAAuD;IACvD,oHAAoH;IACpH,wFAAwF;IACxF,wEAAwE;IACxE,MAAME,mBAAmBjB,CAAAA,CAAAA,uCAAAA,UAAUkB,aAAa,CAACC,WAAW,AAAXA,MAAW,QAAnCnB,yCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qCAAqCiB,gBAAgB,AAAhBA,KAAoB;IAClF,MAAMG,IAAIC,KAAKC,KAAK,CAAClB,YAAYgB,CAAC,GAAGH,oBAAoBA;IACzD,MAAMM,IAAIF,KAAKC,KAAK,CAAClB,YAAYmB,CAAC,GAAGN,oBAAoBA;IAEzDO,OAAOC,MAAM,CAACzB,UAAU0B,KAAK,EAAE;QAC7BC,UAAUzB;IACZ;IAEA,IAAIG,cAAc;QAChBmB,OAAOC,MAAM,CAACzB,UAAU0B,KAAK,EAAE;YAC7BE,WAAWzB,SAAS,CAAC,UAAU,EAAEiB,EAAE,IAAI,EAAEG,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAEH,EAAE,IAAI,EAAEG,EAAE,MAAM,CAAC;QACpF;QACA;IACF;IAEAC,OAAOC,MAAM,CAACzB,UAAU0B,KAAK,EAAE;QAC7BG,MAAM,CAAC,EAAET,EAAE,EAAE,CAAC;QACdU,KAAK,CAAC,EAAEP,EAAE,EAAE,CAAC;IACf;AACF"}
1
+ {"version":3,"sources":["../src/utils/writeContainerupdates.ts"],"sourcesContent":["import type { Placement, MiddlewareData, Strategy, Coords } from '@floating-ui/dom';\nimport {\n DATA_POSITIONING_ESCAPED,\n DATA_POSITIONING_HIDDEN,\n DATA_POSITIONING_INTERSECTING,\n DATA_POSITIONING_PLACEMENT,\n} from '../constants';\n\n/**\n * Writes all container element position updates after the position is computed\n */\nexport function writeContainerUpdates(options: {\n container: HTMLElement | null;\n placement: Placement;\n middlewareData: MiddlewareData;\n /**\n * Layer acceleration can disable subpixel rendering which causes slightly\n * blurry text on low PPI displays, so we want to use 2D transforms\n * instead\n */\n lowPPI: boolean;\n strategy: Strategy;\n coordinates: Coords;\n useTransform?: boolean;\n}) {\n const { container, placement, middlewareData, strategy, lowPPI, coordinates, useTransform = true } = options;\n if (!container) {\n return;\n }\n container.setAttribute(DATA_POSITIONING_PLACEMENT, placement);\n container.removeAttribute(DATA_POSITIONING_INTERSECTING);\n if (middlewareData.intersectionObserver.intersecting) {\n container.setAttribute(DATA_POSITIONING_INTERSECTING, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_ESCAPED);\n if (middlewareData.hide?.escaped) {\n container.setAttribute(DATA_POSITIONING_ESCAPED, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_HIDDEN);\n if (middlewareData.hide?.referenceHidden) {\n container.setAttribute(DATA_POSITIONING_HIDDEN, '');\n }\n\n // Round so that the coordinates land on device pixels.\n // This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like\n // `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.\n // See https://github.com/microsoft/fluentui/issues/26764 for more info.\n const devicePixelRatio = container.ownerDocument.defaultView?.devicePixelRatio || 1;\n const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;\n const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;\n\n Object.assign(container.style, {\n position: strategy,\n });\n\n if (useTransform) {\n Object.assign(container.style, {\n transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`,\n });\n return;\n }\n\n Object.assign(container.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n}\n"],"names":["writeContainerUpdates","options","middlewareData","container","placement","strategy","lowPPI","coordinates","useTransform","setAttribute","DATA_POSITIONING_PLACEMENT","removeAttribute","DATA_POSITIONING_INTERSECTING","intersectionObserver","intersecting","DATA_POSITIONING_ESCAPED","hide","escaped","DATA_POSITIONING_HIDDEN","referenceHidden","devicePixelRatio","ownerDocument","defaultView","x","Math","round","y","Object","assign","style","position","transform","left","top"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWgBA;;;eAAAA;;;2BALT;AAKA,SAASA,sBAAsBC,OAarC;QAYKC,sBAKAA,uBAQqBC;IAxBzB,MAAM,EAAEA,SAAS,EAAEC,SAAS,EAAEF,cAAc,EAAEG,QAAQ,EAAEC,MAAM,EAAEC,WAAW,EAAEC,eAAe,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E,CAAC;QACdU,KAAK,CAAC,EAAEP,EAAE,EAAE,CAAC;IACf;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-positioning",
3
- "version": "9.15.10",
3
+ "version": "9.15.11",
4
4
  "description": "A react wrapper around Popper.js for Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -11,29 +11,16 @@
11
11
  "url": "https://github.com/microsoft/fluentui"
12
12
  },
13
13
  "license": "MIT",
14
- "scripts": {
15
- "build": "just-scripts build",
16
- "bundle-size": "monosize measure",
17
- "clean": "just-scripts clean",
18
- "code-style": "just-scripts code-style",
19
- "just": "just-scripts",
20
- "lint": "just-scripts lint",
21
- "test": "jest --passWithNoTests",
22
- "type-check": "just-scripts type-check",
23
- "generate-api": "just-scripts generate-api",
24
- "test-ssr": "test-ssr \"./stories/**/*.stories.tsx\""
25
- },
26
14
  "devDependencies": {
27
15
  "@fluentui/eslint-plugin": "*",
28
- "@fluentui/scripts-api-extractor": "*",
29
- "@fluentui/scripts-tasks": "*"
16
+ "@fluentui/scripts-api-extractor": "*"
30
17
  },
31
18
  "dependencies": {
32
19
  "@floating-ui/dom": "^1.2.0",
33
20
  "@floating-ui/devtools": "0.2.1",
34
- "@fluentui/react-shared-contexts": "^9.20.2",
35
- "@fluentui/react-theme": "^9.1.21",
36
- "@fluentui/react-utilities": "^9.18.16",
21
+ "@fluentui/react-shared-contexts": "^9.21.0",
22
+ "@fluentui/react-theme": "^9.1.22",
23
+ "@fluentui/react-utilities": "^9.18.17",
37
24
  "@griffel/react": "^1.5.22",
38
25
  "@swc/helpers": "^0.5.1"
39
26
  },