@react-aria/overlays 3.20.0 → 3.21.0

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 (179) hide show
  1. package/dist/import.mjs +254 -53
  2. package/dist/main.js +252 -51
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +254 -53
  5. package/dist/module.js.map +1 -1
  6. package/dist/types.d.ts.map +1 -1
  7. package/package.json +7 -7
  8. package/src/calculatePosition.ts +85 -24
  9. package/src/useOverlayPosition.ts +31 -4
  10. package/dist/ar-AE.main.js +0 -6
  11. package/dist/ar-AE.main.js.map +0 -1
  12. package/dist/ar-AE.mjs +0 -8
  13. package/dist/ar-AE.module.js +0 -8
  14. package/dist/ar-AE.module.js.map +0 -1
  15. package/dist/bg-BG.main.js +0 -6
  16. package/dist/bg-BG.main.js.map +0 -1
  17. package/dist/bg-BG.mjs +0 -8
  18. package/dist/bg-BG.module.js +0 -8
  19. package/dist/bg-BG.module.js.map +0 -1
  20. package/dist/cs-CZ.main.js +0 -6
  21. package/dist/cs-CZ.main.js.map +0 -1
  22. package/dist/cs-CZ.mjs +0 -8
  23. package/dist/cs-CZ.module.js +0 -8
  24. package/dist/cs-CZ.module.js.map +0 -1
  25. package/dist/da-DK.main.js +0 -6
  26. package/dist/da-DK.main.js.map +0 -1
  27. package/dist/da-DK.mjs +0 -8
  28. package/dist/da-DK.module.js +0 -8
  29. package/dist/da-DK.module.js.map +0 -1
  30. package/dist/de-DE.main.js +0 -6
  31. package/dist/de-DE.main.js.map +0 -1
  32. package/dist/de-DE.mjs +0 -8
  33. package/dist/de-DE.module.js +0 -8
  34. package/dist/de-DE.module.js.map +0 -1
  35. package/dist/el-GR.main.js +0 -6
  36. package/dist/el-GR.main.js.map +0 -1
  37. package/dist/el-GR.mjs +0 -8
  38. package/dist/el-GR.module.js +0 -8
  39. package/dist/el-GR.module.js.map +0 -1
  40. package/dist/en-US.main.js +0 -6
  41. package/dist/en-US.main.js.map +0 -1
  42. package/dist/en-US.mjs +0 -8
  43. package/dist/en-US.module.js +0 -8
  44. package/dist/en-US.module.js.map +0 -1
  45. package/dist/es-ES.main.js +0 -6
  46. package/dist/es-ES.main.js.map +0 -1
  47. package/dist/es-ES.mjs +0 -8
  48. package/dist/es-ES.module.js +0 -8
  49. package/dist/es-ES.module.js.map +0 -1
  50. package/dist/et-EE.main.js +0 -6
  51. package/dist/et-EE.main.js.map +0 -1
  52. package/dist/et-EE.mjs +0 -8
  53. package/dist/et-EE.module.js +0 -8
  54. package/dist/et-EE.module.js.map +0 -1
  55. package/dist/fi-FI.main.js +0 -6
  56. package/dist/fi-FI.main.js.map +0 -1
  57. package/dist/fi-FI.mjs +0 -8
  58. package/dist/fi-FI.module.js +0 -8
  59. package/dist/fi-FI.module.js.map +0 -1
  60. package/dist/fr-FR.main.js +0 -6
  61. package/dist/fr-FR.main.js.map +0 -1
  62. package/dist/fr-FR.mjs +0 -8
  63. package/dist/fr-FR.module.js +0 -8
  64. package/dist/fr-FR.module.js.map +0 -1
  65. package/dist/he-IL.main.js +0 -6
  66. package/dist/he-IL.main.js.map +0 -1
  67. package/dist/he-IL.mjs +0 -8
  68. package/dist/he-IL.module.js +0 -8
  69. package/dist/he-IL.module.js.map +0 -1
  70. package/dist/hr-HR.main.js +0 -6
  71. package/dist/hr-HR.main.js.map +0 -1
  72. package/dist/hr-HR.mjs +0 -8
  73. package/dist/hr-HR.module.js +0 -8
  74. package/dist/hr-HR.module.js.map +0 -1
  75. package/dist/hu-HU.main.js +0 -6
  76. package/dist/hu-HU.main.js.map +0 -1
  77. package/dist/hu-HU.mjs +0 -8
  78. package/dist/hu-HU.module.js +0 -8
  79. package/dist/hu-HU.module.js.map +0 -1
  80. package/dist/it-IT.main.js +0 -6
  81. package/dist/it-IT.main.js.map +0 -1
  82. package/dist/it-IT.mjs +0 -8
  83. package/dist/it-IT.module.js +0 -8
  84. package/dist/it-IT.module.js.map +0 -1
  85. package/dist/ja-JP.main.js +0 -6
  86. package/dist/ja-JP.main.js.map +0 -1
  87. package/dist/ja-JP.mjs +0 -8
  88. package/dist/ja-JP.module.js +0 -8
  89. package/dist/ja-JP.module.js.map +0 -1
  90. package/dist/ko-KR.main.js +0 -6
  91. package/dist/ko-KR.main.js.map +0 -1
  92. package/dist/ko-KR.mjs +0 -8
  93. package/dist/ko-KR.module.js +0 -8
  94. package/dist/ko-KR.module.js.map +0 -1
  95. package/dist/lt-LT.main.js +0 -6
  96. package/dist/lt-LT.main.js.map +0 -1
  97. package/dist/lt-LT.mjs +0 -8
  98. package/dist/lt-LT.module.js +0 -8
  99. package/dist/lt-LT.module.js.map +0 -1
  100. package/dist/lv-LV.main.js +0 -6
  101. package/dist/lv-LV.main.js.map +0 -1
  102. package/dist/lv-LV.mjs +0 -8
  103. package/dist/lv-LV.module.js +0 -8
  104. package/dist/lv-LV.module.js.map +0 -1
  105. package/dist/nb-NO.main.js +0 -6
  106. package/dist/nb-NO.main.js.map +0 -1
  107. package/dist/nb-NO.mjs +0 -8
  108. package/dist/nb-NO.module.js +0 -8
  109. package/dist/nb-NO.module.js.map +0 -1
  110. package/dist/nl-NL.main.js +0 -6
  111. package/dist/nl-NL.main.js.map +0 -1
  112. package/dist/nl-NL.mjs +0 -8
  113. package/dist/nl-NL.module.js +0 -8
  114. package/dist/nl-NL.module.js.map +0 -1
  115. package/dist/pl-PL.main.js +0 -6
  116. package/dist/pl-PL.main.js.map +0 -1
  117. package/dist/pl-PL.mjs +0 -8
  118. package/dist/pl-PL.module.js +0 -8
  119. package/dist/pl-PL.module.js.map +0 -1
  120. package/dist/pt-BR.main.js +0 -6
  121. package/dist/pt-BR.main.js.map +0 -1
  122. package/dist/pt-BR.mjs +0 -8
  123. package/dist/pt-BR.module.js +0 -8
  124. package/dist/pt-BR.module.js.map +0 -1
  125. package/dist/pt-PT.main.js +0 -6
  126. package/dist/pt-PT.main.js.map +0 -1
  127. package/dist/pt-PT.mjs +0 -8
  128. package/dist/pt-PT.module.js +0 -8
  129. package/dist/pt-PT.module.js.map +0 -1
  130. package/dist/ro-RO.main.js +0 -6
  131. package/dist/ro-RO.main.js.map +0 -1
  132. package/dist/ro-RO.mjs +0 -8
  133. package/dist/ro-RO.module.js +0 -8
  134. package/dist/ro-RO.module.js.map +0 -1
  135. package/dist/ru-RU.main.js +0 -6
  136. package/dist/ru-RU.main.js.map +0 -1
  137. package/dist/ru-RU.mjs +0 -8
  138. package/dist/ru-RU.module.js +0 -8
  139. package/dist/ru-RU.module.js.map +0 -1
  140. package/dist/sk-SK.main.js +0 -6
  141. package/dist/sk-SK.main.js.map +0 -1
  142. package/dist/sk-SK.mjs +0 -8
  143. package/dist/sk-SK.module.js +0 -8
  144. package/dist/sk-SK.module.js.map +0 -1
  145. package/dist/sl-SI.main.js +0 -6
  146. package/dist/sl-SI.main.js.map +0 -1
  147. package/dist/sl-SI.mjs +0 -8
  148. package/dist/sl-SI.module.js +0 -8
  149. package/dist/sl-SI.module.js.map +0 -1
  150. package/dist/sr-SP.main.js +0 -6
  151. package/dist/sr-SP.main.js.map +0 -1
  152. package/dist/sr-SP.mjs +0 -8
  153. package/dist/sr-SP.module.js +0 -8
  154. package/dist/sr-SP.module.js.map +0 -1
  155. package/dist/sv-SE.main.js +0 -6
  156. package/dist/sv-SE.main.js.map +0 -1
  157. package/dist/sv-SE.mjs +0 -8
  158. package/dist/sv-SE.module.js +0 -8
  159. package/dist/sv-SE.module.js.map +0 -1
  160. package/dist/tr-TR.main.js +0 -6
  161. package/dist/tr-TR.main.js.map +0 -1
  162. package/dist/tr-TR.mjs +0 -8
  163. package/dist/tr-TR.module.js +0 -8
  164. package/dist/tr-TR.module.js.map +0 -1
  165. package/dist/uk-UA.main.js +0 -6
  166. package/dist/uk-UA.main.js.map +0 -1
  167. package/dist/uk-UA.mjs +0 -8
  168. package/dist/uk-UA.module.js +0 -8
  169. package/dist/uk-UA.module.js.map +0 -1
  170. package/dist/zh-CN.main.js +0 -6
  171. package/dist/zh-CN.main.js.map +0 -1
  172. package/dist/zh-CN.mjs +0 -8
  173. package/dist/zh-CN.module.js +0 -8
  174. package/dist/zh-CN.module.js.map +0 -1
  175. package/dist/zh-TW.main.js +0 -6
  176. package/dist/zh-TW.main.js.map +0 -1
  177. package/dist/zh-TW.mjs +0 -8
  178. package/dist/zh-TW.module.js +0 -8
  179. package/dist/zh-TW.module.js.map +0 -1
package/dist/import.mjs CHANGED
@@ -1,39 +1,5 @@
1
- import $773d5888b972f1cf$exports from "./ar-AE.mjs";
2
- import $d11f19852b941573$exports from "./bg-BG.mjs";
3
- import $b983974c2ee1efb3$exports from "./cs-CZ.mjs";
4
- import $5809cc9d4e92de73$exports from "./da-DK.mjs";
5
- import $c68c2e4fc74398d1$exports from "./de-DE.mjs";
6
- import $0898b4c153db2b77$exports from "./el-GR.mjs";
7
- import $6d74810286a15183$exports from "./en-US.mjs";
8
- import $309d73dc65f78055$exports from "./es-ES.mjs";
9
- import $44ad94f7205cf593$exports from "./et-EE.mjs";
10
- import $7c28f5687f0779a9$exports from "./fi-FI.mjs";
11
- import $e6d75df4b68bd73a$exports from "./fr-FR.mjs";
12
- import $87505c9dab186d0f$exports from "./he-IL.mjs";
13
- import $553439c3ffb3e492$exports from "./hr-HR.mjs";
14
- import $74cf411061b983a2$exports from "./hu-HU.mjs";
15
- import $e933f298574dc435$exports from "./it-IT.mjs";
16
- import $ac91fc9fe02f71f6$exports from "./ja-JP.mjs";
17
- import $52b96f86422025af$exports from "./ko-KR.mjs";
18
- import $c0d724c3e51dafa6$exports from "./lt-LT.mjs";
19
- import $c92899672a3fe72e$exports from "./lv-LV.mjs";
20
- import $9f576b39d8e7a9d6$exports from "./nb-NO.mjs";
21
- import $9d025808aeec81a7$exports from "./nl-NL.mjs";
22
- import $fce709921e2c0fa6$exports from "./pl-PL.mjs";
23
- import $2599cf0c4ab37f59$exports from "./pt-BR.mjs";
24
- import $3c220ae7ef8a35fd$exports from "./pt-PT.mjs";
25
- import $93562b5094072f54$exports from "./ro-RO.mjs";
26
- import $cd9e2abd0d06c7b4$exports from "./ru-RU.mjs";
27
- import $45375701f409adf1$exports from "./sk-SK.mjs";
28
- import $27fab53a576de9dd$exports from "./sl-SI.mjs";
29
- import $4438748d9952e7c7$exports from "./sr-SP.mjs";
30
- import $0936d7347ef4da4c$exports from "./sv-SE.mjs";
31
- import $29700c92185d38f8$exports from "./tr-TR.mjs";
32
- import $662ccaf2be4c25b3$exports from "./uk-UA.mjs";
33
- import $d80a27deda7cdb3c$exports from "./zh-CN.mjs";
34
- import $2b2734393847c884$exports from "./zh-TW.mjs";
35
- import $k7QOs$react, {useState as $k7QOs$useState, useCallback as $k7QOs$useCallback, useRef as $k7QOs$useRef, useEffect as $k7QOs$useEffect, useContext as $k7QOs$useContext, useMemo as $k7QOs$useMemo} from "react";
36
- import {useLayoutEffect as $k7QOs$useLayoutEffect, useResizeObserver as $k7QOs$useResizeObserver, clamp as $k7QOs$clamp, useId as $k7QOs$useId, isIOS as $k7QOs$isIOS, chain as $k7QOs$chain, getScrollParent as $k7QOs$getScrollParent, useLabels as $k7QOs$useLabels, mergeProps as $k7QOs$mergeProps} from "@react-aria/utils";
1
+ import $k7QOs$react, {useState as $k7QOs$useState, useRef as $k7QOs$useRef, useEffect as $k7QOs$useEffect, useCallback as $k7QOs$useCallback, useContext as $k7QOs$useContext, useMemo as $k7QOs$useMemo} from "react";
2
+ import {useLayoutEffect as $k7QOs$useLayoutEffect, useResizeObserver as $k7QOs$useResizeObserver, isWebKit as $k7QOs$isWebKit, clamp as $k7QOs$clamp, useId as $k7QOs$useId, isIOS as $k7QOs$isIOS, chain as $k7QOs$chain, getScrollParent as $k7QOs$getScrollParent, useLabels as $k7QOs$useLabels, mergeProps as $k7QOs$mergeProps} from "@react-aria/utils";
37
3
  import {useLocale as $k7QOs$useLocale, useLocalizedStringFormatter as $k7QOs$useLocalizedStringFormatter} from "@react-aria/i18n";
38
4
  import {isElementInChildOfActiveScope as $k7QOs$isElementInChildOfActiveScope, FocusScope as $k7QOs$FocusScope} from "@react-aria/focus";
39
5
  import {useInteractOutside as $k7QOs$useInteractOutside, useFocusWithin as $k7QOs$useFocusWithin, ClearPressResponder as $k7QOs$ClearPressResponder} from "@react-aria/interactions";
@@ -106,6 +72,7 @@ let $edcf132a9284368a$var$visualViewport = typeof document !== "undefined" && wi
106
72
  function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
107
73
  let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
108
74
  let scroll = {};
75
+ let isPinchZoomedIn = ($edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.scale) > 1;
109
76
  if (containerNode.tagName === "BODY") {
110
77
  let documentElement = document.documentElement;
111
78
  totalWidth = documentElement.clientWidth;
@@ -116,6 +83,13 @@ function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
116
83
  height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
117
84
  scroll.top = documentElement.scrollTop || containerNode.scrollTop;
118
85
  scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
86
+ // The goal of the below is to get a top/left value that represents the top/left of the visual viewport with
87
+ // respect to the layout viewport origin. This combined with the scrollTop/scrollLeft will allow us to calculate
88
+ // coordinates/values with respect to the visual viewport or with respect to the layout viewport.
89
+ if ($edcf132a9284368a$var$visualViewport) {
90
+ top = $edcf132a9284368a$var$visualViewport.offsetTop;
91
+ left = $edcf132a9284368a$var$visualViewport.offsetLeft;
92
+ }
119
93
  } else {
120
94
  ({ width: width, height: height, top: top, left: left } = $edcf132a9284368a$var$getOffset(containerNode));
121
95
  scroll.top = containerNode.scrollTop;
@@ -123,6 +97,16 @@ function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
123
97
  totalWidth = width;
124
98
  totalHeight = height;
125
99
  }
100
+ if ((0, $k7QOs$isWebKit)() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
101
+ // Safari will report a non-zero scrollTop/Left for the non-scrolling body/HTML element when pinch zoomed in unlike other browsers.
102
+ // Set to zero for parity calculations so we get consistent positioning of overlays across all browsers.
103
+ // Also switch to visualViewport.pageTop/pageLeft so that we still accomodate for scroll positioning for body/HTML elements that are actually scrollable
104
+ // before pinch zoom happens
105
+ scroll.top = 0;
106
+ scroll.left = 0;
107
+ top = $edcf132a9284368a$var$visualViewport.pageTop;
108
+ left = $edcf132a9284368a$var$visualViewport.pageLeft;
109
+ }
126
110
  return {
127
111
  width: width,
128
112
  height: height,
@@ -141,6 +125,7 @@ function $edcf132a9284368a$var$getScroll(node) {
141
125
  height: node.scrollHeight
142
126
  };
143
127
  }
128
+ // Determines the amount of space required when moving the overlay to ensure it remains in the boundary
144
129
  function $edcf132a9284368a$var$getDelta(axis, offset, size, // The dimensions of the boundary element that the popover is
145
130
  // positioned within (most of the time this is the <body>).
146
131
  boundaryDimensions, // The dimensions of the containing block element that the popover is
@@ -148,13 +133,20 @@ boundaryDimensions, // The dimensions of the containing block element that the p
148
133
  // Usually this is the same as the boundary element, but if the popover
149
134
  // is portaled somewhere other than the body and has an ancestor with
150
135
  // position: relative/absolute, it will be different.
151
- containerDimensions, padding) {
136
+ containerDimensions, padding, containerOffsetWithBoundary) {
152
137
  let containerScroll = containerDimensions.scroll[axis];
153
- let boundaryHeight = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
154
- let startEdgeOffset = offset - padding - containerScroll;
155
- let endEdgeOffset = offset + padding - containerScroll + size;
156
- if (startEdgeOffset < 0) return -startEdgeOffset;
157
- else if (endEdgeOffset > boundaryHeight) return Math.max(boundaryHeight - endEdgeOffset, -startEdgeOffset);
138
+ // The height/width of the boundary. Matches the axis along which we are adjusting the overlay position
139
+ let boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
140
+ // Calculate the edges of the boundary (accomodating for the boundary padding) and the edges of the overlay.
141
+ // Note that these values are with respect to the visual viewport (aka 0,0 is the top left of the viewport)
142
+ let boundaryStartEdge = boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + padding;
143
+ let boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] - padding;
144
+ let startEdgeOffset = offset - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
145
+ let endEdgeOffset = offset - containerScroll + size + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
146
+ // If any of the overlay edges falls outside of the boundary, shift the overlay the required amount to align one of the overlay's
147
+ // edges with the closest boundary edge.
148
+ if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
149
+ else if (endEdgeOffset > boundaryEndEdge) return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
158
150
  else return 0;
159
151
  }
160
152
  function $edcf132a9284368a$var$getMargins(node) {
@@ -198,7 +190,6 @@ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions,
198
190
  /* else {
199
191
  the overlay top should match the button top
200
192
  } */
201
- // add the crossOffset from props
202
193
  position[crossAxis] += crossOffset;
203
194
  // overlay top overlapping arrow with button bottom
204
195
  const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
@@ -216,14 +207,20 @@ function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions,
216
207
  } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
217
208
  return position;
218
209
  }
219
- function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding) {
220
- return position.top != null ? Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top // this is the bottom of the boundary
221
- - (containerOffsetWithBoundary.top + position.top // this is the top of the overlay
222
- ) - (margins.top + margins.bottom + padding // save additional space for margin and padding
223
- )) : Math.max(0, childOffset.top + containerOffsetWithBoundary.top // this is the top of the trigger
210
+ function $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
211
+ const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height];
212
+ // For cases where position is set via "bottom" instead of "top", we need to calculate the true overlay top with respect to the boundary. Reverse calculate this with the same method
213
+ // used in computePosition.
214
+ let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - position.bottom - overlayHeight);
215
+ let maxHeight = heightGrowthDirection !== "top" ? // We want the distance between the top of the overlay to the bottom of the boundary
216
+ Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top // this is the bottom of the boundary
217
+ - overlayTop // this is the top of the overlay
218
+ - (margins.top + margins.bottom + padding // save additional space for margin and padding
219
+ )) : Math.max(0, overlayTop + overlayHeight // this is the bottom of the overlay
224
220
  - (boundaryDimensions.top + boundaryDimensions.scroll.top // this is the top of the boundary
225
221
  ) - (margins.top + margins.bottom + padding // save additional space for margin and padding
226
222
  ));
223
+ return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
227
224
  }
228
225
  function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
229
226
  let { placement: placement, axis: axis, size: size } = placementInfo;
@@ -248,13 +245,22 @@ function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset,
248
245
  normalizedOffset = offset;
249
246
  }
250
247
  }
251
- let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
248
+ // Determine the direction the height of the overlay can grow so that we can choose how to calculate the max height
249
+ let heightGrowthDirection = "bottom";
250
+ if (placementInfo.axis === "top") {
251
+ if (placementInfo.placement === "top") heightGrowthDirection = "top";
252
+ else if (placementInfo.placement === "bottom") heightGrowthDirection = "bottom";
253
+ } else if (placementInfo.crossAxis === "top") {
254
+ if (placementInfo.crossPlacement === "top") heightGrowthDirection = "bottom";
255
+ else if (placementInfo.crossPlacement === "bottom") heightGrowthDirection = "top";
256
+ }
257
+ let delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
252
258
  position[crossAxis] += delta;
253
- let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding);
259
+ let maxHeight = $edcf132a9284368a$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
254
260
  if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
255
261
  overlaySize.height = Math.min(overlaySize.height, maxHeight);
256
262
  position = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
257
- delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
263
+ delta = $edcf132a9284368a$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
258
264
  position[crossAxis] += delta;
259
265
  let arrowPosition = {};
260
266
  // All values are transformed so that 0 is at the top/left of the overlay depending on the orientation
@@ -296,7 +302,14 @@ function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts) {
296
302
  let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
297
303
  let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
298
304
  let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
305
+ // If the container is the HTML element wrapping the body element, the retrieved scrollTop/scrollLeft will be equal to the
306
+ // body element's scroll. Set the container's scroll values to 0 since the overlay's edge position value in getDelta don't then need to be further offset
307
+ // by the container scroll since they are essentially the same containing element and thus in the same coordinate system
299
308
  let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container) : $edcf132a9284368a$var$getPosition(container, boundaryElement);
309
+ if (container.tagName === "HTML" && boundaryElement.tagName === "BODY") {
310
+ containerDimensions.scroll.top = 0;
311
+ containerDimensions.scroll.left = 0;
312
+ }
300
313
  return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
301
314
  }
302
315
  function $edcf132a9284368a$var$getOffset(node) {
@@ -432,8 +445,21 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
432
445
  arrowBoundaryOffset,
433
446
  arrowSize
434
447
  ];
448
+ // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might
449
+ // just be a non-realistic use case
450
+ // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles
451
+ let lastScale = (0, $k7QOs$useRef)($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale);
452
+ (0, $k7QOs$useEffect)(()=>{
453
+ if (isOpen) lastScale.current = $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale;
454
+ }, [
455
+ isOpen
456
+ ]);
435
457
  let updatePosition = (0, $k7QOs$useCallback)(()=>{
436
458
  if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) return;
459
+ if (($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale) !== lastScale.current) return;
460
+ // Always reset the overlay's previous max height if not defined by the user so that we can compensate for
461
+ // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.
462
+ if (!maxHeight && overlayRef.current) overlayRef.current.style.maxHeight = "none";
437
463
  let position = (0, $edcf132a9284368a$export$b3ceb0cbf1056d98)({
438
464
  placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
439
465
  overlayNode: overlayRef.current,
@@ -479,11 +505,16 @@ function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
479
505
  }, 500);
480
506
  updatePosition();
481
507
  };
508
+ // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)
509
+ // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.
510
+ let onScroll = ()=>{
511
+ if (isResizing.current) onResize();
512
+ };
482
513
  $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize);
483
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onResize);
514
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onScroll);
484
515
  return ()=>{
485
516
  $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize);
486
- $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onResize);
517
+ $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onScroll);
487
518
  };
488
519
  }, [
489
520
  updatePosition
@@ -998,39 +1029,209 @@ function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
998
1029
  * OF ANY KIND, either express or implied. See the License for the specific language
999
1030
  * governing permissions and limitations under the License.
1000
1031
  */ var $a2f21f5f14f60553$exports = {};
1032
+ var $773d5888b972f1cf$exports = {};
1033
+ $773d5888b972f1cf$exports = {
1034
+ "dismiss": `\u{62A}\u{62C}\u{627}\u{647}\u{644}`
1035
+ };
1001
1036
 
1002
1037
 
1038
+ var $d11f19852b941573$exports = {};
1039
+ $d11f19852b941573$exports = {
1040
+ "dismiss": `\u{41E}\u{442}\u{445}\u{432}\u{44A}\u{440}\u{43B}\u{44F}\u{43D}\u{435}`
1041
+ };
1003
1042
 
1004
1043
 
1044
+ var $b983974c2ee1efb3$exports = {};
1045
+ $b983974c2ee1efb3$exports = {
1046
+ "dismiss": `Odstranit`
1047
+ };
1005
1048
 
1006
1049
 
1050
+ var $5809cc9d4e92de73$exports = {};
1051
+ $5809cc9d4e92de73$exports = {
1052
+ "dismiss": `Luk`
1053
+ };
1007
1054
 
1008
1055
 
1056
+ var $c68c2e4fc74398d1$exports = {};
1057
+ $c68c2e4fc74398d1$exports = {
1058
+ "dismiss": `Schlie\xdfen`
1059
+ };
1009
1060
 
1010
1061
 
1062
+ var $0898b4c153db2b77$exports = {};
1063
+ $0898b4c153db2b77$exports = {
1064
+ "dismiss": `\u{391}\u{3C0}\u{3CC}\u{3C1}\u{3C1}\u{3B9}\u{3C8}\u{3B7}`
1065
+ };
1011
1066
 
1012
1067
 
1068
+ var $6d74810286a15183$exports = {};
1069
+ $6d74810286a15183$exports = {
1070
+ "dismiss": `Dismiss`
1071
+ };
1013
1072
 
1014
1073
 
1074
+ var $309d73dc65f78055$exports = {};
1075
+ $309d73dc65f78055$exports = {
1076
+ "dismiss": `Descartar`
1077
+ };
1015
1078
 
1016
1079
 
1080
+ var $44ad94f7205cf593$exports = {};
1081
+ $44ad94f7205cf593$exports = {
1082
+ "dismiss": `L\xf5peta`
1083
+ };
1017
1084
 
1018
1085
 
1086
+ var $7c28f5687f0779a9$exports = {};
1087
+ $7c28f5687f0779a9$exports = {
1088
+ "dismiss": `Hylk\xe4\xe4`
1089
+ };
1019
1090
 
1020
1091
 
1092
+ var $e6d75df4b68bd73a$exports = {};
1093
+ $e6d75df4b68bd73a$exports = {
1094
+ "dismiss": `Rejeter`
1095
+ };
1021
1096
 
1022
1097
 
1098
+ var $87505c9dab186d0f$exports = {};
1099
+ $87505c9dab186d0f$exports = {
1100
+ "dismiss": `\u{5D4}\u{5EA}\u{5E2}\u{5DC}\u{5DD}`
1101
+ };
1102
+
1103
+
1104
+ var $553439c3ffb3e492$exports = {};
1105
+ $553439c3ffb3e492$exports = {
1106
+ "dismiss": `Odbaci`
1107
+ };
1108
+
1023
1109
 
1110
+ var $74cf411061b983a2$exports = {};
1111
+ $74cf411061b983a2$exports = {
1112
+ "dismiss": `Elutas\xedt\xe1s`
1113
+ };
1024
1114
 
1025
1115
 
1116
+ var $e933f298574dc435$exports = {};
1117
+ $e933f298574dc435$exports = {
1118
+ "dismiss": `Ignora`
1119
+ };
1026
1120
 
1027
1121
 
1122
+ var $ac91fc9fe02f71f6$exports = {};
1123
+ $ac91fc9fe02f71f6$exports = {
1124
+ "dismiss": `\u{9589}\u{3058}\u{308B}`
1125
+ };
1028
1126
 
1029
1127
 
1128
+ var $52b96f86422025af$exports = {};
1129
+ $52b96f86422025af$exports = {
1130
+ "dismiss": `\u{BB34}\u{C2DC}`
1131
+ };
1030
1132
 
1031
1133
 
1134
+ var $c0d724c3e51dafa6$exports = {};
1135
+ $c0d724c3e51dafa6$exports = {
1136
+ "dismiss": `Atmesti`
1137
+ };
1138
+
1139
+
1140
+ var $c92899672a3fe72e$exports = {};
1141
+ $c92899672a3fe72e$exports = {
1142
+ "dismiss": `Ner\u{101}d\u{12B}t`
1143
+ };
1144
+
1145
+
1146
+ var $9f576b39d8e7a9d6$exports = {};
1147
+ $9f576b39d8e7a9d6$exports = {
1148
+ "dismiss": `Lukk`
1149
+ };
1150
+
1151
+
1152
+ var $9d025808aeec81a7$exports = {};
1153
+ $9d025808aeec81a7$exports = {
1154
+ "dismiss": `Negeren`
1155
+ };
1032
1156
 
1033
1157
 
1158
+ var $fce709921e2c0fa6$exports = {};
1159
+ $fce709921e2c0fa6$exports = {
1160
+ "dismiss": `Zignoruj`
1161
+ };
1162
+
1163
+
1164
+ var $2599cf0c4ab37f59$exports = {};
1165
+ $2599cf0c4ab37f59$exports = {
1166
+ "dismiss": `Descartar`
1167
+ };
1168
+
1169
+
1170
+ var $3c220ae7ef8a35fd$exports = {};
1171
+ $3c220ae7ef8a35fd$exports = {
1172
+ "dismiss": `Dispensar`
1173
+ };
1174
+
1175
+
1176
+ var $93562b5094072f54$exports = {};
1177
+ $93562b5094072f54$exports = {
1178
+ "dismiss": `Revocare`
1179
+ };
1180
+
1181
+
1182
+ var $cd9e2abd0d06c7b4$exports = {};
1183
+ $cd9e2abd0d06c7b4$exports = {
1184
+ "dismiss": `\u{41F}\u{440}\u{43E}\u{43F}\u{443}\u{441}\u{442}\u{438}\u{442}\u{44C}`
1185
+ };
1186
+
1187
+
1188
+ var $45375701f409adf1$exports = {};
1189
+ $45375701f409adf1$exports = {
1190
+ "dismiss": `Zru\u{161}i\u{165}`
1191
+ };
1192
+
1193
+
1194
+ var $27fab53a576de9dd$exports = {};
1195
+ $27fab53a576de9dd$exports = {
1196
+ "dismiss": `Opusti`
1197
+ };
1198
+
1199
+
1200
+ var $4438748d9952e7c7$exports = {};
1201
+ $4438748d9952e7c7$exports = {
1202
+ "dismiss": `Odbaci`
1203
+ };
1204
+
1205
+
1206
+ var $0936d7347ef4da4c$exports = {};
1207
+ $0936d7347ef4da4c$exports = {
1208
+ "dismiss": `Avvisa`
1209
+ };
1210
+
1211
+
1212
+ var $29700c92185d38f8$exports = {};
1213
+ $29700c92185d38f8$exports = {
1214
+ "dismiss": `Kapat`
1215
+ };
1216
+
1217
+
1218
+ var $662ccaf2be4c25b3$exports = {};
1219
+ $662ccaf2be4c25b3$exports = {
1220
+ "dismiss": `\u{421}\u{43A}\u{430}\u{441}\u{443}\u{432}\u{430}\u{442}\u{438}`
1221
+ };
1222
+
1223
+
1224
+ var $d80a27deda7cdb3c$exports = {};
1225
+ $d80a27deda7cdb3c$exports = {
1226
+ "dismiss": `\u{53D6}\u{6D88}`
1227
+ };
1228
+
1229
+
1230
+ var $2b2734393847c884$exports = {};
1231
+ $2b2734393847c884$exports = {
1232
+ "dismiss": `\u{95DC}\u{9589}`
1233
+ };
1234
+
1034
1235
 
1035
1236
  $a2f21f5f14f60553$exports = {
1036
1237
  "ar-AE": $773d5888b972f1cf$exports,