@fluentui/react-positioning 0.0.0-nightly-20221228-0425.1 → 0.0.0-nightly-20221230-0421.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 (113) hide show
  1. package/CHANGELOG.json +9 -9
  2. package/CHANGELOG.md +7 -7
  3. package/lib/createArrowStyles.js +0 -2
  4. package/lib/createArrowStyles.js.map +1 -1
  5. package/lib/createPositionManager.js +4 -17
  6. package/lib/createPositionManager.js.map +1 -1
  7. package/lib/createVirtualElementFromClick.js +0 -2
  8. package/lib/createVirtualElementFromClick.js.map +1 -1
  9. package/lib/middleware/coverTarget.js +0 -5
  10. package/lib/middleware/coverTarget.js.map +1 -1
  11. package/lib/middleware/flip.js +2 -1
  12. package/lib/middleware/flip.js.map +1 -1
  13. package/lib/middleware/intersecting.js.map +1 -1
  14. package/lib/middleware/maxSize.js +0 -3
  15. package/lib/middleware/maxSize.js.map +1 -1
  16. package/lib/middleware/offset.js +0 -1
  17. package/lib/middleware/offset.js.map +1 -1
  18. package/lib/middleware/shift.js +2 -2
  19. package/lib/middleware/shift.js.map +1 -1
  20. package/lib/usePositioning.js +12 -24
  21. package/lib/usePositioning.js.map +1 -1
  22. package/lib/usePositioningMouseTarget.js +0 -7
  23. package/lib/usePositioningMouseTarget.js.map +1 -1
  24. package/lib/utils/debounce.js +0 -1
  25. package/lib/utils/debounce.js.map +1 -1
  26. package/lib/utils/fromFloatingUIPlacement.js +2 -7
  27. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  28. package/lib/utils/getBoundary.js +0 -6
  29. package/lib/utils/getBoundary.js.map +1 -1
  30. package/lib/utils/getFloatingUIOffset.js +0 -3
  31. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  32. package/lib/utils/getReactFiberFromNode.js +0 -4
  33. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  34. package/lib/utils/getScrollParent.js +6 -18
  35. package/lib/utils/getScrollParent.js.map +1 -1
  36. package/lib/utils/hasAutoFocusFilter.js +2 -7
  37. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  38. package/lib/utils/mergeArrowOffset.js +2 -7
  39. package/lib/utils/mergeArrowOffset.js.map +1 -1
  40. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  41. package/lib/utils/resolvePositioningShorthand.js +0 -2
  42. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  43. package/lib/utils/toFloatingUIPlacement.js +2 -8
  44. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  45. package/lib/utils/toggleScrollListener.js +0 -3
  46. package/lib/utils/toggleScrollListener.js.map +1 -1
  47. package/lib/utils/useCallbackRef.js +2 -8
  48. package/lib/utils/useCallbackRef.js.map +1 -1
  49. package/lib/utils/writeArrowUpdates.js +0 -2
  50. package/lib/utils/writeArrowUpdates.js.map +1 -1
  51. package/lib/utils/writeContainerupdates.js +0 -10
  52. package/lib/utils/writeContainerupdates.js.map +1 -1
  53. package/lib-commonjs/constants.js.map +1 -1
  54. package/lib-commonjs/createArrowStyles.js +0 -7
  55. package/lib-commonjs/createArrowStyles.js.map +1 -1
  56. package/lib-commonjs/createPositionManager.js +4 -21
  57. package/lib-commonjs/createPositionManager.js.map +1 -1
  58. package/lib-commonjs/createVirtualElementFromClick.js +0 -4
  59. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  60. package/lib-commonjs/index.js +0 -10
  61. package/lib-commonjs/index.js.map +1 -1
  62. package/lib-commonjs/middleware/coverTarget.js +0 -8
  63. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  64. package/lib-commonjs/middleware/flip.js +2 -5
  65. package/lib-commonjs/middleware/flip.js.map +1 -1
  66. package/lib-commonjs/middleware/index.js +0 -7
  67. package/lib-commonjs/middleware/index.js.map +1 -1
  68. package/lib-commonjs/middleware/intersecting.js +0 -3
  69. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  70. package/lib-commonjs/middleware/maxSize.js +0 -7
  71. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  72. package/lib-commonjs/middleware/offset.js +0 -5
  73. package/lib-commonjs/middleware/offset.js.map +1 -1
  74. package/lib-commonjs/middleware/shift.js +2 -6
  75. package/lib-commonjs/middleware/shift.js.map +1 -1
  76. package/lib-commonjs/types.js.map +1 -1
  77. package/lib-commonjs/usePositioning.js +12 -33
  78. package/lib-commonjs/usePositioning.js.map +1 -1
  79. package/lib-commonjs/usePositioningMouseTarget.js +0 -11
  80. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  81. package/lib-commonjs/utils/debounce.js +0 -3
  82. package/lib-commonjs/utils/debounce.js.map +1 -1
  83. package/lib-commonjs/utils/fromFloatingUIPlacement.js +2 -9
  84. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  85. package/lib-commonjs/utils/getBoundary.js +0 -9
  86. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  87. package/lib-commonjs/utils/getFloatingUIOffset.js +0 -6
  88. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  89. package/lib-commonjs/utils/getReactFiberFromNode.js +0 -5
  90. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  91. package/lib-commonjs/utils/getScrollParent.js +6 -23
  92. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  93. package/lib-commonjs/utils/hasAutoFocusFilter.js +5 -12
  94. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  95. package/lib-commonjs/utils/index.js +0 -15
  96. package/lib-commonjs/utils/index.js.map +1 -1
  97. package/lib-commonjs/utils/mergeArrowOffset.js +2 -9
  98. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  99. package/lib-commonjs/utils/parseFloatingUIPlacement.js +0 -2
  100. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  101. package/lib-commonjs/utils/resolvePositioningShorthand.js +2 -6
  102. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  103. package/lib-commonjs/utils/toFloatingUIPlacement.js +2 -10
  104. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  105. package/lib-commonjs/utils/toggleScrollListener.js +0 -6
  106. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  107. package/lib-commonjs/utils/useCallbackRef.js +2 -12
  108. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  109. package/lib-commonjs/utils/writeArrowUpdates.js +0 -4
  110. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  111. package/lib-commonjs/utils/writeContainerupdates.js +0 -13
  112. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  113. package/package.json +5 -5
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-positioning",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 28 Dec 2022 04:33:30 GMT",
6
- "tag": "@fluentui/react-positioning_v0.0.0-nightly-20221228-0425.1",
7
- "version": "0.0.0-nightly-20221228-0425.1",
5
+ "date": "Fri, 30 Dec 2022 04:28:25 GMT",
6
+ "tag": "@fluentui/react-positioning_v0.0.0-nightly-20221230-0421.1",
7
+ "version": "0.0.0-nightly-20221230-0421.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,20 +16,20 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-positioning",
19
- "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20221228-0425.1",
20
- "commit": "3ee907a253f14ff8e15878e0ec1355e2fbfcef69"
19
+ "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20221230-0421.1",
20
+ "commit": "a38762f3d85d92ff20fe07b067fe74c91defe343"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-positioning",
25
- "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20221228-0425.1",
26
- "commit": "3ee907a253f14ff8e15878e0ec1355e2fbfcef69"
25
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20221230-0421.1",
26
+ "commit": "a38762f3d85d92ff20fe07b067fe74c91defe343"
27
27
  },
28
28
  {
29
29
  "author": "beachball",
30
30
  "package": "@fluentui/react-positioning",
31
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20221228-0425.1",
32
- "commit": "3ee907a253f14ff8e15878e0ec1355e2fbfcef69"
31
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20221230-0421.1",
32
+ "commit": "a38762f3d85d92ff20fe07b067fe74c91defe343"
33
33
  }
34
34
  ]
35
35
  }
package/CHANGELOG.md CHANGED
@@ -1,20 +1,20 @@
1
1
  # Change Log - @fluentui/react-positioning
2
2
 
3
- This log was last generated on Wed, 28 Dec 2022 04:33:30 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 30 Dec 2022 04:28:25 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20221228-0425.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightly-20221228-0425.1)
7
+ ## [0.0.0-nightly-20221230-0421.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v0.0.0-nightly-20221230-0421.1)
8
8
 
9
- Wed, 28 Dec 2022 04:33:30 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.3.5..@fluentui/react-positioning_v0.0.0-nightly-20221228-0425.1)
9
+ Fri, 30 Dec 2022 04:28:25 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.3.5..@fluentui/react-positioning_v0.0.0-nightly-20221230-0421.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20221228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/3ee907a253f14ff8e15878e0ec1355e2fbfcef69) by beachball)
16
- - Bump @fluentui/react-theme to v0.0.0-nightly-20221228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/3ee907a253f14ff8e15878e0ec1355e2fbfcef69) by beachball)
17
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20221228-0425.1 ([commit](https://github.com/microsoft/fluentui/commit/3ee907a253f14ff8e15878e0ec1355e2fbfcef69) by beachball)
15
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20221230-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/a38762f3d85d92ff20fe07b067fe74c91defe343) by beachball)
16
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20221230-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/a38762f3d85d92ff20fe07b067fe74c91defe343) by beachball)
17
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20221230-0421.1 ([commit](https://github.com/microsoft/fluentui/commit/a38762f3d85d92ff20fe07b067fe74c91defe343) by beachball)
18
18
 
19
19
  ## [9.3.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.3.5)
20
20
 
@@ -23,7 +23,6 @@ import { tokens } from '@fluentui/react-theme';
23
23
  * )
24
24
  * ```
25
25
  */
26
-
27
26
  export function createArrowStyles(options) {
28
27
  const {
29
28
  arrowHeight,
@@ -76,7 +75,6 @@ export function createArrowStyles(options) {
76
75
  * Use this when you need to create classes for several different arrow sizes. If you only need a
77
76
  * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.
78
77
  */
79
-
80
78
  export function createArrowHeightStyles(arrowHeight) {
81
79
  // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.
82
80
  // Multiply the triangle's height by sqrt(2) to get length of its edges.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/react-components/react-positioning/src/createArrowStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,QAA2B,gBAA3B;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAsCA;;;;;;;;;;;;;;;;;;;;;;AAsBG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WAAW,IAAzC;EACA,OAAO;IAAE,KAAK,EAAE,UAAT;IAAqB,MAAM,EAAE;EAA7B,CAAP;AACD","sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\n * @internal\n * Options parameter for the createArrowStyles function\n */\nexport type CreateArrowStylesOptions = {\n /**\n * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.\n *\n * This can be undefined to leave out the arrow size styles. You must then add styles created by\n * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.\n */\n arrowHeight: number | undefined;\n\n /**\n * The borderWidth of the arrow. Should be the same borderWidth as the parent element.\n *\n * @defaultvalue 1px\n */\n borderWidth?: GriffelStyle['borderBottomWidth'];\n\n /**\n * The borderStyle for the arrow. Should be the same borderStyle as the parent element.\n *\n * @defaultvalue solid\n */\n borderStyle?: GriffelStyle['borderBottomStyle'];\n\n /**\n * The borderColor of the arrow. Should be the same borderColor as the parent element.\n *\n * @defaultvalue tokens.colorTransparentStroke\n */\n borderColor?: GriffelStyle['borderBottomColor'];\n};\n\n/**\n * @internal\n * Helper that creates a makeStyles rule for an arrow element.\n * For runtime arrow size toggling simply create extra classnames to apply to the arrow element\n *\n * ```ts\n * makeStyles({\n * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),\n *\n * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),\n * mediumArrow: createArrowHeightStyles(4),\n * smallArrow: createArrowHeightStyles(2),\n * })\n * ...\n *\n * state.arrowWithSize.className = styles.arrowWithSize;\n * state.arrowWithoutSize.className = mergeClasses(\n * styles.arrowWithoutSize,\n * state.smallArrow && styles.smallArrow,\n * state.mediumArrow && styles.mediumArrow,\n * )\n * ```\n */\nexport function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle {\n const {\n arrowHeight,\n borderWidth = '1px',\n borderStyle = 'solid',\n borderColor = tokens.colorTransparentStroke,\n } = options;\n\n return {\n position: 'absolute',\n backgroundColor: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ...(arrowHeight && createArrowHeightStyles(arrowHeight)),\n\n '::before': {\n content: '\"\"',\n visibility: 'visible',\n position: 'absolute',\n boxSizing: 'border-box',\n width: 'inherit',\n height: 'inherit',\n backgroundColor: 'inherit',\n ...shorthands.borderRight(\n `${borderWidth} /* @noflip */`,\n `${borderStyle} /* @noflip */`,\n `${borderColor} /* @noflip */`,\n ),\n ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),\n borderBottomRightRadius: tokens.borderRadiusSmall,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': {\n bottom: `-${borderWidth}`,\n '--angle': '0',\n },\n ':global([data-popper-placement^=\"right\"])': {\n left: `-${borderWidth} /* @noflip */`,\n '--angle': '90deg',\n },\n ':global([data-popper-placement^=\"bottom\"])': {\n top: `-${borderWidth}`,\n '--angle': '180deg',\n },\n ':global([data-popper-placement^=\"left\"])': {\n right: `-${borderWidth} /* @noflip */`,\n '--angle': '270deg',\n },\n };\n}\n\n/**\n * @internal\n * Creates CSS styles to size the arrow created by createArrowStyles to the given height.\n *\n * Use this when you need to create classes for several different arrow sizes. If you only need a\n * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.\n */\nexport function createArrowHeightStyles(arrowHeight: number) {\n // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.\n // Multiply the triangle's height by sqrt(2) to get length of its edges.\n const edgeLength = `${1.414 * arrowHeight}px`;\n return { width: edgeLength, height: edgeLength };\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAsC9C;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAM,SAAUC,iBAAiB,CAACC,OAAiC;EACjE,MAAM;IACJC,WAA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AAI;EAC7C,OAAO;IAAEY,KAAK,EAAEW,UAAU;IAAEV,MAAM,EAAEU;EAAU,CAAE;AAClD","names":["shorthands","tokens","createArrowStyles","options","arrowHeight","borderWidth","borderStyle","borderColor","colorTransparentStroke","position","backgroundColor","visibility","zIndex","createArrowHeightStyles","content","boxSizing","width","height","borderRight","borderBottom","borderBottomRightRadius","borderRadiusSmall","transform","bottom","left","top","right","edgeLength"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-positioning/src/createArrowStyles.ts"],"sourcesContent":["import { shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { GriffelStyle } from '@griffel/react';\n\n/**\n * @internal\n * Options parameter for the createArrowStyles function\n */\nexport type CreateArrowStylesOptions = {\n /**\n * The height of the arrow from the base to the tip, in px. The base width of the arrow is always twice its height.\n *\n * This can be undefined to leave out the arrow size styles. You must then add styles created by\n * createArrowHeightStyles to set the arrow's size correctly. This can be useful if the arrow can be different sizes.\n */\n arrowHeight: number | undefined;\n\n /**\n * The borderWidth of the arrow. Should be the same borderWidth as the parent element.\n *\n * @defaultvalue 1px\n */\n borderWidth?: GriffelStyle['borderBottomWidth'];\n\n /**\n * The borderStyle for the arrow. Should be the same borderStyle as the parent element.\n *\n * @defaultvalue solid\n */\n borderStyle?: GriffelStyle['borderBottomStyle'];\n\n /**\n * The borderColor of the arrow. Should be the same borderColor as the parent element.\n *\n * @defaultvalue tokens.colorTransparentStroke\n */\n borderColor?: GriffelStyle['borderBottomColor'];\n};\n\n/**\n * @internal\n * Helper that creates a makeStyles rule for an arrow element.\n * For runtime arrow size toggling simply create extra classnames to apply to the arrow element\n *\n * ```ts\n * makeStyles({\n * arrowWithSize: createArrowStyles({ arrowHeight: 6 }),\n *\n * arrowWithoutSize: createArrowStyles({ arrowHeight: undefined }),\n * mediumArrow: createArrowHeightStyles(4),\n * smallArrow: createArrowHeightStyles(2),\n * })\n * ...\n *\n * state.arrowWithSize.className = styles.arrowWithSize;\n * state.arrowWithoutSize.className = mergeClasses(\n * styles.arrowWithoutSize,\n * state.smallArrow && styles.smallArrow,\n * state.mediumArrow && styles.mediumArrow,\n * )\n * ```\n */\nexport function createArrowStyles(options: CreateArrowStylesOptions): GriffelStyle {\n const {\n arrowHeight,\n borderWidth = '1px',\n borderStyle = 'solid',\n borderColor = tokens.colorTransparentStroke,\n } = options;\n\n return {\n position: 'absolute',\n backgroundColor: 'inherit',\n visibility: 'hidden',\n zIndex: -1,\n\n ...(arrowHeight && createArrowHeightStyles(arrowHeight)),\n\n '::before': {\n content: '\"\"',\n visibility: 'visible',\n position: 'absolute',\n boxSizing: 'border-box',\n width: 'inherit',\n height: 'inherit',\n backgroundColor: 'inherit',\n ...shorthands.borderRight(\n `${borderWidth} /* @noflip */`,\n `${borderStyle} /* @noflip */`,\n `${borderColor} /* @noflip */`,\n ),\n ...shorthands.borderBottom(borderWidth, borderStyle, borderColor),\n borderBottomRightRadius: tokens.borderRadiusSmall,\n transform: 'rotate(var(--angle)) translate(0, 50%) rotate(45deg)',\n },\n\n // Popper sets data-popper-placement on the root element, which is used to align the arrow\n ':global([data-popper-placement^=\"top\"])': {\n bottom: `-${borderWidth}`,\n '--angle': '0',\n },\n ':global([data-popper-placement^=\"right\"])': {\n left: `-${borderWidth} /* @noflip */`,\n '--angle': '90deg',\n },\n ':global([data-popper-placement^=\"bottom\"])': {\n top: `-${borderWidth}`,\n '--angle': '180deg',\n },\n ':global([data-popper-placement^=\"left\"])': {\n right: `-${borderWidth} /* @noflip */`,\n '--angle': '270deg',\n },\n };\n}\n\n/**\n * @internal\n * Creates CSS styles to size the arrow created by createArrowStyles to the given height.\n *\n * Use this when you need to create classes for several different arrow sizes. If you only need a\n * constant arrow size, you can pass the `arrowHeight` param to createArrowStyles instead.\n */\nexport function createArrowHeightStyles(arrowHeight: number) {\n // The arrow is a square rotated 45 degrees to have its bottom and right edges form a right triangle.\n // Multiply the triangle's height by sqrt(2) to get length of its edges.\n const edgeLength = `${1.414 * arrowHeight}px`;\n return { width: edgeLength, height: edgeLength };\n}\n"]}
@@ -4,7 +4,6 @@ import { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } f
4
4
  * @internal
5
5
  * @returns manager that handles positioning out of the react lifecycle
6
6
  */
7
-
8
7
  export function createPositionManager(options) {
9
8
  const {
10
9
  container,
@@ -14,40 +13,34 @@ export function createPositionManager(options) {
14
13
  middleware,
15
14
  placement
16
15
  } = options;
17
-
18
16
  if (!target || !container) {
19
17
  return {
20
18
  updatePosition: () => undefined,
21
19
  dispose: () => undefined
22
20
  };
23
21
  }
24
-
25
22
  let isFirstUpdate = true;
26
23
  const scrollParents = new Set();
27
- const targetWindow = container.ownerDocument.defaultView; // When the container is first resolved, set position `fixed` to avoid scroll jumps.
24
+ const targetWindow = container.ownerDocument.defaultView;
25
+ // When the container is first resolved, set position `fixed` to avoid scroll jumps.
28
26
  // Without this scroll jumps can occur when the element is rendered initially and receives focus
29
-
30
27
  Object.assign(container.style, {
31
28
  position: 'fixed',
32
29
  left: 0,
33
30
  top: 0,
34
31
  margin: 0
35
32
  });
36
-
37
33
  let forceUpdate = () => {
38
34
  if (isFirstUpdate) {
39
35
  scrollParents.add(getScrollParent(container));
40
-
41
36
  if (target instanceof HTMLElement) {
42
37
  scrollParents.add(getScrollParent(target));
43
38
  }
44
-
45
39
  scrollParents.forEach(scrollParent => {
46
40
  scrollParent.addEventListener('scroll', updatePosition);
47
41
  });
48
42
  isFirstUpdate = false;
49
43
  }
50
-
51
44
  Object.assign(container.style, {
52
45
  position: strategy
53
46
  });
@@ -90,30 +83,24 @@ export function createPositionManager(options) {
90
83
  }
91
84
  });
92
85
  };
93
-
94
86
  const updatePosition = debounce(() => forceUpdate());
95
-
96
87
  const dispose = () => {
97
88
  // debounced update can still occur afterwards
98
89
  // so destroy the reference to forceUpdate
99
90
  forceUpdate = () => null;
100
-
101
91
  if (targetWindow) {
102
92
  targetWindow.removeEventListener('scroll', updatePosition);
103
93
  targetWindow.removeEventListener('resize', updatePosition);
104
94
  }
105
-
106
95
  scrollParents.forEach(scrollParent => {
107
96
  scrollParent.removeEventListener('scroll', updatePosition);
108
97
  });
109
98
  };
110
-
111
99
  if (targetWindow) {
112
100
  targetWindow.addEventListener('scroll', updatePosition);
113
101
  targetWindow.addEventListener('resize', updatePosition);
114
- } // Update the position on initialization
115
-
116
-
102
+ }
103
+ // Update the position on initialization
117
104
  updatePosition();
118
105
  return {
119
106
  updatePosition,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/react-components/react-positioning/src/createPositionManager.ts"],"names":[],"mappings":"AAAA,SAAS,eAAT,QAAgC,kBAAhC;AAGA,SAAS,QAAT,EAAmB,iBAAnB,EAAsC,qBAAtC,EAA6D,eAA7D,QAAoF,SAApF;AA8BA;;;AAGG;;AACH,OAAM,SAAU,qBAAV,CAAgC,OAAhC,EAA+D;EACnE,MAAM;IAAE,SAAF;IAAa,MAAb;IAAqB,KAArB;IAA4B,QAA5B;IAAsC,UAAtC;IAAkD;EAAlD,IAAgE,OAAtE;;EACA,IAAI,CAAC,MAAD,IAAW,CAAC,SAAhB,EAA2B;IACzB,OAAO;MACL,cAAc,EAAE,MAAM,SADjB;MAEL,OAAO,EAAE,MAAM;IAFV,CAAP;EAID;;EAED,IAAI,aAAa,GAAG,IAApB;EACA,MAAM,aAAa,GAAqB,IAAI,GAAJ,EAAxC;EACA,MAAM,YAAY,GAAG,SAAS,CAAC,aAAV,CAAwB,WAA7C,CAXmE,CAanE;EACA;;EACA,MAAM,CAAC,MAAP,CAAc,SAAS,CAAC,KAAxB,EAA+B;IAAE,QAAQ,EAAE,OAAZ;IAAqB,IAAI,EAAE,CAA3B;IAA8B,GAAG,EAAE,CAAnC;IAAsC,MAAM,EAAE;EAA9C,CAA/B;;EAEA,IAAI,WAAW,GAAG,MAAK;IACrB,IAAI,aAAJ,EAAmB;MACjB,aAAa,CAAC,GAAd,CAAkB,eAAe,CAAC,SAAD,CAAjC;;MACA,IAAI,MAAM,YAAY,WAA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YAAJ,EAAkB;MAChB,YAAY,CAAC,mBAAb,CAAiC,QAAjC,EAA2C,cAA3C;MACA,YAAY,CAAC,mBAAb,CAAiC,QAAjC,EAA2C,cAA3C;IACD;;IAED,aAAa,CAAC,OAAd,CAAsB,YAAY,IAAG;MACnC,YAAY,CAAC,mBAAb,CAAiC,QAAjC,EAA2C,cAA3C;IACD,CAFD;EAGD,CAbD;;EAeA,IAAI,YAAJ,EAAkB;IAChB,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,cAAxC;IACA,YAAY,CAAC,gBAAb,CAA8B,QAA9B,EAAwC,cAAxC;EACD,CA/EkE,CAiFnE;;;EACA,cAAc;EAEd,OAAO;IACL,cADK;IAEL;EAFK,CAAP;AAID","sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement } = options;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n let forceUpdate = () => {\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (target instanceof HTMLElement) {\n scrollParents.add(getScrollParent(target));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition);\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n // debounced update can still occur afterwards\n // so destroy the reference to forceUpdate\n forceUpdate = () => null;\n\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition);\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,eAAe,QAAQ,kBAAkB;AAGlD,SAASC,QAAQ,EAAEC,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Ac,CAAC;;EAGzD;EACAA,cAAc,EAAE;EAEhB,OAAO;IACLA,cAAc;IACdE;GACD;AACH","names":["computePosition","debounce","writeArrowUpdates","writeContainerUpdates","getScrollParent","createPositionManager","options","container","target","arrow","strategy","middleware","placement","updatePosition","undefined","dispose","isFirstUpdate","scrollParents","Set","targetWindow","ownerDocument","defaultView","Object","assign","style","position","left","top","margin","forceUpdate","add","HTMLElement","forEach","scrollParent","addEventListener","then","x","y","middlewareData","computedPlacement","coordinates","lowPPI","devicePixelRatio","catch","err","process","env","NODE_ENV","console","error","removeEventListener"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-positioning/src/createPositionManager.ts"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement } = options;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n let forceUpdate = () => {\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (target instanceof HTMLElement) {\n scrollParents.add(getScrollParent(target));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition);\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n // debounced update can still occur afterwards\n // so destroy the reference to forceUpdate\n forceUpdate = () => null;\n\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition);\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"]}
@@ -7,7 +7,6 @@ export function createVirtualElementFromClick(nativeEvent) {
7
7
  const top = nativeEvent.clientY;
8
8
  const right = left + 1;
9
9
  const bottom = top + 1;
10
-
11
10
  function getBoundingClientRect() {
12
11
  return {
13
12
  left,
@@ -20,7 +19,6 @@ export function createVirtualElementFromClick(nativeEvent) {
20
19
  width: 1
21
20
  };
22
21
  }
23
-
24
22
  return {
25
23
  getBoundingClientRect
26
24
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/react-components/react-positioning/src/createVirtualElementFromClick.ts"],"names":[],"mappings":"AAEA;;;AAGG;AACH,OAAM,SAAU,6BAAV,CAAwC,WAAxC,EAA+D;EACnE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAzB;EACA,MAAM,GAAG,GAAG,WAAW,CAAC,OAAxB;EACA,MAAM,KAAK,GAAG,IAAI,GAAG,CAArB;EACA,MAAM,MAAM,GAAG,GAAG,GAAG,CAArB;;EAEA,SAAS,qBAAT,GAA8B;IAC5B,OAAO;MACL,IADK;MAEL,GAFK;MAGL,KAHK;MAIL,MAJK;MAKL,CAAC,EAAE,IALE;MAML,CAAC,EAAE,GANE;MAOL,MAAM,EAAE,CAPH;MAQL,KAAK,EAAE;IARF,CAAP;EAUD;;EAED,OAAO;IACL;EADK,CAAP;AAGD","sourcesContent":["import type { PositioningVirtualElement } from './types';\n\n/**\n * Creates a virtual element based on the position of a click event\n * Can be used as a target for popper in scenarios such as context menus\n */\nexport function createVirtualElementFromClick(nativeEvent: MouseEvent): PositioningVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect() {\n return {\n left,\n top,\n right,\n bottom,\n x: left,\n y: top,\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAEA;;;;AAIA,OAAM,SAAUA,6BAA6B,CAACC,WAAuB;EACnE,MAAMC,IAAI,GAAGD,WAAW,CAACE,OAAO;EAChC,MAAMC,GAAG,GAAGH,WAAW,CAACI,OAAO;EAC/B,MAAMC,KAAK,GAAGJ,IAAI,GAAG,CAAC;EACtB,MAAMK,MAAM,GAAGH,GAAG,GAAG,CAAC;EAEtB,SAASI,qBAAqB;IAC5B,OAAO;MACLN,IAAI;MACJE,GAAG;MACHE,KAAK;MACLC,MAAM;MACNE,CAAC,EAAEP,IAAI;MACPQ,CAAC,EAAEN,GAAG;MACNO,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE;KACR;EACH;EAEA,OAAO;IACLJ;GACD;AACH","names":["createVirtualElementFromClick","nativeEvent","left","clientX","top","clientY","right","bottom","getBoundingClientRect","x","y","height","width"],"sourceRoot":"","sources":["../../../../../../../packages/react-components/react-positioning/src/createVirtualElementFromClick.ts"],"sourcesContent":["import type { PositioningVirtualElement } from './types';\n\n/**\n * Creates a virtual element based on the position of a click event\n * Can be used as a target for popper in scenarios such as context menus\n */\nexport function createVirtualElementFromClick(nativeEvent: MouseEvent): PositioningVirtualElement {\n const left = nativeEvent.clientX;\n const top = nativeEvent.clientY;\n const right = left + 1;\n const bottom = top + 1;\n\n function getBoundingClientRect() {\n return {\n left,\n top,\n right,\n bottom,\n x: left,\n y: top,\n height: 1,\n width: 1,\n };\n }\n\n return {\n getBoundingClientRect,\n };\n}\n"]}
@@ -14,25 +14,20 @@ export function coverTarget() {
14
14
  x,
15
15
  y
16
16
  };
17
-
18
17
  switch (basePlacement) {
19
18
  case 'bottom':
20
19
  newCoords.y -= rects.reference.height;
21
20
  break;
22
-
23
21
  case 'top':
24
22
  newCoords.y += rects.reference.height;
25
23
  break;
26
-
27
24
  case 'left':
28
25
  newCoords.x += rects.reference.width;
29
26
  break;
30
-
31
27
  case 'right':
32
28
  newCoords.x -= rects.reference.width;
33
29
  break;
34
30
  }
35
-
36
31
  return newCoords;
37
32
  }
38
33
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/coverTarget.ts"],"names":[],"mappings":"AACA,SAAS,wBAAT,QAAyC,gBAAzC;AAEA,OAAM,SAAU,WAAV,GAAqB;EACzB,OAAO;IACL,IAAI,EAAE,aADD;IAEL,EAAE,EAAE,mBAAmB,IAAG;MACxB,MAAM;QAAE,SAAF;QAAa,KAAb;QAAoB,CAApB;QAAuB;MAAvB,IAA6B,mBAAnC;MACA,MAAM,aAAa,GAAG,wBAAwB,CAAC,SAAD,CAAxB,CAAoC,IAA1D;MACA,MAAM,SAAS,GAAG;QAAE,CAAF;QAAK;MAAL,CAAlB;;MAEA,QAAQ,aAAR;QACE,KAAK,QAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,MAA/B;UACA;;QACF,KAAK,KAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,MAA/B;UACA;;QACF,KAAK,MAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,KAA/B;UACA;;QACF,KAAK,OAAL;UACE,SAAS,CAAC,CAAV,IAAe,KAAK,CAAC,SAAN,CAAgB,KAA/B;UACA;MAZJ;;MAeA,OAAO,SAAP;IACD;EAvBI,CAAP;AAyBD","sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function coverTarget(): Middleware {\n return {\n name: 'coverTarget',\n fn: middlewareArguments => {\n const { placement, rects, x, y } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n const newCoords = { x, y };\n\n switch (basePlacement) {\n case 'bottom':\n newCoords.y -= rects.reference.height;\n break;\n case 'top':\n newCoords.y += rects.reference.height;\n break;\n case 'left':\n newCoords.x += rects.reference.width;\n break;\n case 'right':\n newCoords.x -= rects.reference.width;\n break;\n }\n\n return newCoords;\n },\n };\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AACA,SAASA,wBAAwB,QAAQ,gBAAgB;AAEzD,OAAM,SAAUC,WAAW;EACzB,OAAO;IACLC,IAAI,EAAE,aAAa;IACnBC,EAAE,EAAEC,mBAAmB,IAAG;MACxB,MAAM;QAAEC,SAAS;QAAEC,KAAK;QAAEC,CAAC;QAAEC;MAAC,CAAE,GAAGJ,mBAAmB;MACtD,MAAMK,aAAa,GAAGT,wBAAwB,CAACK,SAAS,CAAC,CAACK,IAAI;MAC9D,MAAMC,SAAS,GAAG;QAAEJ,CAAC;QAAEC;MAAC,CAAE;MAE1B,QAAQC,aAAa;QACnB,KAAK,QAAQ;UACXE,SAAS,CAACH,CAAC,IAAIF,KAAK,CAACM,SAAS,CAACC,MAAM;UACrC;QACF,KAAK,KAAK;UACRF,SAAS,CAACH,CAAC,IAAIF,KAAK,CAACM,SAAS,CAACC,MAAM;UACrC;QACF,KAAK,MAAM;UACTF,SAAS,CAACJ,CAAC,IAAID,KAAK,CAACM,SAAS,CAACE,KAAK;UACpC;QACF,KAAK,OAAO;UACVH,SAAS,CAACJ,CAAC,IAAID,KAAK,CAACM,SAAS,CAACE,KAAK;UACpC;MAAM;MAGV,OAAOH,SAAS;IAClB;GACD;AACH","names":["parseFloatingUIPlacement","coverTarget","name","fn","middlewareArguments","placement","rects","x","y","basePlacement","side","newCoords","reference","height","width"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/coverTarget.ts"],"sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function coverTarget(): Middleware {\n return {\n name: 'coverTarget',\n fn: middlewareArguments => {\n const { placement, rects, x, y } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n const newCoords = { x, y };\n\n switch (basePlacement) {\n case 'bottom':\n newCoords.y -= rects.reference.height;\n break;\n case 'top':\n newCoords.y += rects.reference.height;\n break;\n case 'left':\n newCoords.x += rects.reference.width;\n break;\n case 'right':\n newCoords.x -= rects.reference.width;\n break;\n }\n\n return newCoords;\n },\n };\n}\n"]}
@@ -6,7 +6,8 @@ export function flip(options) {
6
6
  flipBoundary,
7
7
  container
8
8
  } = options;
9
- return baseFlip({ ...(hasScrollableElement && {
9
+ return baseFlip({
10
+ ...(hasScrollableElement && {
10
11
  boundary: 'clippingAncestors'
11
12
  }),
12
13
  ...(flipBoundary && {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/flip.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,IAAI,QAAjB,QAAiC,kBAAjC;AAEA,SAAS,WAAT,QAA4B,gBAA5B;AAOA,OAAM,SAAU,IAAV,CAAe,OAAf,EAA6C;EACjD,MAAM;IAAE,oBAAF;IAAwB,YAAxB;IAAsC;EAAtC,IAAoD,OAA1D;EAEA,OAAO,QAAQ,CAAC,EACd,IAAI,oBAAoB,IAAI;MAAE,QAAQ,EAAE;IAAZ,CAA5B,CADc;IAEd,IAAI,YAAY,IAAI;MAAE,WAAW,EAAE,IAAf;MAAqB,QAAQ,EAAE,WAAW,CAAC,SAAD,EAAY,YAAZ;IAA1C,CAApB,CAFc;IAGd,gBAAgB,EAAE;EAHJ,CAAD,CAAf;AAKD","sourcesContent":["import { flip as baseFlip } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface FlipMiddlewareOptions extends Pick<PositioningOptions, 'flipBoundary'> {\n hasScrollableElement?: boolean;\n container: HTMLElement | null;\n}\n\nexport function flip(options: FlipMiddlewareOptions) {\n const { hasScrollableElement, flipBoundary, container } = options;\n\n return baseFlip({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(flipBoundary && { altBoundary: true, boundary: getBoundary(container, flipBoundary) }),\n fallbackStrategy: 'bestFit',\n });\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,IAAI,IAAIC,QAAQ,QAAQ,kBAAkB;AAEnD,SAASC,WAAW,QAAQ,gBAAgB;AAO5C,OAAM,SAAUF,IAAI,CAACG,OAA8B;EACjD,MAAM;IAAEC,oBAAoB;IAAEC,YAAY;IAAEC;EAAS,CAAE,GAAGH,OAAO;EAEjE,OAAOF,QAAQ,CAAC;IACd,IAAIG,oBAAoB,IAAI;MAAEG,QAAQ,EAAE;IAAmB,CAAE,CAAC;IAC9D,IAAIF,YAAY,IAAI;MAAEG,WAAW,EAAE,IAAI;MAAED,QAAQ,EAAEL,WAAW,CAACI,SAAS,EAAED,YAAY;IAAC,CAAE,CAAC;IAC1FI,gBAAgB,EAAE;GACnB,CAAC;AACJ","names":["flip","baseFlip","getBoundary","options","hasScrollableElement","flipBoundary","container","boundary","altBoundary","fallbackStrategy"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/flip.ts"],"sourcesContent":["import { flip as baseFlip } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface FlipMiddlewareOptions extends Pick<PositioningOptions, 'flipBoundary'> {\n hasScrollableElement?: boolean;\n container: HTMLElement | null;\n}\n\nexport function flip(options: FlipMiddlewareOptions) {\n const { hasScrollableElement, flipBoundary, container } = options;\n\n return baseFlip({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(flipBoundary && { altBoundary: true, boundary: getBoundary(container, flipBoundary) }),\n fallbackStrategy: 'bestFit',\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/intersecting.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,QAA+B,kBAA/B;AAEA,OAAM,SAAU,YAAV,GAAsB;EAC1B,OAAO;IACL,IAAI,EAAE,sBADD;IAEL,EAAE,EAAE,MAAM,mBAAN,IAA4B;MAC9B,MAAM,YAAY,GAAG,mBAAmB,CAAC,KAApB,CAA0B,QAA/C;MACA,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,mBAAD,EAAsB;QAAE,WAAW,EAAE;MAAf,CAAtB,CAAxC;MAEA,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAZ,GAAkB,YAAY,CAAC,MAA/B,IAAyC,WAAW,CAAC,GAAZ,GAAkB,CAArF;MACA,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAZ,GAAqB,YAAY,CAAC,MAAlC,IAA4C,WAAW,CAAC,MAAZ,GAAqB,CAA9F;MAEA,MAAM,cAAc,GAAG,iBAAiB,IAAI,oBAA5C;MAEA,OAAO;QACL,IAAI,EAAE;UACJ,YAAY,EAAE;QADV;MADD,CAAP;IAKD;EAhBI,CAAP;AAkBD","sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { detectOverflow } from '@floating-ui/dom';\n\nexport function intersecting(): Middleware {\n return {\n name: 'intersectionObserver',\n fn: async middlewareArguments => {\n const floatingRect = middlewareArguments.rects.floating;\n const altOverflow = await detectOverflow(middlewareArguments, { altBoundary: true });\n\n const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n return {\n data: {\n intersecting: isIntersecting,\n },\n };\n },\n };\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AACA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,OAAM,SAAUC,YAAY;EAC1B,OAAO;IACLC,IAAI,EAAE,sBAAsB;IAC5BC,EAAE,EAAE,MAAMC,mBAAmB,IAAG;MAC9B,MAAMC,YAAY,GAAGD,mBAAmB,CAACE,KAAK,CAACC,QAAQ;MACvD,MAAMC,WAAW,GAAG,MAAMR,cAAc,CAACI,mBAAmB,EAAE;QAAEK,WAAW,EAAE;MAAI,CAAE,CAAC;MAEpF,MAAMC,iBAAiB,GAAGF,WAAW,CAACG,GAAG,GAAGN,YAAY,CAACO,MAAM,IAAIJ,WAAW,CAACG,GAAG,GAAG,CAAC;MACtF,MAAME,oBAAoB,GAAGL,WAAW,CAACM,MAAM,GAAGT,YAAY,CAACO,MAAM,IAAIJ,WAAW,CAACM,MAAM,GAAG,CAAC;MAE/F,MAAMC,cAAc,GAAGL,iBAAiB,IAAIG,oBAAoB;MAEhE,OAAO;QACLG,IAAI,EAAE;UACJf,YAAY,EAAEc;;OAEjB;IACH;GACD;AACH","names":["detectOverflow","intersecting","name","fn","middlewareArguments","floatingRect","rects","floating","altOverflow","altBoundary","isIntersectingTop","top","height","isIntersectingBottom","bottom","isIntersecting","data"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/intersecting.ts"],"sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { detectOverflow } from '@floating-ui/dom';\n\nexport function intersecting(): Middleware {\n return {\n name: 'intersectionObserver',\n fn: async middlewareArguments => {\n const floatingRect = middlewareArguments.rects.floating;\n const altOverflow = await detectOverflow(middlewareArguments, { altBoundary: true });\n\n const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n\n const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n return {\n data: {\n intersecting: isIntersecting,\n },\n };\n },\n };\n}\n"]}
@@ -27,15 +27,12 @@ export function maxSize(autoSize) {
27
27
  const heightProp = basePlacement === 'top' ? 'top' : 'bottom';
28
28
  const applyMaxWidth = autoSize === 'always' || autoSize === 'width-always' || overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width');
29
29
  const applyMaxHeight = autoSize === 'always' || autoSize === 'height-always' || overflow[heightProp] > 0 && (autoSize === true || autoSize === 'height');
30
-
31
30
  if (applyMaxWidth) {
32
31
  elements.floating.style.maxWidth = `${width - overflow[widthProp] - x}px`;
33
32
  }
34
-
35
33
  if (applyMaxHeight) {
36
34
  elements.floating.style.maxHeight = `${height - overflow[heightProp] - y}px`;
37
35
  }
38
-
39
36
  return {};
40
37
  }
41
38
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/maxSize.ts"],"names":[],"mappings":"AAAA,SAAS,cAAT,QAA+B,kBAA/B;AAGA,SAAS,wBAAT,QAAyC,gBAAzC;AAEA,OAAM,SAAU,O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AAG,QAAQ,CAAC,UAAD,CAAjB,GAAgC,CAAC,IAAxE;MACD;;MAED,OAAO,EAAP;IACD;EA9BI,CAAP;AAgCD","sourcesContent":["import { detectOverflow } from '@floating-ui/dom';\nimport type { Middleware, Side } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function maxSize(autoSize: PositioningOptions['autoSize']): Middleware {\n return {\n name: 'maxSize',\n fn: async middlewareArguments => {\n const { placement, rects, elements, middlewareData } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n\n const overflow = await detectOverflow(middlewareArguments);\n const { x, y } = middlewareData.shift || { x: 0, y: 0 };\n const { width, height } = rects.floating;\n\n const widthProp: Side = basePlacement === 'left' ? 'left' : 'right';\n const heightProp: Side = basePlacement === 'top' ? 'top' : 'bottom';\n\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width'));\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (overflow[heightProp] > 0 && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxWidth) {\n elements.floating.style.maxWidth = `${width - overflow[widthProp] - x}px`;\n }\n if (applyMaxHeight) {\n elements.floating.style.maxHeight = `${height - overflow[heightProp] - y}px`;\n }\n\n return {};\n },\n };\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,cAAc,QAAQ,kBAAkB;AAGjD,SAASC,wBAAwB,QAAQ,gBAAgB;AAEzD,OAAM,SAAUC,OAAO,CAACC,QAAwC;EAC9D,OAAO;IACLC,IAAI,EAAE,SAAS;IACfC,EAAE,EAAE,MAAMC,mBAAmB,IAAG;MAC9B,MAAM;QAAEC,SAAS;QAAEC,KAAK;QAAEC,QAAQ;QAAEC;MAAc,CAAE,GAAGJ,mBAAmB;MAC1E,MAAMK,aAAa,GAAGV,wBAAwB,CAACM,SAAS,CAAC,CAACK,IAAI;MAE9D,MAAMC,QAAQ,GAAG,MAAMb,cAAc,CAACM,mBAAmB,CAAC;MAC1D,MAAM;QAAEQ,CAAC;QAAEC;MAAC,CAAE,GAAGL,cAAc,CAACM,KAAK,IAAI;QAAEF,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAC,CAAE;MACvD,MAAM;QAAEE,KAAK;QAAEC;MAAM,CAAE,GAAGV,KAAK,CAACW,QAAQ;MAExC,MAAMC,SAAS,GAAST,aAAa,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;MACnE,MAAMU,UAAU,GAASV,aAAa,KAAK,KAAK,GAAG,KAAK,GAAG,QAAQ;MAEnE,MAAMW,aAAa,GACjBnB,QAAQ,KAAK,QAAQ,IACrBA,QAAQ,KAAK,cAAc,IAC1BU,QAAQ,CAACO,SAAS,CAAC,GAAG,CAAC,KAAKjB,QAAQ,KAAK,IAAI,IAAIA,QAAQ,KAAK,OAAO,CAAE;MAC1E,MAAMoB,cAAc,GAClBpB,QAAQ,KAAK,QAAQ,IACrBA,QAAQ,KAAK,eAAe,IAC3BU,QAAQ,CAACQ,UAAU,CAAC,GAAG,CAAC,KAAKlB,QAAQ,KAAK,IAAI,IAAIA,QAAQ,KAAK,QAAQ,CAAE;MAE5E,IAAImB,aAAa,EAAE;QACjBb,QAAQ,CAACU,QAAQ,CAACK,KAAK,CAACC,QAAQ,GAAG,GAAGR,KAAK,GAAGJ,QAAQ,CAACO,SAAS,CAAC,GAAGN,CAAC,IAAI;;MAE3E,IAAIS,cAAc,EAAE;QAClBd,QAAQ,CAACU,QAAQ,CAACK,KAAK,CAACE,SAAS,GAAG,GAAGR,MAAM,GAAGL,QAAQ,CAACQ,UAAU,CAAC,GAAGN,CAAC,IAAI;;MAG9E,OAAO,EAAE;IACX;GACD;AACH","names":["detectOverflow","parseFloatingUIPlacement","maxSize","autoSize","name","fn","middlewareArguments","placement","rects","elements","middlewareData","basePlacement","side","overflow","x","y","shift","width","height","floating","widthProp","heightProp","applyMaxWidth","applyMaxHeight","style","maxWidth","maxHeight"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/maxSize.ts"],"sourcesContent":["import { detectOverflow } from '@floating-ui/dom';\nimport type { Middleware, Side } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { parseFloatingUIPlacement } from '../utils/index';\n\nexport function maxSize(autoSize: PositioningOptions['autoSize']): Middleware {\n return {\n name: 'maxSize',\n fn: async middlewareArguments => {\n const { placement, rects, elements, middlewareData } = middlewareArguments;\n const basePlacement = parseFloatingUIPlacement(placement).side;\n\n const overflow = await detectOverflow(middlewareArguments);\n const { x, y } = middlewareData.shift || { x: 0, y: 0 };\n const { width, height } = rects.floating;\n\n const widthProp: Side = basePlacement === 'left' ? 'left' : 'right';\n const heightProp: Side = basePlacement === 'top' ? 'top' : 'bottom';\n\n const applyMaxWidth =\n autoSize === 'always' ||\n autoSize === 'width-always' ||\n (overflow[widthProp] > 0 && (autoSize === true || autoSize === 'width'));\n const applyMaxHeight =\n autoSize === 'always' ||\n autoSize === 'height-always' ||\n (overflow[heightProp] > 0 && (autoSize === true || autoSize === 'height'));\n\n if (applyMaxWidth) {\n elements.floating.style.maxWidth = `${width - overflow[widthProp] - x}px`;\n }\n if (applyMaxHeight) {\n elements.floating.style.maxHeight = `${height - overflow[heightProp] - y}px`;\n }\n\n return {};\n },\n };\n}\n"]}
@@ -3,7 +3,6 @@ import { getFloatingUIOffset } from '../utils/getFloatingUIOffset';
3
3
  /**
4
4
  * Wraps floating UI offset middleware to to transform offset value
5
5
  */
6
-
7
6
  export function offset(offsetValue) {
8
7
  const floatingUIOffset = getFloatingUIOffset(offsetValue);
9
8
  return baseOffset(floatingUIOffset);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/offset.ts"],"names":[],"mappings":"AAAA,SAAS,MAAM,IAAI,UAAnB,QAAqC,kBAArC;AAEA,SAAS,mBAAT,QAAoC,8BAApC;AAEA;;AAEG;;AACH,OAAM,SAAU,MAAV,CAAiB,WAAjB,EAA0D;EAC9D,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,WAAD,CAA5C;EACA,OAAO,UAAU,CAAC,gBAAD,CAAjB;AACD","sourcesContent":["import { offset as baseOffset } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getFloatingUIOffset } from '../utils/getFloatingUIOffset';\n\n/**\n * Wraps floating UI offset middleware to to transform offset value\n */\nexport function offset(offsetValue: PositioningOptions['offset']) {\n const floatingUIOffset = getFloatingUIOffset(offsetValue);\n return baseOffset(floatingUIOffset);\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,MAAM,IAAIC,UAAU,QAAQ,kBAAkB;AAEvD,SAASC,mBAAmB,QAAQ,8BAA8B;AAElE;;;AAGA,OAAM,SAAUF,MAAM,CAACG,WAAyC;EAC9D,MAAMC,gBAAgB,GAAGF,mBAAmB,CAACC,WAAW,CAAC;EACzD,OAAOF,UAAU,CAACG,gBAAgB,CAAC;AACrC","names":["offset","baseOffset","getFloatingUIOffset","offsetValue","floatingUIOffset"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/offset.ts"],"sourcesContent":["import { offset as baseOffset } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getFloatingUIOffset } from '../utils/getFloatingUIOffset';\n\n/**\n * Wraps floating UI offset middleware to to transform offset value\n */\nexport function offset(offsetValue: PositioningOptions['offset']) {\n const floatingUIOffset = getFloatingUIOffset(offsetValue);\n return baseOffset(floatingUIOffset);\n}\n"]}
@@ -3,7 +3,6 @@ import { getBoundary } from '../utils/index';
3
3
  /**
4
4
  * Wraps the floating UI shift middleware for easier usage of our options
5
5
  */
6
-
7
6
  export function shift(options) {
8
7
  const {
9
8
  hasScrollableElement,
@@ -11,7 +10,8 @@ export function shift(options) {
11
10
  overflowBoundary,
12
11
  container
13
12
  } = options;
14
- return baseShift({ ...(hasScrollableElement && {
13
+ return baseShift({
14
+ ...(hasScrollableElement && {
15
15
  boundary: 'clippingAncestors'
16
16
  }),
17
17
  ...(disableTether && {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/shift.ts"],"names":[],"mappings":"AAAA,SAAS,KAAK,IAAI,SAAlB,EAA6B,UAA7B,QAA+C,kBAA/C;AAEA,SAAS,WAAT,QAA4B,gBAA5B;AAQA;;AAEG;;AACH,OAAM,SAAU,KAAV,CAAgB,OAAhB,EAA+C;EACnD,MAAM;IAAE,oBAAF;IAAwB,aAAxB;IAAuC,gBAAvC;IAAyD;EAAzD,IAAuE,OAA7E;EAEA,OAAO,SAAS,CAAC,EACf,IAAI,oBAAoB,IAAI;MAAE,QAAQ,EAAE;IAAZ,CAA5B,CADe;IAEf,IAAI,aAAa,IAAI;MACnB,SAAS,EAAE,aAAa,KAAK,KADV;MAEnB,OAAO,EAAE,UAAU,CAAC;QAAE,SAAS,EAAE,aAAa,KAAK,KAA/B;QAAsC,QAAQ,EAAE;MAAhD,CAAD;IAFA,CAArB,CAFe;IAMf,IAAI,gBAAgB,IAAI;MAAE,WAAW,EAAE,IAAf;MAAqB,QAAQ,EAAE,WAAW,CAAC,SAAD,EAAY,gBAAZ;IAA1C,CAAxB;EANe,CAAD,CAAhB;AAQD","sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface ShiftMiddlewareOptions extends Pick<PositioningOptions, 'overflowBoundary'> {\n hasScrollableElement?: boolean;\n disableTether?: PositioningOptions['unstable_disableTether'];\n container: HTMLElement | null;\n}\n\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */\nexport function shift(options: ShiftMiddlewareOptions) {\n const { hasScrollableElement, disableTether, overflowBoundary, container } = options;\n\n return baseShift({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({ crossAxis: disableTether !== 'all', mainAxis: false }),\n }),\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n });\n}\n"],"sourceRoot":""}
1
+ {"version":3,"mappings":"AAAA,SAASA,KAAK,IAAIC,SAAS,EAAEC,UAAU,QAAQ,kBAAkB;AAEjE,SAASC,WAAW,QAAQ,gBAAgB;AAQ5C;;;AAGA,OAAM,SAAUH,KAAK,CAACI,OAA+B;EACnD,MAAM;IAAEC,oBAAoB;IAAEC,aAAa;IAAEC,gBAAgB;IAAEC;EAAS,CAAE,GAAGJ,OAAO;EAEpF,OAAOH,SAAS,CAAC;IACf,IAAII,oBAAoB,IAAI;MAAEI,QAAQ,EAAE;IAAmB,CAAE,CAAC;IAC9D,IAAIH,aAAa,IAAI;MACnBI,SAAS,EAAEJ,aAAa,KAAK,KAAK;MAClCK,OAAO,EAAET,UAAU,CAAC;QAAEQ,SAAS,EAAEJ,aAAa,KAAK,KAAK;QAAEM,QAAQ,EAAE;MAAK,CAAE;KAC5E,CAAC;IACF,IAAIL,gBAAgB,IAAI;MAAEM,WAAW,EAAE,IAAI;MAAEJ,QAAQ,EAAEN,WAAW,CAACK,SAAS,EAAED,gBAAgB;IAAC,CAAE;GAClG,CAAC;AACJ","names":["shift","baseShift","limitShift","getBoundary","options","hasScrollableElement","disableTether","overflowBoundary","container","boundary","crossAxis","limiter","mainAxis","altBoundary"],"sourceRoot":"","sources":["../../../../../../../../packages/react-components/react-positioning/src/middleware/shift.ts"],"sourcesContent":["import { shift as baseShift, limitShift } from '@floating-ui/dom';\nimport type { PositioningOptions } from '../types';\nimport { getBoundary } from '../utils/index';\n\nexport interface ShiftMiddlewareOptions extends Pick<PositioningOptions, 'overflowBoundary'> {\n hasScrollableElement?: boolean;\n disableTether?: PositioningOptions['unstable_disableTether'];\n container: HTMLElement | null;\n}\n\n/**\n * Wraps the floating UI shift middleware for easier usage of our options\n */\nexport function shift(options: ShiftMiddlewareOptions) {\n const { hasScrollableElement, disableTether, overflowBoundary, container } = options;\n\n return baseShift({\n ...(hasScrollableElement && { boundary: 'clippingAncestors' }),\n ...(disableTether && {\n crossAxis: disableTether === 'all',\n limiter: limitShift({ crossAxis: disableTether !== 'all', mainAxis: false }),\n }),\n ...(overflowBoundary && { altBoundary: true, boundary: getBoundary(container, overflowBoundary) }),\n });\n}\n"]}
@@ -8,7 +8,6 @@ import { createPositionManager } from './createPositionManager';
8
8
  /**
9
9
  * @internal
10
10
  */
11
-
12
11
  export function usePositioning(options) {
13
12
  const managerRef = React.useRef(null);
14
13
  const targetRef = React.useRef(null);
@@ -21,14 +20,11 @@ export function usePositioning(options) {
21
20
  const resolvePositioningOptions = usePositioningOptions(options);
22
21
  const updatePositionManager = React.useCallback(() => {
23
22
  var _a;
24
-
25
23
  if (managerRef.current) {
26
24
  managerRef.current.dispose();
27
25
  }
28
-
29
26
  managerRef.current = null;
30
27
  const target = (_a = overrideTargetRef.current) !== null && _a !== void 0 ? _a : targetRef.current;
31
-
32
28
  if (enabled && canUseDOM() && target && containerRef.current) {
33
29
  managerRef.current = createPositionManager({
34
30
  container: containerRef.current,
@@ -45,56 +41,49 @@ export function usePositioning(options) {
45
41
  React.useImperativeHandle(options.positioningRef, () => ({
46
42
  updatePosition: () => {
47
43
  var _a;
48
-
49
44
  return (_a = managerRef.current) === null || _a === void 0 ? void 0 : _a.updatePosition();
50
45
  },
51
46
  setTarget: target => {
52
47
  if (options.target && process.env.NODE_ENV !== 'production') {
53
- const err = new Error(); // eslint-disable-next-line no-console
54
-
55
- console.warn('Imperative setTarget should not be used at the same time as target option'); // eslint-disable-next-line no-console
56
-
48
+ const err = new Error();
49
+ // eslint-disable-next-line no-console
50
+ console.warn('Imperative setTarget should not be used at the same time as target option');
51
+ // eslint-disable-next-line no-console
57
52
  console.warn(err.stack);
58
53
  }
59
-
60
54
  setOverrideTarget(target);
61
55
  }
62
56
  }), [options.target, setOverrideTarget]);
63
57
  useIsomorphicLayoutEffect(() => {
64
58
  var _a;
65
-
66
59
  setOverrideTarget((_a = options.target) !== null && _a !== void 0 ? _a : null);
67
60
  }, [options.target, setOverrideTarget]);
68
61
  useIsomorphicLayoutEffect(() => {
69
62
  updatePositionManager();
70
63
  }, [updatePositionManager]);
71
-
72
64
  if (process.env.NODE_ENV !== 'production') {
73
65
  // This checked should run only in development mode
74
66
  // eslint-disable-next-line react-hooks/rules-of-hooks
75
67
  React.useEffect(() => {
76
68
  var _a;
77
-
78
69
  if (containerRef.current) {
79
70
  const contentNode = containerRef.current;
80
71
  const treeWalker = (_a = contentNode.ownerDocument) === null || _a === void 0 ? void 0 : _a.createTreeWalker(contentNode, NodeFilter.SHOW_ELEMENT, {
81
72
  acceptNode: hasAutofocusFilter
82
73
  });
83
-
84
74
  while (treeWalker.nextNode()) {
85
- const node = treeWalker.currentNode; // eslint-disable-next-line no-console
86
-
87
- console.warn('<Popper>:', node); // eslint-disable-next-line no-console
88
-
75
+ const node = treeWalker.currentNode;
76
+ // eslint-disable-next-line no-console
77
+ console.warn('<Popper>:', node);
78
+ // eslint-disable-next-line no-console
89
79
  console.warn(['<Popper>: ^ this node contains "autoFocus" prop on a React element. This can break the initial', 'positioning of an element and cause a window jump effect. This issue occurs because React polyfills', '"autoFocus" behavior to solve inconsistencies between different browsers:', 'https://github.com/facebook/react/issues/11851#issuecomment-351787078', '\n', 'However, ".focus()" in this case occurs before any other React effects will be executed', '(React.useEffect(), componentDidMount(), etc.) and we can not prevent this behavior. If you really', 'want to use "autoFocus" please add "position: fixed" to styles of the element that is wrapped by', '"Popper".', `In general, it's not recommended to use "autoFocus" as it may break accessibility aspects:`, 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md', '\n', 'We suggest to use the "trapFocus" prop on Fluent components or a catch "ref" and then use', '"ref.current.focus" in React.useEffect():', 'https://reactjs.org/docs/refs-and-the-dom.html#adding-a-ref-to-a-dom-element'].join(' '));
90
80
  }
91
- } // We run this check once, no need to add deps here
81
+ }
82
+ // We run this check once, no need to add deps here
92
83
  // TODO: Should be rework to handle options.enabled and contentRef updates
93
84
  // eslint-disable-next-line react-hooks/exhaustive-deps
94
-
95
85
  }, []);
96
86
  }
97
-
98
87
  const setTarget = useCallbackRef(null, target => {
99
88
  if (targetRef.current !== target) {
100
89
  targetRef.current = target;
@@ -112,15 +101,14 @@ export function usePositioning(options) {
112
101
  arrowRef.current = arrow;
113
102
  updatePositionManager();
114
103
  }
115
- }); // Let users use callback refs so they feel like 'normal' DOM refs
116
-
104
+ });
105
+ // Let users use callback refs so they feel like 'normal' DOM refs
117
106
  return {
118
107
  targetRef: setTarget,
119
108
  containerRef: setContainer,
120
109
  arrowRef: setArrow
121
110
  };
122
111
  }
123
-
124
112
  function usePositioningOptions(options) {
125
113
  const {
126
114
  align,