@fluentui/react-positioning 9.20.0 → 9.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -2
- package/lib/PositioningConfigurationContext.js.map +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createPositionManager.js.map +1 -1
- package/lib/createSlideStyles.js.map +1 -1
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/SafeZoneArea.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/computeOutsideClipPath.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/createSafeZoneAreaStateStore.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/getMouseAnchor.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/getRectCorners.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/pointsToSvgPath.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/types.js.map +1 -1
- package/lib/hooks/useSafeZoneArea/useSafeZoneArea.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/middleware/coverTarget.js.map +1 -1
- package/lib/middleware/flip.js.map +1 -1
- package/lib/middleware/index.js.map +1 -1
- package/lib/middleware/intersecting.js.map +1 -1
- package/lib/middleware/matchTargetSize.js.map +1 -1
- package/lib/middleware/maxSize.js.map +1 -1
- package/lib/middleware/offset.js.map +1 -1
- package/lib/middleware/shift.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/usePositioning.js.map +1 -1
- package/lib/usePositioningMouseTarget.js.map +1 -1
- package/lib/usePositioningOptions.js.map +1 -1
- package/lib/utils/createResizeObserver.js.map +1 -1
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/devtools.js.map +1 -1
- package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getFloatingUIOffset.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +3 -3
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/listScrollParents.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/normalizeAutoSize.js.map +1 -1
- package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/toFloatingUIPadding.js.map +1 -1
- package/lib/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib/utils/toggleScrollListener.js.map +1 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib/utils/writeArrowUpdates.js.map +1 -1
- package/lib/utils/writeContainerupdates.js.map +1 -1
- package/lib-commonjs/PositioningConfigurationContext.js.map +1 -1
- package/lib-commonjs/constants.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/createSlideStyles.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/SafeZoneArea.styles.raw.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/computeOutsideClipPath.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/createSafeZoneAreaStateStore.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/getMouseAnchor.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/getRectCorners.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/pointsToSvgPath.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/types.js.map +1 -1
- package/lib-commonjs/hooks/useSafeZoneArea/useSafeZoneArea.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/middleware/coverTarget.js.map +1 -1
- package/lib-commonjs/middleware/flip.js.map +1 -1
- package/lib-commonjs/middleware/index.js.map +1 -1
- package/lib-commonjs/middleware/intersecting.js.map +1 -1
- package/lib-commonjs/middleware/matchTargetSize.js.map +1 -1
- package/lib-commonjs/middleware/maxSize.js.map +1 -1
- package/lib-commonjs/middleware/offset.js.map +1 -1
- package/lib-commonjs/middleware/shift.js.map +1 -1
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePositioning.js.map +1 -1
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
- package/lib-commonjs/usePositioningOptions.js.map +1 -1
- package/lib-commonjs/utils/createResizeObserver.js.map +1 -1
- package/lib-commonjs/utils/debounce.js.map +1 -1
- package/lib-commonjs/utils/devtools.js.map +1 -1
- package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +3 -3
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/listScrollParents.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/normalizeAutoSize.js.map +1 -1
- package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
- package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
- package/package.json +4 -4
@@ -1 +1 @@
|
|
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","
|
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":["React","createVirtualElementFromClick","usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget"],"mappings":";;;;+BAaaE;;;;;;;iEAbU,QAAQ;+CACe,kCAAkC;AAYzE,kCAAkC,CACvCC;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGL,OAAMM,QAAQ,CAAwCH;IAElG,MAAMI,wBAA+CC,CAAAA;QACnD,IAAIA,UAAUC,aAAaD,UAAU,MAAM;YACzCH,kBAAkBI;YAClB;QACF;QAEA,IAAIC;QACJ,IAAI,CAAEF,CAAAA,iBAAiBG,UAAAA,CAAS,EAAI;YAClCD,aAAaF,MAAMI,WAAW;QAChC,OAAO;YACLF,aAAaF;QACf;QAEA,IAAI,CAAEE,CAAAA,sBAAsBC,UAAAA,CAAS,IAAME,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YAChF,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;QAChB;QAEA,MAAMC,oBAAgBjB,4DAAAA,EAA8BS;QACpDL,kBAAkBa;IACpB;IAEA,OAAO;QAACd;QAAgBG;KAAsB;AAChD,EAAE"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/usePositioningOptions.ts"],"sourcesContent":["import { devtools } from '@floating-ui/devtools';\nimport { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport * as React from 'react';\n\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 type { PositioningConfigurationFn, PositioningConfigurationFnOptions, PositioningOptions } from './types';\nimport { toFloatingUIPlacement, hasScrollParent, normalizeAutoSize } from './utils';\nimport { devtoolsCallback } from './utils/devtools';\nimport { usePositioningConfiguration } from './PositioningConfigurationContext';\n\n/**\n * @internal\n *\n * This is redundant and exists only to manage React dependencies properly & avoid leaking individual options to the\n * scope of `usePositioningOptions`.\n */\nfunction usePositioningConfigFn(\n configFn: PositioningConfigurationFn,\n options: PositioningOptions,\n): (container: HTMLElement, arrow: HTMLElement | null) => PositioningConfigurationFnOptions {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableUpdateOnResize,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n shiftToCoverTarget,\n } = options;\n\n return React.useCallback(\n (container: HTMLElement, arrow: HTMLElement | null) => {\n return configFn({\n container,\n arrow,\n options: {\n autoSize,\n disableUpdateOnResize,\n matchTargetSize,\n offset,\n strategy,\n coverTarget,\n flipBoundary,\n overflowBoundary,\n useTransform,\n overflowBoundaryPadding,\n pinned,\n arrowPadding,\n align,\n fallbackPositions,\n shiftToCoverTarget,\n position,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n },\n });\n },\n [\n autoSize,\n disableUpdateOnResize,\n matchTargetSize,\n offset,\n strategy,\n coverTarget,\n flipBoundary,\n overflowBoundary,\n useTransform,\n overflowBoundaryPadding,\n pinned,\n arrowPadding,\n align,\n fallbackPositions,\n shiftToCoverTarget,\n position,\n unstable_disableTether,\n configFn,\n ],\n );\n}\n\n/**\n * @internal\n */\nexport function usePositioningOptions(options: PositioningOptions) {\n const { dir, targetDocument } = useFluent();\n const isRtl = dir === 'rtl';\n\n const configFn = usePositioningConfigFn(usePositioningConfiguration(), options);\n const {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n positionFixed,\n } = options;\n\n return React.useCallback(\n (container: HTMLElement, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const optionsAfterEnhancement = configFn(container, arrow);\n const {\n autoSize,\n disableUpdateOnResize,\n matchTargetSize,\n offset,\n coverTarget,\n flipBoundary,\n overflowBoundary,\n useTransform,\n overflowBoundaryPadding,\n pinned,\n position,\n arrowPadding,\n strategy,\n align,\n fallbackPositions,\n shiftToCoverTarget,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n } = optionsAfterEnhancement;\n const normalizedAutoSize = normalizeAutoSize(autoSize);\n\n const middleware = [\n normalizedAutoSize && resetMaxSizeMiddleware(normalizedAutoSize),\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: unstable_disableTether,\n overflowBoundaryPadding,\n isRtl,\n shiftToCoverTarget,\n }),\n normalizedAutoSize &&\n maxSizeMiddleware(normalizedAutoSize, { 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' &&\n targetDocument &&\n devtools(targetDocument, devtoolsCallback(optionsAfterEnhancement)),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy: strategy ?? positionFixed ? ('fixed' as const) : ('absolute' as const),\n\n disableUpdateOnResize,\n useTransform,\n };\n },\n [configFn, isRtl, targetDocument, positionFixed],\n );\n}\n"],"names":["
|
1
|
+
{"version":3,"sources":["../src/usePositioningOptions.ts"],"sourcesContent":["import { devtools } from '@floating-ui/devtools';\nimport { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport * as React from 'react';\n\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 type { PositioningConfigurationFn, PositioningConfigurationFnOptions, PositioningOptions } from './types';\nimport { toFloatingUIPlacement, hasScrollParent, normalizeAutoSize } from './utils';\nimport { devtoolsCallback } from './utils/devtools';\nimport { usePositioningConfiguration } from './PositioningConfigurationContext';\n\n/**\n * @internal\n *\n * This is redundant and exists only to manage React dependencies properly & avoid leaking individual options to the\n * scope of `usePositioningOptions`.\n */\nfunction usePositioningConfigFn(\n configFn: PositioningConfigurationFn,\n options: PositioningOptions,\n): (container: HTMLElement, arrow: HTMLElement | null) => PositioningConfigurationFnOptions {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableUpdateOnResize,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n useTransform,\n matchTargetSize,\n shiftToCoverTarget,\n } = options;\n\n return React.useCallback(\n (container: HTMLElement, arrow: HTMLElement | null) => {\n return configFn({\n container,\n arrow,\n options: {\n autoSize,\n disableUpdateOnResize,\n matchTargetSize,\n offset,\n strategy,\n coverTarget,\n flipBoundary,\n overflowBoundary,\n useTransform,\n overflowBoundaryPadding,\n pinned,\n arrowPadding,\n align,\n fallbackPositions,\n shiftToCoverTarget,\n position,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n },\n });\n },\n [\n autoSize,\n disableUpdateOnResize,\n matchTargetSize,\n offset,\n strategy,\n coverTarget,\n flipBoundary,\n overflowBoundary,\n useTransform,\n overflowBoundaryPadding,\n pinned,\n arrowPadding,\n align,\n fallbackPositions,\n shiftToCoverTarget,\n position,\n unstable_disableTether,\n configFn,\n ],\n );\n}\n\n/**\n * @internal\n */\nexport function usePositioningOptions(options: PositioningOptions) {\n const { dir, targetDocument } = useFluent();\n const isRtl = dir === 'rtl';\n\n const configFn = usePositioningConfigFn(usePositioningConfiguration(), options);\n const {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n positionFixed,\n } = options;\n\n return React.useCallback(\n (container: HTMLElement, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const optionsAfterEnhancement = configFn(container, arrow);\n const {\n autoSize,\n disableUpdateOnResize,\n matchTargetSize,\n offset,\n coverTarget,\n flipBoundary,\n overflowBoundary,\n useTransform,\n overflowBoundaryPadding,\n pinned,\n position,\n arrowPadding,\n strategy,\n align,\n fallbackPositions,\n shiftToCoverTarget,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n unstable_disableTether,\n } = optionsAfterEnhancement;\n const normalizedAutoSize = normalizeAutoSize(autoSize);\n\n const middleware = [\n normalizedAutoSize && resetMaxSizeMiddleware(normalizedAutoSize),\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: unstable_disableTether,\n overflowBoundaryPadding,\n isRtl,\n shiftToCoverTarget,\n }),\n normalizedAutoSize &&\n maxSizeMiddleware(normalizedAutoSize, { 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' &&\n targetDocument &&\n devtools(targetDocument, devtoolsCallback(optionsAfterEnhancement)),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy: strategy ?? positionFixed ? ('fixed' as const) : ('absolute' as const),\n\n disableUpdateOnResize,\n useTransform,\n };\n },\n [configFn, isRtl, targetDocument, positionFixed],\n );\n}\n"],"names":["devtools","hide","hideMiddleware","arrow","arrowMiddleware","useFluent_unstable","useFluent","React","shift","shiftMiddleware","flip","flipMiddleware","coverTarget","coverTargetMiddleware","maxSize","maxSizeMiddleware","resetMaxSize","resetMaxSizeMiddleware","offset","offsetMiddleware","intersecting","intersectingMiddleware","matchTargetSize","matchTargetSizeMiddleware","toFloatingUIPlacement","hasScrollParent","normalizeAutoSize","devtoolsCallback","usePositioningConfiguration","usePositioningConfigFn","configFn","options","align","arrowPadding","autoSize","disableUpdateOnResize","flipBoundary","overflowBoundary","pinned","position","unstable_disableTether","strategy","overflowBoundaryPadding","fallbackPositions","useTransform","shiftToCoverTarget","useCallback","container","usePositioningOptions","dir","targetDocument","isRtl","positionFixed","hasScrollableElement","optionsAfterEnhancement","normalizedAutoSize","middleware","disableTether","element","padding","process","env","NODE_ENV","filter","Boolean","placement"],"mappings":";;;;+BAyGgBgD;;;;;;;0BAzGS,wBAAwB;qBACgB,mBAAmB;qCAEpC,kCAAkC;iEAC3D,QAAQ;4BAWxB,eAAe;uBAEoD,UAAU;2BACnD,mBAAmB;iDACR,oCAAoC;AAEhF;;;;;CAKC,GACD,SAASnB,uBACPC,QAAoC,EACpCC,OAA2B;IAE3B,MAAM,EACJC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRtB,WAAW,EACXuB,qBAAqB,EACrBC,YAAY,EACZlB,MAAM,EACNmB,gBAAgB,EAChBC,MAAM,EACNC,QAAQ,EACR,AACAC,sBAAsB,EACtBC,QAAQ,EACRC,uBAAuB,EACvBC,KAJgE,YAI/C,EACjBC,YAAY,EACZtB,eAAe,EACfuB,kBAAkB,EACnB,GAAGd;IAEJ,OAAOxB,OAAMuC,WAAW,CACtB,CAACC,WAAwB5C;QACvB,OAAO2B,SAAS;YACdiB;YACA5C;YACA4B,SAAS;gBACPG;gBACAC;gBACAb;gBACAJ;gBACAuB;gBACA7B;gBACAwB;gBACAC;gBACAO;gBACAF;gBACAJ;gBACAL;gBACAD;gBACAW;gBACAE;gBACAN;gBACA,gEAAgE;gBAChEC;YACF;QACF;IACF,GACA;QACEN;QACAC;QACAb;QACAJ;QACAuB;QACA7B;QACAwB;QACAC;QACAO;QACAF;QACAJ;QACAL;QACAD;QACAW;QACAE;QACAN;QACAC;QACAV;KACD;AAEL;AAKO,+BAA+BC,OAA2B;IAC/D,MAAM,EAAEkB,GAAG,EAAEC,cAAc,EAAE,OAAG5C,uCAAAA;IAChC,MAAM6C,QAAQF,QAAQ;IAEtB,MAAMnB,WAAWD,2BAAuBD,4DAAAA,KAA+BG;IACvE,MAAM,EAEJqB,AADA,aACa,EACd,GAAGrB,0CAF0D;IAI9D,OAAOxB,OAAMuC,WAAW,CACtB,CAACC,WAAwB5C;QACvB,MAAMkD,2BAAuB5B,sBAAAA,EAAgBsB;QAE7C,MAAMO,0BAA0BxB,SAASiB,WAAW5C;QACpD,MAAM,EACJ+B,QAAQ,EACRC,qBAAqB,EACrBb,eAAe,EACfJ,MAAM,EACNN,WAAW,EACXwB,YAAY,EACZC,gBAAgB,EAChBO,YAAY,EACZF,uBAAuB,EACvBJ,MAAM,EACNC,QAAQ,EACRN,YAAY,EACZQ,QAAQ,EACRT,KAAK,EACLW,iBAAiB,EACjBE,kBAAkB,EAClB,AACAL,sBAAsB,EACvB,GAAGc,qCAF8D;QAGlE,MAAMC,yBAAqB7B,wBAAAA,EAAkBQ;QAE7C,MAAMsB,aAAa;YACjBD,0BAAsBtC,wBAAAA,EAAuBsC;YAC7CjC,uBAAmBC,2BAAAA;YACnBL,cAAUC,kBAAAA,EAAiBD;YAC3BN,mBAAeC,uBAAAA;YACf,CAACyB,cAAU3B,gBAAAA,EAAe;gBAAEoC;gBAAWX;gBAAciB;gBAAsBF;gBAAOR;YAAkB;YACpGlC,qBAAAA,EAAgB;gBACdsC;gBACAM;gBACAhB;gBACAoB,eAAejB;gBACfE;gBACAS;gBACAN;YACF;YACAU,0BACExC,mBAAAA,EAAkBwC,oBAAoB;gBAAER;gBAAWV;gBAAkBK;gBAAyBS;YAAM;gBACtG9B,wBAAAA;YACAlB,aAASC,UAAAA,EAAgB;gBAAEsD,SAASvD;gBAAOwD,SAAS1B;YAAa;YACjE/B,aAAAA,EAAe;gBAAEuC,UAAU;YAAkB;gBAC7CvC,SAAAA,EAAe;gBAAEuC,UAAU;YAAU;YACrCmB,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACvBZ,sBACAlD,kBAAAA,EAASkD,oBAAgBvB,2BAAAA,EAAiB2B;SAC7C,CAACS,MAAM,CAACC;QAET,MAAMC,gBAAYzC,4BAAAA,EAAsBQ,OAAOO,UAAUY;QAEzD,OAAO;YACLc;YACAT;YACAf,UAAUA,CAAAA,aAAAA,QAAAA,aAAAA,KAAAA,IAAAA,WAAYW,aAAAA,CAAY,GAAK,UAAqB;YAE5DjB;YACAS;QACF;IACF,GACA;QAACd;QAAUqB;QAAOD;QAAgBE;KAAc;AAEpD"}
|
@@ -1 +1 @@
|
|
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"],"
|
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"],"mappings":";;;;+BAAgBA;;;;;;AAAT,8BAA8BC,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":["../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"],"
|
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"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;AAAO,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":["../src/utils/devtools.ts"],"sourcesContent":["import type { MiddlewareState } 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 =\n (options: Pick<PositioningOptions, 'flipBoundary' | 'overflowBoundary'>) => (middlewareState: MiddlewareState) => {\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","
|
1
|
+
{"version":3,"sources":["../src/utils/devtools.ts"],"sourcesContent":["import type { MiddlewareState } 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 =\n (options: Pick<PositioningOptions, 'flipBoundary' | 'overflowBoundary'>) => (middlewareState: MiddlewareState) => {\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":["isHTMLElement","listScrollParents","fromFloatingUIPlacement","devtoolsCallback","options","middlewareState","elements","floating","reference","scrollParentsSet","Set","forEach","scrollParent","add","flipBoundaries","Array","isArray","flipBoundary","overflowBoundaries","overflowBoundary","type","initialPlacement","placement","scrollParents","from"],"mappings":";;;;+BAMaG;;;;;;gCAJiB,4BAA4B;mCACxB,sBAAsB;yCAChB,4BAA4B;AAE7D,yBACL,CAACC,UAA2E,CAACC;QAC3E,MAAM,EACJC,UAAU,EAAEC,QAAQ,EAAEC,SAAS,EAAE,EAClC,GAAGH;QACJ,MAAMI,mBAAmB,IAAIC;QAC7B,QAAIV,6BAAAA,EAAcQ,YAAY;gBAC5BP,oCAAAA,EAAkBO,WAAWG,OAAO,CAACC,CAAAA,eAAgBH,iBAAiBI,GAAG,CAACD;QAC5E;YACAX,oCAAAA,EAAkBM,UAAUI,OAAO,CAACC,CAAAA,eAAgBH,iBAAiBI,GAAG,CAACD;QACzE,MAAME,iBAAgCC,MAAMC,OAAO,CAACZ,QAAQa,YAAY,IACpEb,QAAQa,YAAY,OACpBjB,6BAAAA,EAAcI,QAAQa,YAAY,IAClC;YAACb,QAAQa,YAAY;SAAC,GACtB,EAAE;QACN,MAAMC,qBAAoCH,MAAMC,OAAO,CAACZ,QAAQe,gBAAgB,IAC5Ef,QAAQe,gBAAgB,OACxBnB,6BAAAA,EAAcI,QAAQe,gBAAgB,IACtC;YAACf,QAAQe,gBAAgB;SAAC,GAC1B,EAAE;QACN,OAAO;YACLC,MAAM;YACNf;YACAD;YACAiB,sBAAkBnB,gDAAAA,EAAwBG,gBAAgBgB,gBAAgB;YAC1EC,eAAWpB,gDAAAA,EAAwBG,gBAAgBiB,SAAS;YAC5DR;YACAI;YACAK,eAAeR,MAAMS,IAAI,CAACf;QAC5B;IACF,EAAE"}
|
@@ -1 +1 @@
|
|
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":["
|
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":["parseFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","fromFloatingUIPlacement","placement","side","alignment","floatingUIAlignment"],"mappings":";;;;;;;eA+BaU;;;0CA7B4B,6BAA6B;AAEtE,MAAMT,iBAAiB,IAA+B,CAAA;QACpDC,KAAK;QACLC,QAAQ;QACRC,OAAO;QACPC,MAAM;KACR,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,gCAAgC,CAACE;IACtC,MAAM,EAAEC,IAAI,EAAEC,WAAWC,mBAAmB,EAAE,OAAGd,kDAAAA,EAAyBW;IAC1E,MAAMJ,WAAWN,gBAAgB,CAACW,KAAK;IACvC,MAAMC,YAAYC,uBAAuBR,gBAAgBC,SAAS,CAACO,oBAAoB;IAEvF,OAAO;QAAEP;QAAUM;IAAU;AAC/B,EAAE"}
|
@@ -1 +1 @@
|
|
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 { PositioningBoundary } 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(\n element: HTMLElement | null,\n boundary?: PositioningBoundary,\n): 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","
|
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 { PositioningBoundary } 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(\n element: HTMLElement | null,\n boundary?: PositioningBoundary,\n): 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":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"mappings":";;;;+BAQgBC;;;;;;iCANgB,oBAAoB;AAM7C,qBACLC,OAA2B,EAC3BC,QAA8B;IAE9B,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,qBAA0CN,gCAAAA,EAAgBE;QAE9D,IAAII,eAAeC,QAAQ,KAAK,QAAQ;YACtCD,iBAAiBJ,YAAAA,QAAAA,YAAAA,KAAAA,IAAAA,KAAAA,IAAAA,QAASE,aAAa,CAAEC,eAAe;QAC1D;QAEA,OAAOC;IACT;IAEA,OAAOH;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/getFloatingUIOffset.ts"],"sourcesContent":["import type { Offset } from '../types';\nimport type { MiddlewareState } 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: MiddlewareState) => 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","
|
1
|
+
{"version":3,"sources":["../src/utils/getFloatingUIOffset.ts"],"sourcesContent":["import type { Offset } from '../types';\nimport type { MiddlewareState } 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: MiddlewareState) => 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":["fromFloatingUIPlacement","getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","positionedRect","targetRect"],"mappings":";;;;+BAuCgBC;;;;;;yCArCwB,4BAA4B;AAqC7D,6BACLC,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,OAAGR,gDAAAA,EAAwBM;QACxD,OAAOJ,UAAU;YAAEO,gBAAgBL;YAAUM,YAAYL;YAAWE;YAAUC;QAAU;IAC1F;AACF"}
|
@@ -10,8 +10,7 @@ Object.defineProperty(exports, "getReactFiberFromNode", {
|
|
10
10
|
});
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
-
var WorkTag
|
14
|
-
(function(WorkTag) {
|
13
|
+
var WorkTag = /*#__PURE__*/ function(WorkTag) {
|
15
14
|
WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
|
16
15
|
WorkTag[WorkTag["ClassComponent"] = 1] = "ClassComponent";
|
17
16
|
WorkTag[WorkTag["IndeterminateComponent"] = 2] = "IndeterminateComponent";
|
@@ -34,7 +33,8 @@ var WorkTag;
|
|
34
33
|
WorkTag[WorkTag["SuspenseListComponent"] = 19] = "SuspenseListComponent";
|
35
34
|
WorkTag[WorkTag["FundamentalComponent"] = 20] = "FundamentalComponent";
|
36
35
|
WorkTag[WorkTag["ScopeComponent"] = 21] = "ScopeComponent";
|
37
|
-
|
36
|
+
return WorkTag;
|
37
|
+
}(WorkTag || {});
|
38
38
|
function getReactFiberFromNode(elm) {
|
39
39
|
if (!elm) {
|
40
40
|
return null;
|
@@ -1 +1 @@
|
|
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,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":["React","WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"mappings":";;;;+BA6PgBE;;;;;;;iEA7PO,QAAQ;AAuE/B,IAAKD,UAAAA,WAAAA,GAAAA,SAAAA,OAAAA;;;;;;;;;;;;;;;;;;;;;;;WAAAA;EAAAA,WAAAA,CAAAA;AAsLE,+BAA+BE,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":["../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\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 */\nexport const getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const targetWindow = node.ownerDocument?.defaultView;\n\n if (targetWindow) {\n return targetWindow.getComputedStyle(node, null);\n }\n\n return {};\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\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"names":["getParentNode","
|
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\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 */\nexport const getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const targetWindow = node.ownerDocument?.defaultView;\n\n if (targetWindow) {\n return targetWindow.getComputedStyle(node, null);\n }\n\n return {};\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\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"names":["getParentNode","node","nodeName","parentNode","host","getStyleComputedProperty","nodeType","targetWindow","ownerDocument","defaultView","getComputedStyle","getScrollParent","document","body","overflow","overflowX","overflowY","test","hasScrollParent","scrollParentElement"],"mappings":"AAAA;;;;CAIC,GACD;;;;;;;;;;;IAAaA,aAAAA;;;mBAiCAW;;;4BAnBAN;eAAAA;;mBA0CAa;;;;AAxDN,sBAAsB,CAACjB;IAC5B,IAAIA,KAAKC,QAAQ,KAAK,QAAQ;QAC5B,OAAOD;IACT;IAEA,8DAA8D;IAC9D,OAAOA,KAAKE,UAAU,IAAKF,KAAaG,IAAI;AAC9C,EAAE;AAOK,iCAAiC,CAACH;QAKlBA;IAJrB,IAAIA,KAAKK,QAAQ,KAAK,GAAG;QACvB,OAAO,CAAC;IACV;IAEA,MAAMC,eAAAA,CAAeN,sBAAAA,KAAKO,aAAAA,AAAa,MAAA,QAAlBP,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAoBQ,WAAW;IAEpD,IAAIF,cAAc;QAChB,OAAOA,aAAaG,gBAAgB,CAACT,MAAM;IAC7C;IAEA,OAAO,CAAC;AACV,EAAE;AAOK,MAAMU,kBAAkB,CAACV;IAC9B,iFAAiF;IACjF,MAAME,aAAaF,QAAQD,cAAcC;IACzC,2BAA2B;IAC3B,IAAI,CAACE,YAAY,OAAOS,SAASC,IAAI;IAErC,OAAQV,WAAWD,QAAQ;QACzB,KAAK;QACL,KAAK;YACH,OAAOC,WAAWK,aAAa,CAAEK,IAAI;QACvC,KAAK;YACH,OAAQV,WAAmCU,IAAI;IACnD;IAEA,uFAAuF;IACvF,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGX,yBAAyBF;IACpE,IAAI,wBAAwBc,IAAI,CAACH,WAAYE,YAAaD,YAAY;QACpE,OAAOZ;IACT;IAEA,OAAOQ,gBAAgBR;AACzB,EAAE;AAEK,MAAMe,kBAAkB,CAACjB;QAGuBkB;IAFrD,MAAMA,sBAAmCR,gBAAgBV;IAEzD,OAAOkB,sBAAsBA,wBAAAA,CAAAA,CAAwBA,qCAAAA,oBAAoBX,aAAAA,AAAa,MAAA,QAAjCW,uCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mCAAmCN,IAAAA,AAAI,IAAG;AACjG,EAAE"}
|
@@ -1 +1 @@
|
|
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":["
|
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":["getReactFiberFromNode","hasAutofocusProp","node","isAutoFocusableElement","nodeName","pendingProps","autoFocus","hasAutofocusFilter","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"mappings":"AAAA,EAAE;AACF,uDAAuD;AACvD,EAAE;;;;;;;;;;;uCAEoC,0BAA0B;AAEhE;;;;;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;YACjBH;QAAT,OAAO,CAAC,CAAA,CAAA,CAACA,8BAAAA,4CAAAA,EAAsBE,KAAAA,MAAAA,QAAtBF,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAA6BK,YAAY,CAACC,SAAAA,AAAS;IAC9D;IAEA,OAAO;AACT;AAEO,SAASC,mBAAmBL,IAAU;IAC3C,OAAOD,iBAAiBC,QAAQM,WAAWC,aAAa,GAAGD,WAAWE,WAAW;AACnF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\nexport { getBoundary } from './getBoundary';\nexport type { Fiber, HookType } from './getReactFiberFromNode';\nexport { getReactFiberFromNode } from './getReactFiberFromNode';\nexport { getParentNode, getScrollParent, hasScrollParent } from './getScrollParent';\nexport { mergeArrowOffset } from './mergeArrowOffset';\nexport { toFloatingUIPadding } from './toFloatingUIPadding';\nexport { toFloatingUIPlacement } from './toFloatingUIPlacement';\nexport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\nexport { resolvePositioningShorthand } from './resolvePositioningShorthand';\nexport { useCallbackRef } from './useCallbackRef';\nexport { debounce } from './debounce';\nexport { toggleScrollListener } from './toggleScrollListener';\nexport { hasAutofocusFilter } from './hasAutoFocusFilter';\nexport { writeArrowUpdates } from './writeArrowUpdates';\nexport { writeContainerUpdates } from './writeContainerupdates';\nexport { normalizeAutoSize } from './normalizeAutoSize';\n"],"names":["
|
1
|
+
{"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\nexport { getBoundary } from './getBoundary';\nexport type { Fiber, HookType } from './getReactFiberFromNode';\nexport { getReactFiberFromNode } from './getReactFiberFromNode';\nexport { getParentNode, getScrollParent, hasScrollParent } from './getScrollParent';\nexport { mergeArrowOffset } from './mergeArrowOffset';\nexport { toFloatingUIPadding } from './toFloatingUIPadding';\nexport { toFloatingUIPlacement } from './toFloatingUIPlacement';\nexport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\nexport { resolvePositioningShorthand } from './resolvePositioningShorthand';\nexport { useCallbackRef } from './useCallbackRef';\nexport { debounce } from './debounce';\nexport { toggleScrollListener } from './toggleScrollListener';\nexport { hasAutofocusFilter } from './hasAutoFocusFilter';\nexport { writeArrowUpdates } from './writeArrowUpdates';\nexport { writeContainerUpdates } from './writeContainerupdates';\nexport { normalizeAutoSize } from './normalizeAutoSize';\n"],"names":["parseFloatingUIPlacement","getBoundary","getReactFiberFromNode","getParentNode","getScrollParent","hasScrollParent","mergeArrowOffset","toFloatingUIPadding","toFloatingUIPlacement","fromFloatingUIPlacement","resolvePositioningShorthand","useCallbackRef","debounce","toggleScrollListener","hasAutofocusFilter","writeArrowUpdates","writeContainerUpdates","normalizeAutoSize"],"mappings":";;;;;;;;;;;IAWSY;iCAAQ;;2BAHe;eAAvBH;;;eAPAR,wBAAW;;;eAGXE,8BAAa;;;eADbD,4CAAqB;;mBACS;eAAfE;;IASfU;qDAAkB;;;eATcT,gCAAe;;IAC/CC;iDAAgB;;;eAWhBW,oCAAiB;;;eAhBjBjB,kDAAwB;;+BASG;eAA3BU;;;eAHAH,wCAAmB;;;eACnBC,4CAAqB;;;eAKrBK,0CAAoB;;;eAFpBF,8BAAc;;;eAIdI,oCAAiB;;;eACjBC,4CAAqB;;;0CAfW,6BAA6B;6BAC1C,gBAAgB;uCAEN,0BAA0B;iCACA,oBAAoB;kCACnD,qBAAqB;qCAClB,wBAAwB;uCACtB,0BAA0B;yCACxB,4BAA4B;6CACxB,gCAAgC;gCAC7C,mBAAmB;0BACzB,aAAa;sCACD,yBAAyB;oCAC3B,uBAAuB;mCACxB,sBAAsB;uCAClB,0BAA0B;mCAC9B,sBAAsB"}
|
@@ -1 +1 @@
|
|
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","
|
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":["getScrollParent","listScrollParents","node","scrollParents","cur","scrollParent","ownerDocument","body","push","nodeName","process","env","NODE_ENV","console","error"],"mappings":";;;;+BAEgBC;;;;;;iCAFgB,oBAAoB;AAE7C,2BAA2BC,IAAiB;IACjD,MAAMC,gBAA+B,EAAE;IAEvC,IAAIC,MAA0BF;IAC9B,MAAOE,IAAK;QACV,MAAMC,mBAAeL,gCAAAA,EAAgBI;QAErC,IAAIF,KAAKI,aAAa,CAACC,IAAI,KAAKF,cAAc;YAC5CF,cAAcK,IAAI,CAACH;YACnB;QACF;QAEA,IAAIA,aAAaI,QAAQ,KAAK,UAAUJ,iBAAiBH,KAAKI,aAAa,CAACC,IAAI,EAAE;YAChF,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;gBACzC,sCAAsC;gBACtCC,QAAQC,KAAK,CACX;YAEJ;YACA;QACF;QAEAX,cAAcK,IAAI,CAACH;QACnBD,MAAMC;IACR;IAEA,OAAOF;AACT"}
|
@@ -1 +1 @@
|
|
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"],"
|
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"],"mappings":"AAEA;;;;;;;;CAQC,GACD;;;;;;;;;;AAAO,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,UAAWD,CAAAA,CAAAA,mBAAAA,OAAOC,QAAAA,AAAQ,MAAA,QAAfD,qBAAAA,KAAAA,IAAAA,oBAAmB,CAAA,GAAKH;IAAY;AACrE"}
|
@@ -1 +1 @@
|
|
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"],"
|
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"],"mappings":"AAEA;;;;CAIC,GACD;;;;;;;;;;AAAO,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,EAAE"}
|
@@ -1 +1 @@
|
|
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"],"
|
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"],"mappings":"AAEA;;;;;CAKC,GACD;;;;;;;;;;AAAO,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 +1 @@
|
|
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":["
|
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":["shorthandLookup","above","position","align","below","before","after","resolvePositioningShorthand","shorthand","undefined"],"mappings":"AAEA,uDAAuD;;;;;;;;;;;AACvD,MAAMA,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,SAASI,4BACdC,SAAkD;IAElD,IAAIA,cAAcC,aAAaD,cAAc,MAAM;QACjD,OAAO,CAAC;IACV;IAEA,IAAI,OAAOA,cAAc,UAAU;QACjC,OAAOR,eAAe,CAACQ,UAAU;IACnC;IAEA,OAAOA;AACT"}
|
@@ -1 +1 @@
|
|
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"],"
|
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"],"mappings":";;;;+BAGgBA;;;;;;AAAT,6BACLC,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":["../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":["
|
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":["getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","toFloatingUIPlacement","align","position","alignment","computedPosition","computedAlignment"],"mappings":";;;;;;;eAkCakB;;;AA5Bb,MAAMlB,iBAAiB,CAACC,MAAwD,CAAA;QAC9EC,OAAO;QACPC,OAAO;QACPC,QAAQH,MAAM,UAAU;QACxBI,OAAOJ,MAAM,SAAS;KACxB,CAAA;AAEA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMK,kBAAkB,IAAsD,CAAA;QAC5EC,OAAO;QACPC,KAAK;QACLC,KAAK;QACLC,QAAQ;QACRC,QAAQC;KACV,CAAA;AAEA,MAAMC,sBAAsB,CAACC,GAAcC;IACzC,MAAMC,uBAAuBF,MAAM,WAAWA,MAAM;IACpD,MAAMG,oBAAoBF,MAAM,SAASA,MAAM;IAE/C,OAAQC,wBAAwBC,qBAAuB,CAACD,wBAAwB,CAACC;AACnF;AAMO,8BAA8B,CAACE,OAAmBC,UAAqBnB;IAC5E,MAAMoB,YAAYR,oBAAoBO,UAAUD,SAAS,WAAWA;IAEpE,MAAMG,mBAAmBF,YAAYpB,eAAeC,IAAI,CAACmB,SAAS;IAClE,MAAMG,oBAAoBF,aAAaf,iBAAiB,CAACe,UAAU;IAEnE,IAAIC,oBAAoBC,mBAAmB;QACzC,OAAO,GAAGD,iBAAiB,CAAC,EAAEC,mBAAmB;IACnD;IAEA,OAAOD;AACT,EAAE"}
|
@@ -1 +1 @@
|
|
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":["
|
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":["isHTMLElement","getScrollParent","toggleScrollListener","next","prev","handler","prevScrollParent","removeEventListener","scrollParent","addEventListener"],"mappings":";;;;+BAUgBE;;;;;;gCAVc,4BAA4B;iCAE1B,oBAAoB;AAQ7C,8BACLC,IAAoD,EACpDC,IAAoD,EACpDC,OAAsB;IAEtB,IAAIF,SAASC,MAAM;QACjB;IACF;IAEA,QAAIJ,6BAAAA,EAAcI,OAAO;QACvB,MAAME,uBAAmBL,gCAAAA,EAAgBG;QACzCE,iBAAiBC,mBAAmB,CAAC,UAAUF;IACjD;IACA,QAAIL,6BAAAA,EAAcG,OAAO;QACvB,MAAMK,mBAAeP,gCAAAA,EAAgBE;QACrCK,aAAaC,gBAAgB,CAAC,UAAUJ;IAC1C;AACF"}
|
@@ -1 +1 @@
|
|
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","
|
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":["React","useIsomorphicLayoutEffect","useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","useRef","ref","useState","value","facade","current","last"],"mappings":";;;;+BAoBgBE;;;;;;;iEApBO,QAAQ;gCACW,4BAA4B;AAmB/D,wBACLC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B;IAE5B,MAAMC,UAAUN,OAAMO,MAAM,CAAC;IAC7B,MAAM,CAACC,IAAI,GAAGR,OAAMS,QAAQ,CAAC,IAAO,CAAA;YAClC,QAAQ;YACRC,OAAOP;YACP,gBAAgB;YAChBC;YACA,8BAA8B;YAC9BO,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,IAAIL,sBAAsBC,QAAQM,OAAO,EAAE;4BACzC;wBACF;wBAEAJ,IAAIJ,QAAQ,CAACM,OAAOG;oBACtB;gBACF;YACF;SACF,CAAA;QAEAZ,yCAAAA,EAA0B;QACxBK,QAAQM,OAAO,GAAG;IACpB,GAAG,EAAE;IAEL,kBAAkB;IAClBJ,IAAIJ,QAAQ,GAAGA;IAEf,OAAOI,IAAIG,MAAM;AACnB"}
|
@@ -1 +1 @@
|
|
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 !== null && arrowX !== undefined ? `${arrowX}px` : '',\n top: arrowY !== null && arrowY !== undefined ? `${arrowY}px` : '',\n });\n}\n"],"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","undefined","top"],"
|
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 !== null && arrowX !== undefined ? `${arrowX}px` : '',\n top: arrowY !== null && arrowY !== undefined ? `${arrowY}px` : '',\n });\n}\n"],"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","undefined","top"],"mappings":"AAEA;;CAEC,GACD;;;;;;;;;;AAAO,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,MAAMN,WAAW,QAAQA,WAAWO,YAAY,GAAGP,OAAO,EAAE,CAAC,GAAG;QAChEQ,KAAKN,WAAW,QAAQA,WAAWK,YAAY,GAAGL,OAAO,EAAE,CAAC,GAAG;IACjE;AACF"}
|
@@ -1 +1 @@
|
|
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","
|
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":["DATA_POSITIONING_ESCAPED","DATA_POSITIONING_HIDDEN","DATA_POSITIONING_INTERSECTING","DATA_POSITIONING_PLACEMENT","writeContainerUpdates","options","middlewareData","container","placement","strategy","lowPPI","coordinates","useTransform","setAttribute","removeAttribute","intersectionObserver","intersecting","hide","escaped","referenceHidden","devicePixelRatio","ownerDocument","defaultView","x","Math","round","y","Object","assign","style","position","transform","left","top"],"mappings":";;;;+BAWgBI;;;;;;2BALT,eAAe;AAKf,+BAA+BC,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,CAACV,qCAAAA,EAA4BK;IACnDD,UAAUO,eAAe,CAACZ,wCAAAA;IAC1B,IAAII,eAAeS,oBAAoB,CAACC,YAAY,EAAE;QACpDT,UAAUM,YAAY,CAACX,wCAAAA,EAA+B;IACxD;IAEAK,UAAUO,eAAe,CAACd,mCAAAA;IAC1B,IAAA,CAAIM,uBAAAA,eAAeW,IAAAA,AAAI,MAAA,QAAnBX,yBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qBAAqBY,OAAO,EAAE;QAChCX,UAAUM,YAAY,CAACb,mCAAAA,EAA0B;IACnD;IAEAO,UAAUO,eAAe,CAACb,kCAAAA;IAC1B,IAAA,CAAIK,wBAAAA,eAAeW,IAAAA,AAAI,MAAA,QAAnBX,0BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,sBAAqBa,eAAe,EAAE;QACxCZ,UAAUM,YAAY,CAACZ,kCAAAA,EAAyB;IAClD;IAEA,uDAAuD;IACvD,oHAAoH;IACpH,wFAAwF;IACxF,wEAAwE;IACxE,MAAMmB,mBAAmBb,CAAAA,CAAAA,uCAAAA,UAAUc,aAAa,CAACC,WAAAA,AAAW,MAAA,QAAnCf,yCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,qCAAqCa,gBAAAA,AAAgB,KAAI;IAClF,MAAMG,IAAIC,KAAKC,KAAK,CAACd,YAAYY,CAAC,GAAGH,oBAAoBA;IACzD,MAAMM,IAAIF,KAAKC,KAAK,CAACd,YAAYe,CAAC,GAAGN,oBAAoBA;IAEzDO,OAAOC,MAAM,CAACrB,UAAUsB,KAAK,EAAE;QAC7BC,UAAUrB;IACZ;IAEA,IAAIG,cAAc;QAChBe,OAAOC,MAAM,CAACrB,UAAUsB,KAAK,EAAE;YAC7BE,WAAWrB,SAAS,CAAC,UAAU,EAAEa,EAAE,IAAI,EAAEG,EAAE,GAAG,CAAC,GAAG,CAAC,YAAY,EAAEH,EAAE,IAAI,EAAEG,EAAE,MAAM,CAAC;QACpF;QACA;IACF;IAEAC,OAAOC,MAAM,CAACrB,UAAUsB,KAAK,EAAE;QAC7BG,MAAM,GAAGT,EAAE,EAAE,CAAC;QACdU,KAAK,GAAGP,EAAE,EAAE,CAAC;IACf;AACF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
|
-
"version": "9.20.
|
3
|
+
"version": "9.20.2",
|
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",
|
@@ -19,9 +19,9 @@
|
|
19
19
|
"dependencies": {
|
20
20
|
"@floating-ui/dom": "^1.6.12",
|
21
21
|
"@floating-ui/devtools": "0.2.1",
|
22
|
-
"@fluentui/react-shared-contexts": "^9.24.
|
23
|
-
"@fluentui/react-theme": "^9.
|
24
|
-
"@fluentui/react-utilities": "^9.
|
22
|
+
"@fluentui/react-shared-contexts": "^9.24.1",
|
23
|
+
"@fluentui/react-theme": "^9.2.0",
|
24
|
+
"@fluentui/react-utilities": "^9.23.1",
|
25
25
|
"@griffel/react": "^1.5.22",
|
26
26
|
"@swc/helpers": "^0.5.1",
|
27
27
|
"use-sync-external-store": "^1.2.0"
|