@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/main.js CHANGED
@@ -1,37 +1,3 @@
1
- var $4393d9b86d3ad278$exports = require("./ar-AE.main.js");
2
- var $254224013ae06959$exports = require("./bg-BG.main.js");
3
- var $55d3567b59d09782$exports = require("./cs-CZ.main.js");
4
- var $0e419a7be7773c16$exports = require("./da-DK.main.js");
5
- var $be606513c8356c34$exports = require("./de-DE.main.js");
6
- var $7d99787e5bd26f87$exports = require("./el-GR.main.js");
7
- var $0360f2a6534752c1$exports = require("./en-US.main.js");
8
- var $92bf4fdecfeb6a61$exports = require("./es-ES.main.js");
9
- var $7c02fa9b9c598043$exports = require("./et-EE.main.js");
10
- var $ba53535dcca59343$exports = require("./fi-FI.main.js");
11
- var $2fbbcddf7d252cb7$exports = require("./fr-FR.main.js");
12
- var $0a1f0520e07d3596$exports = require("./he-IL.main.js");
13
- var $f7be5df1487823a9$exports = require("./hr-HR.main.js");
14
- var $8dbe4363bfbba3f9$exports = require("./hu-HU.main.js");
15
- var $90a445da1ad273e7$exports = require("./it-IT.main.js");
16
- var $e1ebf18259c9b1ee$exports = require("./ja-JP.main.js");
17
- var $765893642f3b4f72$exports = require("./ko-KR.main.js");
18
- var $af73ba24f63febd1$exports = require("./lt-LT.main.js");
19
- var $97aac9f6740ee412$exports = require("./lv-LV.main.js");
20
- var $92fbe76e196d7e0a$exports = require("./nb-NO.main.js");
21
- var $44399897afb701ce$exports = require("./nl-NL.main.js");
22
- var $d679e258664d7384$exports = require("./pl-PL.main.js");
23
- var $b51fc2992648966b$exports = require("./pt-BR.main.js");
24
- var $6abbc540dcd5f78c$exports = require("./pt-PT.main.js");
25
- var $6cbc0c9bf574473b$exports = require("./ro-RO.main.js");
26
- var $009edbe58be6525b$exports = require("./ru-RU.main.js");
27
- var $01cf6095489e78f7$exports = require("./sk-SK.main.js");
28
- var $33fd5a1a3753e83f$exports = require("./sl-SI.main.js");
29
- var $6b9373a558e74e84$exports = require("./sr-SP.main.js");
30
- var $90008194c3db7fce$exports = require("./sv-SE.main.js");
31
- var $e29d21290b4ce15c$exports = require("./tr-TR.main.js");
32
- var $96139c59e8ba3f85$exports = require("./uk-UA.main.js");
33
- var $052554192ea8e826$exports = require("./zh-CN.main.js");
34
- var $3f3b5d798a5abdbc$exports = require("./zh-TW.main.js");
35
1
  var $6Zb2x$react = require("react");
36
2
  var $6Zb2x$reactariautils = require("@react-aria/utils");
37
3
  var $6Zb2x$reactariai18n = require("@react-aria/i18n");
@@ -126,6 +92,7 @@ let $5935ba4d7da2c103$var$visualViewport = typeof document !== "undefined" && wi
126
92
  function $5935ba4d7da2c103$var$getContainerDimensions(containerNode) {
127
93
  let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
128
94
  let scroll = {};
95
+ let isPinchZoomedIn = ($5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.scale) > 1;
129
96
  if (containerNode.tagName === "BODY") {
130
97
  let documentElement = document.documentElement;
131
98
  totalWidth = documentElement.clientWidth;
@@ -136,6 +103,13 @@ function $5935ba4d7da2c103$var$getContainerDimensions(containerNode) {
136
103
  height = (_visualViewport_height = $5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
137
104
  scroll.top = documentElement.scrollTop || containerNode.scrollTop;
138
105
  scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
106
+ // The goal of the below is to get a top/left value that represents the top/left of the visual viewport with
107
+ // respect to the layout viewport origin. This combined with the scrollTop/scrollLeft will allow us to calculate
108
+ // coordinates/values with respect to the visual viewport or with respect to the layout viewport.
109
+ if ($5935ba4d7da2c103$var$visualViewport) {
110
+ top = $5935ba4d7da2c103$var$visualViewport.offsetTop;
111
+ left = $5935ba4d7da2c103$var$visualViewport.offsetLeft;
112
+ }
139
113
  } else {
140
114
  ({ width: width, height: height, top: top, left: left } = $5935ba4d7da2c103$var$getOffset(containerNode));
141
115
  scroll.top = containerNode.scrollTop;
@@ -143,6 +117,16 @@ function $5935ba4d7da2c103$var$getContainerDimensions(containerNode) {
143
117
  totalWidth = width;
144
118
  totalHeight = height;
145
119
  }
120
+ if ((0, $6Zb2x$reactariautils.isWebKit)() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
121
+ // Safari will report a non-zero scrollTop/Left for the non-scrolling body/HTML element when pinch zoomed in unlike other browsers.
122
+ // Set to zero for parity calculations so we get consistent positioning of overlays across all browsers.
123
+ // Also switch to visualViewport.pageTop/pageLeft so that we still accomodate for scroll positioning for body/HTML elements that are actually scrollable
124
+ // before pinch zoom happens
125
+ scroll.top = 0;
126
+ scroll.left = 0;
127
+ top = $5935ba4d7da2c103$var$visualViewport.pageTop;
128
+ left = $5935ba4d7da2c103$var$visualViewport.pageLeft;
129
+ }
146
130
  return {
147
131
  width: width,
148
132
  height: height,
@@ -161,6 +145,7 @@ function $5935ba4d7da2c103$var$getScroll(node) {
161
145
  height: node.scrollHeight
162
146
  };
163
147
  }
148
+ // Determines the amount of space required when moving the overlay to ensure it remains in the boundary
164
149
  function $5935ba4d7da2c103$var$getDelta(axis, offset, size, // The dimensions of the boundary element that the popover is
165
150
  // positioned within (most of the time this is the <body>).
166
151
  boundaryDimensions, // The dimensions of the containing block element that the popover is
@@ -168,13 +153,20 @@ boundaryDimensions, // The dimensions of the containing block element that the p
168
153
  // Usually this is the same as the boundary element, but if the popover
169
154
  // is portaled somewhere other than the body and has an ancestor with
170
155
  // position: relative/absolute, it will be different.
171
- containerDimensions, padding) {
156
+ containerDimensions, padding, containerOffsetWithBoundary) {
172
157
  let containerScroll = containerDimensions.scroll[axis];
173
- let boundaryHeight = boundaryDimensions[$5935ba4d7da2c103$var$AXIS_SIZE[axis]];
174
- let startEdgeOffset = offset - padding - containerScroll;
175
- let endEdgeOffset = offset + padding - containerScroll + size;
176
- if (startEdgeOffset < 0) return -startEdgeOffset;
177
- else if (endEdgeOffset > boundaryHeight) return Math.max(boundaryHeight - endEdgeOffset, -startEdgeOffset);
158
+ // The height/width of the boundary. Matches the axis along which we are adjusting the overlay position
159
+ let boundarySize = boundaryDimensions[$5935ba4d7da2c103$var$AXIS_SIZE[axis]];
160
+ // Calculate the edges of the boundary (accomodating for the boundary padding) and the edges of the overlay.
161
+ // Note that these values are with respect to the visual viewport (aka 0,0 is the top left of the viewport)
162
+ let boundaryStartEdge = boundaryDimensions.scroll[$5935ba4d7da2c103$var$AXIS[axis]] + padding;
163
+ let boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$5935ba4d7da2c103$var$AXIS[axis]] - padding;
164
+ let startEdgeOffset = offset - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$5935ba4d7da2c103$var$AXIS[axis]];
165
+ let endEdgeOffset = offset - containerScroll + size + containerOffsetWithBoundary[axis] - boundaryDimensions[$5935ba4d7da2c103$var$AXIS[axis]];
166
+ // If any of the overlay edges falls outside of the boundary, shift the overlay the required amount to align one of the overlay's
167
+ // edges with the closest boundary edge.
168
+ if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
169
+ else if (endEdgeOffset > boundaryEndEdge) return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
178
170
  else return 0;
179
171
  }
180
172
  function $5935ba4d7da2c103$var$getMargins(node) {
@@ -218,7 +210,6 @@ function $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions,
218
210
  /* else {
219
211
  the overlay top should match the button top
220
212
  } */
221
- // add the crossOffset from props
222
213
  position[crossAxis] += crossOffset;
223
214
  // overlay top overlapping arrow with button bottom
224
215
  const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
@@ -236,14 +227,20 @@ function $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions,
236
227
  } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
237
228
  return position;
238
229
  }
239
- function $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding) {
240
- return position.top != null ? Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top // this is the bottom of the boundary
241
- - (containerOffsetWithBoundary.top + position.top // this is the top of the overlay
242
- ) - (margins.top + margins.bottom + padding // save additional space for margin and padding
243
- )) : Math.max(0, childOffset.top + containerOffsetWithBoundary.top // this is the top of the trigger
230
+ function $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
231
+ const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$5935ba4d7da2c103$var$TOTAL_SIZE.height];
232
+ // 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
233
+ // used in computePosition.
234
+ let overlayTop = position.top != null ? containerOffsetWithBoundary.top + position.top : containerOffsetWithBoundary.top + (containerHeight - position.bottom - overlayHeight);
235
+ let maxHeight = heightGrowthDirection !== "top" ? // We want the distance between the top of the overlay to the bottom of the boundary
236
+ Math.max(0, boundaryDimensions.height + boundaryDimensions.top + boundaryDimensions.scroll.top // this is the bottom of the boundary
237
+ - overlayTop // this is the top of the overlay
238
+ - (margins.top + margins.bottom + padding // save additional space for margin and padding
239
+ )) : Math.max(0, overlayTop + overlayHeight // this is the bottom of the overlay
244
240
  - (boundaryDimensions.top + boundaryDimensions.scroll.top // this is the top of the boundary
245
241
  ) - (margins.top + margins.bottom + padding // save additional space for margin and padding
246
242
  ));
243
+ return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
247
244
  }
248
245
  function $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
249
246
  let { placement: placement, axis: axis, size: size } = placementInfo;
@@ -268,13 +265,22 @@ function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset,
268
265
  normalizedOffset = offset;
269
266
  }
270
267
  }
271
- let delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
268
+ // Determine the direction the height of the overlay can grow so that we can choose how to calculate the max height
269
+ let heightGrowthDirection = "bottom";
270
+ if (placementInfo.axis === "top") {
271
+ if (placementInfo.placement === "top") heightGrowthDirection = "top";
272
+ else if (placementInfo.placement === "bottom") heightGrowthDirection = "bottom";
273
+ } else if (placementInfo.crossAxis === "top") {
274
+ if (placementInfo.crossPlacement === "top") heightGrowthDirection = "bottom";
275
+ else if (placementInfo.crossPlacement === "bottom") heightGrowthDirection = "top";
276
+ }
277
+ let delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
272
278
  position[crossAxis] += delta;
273
- let maxHeight = $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding);
279
+ let maxHeight = $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
274
280
  if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
275
281
  overlaySize.height = Math.min(overlaySize.height, maxHeight);
276
282
  position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
277
- delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding);
283
+ delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
278
284
  position[crossAxis] += delta;
279
285
  let arrowPosition = {};
280
286
  // All values are transformed so that 0 is at the top/left of the overlay depending on the orientation
@@ -316,7 +322,14 @@ function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
316
322
  let scrollSize = $5935ba4d7da2c103$var$getScroll(scrollNode);
317
323
  let boundaryDimensions = $5935ba4d7da2c103$var$getContainerDimensions(boundaryElement);
318
324
  let containerDimensions = $5935ba4d7da2c103$var$getContainerDimensions(container);
325
+ // If the container is the HTML element wrapping the body element, the retrieved scrollTop/scrollLeft will be equal to the
326
+ // 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
327
+ // by the container scroll since they are essentially the same containing element and thus in the same coordinate system
319
328
  let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $5935ba4d7da2c103$var$getOffset(container) : $5935ba4d7da2c103$var$getPosition(container, boundaryElement);
329
+ if (container.tagName === "HTML" && boundaryElement.tagName === "BODY") {
330
+ containerDimensions.scroll.top = 0;
331
+ containerDimensions.scroll.left = 0;
332
+ }
320
333
  return $5935ba4d7da2c103$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
321
334
  }
322
335
  function $5935ba4d7da2c103$var$getOffset(node) {
@@ -452,8 +465,21 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
452
465
  arrowBoundaryOffset,
453
466
  arrowSize
454
467
  ];
468
+ // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might
469
+ // just be a non-realistic use case
470
+ // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles
471
+ let lastScale = (0, $6Zb2x$react.useRef)($cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.scale);
472
+ (0, $6Zb2x$react.useEffect)(()=>{
473
+ if (isOpen) lastScale.current = $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.scale;
474
+ }, [
475
+ isOpen
476
+ ]);
455
477
  let updatePosition = (0, $6Zb2x$react.useCallback)(()=>{
456
478
  if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !scrollRef.current || !boundaryElement) return;
479
+ if (($cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.scale) !== lastScale.current) return;
480
+ // Always reset the overlay's previous max height if not defined by the user so that we can compensate for
481
+ // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.
482
+ if (!maxHeight && overlayRef.current) overlayRef.current.style.maxHeight = "none";
457
483
  let position = (0, $5935ba4d7da2c103$export$b3ceb0cbf1056d98)({
458
484
  placement: $cd94b4896dd97759$var$translateRTL(placement, direction),
459
485
  overlayNode: overlayRef.current,
@@ -499,11 +525,16 @@ function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
499
525
  }, 500);
500
526
  updatePosition();
501
527
  };
528
+ // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)
529
+ // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.
530
+ let onScroll = ()=>{
531
+ if (isResizing.current) onResize();
532
+ };
502
533
  $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener("resize", onResize);
503
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener("scroll", onResize);
534
+ $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener("scroll", onScroll);
504
535
  return ()=>{
505
536
  $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener("resize", onResize);
506
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener("scroll", onResize);
537
+ $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener("scroll", onScroll);
507
538
  };
508
539
  }, [
509
540
  updatePosition
@@ -1018,39 +1049,209 @@ function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
1018
1049
  * OF ANY KIND, either express or implied. See the License for the specific language
1019
1050
  * governing permissions and limitations under the License.
1020
1051
  */ var $90f032faf016e1fb$exports = {};
1052
+ var $4393d9b86d3ad278$exports = {};
1053
+ $4393d9b86d3ad278$exports = {
1054
+ "dismiss": `\u{62A}\u{62C}\u{627}\u{647}\u{644}`
1055
+ };
1021
1056
 
1022
1057
 
1058
+ var $254224013ae06959$exports = {};
1059
+ $254224013ae06959$exports = {
1060
+ "dismiss": `\u{41E}\u{442}\u{445}\u{432}\u{44A}\u{440}\u{43B}\u{44F}\u{43D}\u{435}`
1061
+ };
1023
1062
 
1024
1063
 
1064
+ var $55d3567b59d09782$exports = {};
1065
+ $55d3567b59d09782$exports = {
1066
+ "dismiss": `Odstranit`
1067
+ };
1025
1068
 
1026
1069
 
1070
+ var $0e419a7be7773c16$exports = {};
1071
+ $0e419a7be7773c16$exports = {
1072
+ "dismiss": `Luk`
1073
+ };
1027
1074
 
1028
1075
 
1076
+ var $be606513c8356c34$exports = {};
1077
+ $be606513c8356c34$exports = {
1078
+ "dismiss": `Schlie\xdfen`
1079
+ };
1029
1080
 
1030
1081
 
1082
+ var $7d99787e5bd26f87$exports = {};
1083
+ $7d99787e5bd26f87$exports = {
1084
+ "dismiss": `\u{391}\u{3C0}\u{3CC}\u{3C1}\u{3C1}\u{3B9}\u{3C8}\u{3B7}`
1085
+ };
1031
1086
 
1032
1087
 
1088
+ var $0360f2a6534752c1$exports = {};
1089
+ $0360f2a6534752c1$exports = {
1090
+ "dismiss": `Dismiss`
1091
+ };
1033
1092
 
1034
1093
 
1094
+ var $92bf4fdecfeb6a61$exports = {};
1095
+ $92bf4fdecfeb6a61$exports = {
1096
+ "dismiss": `Descartar`
1097
+ };
1035
1098
 
1036
1099
 
1100
+ var $7c02fa9b9c598043$exports = {};
1101
+ $7c02fa9b9c598043$exports = {
1102
+ "dismiss": `L\xf5peta`
1103
+ };
1037
1104
 
1038
1105
 
1106
+ var $ba53535dcca59343$exports = {};
1107
+ $ba53535dcca59343$exports = {
1108
+ "dismiss": `Hylk\xe4\xe4`
1109
+ };
1039
1110
 
1040
1111
 
1112
+ var $2fbbcddf7d252cb7$exports = {};
1113
+ $2fbbcddf7d252cb7$exports = {
1114
+ "dismiss": `Rejeter`
1115
+ };
1041
1116
 
1042
1117
 
1118
+ var $0a1f0520e07d3596$exports = {};
1119
+ $0a1f0520e07d3596$exports = {
1120
+ "dismiss": `\u{5D4}\u{5EA}\u{5E2}\u{5DC}\u{5DD}`
1121
+ };
1122
+
1123
+
1124
+ var $f7be5df1487823a9$exports = {};
1125
+ $f7be5df1487823a9$exports = {
1126
+ "dismiss": `Odbaci`
1127
+ };
1128
+
1043
1129
 
1130
+ var $8dbe4363bfbba3f9$exports = {};
1131
+ $8dbe4363bfbba3f9$exports = {
1132
+ "dismiss": `Elutas\xedt\xe1s`
1133
+ };
1044
1134
 
1045
1135
 
1136
+ var $90a445da1ad273e7$exports = {};
1137
+ $90a445da1ad273e7$exports = {
1138
+ "dismiss": `Ignora`
1139
+ };
1046
1140
 
1047
1141
 
1142
+ var $e1ebf18259c9b1ee$exports = {};
1143
+ $e1ebf18259c9b1ee$exports = {
1144
+ "dismiss": `\u{9589}\u{3058}\u{308B}`
1145
+ };
1048
1146
 
1049
1147
 
1148
+ var $765893642f3b4f72$exports = {};
1149
+ $765893642f3b4f72$exports = {
1150
+ "dismiss": `\u{BB34}\u{C2DC}`
1151
+ };
1050
1152
 
1051
1153
 
1154
+ var $af73ba24f63febd1$exports = {};
1155
+ $af73ba24f63febd1$exports = {
1156
+ "dismiss": `Atmesti`
1157
+ };
1158
+
1159
+
1160
+ var $97aac9f6740ee412$exports = {};
1161
+ $97aac9f6740ee412$exports = {
1162
+ "dismiss": `Ner\u{101}d\u{12B}t`
1163
+ };
1164
+
1165
+
1166
+ var $92fbe76e196d7e0a$exports = {};
1167
+ $92fbe76e196d7e0a$exports = {
1168
+ "dismiss": `Lukk`
1169
+ };
1170
+
1171
+
1172
+ var $44399897afb701ce$exports = {};
1173
+ $44399897afb701ce$exports = {
1174
+ "dismiss": `Negeren`
1175
+ };
1052
1176
 
1053
1177
 
1178
+ var $d679e258664d7384$exports = {};
1179
+ $d679e258664d7384$exports = {
1180
+ "dismiss": `Zignoruj`
1181
+ };
1182
+
1183
+
1184
+ var $b51fc2992648966b$exports = {};
1185
+ $b51fc2992648966b$exports = {
1186
+ "dismiss": `Descartar`
1187
+ };
1188
+
1189
+
1190
+ var $6abbc540dcd5f78c$exports = {};
1191
+ $6abbc540dcd5f78c$exports = {
1192
+ "dismiss": `Dispensar`
1193
+ };
1194
+
1195
+
1196
+ var $6cbc0c9bf574473b$exports = {};
1197
+ $6cbc0c9bf574473b$exports = {
1198
+ "dismiss": `Revocare`
1199
+ };
1200
+
1201
+
1202
+ var $009edbe58be6525b$exports = {};
1203
+ $009edbe58be6525b$exports = {
1204
+ "dismiss": `\u{41F}\u{440}\u{43E}\u{43F}\u{443}\u{441}\u{442}\u{438}\u{442}\u{44C}`
1205
+ };
1206
+
1207
+
1208
+ var $01cf6095489e78f7$exports = {};
1209
+ $01cf6095489e78f7$exports = {
1210
+ "dismiss": `Zru\u{161}i\u{165}`
1211
+ };
1212
+
1213
+
1214
+ var $33fd5a1a3753e83f$exports = {};
1215
+ $33fd5a1a3753e83f$exports = {
1216
+ "dismiss": `Opusti`
1217
+ };
1218
+
1219
+
1220
+ var $6b9373a558e74e84$exports = {};
1221
+ $6b9373a558e74e84$exports = {
1222
+ "dismiss": `Odbaci`
1223
+ };
1224
+
1225
+
1226
+ var $90008194c3db7fce$exports = {};
1227
+ $90008194c3db7fce$exports = {
1228
+ "dismiss": `Avvisa`
1229
+ };
1230
+
1231
+
1232
+ var $e29d21290b4ce15c$exports = {};
1233
+ $e29d21290b4ce15c$exports = {
1234
+ "dismiss": `Kapat`
1235
+ };
1236
+
1237
+
1238
+ var $96139c59e8ba3f85$exports = {};
1239
+ $96139c59e8ba3f85$exports = {
1240
+ "dismiss": `\u{421}\u{43A}\u{430}\u{441}\u{443}\u{432}\u{430}\u{442}\u{438}`
1241
+ };
1242
+
1243
+
1244
+ var $052554192ea8e826$exports = {};
1245
+ $052554192ea8e826$exports = {
1246
+ "dismiss": `\u{53D6}\u{6D88}`
1247
+ };
1248
+
1249
+
1250
+ var $3f3b5d798a5abdbc$exports = {};
1251
+ $3f3b5d798a5abdbc$exports = {
1252
+ "dismiss": `\u{95DC}\u{9589}`
1253
+ };
1254
+
1054
1255
 
1055
1256
  $90f032faf016e1fb$exports = {
1056
1257
  "ar-AE": $4393d9b86d3ad278$exports,