@fluentui/react-positioning 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230322-0439.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/.swcrc +2 -11
  2. package/CHANGELOG.json +48 -9
  3. package/CHANGELOG.md +20 -7
  4. package/lib/constants.js +4 -4
  5. package/lib/createArrowStyles.js +19 -19
  6. package/lib/createPositionManager.js +13 -13
  7. package/lib/createPositionManager.js.map +1 -1
  8. package/lib/index.js +5 -5
  9. package/lib/middleware/coverTarget.js +6 -6
  10. package/lib/middleware/flip.js +4 -4
  11. package/lib/middleware/index.js +6 -6
  12. package/lib/middleware/intersecting.js +2 -2
  13. package/lib/middleware/maxSize.js +8 -8
  14. package/lib/middleware/offset.js +2 -2
  15. package/lib/middleware/shift.js +5 -5
  16. package/lib/types.js +1 -1
  17. package/lib/usePositioning.js +37 -29
  18. package/lib/usePositioning.js.map +1 -1
  19. package/lib/usePositioningMouseTarget.js +4 -4
  20. package/lib/utils/fromFloatingUIPlacement.js +10 -10
  21. package/lib/utils/getBoundary.js +8 -8
  22. package/lib/utils/getBoundary.js.map +1 -1
  23. package/lib/utils/getFloatingUIOffset.js +2 -2
  24. package/lib/utils/getReactFiberFromNode.js +3 -3
  25. package/lib/utils/getScrollParent.js +8 -6
  26. package/lib/utils/getScrollParent.js.map +1 -1
  27. package/lib/utils/hasAutoFocusFilter.js +4 -3
  28. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  29. package/lib/utils/index.js +15 -15
  30. package/lib/utils/mergeArrowOffset.js +6 -5
  31. package/lib/utils/mergeArrowOffset.js.map +1 -1
  32. package/lib/utils/parseFloatingUIPlacement.js +1 -1
  33. package/lib/utils/resolvePositioningShorthand.js +33 -33
  34. package/lib/utils/toFloatingUIPadding.js +3 -3
  35. package/lib/utils/toFloatingUIPlacement.js +11 -11
  36. package/lib/utils/toggleScrollListener.js +4 -4
  37. package/lib/utils/useCallbackRef.js +2 -2
  38. package/lib/utils/writeContainerupdates.js +8 -7
  39. package/lib/utils/writeContainerupdates.js.map +1 -1
  40. package/lib-commonjs/constants.js +4 -4
  41. package/lib-commonjs/constants.js.map +1 -1
  42. package/lib-commonjs/createArrowStyles.js +16 -16
  43. package/lib-commonjs/createArrowStyles.js.map +1 -1
  44. package/lib-commonjs/createPositionManager.js +10 -10
  45. package/lib-commonjs/createPositionManager.js.map +1 -1
  46. package/lib-commonjs/index.js.map +1 -1
  47. package/lib-commonjs/middleware/coverTarget.js +5 -5
  48. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  49. package/lib-commonjs/middleware/flip.js +2 -2
  50. package/lib-commonjs/middleware/flip.js.map +1 -1
  51. package/lib-commonjs/middleware/index.js.map +1 -1
  52. package/lib-commonjs/middleware/intersecting.js +1 -1
  53. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  54. package/lib-commonjs/middleware/maxSize.js +6 -6
  55. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  56. package/lib-commonjs/middleware/offset.js.map +1 -1
  57. package/lib-commonjs/middleware/shift.js +3 -3
  58. package/lib-commonjs/middleware/shift.js.map +1 -1
  59. package/lib-commonjs/types.js.map +1 -1
  60. package/lib-commonjs/usePositioning.js +30 -22
  61. package/lib-commonjs/usePositioning.js.map +1 -1
  62. package/lib-commonjs/usePositioningMouseTarget.js +2 -2
  63. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  64. package/lib-commonjs/utils/fromFloatingUIPlacement.js +9 -9
  65. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  66. package/lib-commonjs/utils/getBoundary.js +7 -7
  67. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  68. package/lib-commonjs/utils/getFloatingUIOffset.js +1 -1
  69. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  70. package/lib-commonjs/utils/getReactFiberFromNode.js +2 -2
  71. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  72. package/lib-commonjs/utils/getScrollParent.js +8 -6
  73. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  74. package/lib-commonjs/utils/hasAutoFocusFilter.js +3 -2
  75. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  76. package/lib-commonjs/utils/index.js.map +1 -1
  77. package/lib-commonjs/utils/mergeArrowOffset.js +6 -5
  78. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  79. package/lib-commonjs/utils/parseFloatingUIPlacement.js +1 -1
  80. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  81. package/lib-commonjs/utils/resolvePositioningShorthand.js +33 -33
  82. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  83. package/lib-commonjs/utils/toFloatingUIPadding.js +3 -3
  84. package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
  85. package/lib-commonjs/utils/toFloatingUIPlacement.js +11 -11
  86. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  87. package/lib-commonjs/utils/toggleScrollListener.js +2 -2
  88. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  89. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  90. package/lib-commonjs/utils/writeContainerupdates.js +7 -6
  91. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  92. package/package.json +5 -4
@@ -1,10 +1,10 @@
1
- import { hide as hideMiddleware, arrow as arrowMiddleware } from "@floating-ui/dom";
2
- import { useFluent_unstable as useFluent } from "@fluentui/react-shared-contexts";
3
- import { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from "@fluentui/react-utilities";
4
- import * as React from "react";
5
- import { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from "./utils";
6
- import { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from "./middleware";
7
- import { createPositionManager } from "./createPositionManager";
1
+ import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';
2
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
3
+ import { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
4
+ import * as React from 'react';
5
+ import { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';
6
+ import { shift as shiftMiddleware, flip as flipMiddleware, coverTarget as coverTargetMiddleware, maxSize as maxSizeMiddleware, offset as offsetMiddleware, intersecting as intersectingMiddleware } from './middleware';
7
+ import { createPositionManager } from './createPositionManager';
8
8
  /**
9
9
  * @internal
10
10
  */
@@ -23,7 +23,8 @@ export function usePositioning(options) {
23
23
  managerRef.current.dispose();
24
24
  }
25
25
  managerRef.current = null;
26
- const target = overrideTargetRef.current ?? targetRef.current;
26
+ var _overrideTargetRef_current;
27
+ const target = (_overrideTargetRef_current = overrideTargetRef.current) !== null && _overrideTargetRef_current !== void 0 ? _overrideTargetRef_current : targetRef.current;
27
28
  if (enabled && canUseDOM() && target && containerRef.current) {
28
29
  managerRef.current = createPositionManager({
29
30
  container: containerRef.current,
@@ -37,40 +38,47 @@ export function usePositioning(options) {
37
38
  overrideTargetRef.current = target;
38
39
  updatePositionManager();
39
40
  });
40
- React.useImperativeHandle(options.positioningRef, () => ({
41
- updatePosition: () => managerRef.current?.updatePosition(),
42
- setTarget: target => {
43
- if (options.target && process.env.NODE_ENV !== "production") {
44
- const err = new Error();
45
- // eslint-disable-next-line no-console
46
- console.warn("Imperative setTarget should not be used at the same time as target option");
47
- // eslint-disable-next-line no-console
48
- console.warn(err.stack);
41
+ React.useImperativeHandle(options.positioningRef, () => {
42
+ return {
43
+ updatePosition: () => {
44
+ var _managerRef_current;
45
+ return (_managerRef_current = managerRef.current) === null || _managerRef_current === void 0 ? void 0 : _managerRef_current.updatePosition();
46
+ },
47
+ setTarget: target => {
48
+ if (options.target && process.env.NODE_ENV !== 'production') {
49
+ const err = new Error();
50
+ // eslint-disable-next-line no-console
51
+ console.warn('Imperative setTarget should not be used at the same time as target option');
52
+ // eslint-disable-next-line no-console
53
+ console.warn(err.stack);
54
+ }
55
+ setOverrideTarget(target);
49
56
  }
50
- setOverrideTarget(target);
51
- }
52
- }), [options.target, setOverrideTarget]);
57
+ };
58
+ }, [options.target, setOverrideTarget]);
53
59
  useIsomorphicLayoutEffect(() => {
54
- setOverrideTarget(options.target ?? null);
60
+ var _options_target;
61
+ setOverrideTarget((_options_target = options.target) !== null && _options_target !== void 0 ? _options_target : null);
55
62
  }, [options.target, setOverrideTarget]);
56
63
  useIsomorphicLayoutEffect(() => {
57
64
  updatePositionManager();
58
65
  }, [updatePositionManager]);
59
- if (process.env.NODE_ENV !== "production") {
66
+ if (process.env.NODE_ENV !== 'production') {
60
67
  // This checked should run only in development mode
61
68
  // eslint-disable-next-line react-hooks/rules-of-hooks
62
69
  React.useEffect(() => {
63
70
  if (containerRef.current) {
71
+ var _contentNode_ownerDocument;
64
72
  const contentNode = containerRef.current;
65
- const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {
73
+ const treeWalker = (_contentNode_ownerDocument = contentNode.ownerDocument) === null || _contentNode_ownerDocument === void 0 ? void 0 : _contentNode_ownerDocument.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {
66
74
  acceptNode: hasAutofocusFilter
67
75
  });
68
76
  while (treeWalker.nextNode()) {
69
77
  const node = treeWalker.currentNode;
70
78
  // eslint-disable-next-line no-console
71
- console.warn("<Popper>:", node);
79
+ console.warn('<Popper>:', node);
72
80
  // eslint-disable-next-line no-console
73
- console.warn(['<Popper>: ^ this node contains "autoFocus" prop on a React element. This can break the initial', "positioning of an element and cause a window jump effect. This issue occurs because React polyfills", '"autoFocus" behavior to solve inconsistencies between different browsers:', "https://github.com/facebook/react/issues/11851#issuecomment-351787078", "\n", 'However, ".focus()" in this case occurs before any other React effects will be executed', "(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really", 'want to use "autoFocus" please add "position: fixed" to styles of the element that is wrapped by', '"Popper".', `In general, it's not recommended to use "autoFocus" as it may break accessibility aspects:`, "https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md", "\n", 'We suggest to use the "trapFocus" prop on Fluent components or a catch "ref" and then use', '"ref.current.focus" in React.useEffect():', "https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element"].join(" "));
81
+ console.warn(['<Popper>: ^ this node contains "autoFocus" prop on a React element. This can break the initial', 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills', '"autoFocus" behavior to solve inconsistencies between different browsers:', 'https://github.com/facebook/react/issues/11851#issuecomment-351787078', '\n', 'However, ".focus()" in this case occurs before any other React effects will be executed', '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really', 'want to use "autoFocus" please add "position: fixed" to styles of the element that is wrapped by', '"Popper".', `In general, it's not recommended to use "autoFocus" as it may break accessibility aspects:`, 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md', '\n', 'We suggest to use the "trapFocus" prop on Fluent components or a catch "ref" and then use', '"ref.current.focus" in React.useEffect():', 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element'].join(' '));
74
82
  }
75
83
  }
76
84
  // We run this check once, no need to add deps here
@@ -122,8 +130,8 @@ function usePositioningOptions(options) {
122
130
  const {
123
131
  dir
124
132
  } = useFluent();
125
- const isRtl = dir === "rtl";
126
- const strategy = positionFixed ? "fixed" : "absolute";
133
+ const isRtl = dir === 'rtl';
134
+ const strategy = positionFixed ? 'fixed' : 'absolute';
127
135
  return React.useCallback((container, arrow) => {
128
136
  const hasScrollableElement = hasScrollParent(container);
129
137
  const middleware = [offset && offsetMiddleware(offset), coverTarget && coverTargetMiddleware(), !pinned && flipMiddleware({
@@ -146,9 +154,9 @@ function usePositioningOptions(options) {
146
154
  element: arrow,
147
155
  padding: arrowPadding
148
156
  }), hideMiddleware({
149
- strategy: "referenceHidden"
157
+ strategy: 'referenceHidden'
150
158
  }), hideMiddleware({
151
- strategy: "escaped"
159
+ strategy: 'escaped'
152
160
  })].filter(Boolean);
153
161
  const placement = toFloatingUIPlacement(align, position, isRtl);
154
162
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["hide","hideMiddleware","arrow","arrowMiddleware","useFluent_unstable","useFluent","canUseDOM","useEventCallback","useIsomorphicLayoutEffect","React","useCallbackRef","toFloatingUIPlacement","hasAutofocusFilter","hasScrollParent","shift","shiftMiddleware","flip","flipMiddleware","coverTarget","coverTargetMiddleware","maxSize","maxSizeMiddleware","offset","offsetMiddleware","intersecting","intersectingMiddleware","createPositionManager","usePositioning","options","managerRef","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","target","container","setOverrideTarget","useImperativeHandle","positioningRef","updatePosition","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","useEffect","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","nextNode","node","currentNode","join","setContainer","setArrow","align","arrowPadding","autoSize","flipBoundary","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","overflowBoundaryPadding","fallbackPositions","dir","isRtl","strategy","hasScrollableElement","middleware","element","padding","filter","Boolean","placement"],"sources":["../src/usePositioning.ts"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = useEventCallback((target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\ninterface UsePositioningOptions extends PositioningProps, Pick<PositioningOptions, 'fallbackPositions' | 'pinned'> {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n overflowBoundaryPadding,\n fallbackPositions,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement, isRtl, fallbackPositions }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl,\n }),\n autoSize && maxSizeMiddleware(autoSize, { container, overflowBoundary }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n ],\n );\n}\n"],"mappings":"AAAA,SAASA,IAAA,IAAQC,cAAc,EAAEC,KAAA,IAASC,eAAe,QAAQ;AAEjE,SAASC,kBAAA,IAAsBC,SAAS,QAAQ;AAChD,SAASC,SAAS,EA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AAA,EACA6D,aAAA,EACAL,YAAA,EACAU,KAAA,EACA9D,MAAA,EACAqD,gBAAA,EACAC,MAAA,EACAC,QAAA,EACAQ,QAAA,EACAJ,uBAAA,EACAC,iBAAA,CACD;AAEL"}
1
+ {"version":3,"names":["hide","hideMiddleware","arrow","arrowMiddleware","useFluent_unstable","useFluent","canUseDOM","useEventCallback","useIsomorphicLayoutEffect","React","useCallbackRef","toFloatingUIPlacement","hasAutofocusFilter","hasScrollParent","shift","shiftMiddleware","flip","flipMiddleware","coverTarget","coverTargetMiddleware","maxSize","maxSizeMiddleware","offset","offsetMiddleware","intersecting","intersectingMiddleware","createPositionManager","usePositioning","options","managerRef","useRef","targetRef","overrideTargetRef","containerRef","arrowRef","enabled","resolvePositioningOptions","usePositioningOptions","updatePositionManager","useCallback","current","dispose","_overrideTargetRef_current","target","container","setOverrideTarget","useImperativeHandle","positioningRef","updatePosition","_managerRef_current","setTarget","process","env","NODE_ENV","err","Error","console","warn","stack","_options_target","useEffect","_contentNode_ownerDocument","contentNode","treeWalker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","nextNode","node","currentNode","join","setContainer","setArrow","align","arrowPadding","autoSize","flipBoundary","overflowBoundary","pinned","position","unstable_disableTether","disableTether","positionFixed","overflowBoundaryPadding","fallbackPositions","dir","isRtl","strategy","hasScrollableElement","middleware","element","padding","filter","Boolean","placement"],"sources":["../src/usePositioning.ts"],"sourcesContent":["import { hide as hideMiddleware, arrow as arrowMiddleware } from '@floating-ui/dom';\nimport type { Middleware, Strategy } from '@floating-ui/dom';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { canUseDOM, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nimport * as React from 'react';\nimport type {\n PositioningOptions,\n PositioningProps,\n PositionManager,\n TargetElement,\n UsePositioningReturn,\n} from './types';\nimport { useCallbackRef, toFloatingUIPlacement, hasAutofocusFilter, hasScrollParent } from './utils';\nimport {\n shift as shiftMiddleware,\n flip as flipMiddleware,\n coverTarget as coverTargetMiddleware,\n maxSize as maxSizeMiddleware,\n offset as offsetMiddleware,\n intersecting as intersectingMiddleware,\n} from './middleware';\nimport { createPositionManager } from './createPositionManager';\n\n/**\n * @internal\n */\nexport function usePositioning(options: UsePositioningOptions): UsePositioningReturn {\n const managerRef = React.useRef<PositionManager | null>(null);\n const targetRef = React.useRef<TargetElement | null>(null);\n const overrideTargetRef = React.useRef<TargetElement | null>(null);\n const containerRef = React.useRef<HTMLElement | null>(null);\n const arrowRef = React.useRef<HTMLElement | null>(null);\n\n const { enabled = true } = options;\n const resolvePositioningOptions = usePositioningOptions(options);\n const updatePositionManager = React.useCallback(() => {\n if (managerRef.current) {\n managerRef.current.dispose();\n }\n managerRef.current = null;\n\n const target = overrideTargetRef.current ?? targetRef.current;\n\n if (enabled && canUseDOM() && target && containerRef.current) {\n managerRef.current = createPositionManager({\n container: containerRef.current,\n target,\n arrow: arrowRef.current,\n ...resolvePositioningOptions(containerRef.current, arrowRef.current),\n });\n }\n }, [enabled, resolvePositioningOptions]);\n\n const setOverrideTarget = useEventCallback((target: TargetElement | null) => {\n overrideTargetRef.current = target;\n updatePositionManager();\n });\n\n React.useImperativeHandle(\n options.positioningRef,\n () => ({\n updatePosition: () => managerRef.current?.updatePosition(),\n setTarget: (target: TargetElement) => {\n if (options.target && process.env.NODE_ENV !== 'production') {\n const err = new Error();\n // eslint-disable-next-line no-console\n console.warn('Imperative setTarget should not be used at the same time as target option');\n // eslint-disable-next-line no-console\n console.warn(err.stack);\n }\n\n setOverrideTarget(target);\n },\n }),\n [options.target, setOverrideTarget],\n );\n\n useIsomorphicLayoutEffect(() => {\n setOverrideTarget(options.target ?? null);\n }, [options.target, setOverrideTarget]);\n\n useIsomorphicLayoutEffect(() => {\n updatePositionManager();\n }, [updatePositionManager]);\n\n if (process.env.NODE_ENV !== 'production') {\n // This checked should run only in development mode\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (containerRef.current) {\n const contentNode = containerRef.current;\n const treeWalker = contentNode.ownerDocument?.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {\n acceptNode: hasAutofocusFilter,\n });\n\n while (treeWalker.nextNode()) {\n const node = treeWalker.currentNode;\n // eslint-disable-next-line no-console\n console.warn('<Popper>:', node);\n // eslint-disable-next-line no-console\n console.warn(\n [\n '<Popper>: ^ this node contains \"autoFocus\" prop on a React element. This can break the initial',\n 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills',\n '\"autoFocus\" behavior to solve inconsistencies between different browsers:',\n 'https://github.com/facebook/react/issues/11851#issuecomment-351787078',\n '\\n',\n 'However, \".focus()\" in this case occurs before any other React effects will be executed',\n '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really',\n 'want to use \"autoFocus\" please add \"position: fixed\" to styles of the element that is wrapped by',\n '\"Popper\".',\n `In general, it's not recommended to use \"autoFocus\" as it may break accessibility aspects:`,\n 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md',\n '\\n',\n 'We suggest to use the \"trapFocus\" prop on Fluent components or a catch \"ref\" and then use',\n '\"ref.current.focus\" in React.useEffect():',\n 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element',\n ].join(' '),\n );\n }\n }\n // We run this check once, no need to add deps here\n // TODO: Should be rework to handle options.enabled and contentRef updates\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n }\n\n const setTarget = useCallbackRef<TargetElement>(null, target => {\n if (targetRef.current !== target) {\n targetRef.current = target;\n updatePositionManager();\n }\n });\n\n const setContainer = useCallbackRef<HTMLElement | null>(null, container => {\n if (containerRef.current !== container) {\n containerRef.current = container;\n updatePositionManager();\n }\n });\n\n const setArrow = useCallbackRef<HTMLElement | null>(null, arrow => {\n if (arrowRef.current !== arrow) {\n arrowRef.current = arrow;\n updatePositionManager();\n }\n });\n\n // Let users use callback refs so they feel like 'normal' DOM refs\n return { targetRef: setTarget, containerRef: setContainer, arrowRef: setArrow };\n}\n\ninterface UsePositioningOptions extends PositioningProps, Pick<PositioningOptions, 'fallbackPositions' | 'pinned'> {\n /**\n * If false, does not position anything\n */\n enabled?: boolean;\n}\n\nfunction usePositioningOptions(options: PositioningOptions) {\n const {\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n flipBoundary,\n offset,\n overflowBoundary,\n pinned,\n position,\n unstable_disableTether: disableTether,\n positionFixed,\n overflowBoundaryPadding,\n fallbackPositions,\n } = options;\n\n const { dir } = useFluent();\n const isRtl = dir === 'rtl';\n const strategy: Strategy = positionFixed ? 'fixed' : 'absolute';\n\n return React.useCallback(\n (container: HTMLElement | null, arrow: HTMLElement | null) => {\n const hasScrollableElement = hasScrollParent(container);\n\n const middleware = [\n offset && offsetMiddleware(offset),\n coverTarget && coverTargetMiddleware(),\n !pinned && flipMiddleware({ container, flipBoundary, hasScrollableElement, isRtl, fallbackPositions }),\n shiftMiddleware({\n container,\n hasScrollableElement,\n overflowBoundary,\n disableTether,\n overflowBoundaryPadding,\n isRtl,\n }),\n autoSize && maxSizeMiddleware(autoSize, { container, overflowBoundary }),\n intersectingMiddleware(),\n arrow && arrowMiddleware({ element: arrow, padding: arrowPadding }),\n hideMiddleware({ strategy: 'referenceHidden' }),\n hideMiddleware({ strategy: 'escaped' }),\n ].filter(Boolean) as Middleware[];\n\n const placement = toFloatingUIPlacement(align, position, isRtl);\n\n return {\n placement,\n middleware,\n strategy,\n };\n },\n [\n align,\n arrowPadding,\n autoSize,\n coverTarget,\n disableTether,\n flipBoundary,\n isRtl,\n offset,\n overflowBoundary,\n pinned,\n position,\n strategy,\n overflowBoundaryPadding,\n fallbackPositions,\n ],\n );\n}\n"],"mappings":"AAAA,SAASA,IAAA,IAAQC,cAAc,EAAEC,KAAA,IAASC,eAAe,QAAQ;AAEjE,SAASC,kBAAA,IAAsBC,SAAS,QAAQ;AAChD,SAASC,SAAS,EAAEC,gBAAgB,EAAEC,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,cAAA,CAAe;MAAEwF,QAAA,EAAU;IAAU,GACtC,CAACK,MAAM,CAACC,OAAA;IAET,MAAMC,SAAA,GAAYrF,qBAAA,CAAsBgE,KAAA,EAAOM,QAAA,EAAUO,KAAA;IAEzD,OAAO;MACLQ,SAAA;MACAL,UAAA;MACAF;IACF;EACF,GACA,CACEd,KAAA,EACAC,YAAA,EACAC,QAAA,EACA3D,WAAA,EACAiE,aAAA,EACAL,YAAA,EACAU,KAAA,EACAlE,MAAA,EACAyD,gBAAA,EACAC,MAAA,EACAC,QAAA,EACAQ,QAAA,EACAJ,uBAAA,EACAC,iBAAA,CACD;AAEL"}
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { createVirtualElementFromClick } from "./createVirtualElementFromClick";
1
+ import * as React from 'react';
2
+ import { createVirtualElementFromClick } from './createVirtualElementFromClick';
3
3
  /**
4
4
  * @internal
5
5
  * A state hook that manages a popper virtual element from mouseevents.
@@ -22,9 +22,9 @@ export const usePositioningMouseTarget = initialState => {
22
22
  } else {
23
23
  mouseevent = event;
24
24
  }
25
- if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== "production") {
25
+ if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {
26
26
  // eslint-disable-next-line no-console
27
- console.error("usePositioningMouseTarget should only be used with MouseEvent");
27
+ console.error('usePositioningMouseTarget should only be used with MouseEvent');
28
28
  }
29
29
  const contextTarget = createVirtualElementFromClick(mouseevent);
30
30
  setVirtualElement(contextTarget);
@@ -1,22 +1,22 @@
1
- import { parseFloatingUIPlacement } from "./parseFloatingUIPlacement";
1
+ import { parseFloatingUIPlacement } from './parseFloatingUIPlacement';
2
2
  const getPositionMap = () => ({
3
- top: "above",
4
- bottom: "below",
5
- right: "after",
6
- left: "before"
3
+ top: 'above',
4
+ bottom: 'below',
5
+ right: 'after',
6
+ left: 'before'
7
7
  });
8
8
  // Floating UI automatically flips alignment
9
9
  // https://github.com/floating-ui/floating-ui/issues/1563
10
10
  const getAlignmentMap = position => {
11
- if (position === "above" || position === "below") {
11
+ if (position === 'above' || position === 'below') {
12
12
  return {
13
- start: "start",
14
- end: "end"
13
+ start: 'start',
14
+ end: 'end'
15
15
  };
16
16
  }
17
17
  return {
18
- start: "top",
19
- end: "bottom"
18
+ start: 'top',
19
+ end: 'bottom'
20
20
  };
21
21
  };
22
22
  /**
@@ -1,18 +1,18 @@
1
- import { getScrollParent } from "./getScrollParent";
1
+ import { getScrollParent } from './getScrollParent';
2
2
  /**
3
3
  * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
4
4
  */
5
5
  export function getBoundary(element, boundary) {
6
- if (boundary === "window") {
7
- return element?.ownerDocument.documentElement;
6
+ if (boundary === 'window') {
7
+ return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
8
8
  }
9
- if (boundary === "clippingParents") {
10
- return "clippingAncestors";
9
+ if (boundary === 'clippingParents') {
10
+ return 'clippingAncestors';
11
11
  }
12
- if (boundary === "scrollParent") {
12
+ if (boundary === 'scrollParent') {
13
13
  let boundariesNode = getScrollParent(element);
14
- if (boundariesNode.nodeName === "BODY") {
15
- boundariesNode = element?.ownerDocument.documentElement;
14
+ if (boundariesNode.nodeName === 'BODY') {
15
+ boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
16
16
  }
17
17
  return boundariesNode;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"sources":["../../src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } from '../types';\n\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */\nexport function getBoundary(element: HTMLElement | null, boundary?: Boundary): FloatingUIBoundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\n }\n\n if (boundary === 'clippingParents') {\n return 'clippingAncestors';\n }\n\n if (boundary === 'scrollParent') {\n let boundariesNode: HTMLElement | undefined = getScrollParent(element);\n\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = element?.ownerDocument!.documentElement;\n }\n\n return boundariesNode;\n }\n\n return boundary;\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ;AAGhC;;;AAGA,OAAO,SAASC,YAAYC,OAA2B,EAAEC,QAAmB,EAAkC;EAC5G,IAAIA,QAAA,KAAa,UAAU;IACzB,OAAOD,OAAA,EAASE,aAAA,CAAeC,eAAe;EAChD;EAEA,IAAIF,QAAA,KAAa,mBAAmB;IAClC,OAAO;EACT;EAEA,IAAIA,QAAA,KAAa,gBAAgB;IAC/B,IAAIG,cAAA,GAA0CN,eAAA,CAAgBE,OAAA;IAE9D,IAAII,cAAA,CAAeC,QAAQ,KAAK,QAAQ;MACtCD,cAAA,GAAiBJ,OAAA,EAASE,aAAA,CAAeC,eAAe;IAC1D;IAEA,OAAOC,cAAA;EACT;EAEA,OAAOH,QAAA;AACT"}
1
+ {"version":3,"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"sources":["../../src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } from '../types';\n\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */\nexport function getBoundary(element: HTMLElement | null, boundary?: Boundary): FloatingUIBoundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\n }\n\n if (boundary === 'clippingParents') {\n return 'clippingAncestors';\n }\n\n if (boundary === 'scrollParent') {\n let boundariesNode: HTMLElement | undefined = getScrollParent(element);\n\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = element?.ownerDocument!.documentElement;\n }\n\n return boundariesNode;\n }\n\n return boundary;\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ;AAGhC;;;AAGA,OAAO,SAASC,YAAYC,OAA2B,EAAEC,QAAmB,EAAkC;EAC5G,IAAIA,QAAA,KAAa,UAAU;IACzB,OAAOD,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASE,aAAa,CAAEC,eAAe;EAChD;EAEA,IAAIF,QAAA,KAAa,mBAAmB;IAClC,OAAO;EACT;EAEA,IAAIA,QAAA,KAAa,gBAAgB;IAC/B,IAAIG,cAAA,GAA0CN,eAAA,CAAgBE,OAAA;IAE9D,IAAII,cAAA,CAAeC,QAAQ,KAAK,QAAQ;MACtCD,cAAA,GAAiBJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASE,aAAa,CAAEC,eAAe;IAC1D;IAEA,OAAOC,cAAA;EACT;EAEA,OAAOH,QAAA;AACT"}
@@ -1,4 +1,4 @@
1
- import { fromFloatingUIPlacement } from "./fromFloatingUIPlacement";
1
+ import { fromFloatingUIPlacement } from './fromFloatingUIPlacement';
2
2
  /**
3
3
  * Shim to transform offset values from this library to Floating UI
4
4
  * @param rawOffset Offset from this library
@@ -8,7 +8,7 @@ export function getFloatingUIOffset(rawOffset) {
8
8
  if (!rawOffset) {
9
9
  return rawOffset;
10
10
  }
11
- if (typeof rawOffset === "number" || typeof rawOffset === "object") {
11
+ if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {
12
12
  return rawOffset;
13
13
  }
14
14
  return ({
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  var WorkTag;
3
3
  (function (WorkTag) {
4
4
  WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
@@ -32,12 +32,12 @@ export function getReactFiberFromNode(elm) {
32
32
  // React 16 uses "__reactInternalInstance$" prefix
33
33
  // React 17 uses "__reactFiber$" prefix
34
34
  // https://github.com/facebook/react/pull/18377
35
- if (k.indexOf("__reactInternalInstance$") === 0 || k.indexOf("__reactFiber$") === 0) {
35
+ if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
36
36
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
37
37
  // @ts-ignore
38
38
  return elm[k];
39
39
  }
40
40
  }
41
- throw new Error("getReactFiber(): Failed to find a React Fiber on a node");
41
+ throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
42
42
  }
43
43
  //# sourceMappingURL=getReactFiberFromNode.js.map
@@ -3,7 +3,7 @@
3
3
  * @param node - DOM node.
4
4
  * @returns - parent DOM node.
5
5
  */export const getParentNode = node => {
6
- if (node.nodeName === "HTML") {
6
+ if (node.nodeName === 'HTML') {
7
7
  return node;
8
8
  }
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -15,10 +15,11 @@
15
15
  * @returns - CSS styles.
16
16
  */
17
17
  const getStyleComputedProperty = node => {
18
+ var _node_ownerDocument;
18
19
  if (node.nodeType !== 1) {
19
20
  return {};
20
21
  }
21
- const window = node.ownerDocument?.defaultView;
22
+ const window = (_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.defaultView;
22
23
  return window.getComputedStyle(node, null);
23
24
  };
24
25
  /**
@@ -32,10 +33,10 @@ export const getScrollParent = node => {
32
33
  // eslint-disable-next-line
33
34
  if (!parentNode) return document.body;
34
35
  switch (parentNode.nodeName) {
35
- case "HTML":
36
- case "BODY":
36
+ case 'HTML':
37
+ case 'BODY':
37
38
  return parentNode.ownerDocument.body;
38
- case "#document":
39
+ case '#document':
39
40
  return parentNode.body;
40
41
  }
41
42
  // If any of the overflow props is defined for the node then we return it as the parent
@@ -50,7 +51,8 @@ export const getScrollParent = node => {
50
51
  return getScrollParent(parentNode);
51
52
  };
52
53
  export const hasScrollParent = node => {
54
+ var _scrollParentElement_ownerDocument;
53
55
  const scrollParentElement = getScrollParent(node);
54
- return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;
56
+ return scrollParentElement ? scrollParentElement !== ((_scrollParentElement_ownerDocument = scrollParentElement.ownerDocument) === null || _scrollParentElement_ownerDocument === void 0 ? void 0 : _scrollParentElement_ownerDocument.body) : false;
55
57
  };
56
58
  //# sourceMappingURL=getScrollParent.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getParentNode","node","nodeName","parentNode","host","getStyleComputedProperty","nodeType","window","ownerDocument","defaultView","getComputedStyle","getScrollParent","document","body","overflow","overflowX","overflowY","test","hasScrollParent","scrollParentElement"],"sources":["../../src/utils/getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\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X,aAAa,EAAEK,IAAA,GAAO,KAAK;AACtG"}
1
+ {"version":3,"names":["getParentNode","node","nodeName","parentNode","host","getStyleComputedProperty","_node_ownerDocument","nodeType","window","ownerDocument","defaultView","getComputedStyle","getScrollParent","document","body","overflow","overflowX","overflowY","test","hasScrollParent","_scrollParentElement_ownerDocument","scrollParentElement"],"sources":["../../src/utils/getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"mapp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AAA,MAAwB,CAAAD,kCAAA,GAAAC,mBAAA,CAAoBZ,aAAa,cAAjCW,kCAAA,uBAAAA,kCAAA,CAAmCN,IAAI,CAAD,GAAI,KAAK;AACtG"}
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // Dev utils to detect if nodes have "autoFocus" props.
3
3
  //
4
- import { getReactFiberFromNode } from "./getReactFiberFromNode";
4
+ import { getReactFiberFromNode } from './getReactFiberFromNode';
5
5
  /**
6
6
  * Detects if a passed HTML node has "autoFocus" prop on a React's fiber. Is needed as React handles autofocus behavior
7
7
  * in React DOM and will not pass "autoFocus" to an actual HTML.
@@ -10,9 +10,10 @@ import { getReactFiberFromNode } from "./getReactFiberFromNode";
10
10
  */
11
11
  function hasAutofocusProp(node) {
12
12
  // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
13
- const isAutoFocusableElement = node.nodeName === "BUTTON" || node.nodeName === "INPUT" || node.nodeName === "SELECT" || node.nodeName === "TEXTAREA";
13
+ const isAutoFocusableElement = node.nodeName === 'BUTTON' || node.nodeName === 'INPUT' || node.nodeName === 'SELECT' || node.nodeName === 'TEXTAREA';
14
14
  if (isAutoFocusableElement) {
15
- return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;
15
+ var _getReactFiberFromNode;
16
+ return !!((_getReactFiberFromNode = getReactFiberFromNode(node)) === null || _getReactFiberFromNode === void 0 ? void 0 : _getReactFiberFromNode.pendingProps.autoFocus);
16
17
  }
17
18
  return false;
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"names":["getReactFiberFromNode","hasAutofocusProp","node","isAutoFocusableElement","nodeName","pendingProps","autoFocus","hasAutofocusFilter","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"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"],"mappings":"AAAA;AACA;AACA;AAEA,SAASA,qBAAqB,QAAQ;AAEtC;;;;;;AAMA,SAASC,iBAAiBC,IAAU,EAAW;EAC7C;EACA,MAAMC,sBAAA,GACJD,IAAA,CAAKE,QAAQ,KAAK,YAClBF,IAAA,CAAKE,QAAQ,KAAK,WAClBF,IAAA,CAAKE,QAAQ,KAAK,YAClBF,IAAA,CAAKE,QAAQ,KAAK;EAEpB,IAAID,sBAAA,EAAwB;IAC1B,OAAO,CAAC,CAACH,qBAAA,CAAsBE,IAAA,GAAOG,YAAA,CAAaC,SAAS;EAC9D;EAEA,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,mBAAmBL,IAAU,EAAE;EAC7C,OAAOD,gBAAA,CAAiBC,IAAA,IAAQM,UAAA,CAAWC,aAAa,GAAGD,UAAA,CAAWE,WAAW;AACnF"}
1
+ {"version":3,"names":["getReactFiberFromNode","hasAutofocusProp","node","isAutoFocusableElement","nodeName","_getReactFiberFromNode","pendingProps","autoFocus","hasAutofocusFilter","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"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"],"mappings":"AAAA;AACA;AACA;AAEA,SAASA,qBAAqB,QAAQ;AAEtC;;;;;;AAMA,SAASC,iBAAiBC,IAAU,EAAW;EAC7C;EACA,MAAMC,sBAAA,GACJD,IAAA,CAAKE,QAAQ,KAAK,YAClBF,IAAA,CAAKE,QAAQ,KAAK,WAClBF,IAAA,CAAKE,QAAQ,KAAK,YAClBF,IAAA,CAAKE,QAAQ,KAAK;EAEpB,IAAID,sBAAA,EAAwB;QACjBE,sBAAA;IAAT,OAAO,CAAC,EAAC,CAAAA,sBAAA,GAAAL,qBAAA,CAAsBE,IAAA,eAAtBG,sBAAA,uBAAAA,sBAAA,CAA6BC,YAAA,CAAaC,SAAS;EAC9D;EAEA,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,mBAAmBN,IAAU,EAAE;EAC7C,OAAOD,gBAAA,CAAiBC,IAAA,IAAQO,UAAA,CAAWC,aAAa,GAAGD,UAAA,CAAWE,WAAW;AACnF"}
@@ -1,16 +1,16 @@
1
- export * from "./parseFloatingUIPlacement";
2
- export * from "./getBoundary";
3
- export * from "./getReactFiberFromNode";
4
- export * from "./getScrollParent";
5
- export * from "./mergeArrowOffset";
6
- export * from "./toFloatingUIPadding";
7
- export * from "./toFloatingUIPlacement";
8
- export * from "./fromFloatingUIPlacement";
9
- export * from "./resolvePositioningShorthand";
10
- export * from "./useCallbackRef";
11
- export * from "./debounce";
12
- export * from "./toggleScrollListener";
13
- export * from "./hasAutoFocusFilter";
14
- export * from "./writeArrowUpdates";
15
- export * from "./writeContainerupdates";
1
+ export * from './parseFloatingUIPlacement';
2
+ export * from './getBoundary';
3
+ export * from './getReactFiberFromNode';
4
+ export * from './getScrollParent';
5
+ export * from './mergeArrowOffset';
6
+ export * from './toFloatingUIPadding';
7
+ export * from './toFloatingUIPlacement';
8
+ export * from './fromFloatingUIPlacement';
9
+ export * from './resolvePositioningShorthand';
10
+ export * from './useCallbackRef';
11
+ export * from './debounce';
12
+ export * from './toggleScrollListener';
13
+ export * from './hasAutoFocusFilter';
14
+ export * from './writeArrowUpdates';
15
+ export * from './writeContainerupdates';
16
16
  //# sourceMappingURL=index.js.map
@@ -7,13 +7,13 @@
7
7
  * @param arrowHeight - The height of the arrow in px
8
8
  * @returns User offset augmented with arrow height
9
9
  */export function mergeArrowOffset(userOffset, arrowHeight) {
10
- if (typeof userOffset === "number") {
10
+ if (typeof userOffset === 'number') {
11
11
  return addArrowOffset(userOffset, arrowHeight);
12
12
  }
13
- if (typeof userOffset === "object" && userOffset !== null) {
13
+ if (typeof userOffset === 'object' && userOffset !== null) {
14
14
  return addArrowOffset(userOffset, arrowHeight);
15
15
  }
16
- if (typeof userOffset === "function") {
16
+ if (typeof userOffset === 'function') {
17
17
  return offsetParams => {
18
18
  const offset = userOffset(offsetParams);
19
19
  return addArrowOffset(offset, arrowHeight);
@@ -24,14 +24,15 @@
24
24
  };
25
25
  }
26
26
  const addArrowOffset = (offset, arrowHeight) => {
27
- if (typeof offset === "number") {
27
+ if (typeof offset === 'number') {
28
28
  return {
29
29
  mainAxis: offset + arrowHeight
30
30
  };
31
31
  }
32
+ var _offset_mainAxis;
32
33
  return {
33
34
  ...offset,
34
- mainAxis: (offset.mainAxis ?? 0) + arrowHeight
35
+ mainAxis: ((_offset_mainAxis = offset.mainAxis) !== null && _offset_mainAxis !== void 0 ? _offset_mainAxis : 0) + arrowHeight
35
36
  };
36
37
  };
37
38
  //# sourceMappingURL=mergeArrowOffset.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis"],"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"],"mappings":"AAEA;;;;;;;;GASA,OAAO,SAASA,iBAAiBC,UAAqC,EAAEC,WAAmB,EAAU;EACnG,IAAI,OAAOD,UAAA,KAAe,UAAU;IAClC,OAAOE,cAAA,CAAeF,UAAA,EAAYC,WAAA;EACpC;EAEA,IAAI,OAAOD,UAAA,KAAe,YAAYA,UAAA,KAAe,IAAI,EAAE;IACzD,OAAOE,cAAA,CAAeF,UAAA,EAAYC,WAAA;EACpC;EAEA,IAAI,OAAOD,UAAA,KAAe,YAAY;IACpC,OAAOG,YAAA,IAAgB;MACrB,MAAMC,MAAA,GAASJ,UAAA,CAAWG,YAAA;MAC1B,OAAOD,cAAA,CAAeE,MAAA,EAAQH,WAAA;IAChC;EACF;EAEA,OAAO;IAAEI,QAAA,EAAUJ;EAAY;AACjC;AAEA,MAAMC,cAAA,GAAiBA,CAACE,MAAA,EAA+BH,WAAA,KAAsC;EAC3F,IAAI,OAAOG,MAAA,KAAW,UAAU;IAC9B,OAAO;MAAEC,QAAA,EAAUD,MAAA,GAASH;IAAY;EAC1C;EAEA,OAAO;IAAE,GAAGG,MAAM;IAAEC,QAAA,EAAU,CAACD,MAAA,CAAOC,QAAQ,IAAI,KAAKJ;EAAY;AACrE"}
1
+ {"version":3,"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","_offset_mainAxis"],"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"],"mappings":"AAEA;;;;;;;;GASA,OAAO,SAASA,iBAAiBC,UAAqC,EAAEC,WAAmB,EAAU;EACnG,IAAI,OAAOD,UAAA,KAAe,UAAU;IAClC,OAAOE,cAAA,CAAeF,UAAA,EAAYC,WAAA;EACpC;EAEA,IAAI,OAAOD,UAAA,KAAe,YAAYA,UAAA,KAAe,IAAI,EAAE;IACzD,OAAOE,cAAA,CAAeF,UAAA,EAAYC,WAAA;EACpC;EAEA,IAAI,OAAOD,UAAA,KAAe,YAAY;IACpC,OAAOG,YAAA,IAAgB;MACrB,MAAMC,MAAA,GAASJ,UAAA,CAAWG,YAAA;MAC1B,OAAOD,cAAA,CAAeE,MAAA,EAAQH,WAAA;IAChC;EACF;EAEA,OAAO;IAAEI,QAAA,EAAUJ;EAAY;AACjC;AAEA,MAAMC,cAAA,GAAiBA,CAACE,MAAA,EAA+BH,WAAA,KAAsC;EAC3F,IAAI,OAAOG,MAAA,KAAW,UAAU;IAC9B,OAAO;MAAEC,QAAA,EAAUD,MAAA,GAASH;IAAY;EAC1C;MAE+BK,gBAAA;EAA/B,OAAO;IAAE,GAAGF,MAAM;IAAEC,QAAA,EAAU,CAAC,CAAAC,gBAAA,GAAAF,MAAA,CAAOC,QAAQ,cAAfC,gBAAA,cAAAA,gBAAA,GAAmB,CAAC,IAAIL;EAAY;AACrE"}
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @returns side and alignment components of the placement
6
6
  */export function parseFloatingUIPlacement(placement) {
7
- const tokens = placement.split("-");
7
+ const tokens = placement.split('-');
8
8
  return {
9
9
  side: tokens[0],
10
10
  alignment: tokens[1]
@@ -1,59 +1,59 @@
1
1
  // Look up table for shorthand to avoid parsing strings
2
2
  const shorthandLookup = {
3
3
  above: {
4
- position: "above",
5
- align: "center"
4
+ position: 'above',
5
+ align: 'center'
6
6
  },
7
- "above-start": {
8
- position: "above",
9
- align: "start"
7
+ 'above-start': {
8
+ position: 'above',
9
+ align: 'start'
10
10
  },
11
- "above-end": {
12
- position: "above",
13
- align: "end"
11
+ 'above-end': {
12
+ position: 'above',
13
+ align: 'end'
14
14
  },
15
15
  below: {
16
- position: "below",
17
- align: "center"
16
+ position: 'below',
17
+ align: 'center'
18
18
  },
19
- "below-start": {
20
- position: "below",
21
- align: "start"
19
+ 'below-start': {
20
+ position: 'below',
21
+ align: 'start'
22
22
  },
23
- "below-end": {
24
- position: "below",
25
- align: "end"
23
+ 'below-end': {
24
+ position: 'below',
25
+ align: 'end'
26
26
  },
27
27
  before: {
28
- position: "before",
29
- align: "center"
28
+ position: 'before',
29
+ align: 'center'
30
30
  },
31
- "before-top": {
32
- position: "before",
33
- align: "top"
31
+ 'before-top': {
32
+ position: 'before',
33
+ align: 'top'
34
34
  },
35
- "before-bottom": {
36
- position: "before",
37
- align: "bottom"
35
+ 'before-bottom': {
36
+ position: 'before',
37
+ align: 'bottom'
38
38
  },
39
39
  after: {
40
- position: "after",
41
- align: "center"
40
+ position: 'after',
41
+ align: 'center'
42
42
  },
43
- "after-top": {
44
- position: "after",
45
- align: "top"
43
+ 'after-top': {
44
+ position: 'after',
45
+ align: 'top'
46
46
  },
47
- "after-bottom": {
48
- position: "after",
49
- align: "bottom"
47
+ 'after-bottom': {
48
+ position: 'after',
49
+ align: 'bottom'
50
50
  }
51
51
  };
52
52
  export function resolvePositioningShorthand(shorthand) {
53
53
  if (shorthand === undefined || shorthand === null) {
54
54
  return {};
55
55
  }
56
- if (typeof shorthand === "string") {
56
+ if (typeof shorthand === 'string') {
57
57
  return shorthandLookup[shorthand];
58
58
  }
59
59
  return shorthand;