@react-aria/overlays 3.21.0 → 3.22.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 (253) hide show
  1. package/dist/DismissButton.main.js +51 -0
  2. package/dist/DismissButton.main.js.map +1 -0
  3. package/dist/DismissButton.mjs +46 -0
  4. package/dist/DismissButton.module.js +46 -0
  5. package/dist/DismissButton.module.js.map +1 -0
  6. package/dist/Overlay.main.js +73 -0
  7. package/dist/Overlay.main.js.map +1 -0
  8. package/dist/Overlay.mjs +63 -0
  9. package/dist/Overlay.module.js +63 -0
  10. package/dist/Overlay.module.js.map +1 -0
  11. package/dist/PortalProvider.main.js +41 -0
  12. package/dist/PortalProvider.main.js.map +1 -0
  13. package/dist/PortalProvider.mjs +31 -0
  14. package/dist/PortalProvider.module.js +31 -0
  15. package/dist/PortalProvider.module.js.map +1 -0
  16. package/dist/ar-AE.main.js +6 -0
  17. package/dist/ar-AE.main.js.map +1 -0
  18. package/dist/ar-AE.mjs +8 -0
  19. package/dist/ar-AE.module.js +8 -0
  20. package/dist/ar-AE.module.js.map +1 -0
  21. package/dist/ariaHideOutside.main.js +121 -0
  22. package/dist/ariaHideOutside.main.js.map +1 -0
  23. package/dist/ariaHideOutside.mjs +116 -0
  24. package/dist/ariaHideOutside.module.js +116 -0
  25. package/dist/ariaHideOutside.module.js.map +1 -0
  26. package/dist/bg-BG.main.js +6 -0
  27. package/dist/bg-BG.main.js.map +1 -0
  28. package/dist/bg-BG.mjs +8 -0
  29. package/dist/bg-BG.module.js +8 -0
  30. package/dist/bg-BG.module.js.map +1 -0
  31. package/dist/calculatePosition.main.js +355 -0
  32. package/dist/calculatePosition.main.js.map +1 -0
  33. package/dist/calculatePosition.mjs +350 -0
  34. package/dist/calculatePosition.module.js +350 -0
  35. package/dist/calculatePosition.module.js.map +1 -0
  36. package/dist/cs-CZ.main.js +6 -0
  37. package/dist/cs-CZ.main.js.map +1 -0
  38. package/dist/cs-CZ.mjs +8 -0
  39. package/dist/cs-CZ.module.js +8 -0
  40. package/dist/cs-CZ.module.js.map +1 -0
  41. package/dist/da-DK.main.js +6 -0
  42. package/dist/da-DK.main.js.map +1 -0
  43. package/dist/da-DK.mjs +8 -0
  44. package/dist/da-DK.module.js +8 -0
  45. package/dist/da-DK.module.js.map +1 -0
  46. package/dist/de-DE.main.js +6 -0
  47. package/dist/de-DE.main.js.map +1 -0
  48. package/dist/de-DE.mjs +8 -0
  49. package/dist/de-DE.module.js +8 -0
  50. package/dist/de-DE.module.js.map +1 -0
  51. package/dist/el-GR.main.js +6 -0
  52. package/dist/el-GR.main.js.map +1 -0
  53. package/dist/el-GR.mjs +8 -0
  54. package/dist/el-GR.module.js +8 -0
  55. package/dist/el-GR.module.js.map +1 -0
  56. package/dist/en-US.main.js +6 -0
  57. package/dist/en-US.main.js.map +1 -0
  58. package/dist/en-US.mjs +8 -0
  59. package/dist/en-US.module.js +8 -0
  60. package/dist/en-US.module.js.map +1 -0
  61. package/dist/es-ES.main.js +6 -0
  62. package/dist/es-ES.main.js.map +1 -0
  63. package/dist/es-ES.mjs +8 -0
  64. package/dist/es-ES.module.js +8 -0
  65. package/dist/es-ES.module.js.map +1 -0
  66. package/dist/et-EE.main.js +6 -0
  67. package/dist/et-EE.main.js.map +1 -0
  68. package/dist/et-EE.mjs +8 -0
  69. package/dist/et-EE.module.js +8 -0
  70. package/dist/et-EE.module.js.map +1 -0
  71. package/dist/fi-FI.main.js +6 -0
  72. package/dist/fi-FI.main.js.map +1 -0
  73. package/dist/fi-FI.mjs +8 -0
  74. package/dist/fi-FI.module.js +8 -0
  75. package/dist/fi-FI.module.js.map +1 -0
  76. package/dist/fr-FR.main.js +6 -0
  77. package/dist/fr-FR.main.js.map +1 -0
  78. package/dist/fr-FR.mjs +8 -0
  79. package/dist/fr-FR.module.js +8 -0
  80. package/dist/fr-FR.module.js.map +1 -0
  81. package/dist/he-IL.main.js +6 -0
  82. package/dist/he-IL.main.js.map +1 -0
  83. package/dist/he-IL.mjs +8 -0
  84. package/dist/he-IL.module.js +8 -0
  85. package/dist/he-IL.module.js.map +1 -0
  86. package/dist/hr-HR.main.js +6 -0
  87. package/dist/hr-HR.main.js.map +1 -0
  88. package/dist/hr-HR.mjs +8 -0
  89. package/dist/hr-HR.module.js +8 -0
  90. package/dist/hr-HR.module.js.map +1 -0
  91. package/dist/hu-HU.main.js +6 -0
  92. package/dist/hu-HU.main.js.map +1 -0
  93. package/dist/hu-HU.mjs +8 -0
  94. package/dist/hu-HU.module.js +8 -0
  95. package/dist/hu-HU.module.js.map +1 -0
  96. package/dist/import.mjs +12 -1533
  97. package/dist/intlStrings.main.js +108 -0
  98. package/dist/intlStrings.main.js.map +1 -0
  99. package/dist/intlStrings.mjs +110 -0
  100. package/dist/intlStrings.module.js +110 -0
  101. package/dist/intlStrings.module.js.map +1 -0
  102. package/dist/it-IT.main.js +6 -0
  103. package/dist/it-IT.main.js.map +1 -0
  104. package/dist/it-IT.mjs +8 -0
  105. package/dist/it-IT.module.js +8 -0
  106. package/dist/it-IT.module.js.map +1 -0
  107. package/dist/ja-JP.main.js +6 -0
  108. package/dist/ja-JP.main.js.map +1 -0
  109. package/dist/ja-JP.mjs +8 -0
  110. package/dist/ja-JP.module.js +8 -0
  111. package/dist/ja-JP.module.js.map +1 -0
  112. package/dist/ko-KR.main.js +6 -0
  113. package/dist/ko-KR.main.js.map +1 -0
  114. package/dist/ko-KR.mjs +8 -0
  115. package/dist/ko-KR.module.js +8 -0
  116. package/dist/ko-KR.module.js.map +1 -0
  117. package/dist/lt-LT.main.js +6 -0
  118. package/dist/lt-LT.main.js.map +1 -0
  119. package/dist/lt-LT.mjs +8 -0
  120. package/dist/lt-LT.module.js +8 -0
  121. package/dist/lt-LT.module.js.map +1 -0
  122. package/dist/lv-LV.main.js +6 -0
  123. package/dist/lv-LV.main.js.map +1 -0
  124. package/dist/lv-LV.mjs +8 -0
  125. package/dist/lv-LV.module.js +8 -0
  126. package/dist/lv-LV.module.js.map +1 -0
  127. package/dist/main.js +28 -1547
  128. package/dist/main.js.map +1 -1
  129. package/dist/module.js +12 -1533
  130. package/dist/module.js.map +1 -1
  131. package/dist/nb-NO.main.js +6 -0
  132. package/dist/nb-NO.main.js.map +1 -0
  133. package/dist/nb-NO.mjs +8 -0
  134. package/dist/nb-NO.module.js +8 -0
  135. package/dist/nb-NO.module.js.map +1 -0
  136. package/dist/nl-NL.main.js +6 -0
  137. package/dist/nl-NL.main.js.map +1 -0
  138. package/dist/nl-NL.mjs +8 -0
  139. package/dist/nl-NL.module.js +8 -0
  140. package/dist/nl-NL.module.js.map +1 -0
  141. package/dist/pl-PL.main.js +6 -0
  142. package/dist/pl-PL.main.js.map +1 -0
  143. package/dist/pl-PL.mjs +8 -0
  144. package/dist/pl-PL.module.js +8 -0
  145. package/dist/pl-PL.module.js.map +1 -0
  146. package/dist/pt-BR.main.js +6 -0
  147. package/dist/pt-BR.main.js.map +1 -0
  148. package/dist/pt-BR.mjs +8 -0
  149. package/dist/pt-BR.module.js +8 -0
  150. package/dist/pt-BR.module.js.map +1 -0
  151. package/dist/pt-PT.main.js +6 -0
  152. package/dist/pt-PT.main.js.map +1 -0
  153. package/dist/pt-PT.mjs +8 -0
  154. package/dist/pt-PT.module.js +8 -0
  155. package/dist/pt-PT.module.js.map +1 -0
  156. package/dist/ro-RO.main.js +6 -0
  157. package/dist/ro-RO.main.js.map +1 -0
  158. package/dist/ro-RO.mjs +8 -0
  159. package/dist/ro-RO.module.js +8 -0
  160. package/dist/ro-RO.module.js.map +1 -0
  161. package/dist/ru-RU.main.js +6 -0
  162. package/dist/ru-RU.main.js.map +1 -0
  163. package/dist/ru-RU.mjs +8 -0
  164. package/dist/ru-RU.module.js +8 -0
  165. package/dist/ru-RU.module.js.map +1 -0
  166. package/dist/sk-SK.main.js +6 -0
  167. package/dist/sk-SK.main.js.map +1 -0
  168. package/dist/sk-SK.mjs +8 -0
  169. package/dist/sk-SK.module.js +8 -0
  170. package/dist/sk-SK.module.js.map +1 -0
  171. package/dist/sl-SI.main.js +6 -0
  172. package/dist/sl-SI.main.js.map +1 -0
  173. package/dist/sl-SI.mjs +8 -0
  174. package/dist/sl-SI.module.js +8 -0
  175. package/dist/sl-SI.module.js.map +1 -0
  176. package/dist/sr-SP.main.js +6 -0
  177. package/dist/sr-SP.main.js.map +1 -0
  178. package/dist/sr-SP.mjs +8 -0
  179. package/dist/sr-SP.module.js +8 -0
  180. package/dist/sr-SP.module.js.map +1 -0
  181. package/dist/sv-SE.main.js +6 -0
  182. package/dist/sv-SE.main.js.map +1 -0
  183. package/dist/sv-SE.mjs +8 -0
  184. package/dist/sv-SE.module.js +8 -0
  185. package/dist/sv-SE.module.js.map +1 -0
  186. package/dist/tr-TR.main.js +6 -0
  187. package/dist/tr-TR.main.js.map +1 -0
  188. package/dist/tr-TR.mjs +8 -0
  189. package/dist/tr-TR.module.js +8 -0
  190. package/dist/tr-TR.module.js.map +1 -0
  191. package/dist/types.d.ts +8 -1
  192. package/dist/types.d.ts.map +1 -1
  193. package/dist/uk-UA.main.js +6 -0
  194. package/dist/uk-UA.main.js.map +1 -0
  195. package/dist/uk-UA.mjs +8 -0
  196. package/dist/uk-UA.module.js +8 -0
  197. package/dist/uk-UA.module.js.map +1 -0
  198. package/dist/useCloseOnScroll.main.js +46 -0
  199. package/dist/useCloseOnScroll.main.js.map +1 -0
  200. package/dist/useCloseOnScroll.mjs +40 -0
  201. package/dist/useCloseOnScroll.module.js +40 -0
  202. package/dist/useCloseOnScroll.module.js.map +1 -0
  203. package/dist/useModal.main.js +114 -0
  204. package/dist/useModal.main.js.map +1 -0
  205. package/dist/useModal.mjs +101 -0
  206. package/dist/useModal.module.js +101 -0
  207. package/dist/useModal.module.js.map +1 -0
  208. package/dist/useModalOverlay.main.js +55 -0
  209. package/dist/useModalOverlay.main.js.map +1 -0
  210. package/dist/useModalOverlay.mjs +50 -0
  211. package/dist/useModalOverlay.module.js +50 -0
  212. package/dist/useModalOverlay.module.js.map +1 -0
  213. package/dist/useOverlay.main.js +105 -0
  214. package/dist/useOverlay.main.js.map +1 -0
  215. package/dist/useOverlay.mjs +100 -0
  216. package/dist/useOverlay.module.js +100 -0
  217. package/dist/useOverlay.module.js.map +1 -0
  218. package/dist/useOverlayPosition.main.js +181 -0
  219. package/dist/useOverlayPosition.main.js.map +1 -0
  220. package/dist/useOverlayPosition.mjs +176 -0
  221. package/dist/useOverlayPosition.module.js +176 -0
  222. package/dist/useOverlayPosition.module.js.map +1 -0
  223. package/dist/useOverlayTrigger.main.js +54 -0
  224. package/dist/useOverlayTrigger.main.js.map +1 -0
  225. package/dist/useOverlayTrigger.mjs +49 -0
  226. package/dist/useOverlayTrigger.module.js +49 -0
  227. package/dist/useOverlayTrigger.module.js.map +1 -0
  228. package/dist/usePopover.main.js +66 -0
  229. package/dist/usePopover.main.js.map +1 -0
  230. package/dist/usePopover.mjs +61 -0
  231. package/dist/usePopover.module.js +61 -0
  232. package/dist/usePopover.module.js.map +1 -0
  233. package/dist/usePreventScroll.main.js +226 -0
  234. package/dist/usePreventScroll.main.js.map +1 -0
  235. package/dist/usePreventScroll.mjs +221 -0
  236. package/dist/usePreventScroll.module.js +221 -0
  237. package/dist/usePreventScroll.module.js.map +1 -0
  238. package/dist/zh-CN.main.js +6 -0
  239. package/dist/zh-CN.main.js.map +1 -0
  240. package/dist/zh-CN.mjs +8 -0
  241. package/dist/zh-CN.module.js +8 -0
  242. package/dist/zh-CN.module.js.map +1 -0
  243. package/dist/zh-TW.main.js +6 -0
  244. package/dist/zh-TW.main.js.map +1 -0
  245. package/dist/zh-TW.mjs +8 -0
  246. package/dist/zh-TW.module.js +8 -0
  247. package/dist/zh-TW.module.js.map +1 -0
  248. package/package.json +12 -12
  249. package/src/Overlay.tsx +6 -0
  250. package/src/PortalProvider.tsx +34 -0
  251. package/src/index.ts +1 -0
  252. package/src/useModalOverlay.ts +2 -2
  253. package/src/useOverlay.ts +1 -1
package/dist/main.js CHANGED
@@ -1,594 +1,37 @@
1
- var $6Zb2x$react = require("react");
2
- var $6Zb2x$reactariautils = require("@react-aria/utils");
3
- var $6Zb2x$reactariai18n = require("@react-aria/i18n");
4
- var $6Zb2x$reactariafocus = require("@react-aria/focus");
5
- var $6Zb2x$reactariainteractions = require("@react-aria/interactions");
6
- var $6Zb2x$reactdom = require("react-dom");
7
- var $6Zb2x$reactariassr = require("@react-aria/ssr");
8
- var $6Zb2x$reactariavisuallyhidden = require("@react-aria/visually-hidden");
1
+ var $cd94b4896dd97759$exports = require("./useOverlayPosition.main.js");
2
+ var $82711f9cb668ecdb$exports = require("./useOverlay.main.js");
3
+ var $b4878eb6316f670a$exports = require("./useOverlayTrigger.main.js");
4
+ var $5c2f5cd01815d369$exports = require("./usePreventScroll.main.js");
5
+ var $0775ea8ea6a0565e$exports = require("./useModal.main.js");
6
+ var $f69bb3e6457495cc$exports = require("./DismissButton.main.js");
7
+ var $08ef1685902b6011$exports = require("./ariaHideOutside.main.js");
8
+ var $6c2dfcdee3e15e20$exports = require("./usePopover.main.js");
9
+ var $11b7e0b04b421e95$exports = require("./useModalOverlay.main.js");
10
+ var $745edbb83ab4296f$exports = require("./Overlay.main.js");
11
+ var $d7347c25ab757295$exports = require("./PortalProvider.main.js");
9
12
 
10
13
 
11
14
  function $parcel$export(e, n, v, s) {
12
15
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
13
16
  }
14
17
 
15
- function $parcel$interopDefault(a) {
16
- return a && a.__esModule ? a.default : a;
17
- }
18
-
19
- $parcel$export(module.exports, "useOverlayPosition", () => $cd94b4896dd97759$export$d39e1813b3bdd0e1);
20
- $parcel$export(module.exports, "useOverlay", () => $82711f9cb668ecdb$export$ea8f71083e90600f);
21
- $parcel$export(module.exports, "useOverlayTrigger", () => $b4878eb6316f670a$export$f9d5c8beee7d008d);
22
- $parcel$export(module.exports, "usePreventScroll", () => $5c2f5cd01815d369$export$ee0f7cc6afcd1c18);
23
- $parcel$export(module.exports, "ModalProvider", () => $0775ea8ea6a0565e$export$178405afcd8c5eb);
24
- $parcel$export(module.exports, "useModalProvider", () => $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0);
25
- $parcel$export(module.exports, "OverlayProvider", () => $0775ea8ea6a0565e$export$bf688221f59024e5);
26
- $parcel$export(module.exports, "OverlayContainer", () => $0775ea8ea6a0565e$export$b47c3594eab58386);
27
- $parcel$export(module.exports, "useModal", () => $0775ea8ea6a0565e$export$33ffd74ebf07f060);
28
- $parcel$export(module.exports, "DismissButton", () => $f69bb3e6457495cc$export$2317d149ed6f78c4);
29
- $parcel$export(module.exports, "ariaHideOutside", () => $08ef1685902b6011$export$1c3ebcada18427bf);
30
- $parcel$export(module.exports, "usePopover", () => $6c2dfcdee3e15e20$export$542a6fd13ac93354);
31
- $parcel$export(module.exports, "useModalOverlay", () => $11b7e0b04b421e95$export$dbc0f175b25fb0fb);
32
- $parcel$export(module.exports, "Overlay", () => $745edbb83ab4296f$export$c6fdb837b070b4ff);
33
- $parcel$export(module.exports, "useOverlayFocusContain", () => $745edbb83ab4296f$export$14c98a7594375490);
34
- /*
35
- * Copyright 2020 Adobe. All rights reserved.
36
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
37
- * you may not use this file except in compliance with the License. You may obtain a copy
38
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
39
- *
40
- * Unless required by applicable law or agreed to in writing, software distributed under
41
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
42
- * OF ANY KIND, either express or implied. See the License for the specific language
43
- * governing permissions and limitations under the License.
44
- */ /*
45
- * Copyright 2020 Adobe. All rights reserved.
46
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
47
- * you may not use this file except in compliance with the License. You may obtain a copy
48
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
49
- *
50
- * Unless required by applicable law or agreed to in writing, software distributed under
51
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
52
- * OF ANY KIND, either express or implied. See the License for the specific language
53
- * governing permissions and limitations under the License.
54
- */ /*
55
- * Copyright 2020 Adobe. All rights reserved.
56
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
57
- * you may not use this file except in compliance with the License. You may obtain a copy
58
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
59
- *
60
- * Unless required by applicable law or agreed to in writing, software distributed under
61
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
62
- * OF ANY KIND, either express or implied. See the License for the specific language
63
- * governing permissions and limitations under the License.
64
- */
65
- const $5935ba4d7da2c103$var$AXIS = {
66
- top: "top",
67
- bottom: "top",
68
- left: "left",
69
- right: "left"
70
- };
71
- const $5935ba4d7da2c103$var$FLIPPED_DIRECTION = {
72
- top: "bottom",
73
- bottom: "top",
74
- left: "right",
75
- right: "left"
76
- };
77
- const $5935ba4d7da2c103$var$CROSS_AXIS = {
78
- top: "left",
79
- left: "top"
80
- };
81
- const $5935ba4d7da2c103$var$AXIS_SIZE = {
82
- top: "height",
83
- left: "width"
84
- };
85
- const $5935ba4d7da2c103$var$TOTAL_SIZE = {
86
- width: "totalWidth",
87
- height: "totalHeight"
88
- };
89
- const $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE = {};
90
- // @ts-ignore
91
- let $5935ba4d7da2c103$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
92
- function $5935ba4d7da2c103$var$getContainerDimensions(containerNode) {
93
- let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
94
- let scroll = {};
95
- let isPinchZoomedIn = ($5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.scale) > 1;
96
- if (containerNode.tagName === "BODY") {
97
- let documentElement = document.documentElement;
98
- totalWidth = documentElement.clientWidth;
99
- totalHeight = documentElement.clientHeight;
100
- var _visualViewport_width;
101
- width = (_visualViewport_width = $5935ba4d7da2c103$var$visualViewport === null || $5935ba4d7da2c103$var$visualViewport === void 0 ? void 0 : $5935ba4d7da2c103$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
102
- var _visualViewport_height;
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;
104
- scroll.top = documentElement.scrollTop || containerNode.scrollTop;
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
- }
113
- } else {
114
- ({ width: width, height: height, top: top, left: left } = $5935ba4d7da2c103$var$getOffset(containerNode));
115
- scroll.top = containerNode.scrollTop;
116
- scroll.left = containerNode.scrollLeft;
117
- totalWidth = width;
118
- totalHeight = height;
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
- }
130
- return {
131
- width: width,
132
- height: height,
133
- totalWidth: totalWidth,
134
- totalHeight: totalHeight,
135
- scroll: scroll,
136
- top: top,
137
- left: left
138
- };
139
- }
140
- function $5935ba4d7da2c103$var$getScroll(node) {
141
- return {
142
- top: node.scrollTop,
143
- left: node.scrollLeft,
144
- width: node.scrollWidth,
145
- height: node.scrollHeight
146
- };
147
- }
148
- // Determines the amount of space required when moving the overlay to ensure it remains in the boundary
149
- function $5935ba4d7da2c103$var$getDelta(axis, offset, size, // The dimensions of the boundary element that the popover is
150
- // positioned within (most of the time this is the <body>).
151
- boundaryDimensions, // The dimensions of the containing block element that the popover is
152
- // positioned relative to (e.g. parent with position: relative).
153
- // Usually this is the same as the boundary element, but if the popover
154
- // is portaled somewhere other than the body and has an ancestor with
155
- // position: relative/absolute, it will be different.
156
- containerDimensions, padding, containerOffsetWithBoundary) {
157
- let containerScroll = containerDimensions.scroll[axis];
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);
170
- else return 0;
171
- }
172
- function $5935ba4d7da2c103$var$getMargins(node) {
173
- let style = window.getComputedStyle(node);
174
- return {
175
- top: parseInt(style.marginTop, 10) || 0,
176
- bottom: parseInt(style.marginBottom, 10) || 0,
177
- left: parseInt(style.marginLeft, 10) || 0,
178
- right: parseInt(style.marginRight, 10) || 0
179
- };
180
- }
181
- function $5935ba4d7da2c103$var$parsePlacement(input) {
182
- if ($5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input]) return $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input];
183
- let [placement, crossPlacement] = input.split(" ");
184
- let axis = $5935ba4d7da2c103$var$AXIS[placement] || "right";
185
- let crossAxis = $5935ba4d7da2c103$var$CROSS_AXIS[axis];
186
- if (!$5935ba4d7da2c103$var$AXIS[crossPlacement]) crossPlacement = "center";
187
- let size = $5935ba4d7da2c103$var$AXIS_SIZE[axis];
188
- let crossSize = $5935ba4d7da2c103$var$AXIS_SIZE[crossAxis];
189
- $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input] = {
190
- placement: placement,
191
- crossPlacement: crossPlacement,
192
- axis: axis,
193
- crossAxis: crossAxis,
194
- size: size,
195
- crossSize: crossSize
196
- };
197
- return $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input];
198
- }
199
- function $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
200
- let { placement: placement, crossPlacement: crossPlacement, axis: axis, crossAxis: crossAxis, size: size, crossSize: crossSize } = placementInfo;
201
- let position = {};
202
- // button position
203
- position[crossAxis] = childOffset[crossAxis];
204
- if (crossPlacement === "center") // + (button size / 2) - (overlay size / 2)
205
- // at this point the overlay center should match the button center
206
- position[crossAxis] += (childOffset[crossSize] - overlaySize[crossSize]) / 2;
207
- else if (crossPlacement !== crossAxis) // + (button size) - (overlay size)
208
- // at this point the overlay bottom should match the button bottom
209
- position[crossAxis] += childOffset[crossSize] - overlaySize[crossSize];
210
- /* else {
211
- the overlay top should match the button top
212
- } */
213
- position[crossAxis] += crossOffset;
214
- // overlay top overlapping arrow with button bottom
215
- const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
216
- // overlay bottom overlapping arrow with button top
217
- const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
218
- position[crossAxis] = (0, $6Zb2x$reactariautils.clamp)(position[crossAxis], minPosition, maxPosition);
219
- // Floor these so the position isn't placed on a partial pixel, only whole pixels. Shouldn't matter if it was floored or ceiled, so chose one.
220
- if (placement === axis) {
221
- // If the container is positioned (non-static), then we use the container's actual
222
- // height, as `bottom` will be relative to this height. But if the container is static,
223
- // then it can only be the `document.body`, and `bottom` will be relative to _its_
224
- // container, which should be as large as boundaryDimensions.
225
- const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size] : boundaryDimensions[$5935ba4d7da2c103$var$TOTAL_SIZE[size]];
226
- position[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
227
- } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
228
- return position;
229
- }
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
240
- - (boundaryDimensions.top + boundaryDimensions.scroll.top // this is the top of the boundary
241
- ) - (margins.top + margins.bottom + padding // save additional space for margin and padding
242
- ));
243
- return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
244
- }
245
- function $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
246
- let { placement: placement, axis: axis, size: size } = placementInfo;
247
- if (placement === axis) return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - boundaryDimensions.scroll[axis] + containerOffsetWithBoundary[axis] - margins[axis] - margins[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] - padding);
248
- return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size] - margins[axis] - margins[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] - padding);
249
- }
250
- function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
251
- let placementInfo = $5935ba4d7da2c103$var$parsePlacement(placementInput);
252
- let { size: size, crossAxis: crossAxis, crossSize: crossSize, placement: placement, crossPlacement: crossPlacement } = placementInfo;
253
- let position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
254
- let normalizedOffset = offset;
255
- let space = $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo);
256
- // Check if the scroll size of the overlay is greater than the available space to determine if we need to flip
257
- if (flip && scrollSize[size] > space) {
258
- let flippedPlacementInfo = $5935ba4d7da2c103$var$parsePlacement(`${$5935ba4d7da2c103$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
259
- let flippedPosition = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
260
- let flippedSpace = $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo);
261
- // If the available space for the flipped position is greater than the original available space, flip.
262
- if (flippedSpace > space) {
263
- placementInfo = flippedPlacementInfo;
264
- position = flippedPosition;
265
- normalizedOffset = offset;
266
- }
267
- }
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);
278
- position[crossAxis] += delta;
279
- let maxHeight = $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
280
- if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
281
- overlaySize.height = Math.min(overlaySize.height, maxHeight);
282
- position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
283
- delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
284
- position[crossAxis] += delta;
285
- let arrowPosition = {};
286
- // All values are transformed so that 0 is at the top/left of the overlay depending on the orientation
287
- // Prefer the arrow being in the center of the trigger/overlay anchor element
288
- let preferredArrowPosition = childOffset[crossAxis] + .5 * childOffset[crossSize] - overlaySize[crossAxis];
289
- // Min/Max position limits for the arrow with respect to the overlay
290
- const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
291
- const arrowMaxPosition = overlaySize[crossSize] - arrowSize / 2 - arrowBoundaryOffset;
292
- // Min/Max position limits for the arrow with respect to the trigger/overlay anchor element
293
- const arrowOverlappingChildMinEdge = childOffset[crossAxis] - overlaySize[crossAxis] + arrowSize / 2;
294
- const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - overlaySize[crossAxis] - arrowSize / 2;
295
- // Clamp the arrow positioning so that it always is within the bounds of the anchor and the overlay
296
- const arrowPositionOverlappingChild = (0, $6Zb2x$reactariautils.clamp)(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
297
- arrowPosition[crossAxis] = (0, $6Zb2x$reactariautils.clamp)(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
298
- return {
299
- position: position,
300
- maxHeight: maxHeight,
301
- arrowOffsetLeft: arrowPosition.left,
302
- arrowOffsetTop: arrowPosition.top,
303
- placement: placementInfo.placement
304
- };
305
- }
306
- function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
307
- let { placement: placement, targetNode: targetNode, overlayNode: overlayNode, scrollNode: scrollNode, padding: padding, shouldFlip: shouldFlip, boundaryElement: boundaryElement, offset: offset, crossOffset: crossOffset, maxHeight: maxHeight, arrowSize: arrowSize = 0, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = opts;
308
- let container = overlayNode instanceof HTMLElement ? $5935ba4d7da2c103$var$getContainingBlock(overlayNode) : document.documentElement;
309
- let isViewportContainer = container === document.documentElement;
310
- const containerPositionStyle = window.getComputedStyle(container).position;
311
- let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
312
- let childOffset = isViewportContainer ? $5935ba4d7da2c103$var$getOffset(targetNode) : $5935ba4d7da2c103$var$getPosition(targetNode, container);
313
- if (!isViewportContainer) {
314
- let { marginTop: marginTop, marginLeft: marginLeft } = window.getComputedStyle(targetNode);
315
- childOffset.top += parseInt(marginTop, 10) || 0;
316
- childOffset.left += parseInt(marginLeft, 10) || 0;
317
- }
318
- let overlaySize = $5935ba4d7da2c103$var$getOffset(overlayNode);
319
- let margins = $5935ba4d7da2c103$var$getMargins(overlayNode);
320
- overlaySize.width += margins.left + margins.right;
321
- overlaySize.height += margins.top + margins.bottom;
322
- let scrollSize = $5935ba4d7da2c103$var$getScroll(scrollNode);
323
- let boundaryDimensions = $5935ba4d7da2c103$var$getContainerDimensions(boundaryElement);
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
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
- }
333
- return $5935ba4d7da2c103$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
334
- }
335
- function $5935ba4d7da2c103$var$getOffset(node) {
336
- let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
337
- let { scrollTop: scrollTop, scrollLeft: scrollLeft, clientTop: clientTop, clientLeft: clientLeft } = document.documentElement;
338
- return {
339
- top: top + scrollTop - clientTop,
340
- left: left + scrollLeft - clientLeft,
341
- width: width,
342
- height: height
343
- };
344
- }
345
- function $5935ba4d7da2c103$var$getPosition(node, parent) {
346
- let style = window.getComputedStyle(node);
347
- let offset;
348
- if (style.position === "fixed") {
349
- let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
350
- offset = {
351
- top: top,
352
- left: left,
353
- width: width,
354
- height: height
355
- };
356
- } else {
357
- offset = $5935ba4d7da2c103$var$getOffset(node);
358
- let parentOffset = $5935ba4d7da2c103$var$getOffset(parent);
359
- let parentStyle = window.getComputedStyle(parent);
360
- parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
361
- parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
362
- offset.top -= parentOffset.top;
363
- offset.left -= parentOffset.left;
364
- }
365
- offset.top -= parseInt(style.marginTop, 10) || 0;
366
- offset.left -= parseInt(style.marginLeft, 10) || 0;
367
- return offset;
368
- }
369
- // Returns the containing block of an element, which is the element that
370
- // this element will be positioned relative to.
371
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block
372
- function $5935ba4d7da2c103$var$getContainingBlock(node) {
373
- // The offsetParent of an element in most cases equals the containing block.
374
- // https://w3c.github.io/csswg-drafts/cssom-view/#dom-htmlelement-offsetparent
375
- let offsetParent = node.offsetParent;
376
- // The offsetParent algorithm terminates at the document body,
377
- // even if the body is not a containing block. Double check that
378
- // and use the documentElement if so.
379
- if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$5935ba4d7da2c103$var$isContainingBlock(offsetParent)) offsetParent = document.documentElement;
380
- // TODO(later): handle table elements?
381
- // The offsetParent can be null if the element has position: fixed, or a few other cases.
382
- // We have to walk up the tree manually in this case because fixed positioned elements
383
- // are still positioned relative to their containing block, which is not always the viewport.
384
- if (offsetParent == null) {
385
- offsetParent = node.parentElement;
386
- while(offsetParent && !$5935ba4d7da2c103$var$isContainingBlock(offsetParent))offsetParent = offsetParent.parentElement;
387
- }
388
- // Fall back to the viewport.
389
- return offsetParent || document.documentElement;
390
- }
391
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
392
- function $5935ba4d7da2c103$var$isContainingBlock(node) {
393
- let style = window.getComputedStyle(node);
394
- return style.transform !== "none" || /transform|perspective/.test(style.willChange) || style.filter !== "none" || style.contain === "paint" || // @ts-ignore
395
- "backdropFilter" in style && style.backdropFilter !== "none" || // @ts-ignore
396
- "WebkitBackdropFilter" in style && style.WebkitBackdropFilter !== "none";
397
- }
398
-
399
-
400
-
401
- /*
402
- * Copyright 2020 Adobe. All rights reserved.
403
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
404
- * you may not use this file except in compliance with the License. You may obtain a copy
405
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
406
- *
407
- * Unless required by applicable law or agreed to in writing, software distributed under
408
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
409
- * OF ANY KIND, either express or implied. See the License for the specific language
410
- * governing permissions and limitations under the License.
411
- */
412
- const $9a8aa1b0b336ea3a$export$f6211563215e3b37 = new WeakMap();
413
- function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
414
- let { triggerRef: triggerRef, isOpen: isOpen, onClose: onClose } = opts;
415
- (0, $6Zb2x$react.useEffect)(()=>{
416
- if (!isOpen || onClose === null) return;
417
- let onScroll = (e)=>{
418
- // Ignore if scrolling an scrollable region outside the trigger's tree.
419
- let target = e.target;
420
- // window is not a Node and doesn't have contain, but window contains everything
421
- if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
422
- let onCloseHandler = onClose || $9a8aa1b0b336ea3a$export$f6211563215e3b37.get(triggerRef.current);
423
- if (onCloseHandler) onCloseHandler();
424
- };
425
- window.addEventListener("scroll", onScroll, true);
426
- return ()=>{
427
- window.removeEventListener("scroll", onScroll, true);
428
- };
429
- }, [
430
- isOpen,
431
- onClose,
432
- triggerRef
433
- ]);
434
- }
435
-
436
-
437
-
438
-
439
- // @ts-ignore
440
- let $cd94b4896dd97759$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
441
- function $cd94b4896dd97759$export$d39e1813b3bdd0e1(props) {
442
- let { direction: direction } = (0, $6Zb2x$reactariai18n.useLocale)();
443
- let { arrowSize: arrowSize = 0, targetRef: targetRef, overlayRef: overlayRef, scrollRef: scrollRef = overlayRef, placement: placement = "bottom", containerPadding: containerPadding = 12, shouldFlip: shouldFlip = true, boundaryElement: boundaryElement = typeof document !== "undefined" ? document.body : null, offset: offset = 0, crossOffset: crossOffset = 0, shouldUpdatePosition: shouldUpdatePosition = true, isOpen: isOpen = true, onClose: onClose, maxHeight: maxHeight, arrowBoundaryOffset: arrowBoundaryOffset = 0 } = props;
444
- let [position, setPosition] = (0, $6Zb2x$react.useState)({
445
- position: {},
446
- arrowOffsetLeft: undefined,
447
- arrowOffsetTop: undefined,
448
- maxHeight: undefined,
449
- placement: undefined
450
- });
451
- let deps = [
452
- shouldUpdatePosition,
453
- placement,
454
- overlayRef.current,
455
- targetRef.current,
456
- scrollRef.current,
457
- containerPadding,
458
- shouldFlip,
459
- boundaryElement,
460
- offset,
461
- crossOffset,
462
- isOpen,
463
- direction,
464
- maxHeight,
465
- arrowBoundaryOffset,
466
- arrowSize
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
- ]);
477
- let updatePosition = (0, $6Zb2x$react.useCallback)(()=>{
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";
483
- let position = (0, $5935ba4d7da2c103$export$b3ceb0cbf1056d98)({
484
- placement: $cd94b4896dd97759$var$translateRTL(placement, direction),
485
- overlayNode: overlayRef.current,
486
- targetNode: targetRef.current,
487
- scrollNode: scrollRef.current,
488
- padding: containerPadding,
489
- shouldFlip: shouldFlip,
490
- boundaryElement: boundaryElement,
491
- offset: offset,
492
- crossOffset: crossOffset,
493
- maxHeight: maxHeight,
494
- arrowSize: arrowSize,
495
- arrowBoundaryOffset: arrowBoundaryOffset
496
- });
497
- // Modify overlay styles directly so positioning happens immediately without the need of a second render
498
- // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers
499
- Object.keys(position.position).forEach((key)=>overlayRef.current.style[key] = position.position[key] + "px");
500
- overlayRef.current.style.maxHeight = position.maxHeight != null ? position.maxHeight + "px" : undefined;
501
- // Trigger a set state for a second render anyway for arrow positioning
502
- setPosition(position);
503
- // eslint-disable-next-line react-hooks/exhaustive-deps
504
- }, deps);
505
- // Update position when anything changes
506
- // eslint-disable-next-line react-hooks/exhaustive-deps
507
- (0, $6Zb2x$reactariautils.useLayoutEffect)(updatePosition, deps);
508
- // Update position on window resize
509
- $cd94b4896dd97759$var$useResize(updatePosition);
510
- // Update position when the overlay changes size (might need to flip).
511
- (0, $6Zb2x$reactariautils.useResizeObserver)({
512
- ref: overlayRef,
513
- onResize: updatePosition
514
- });
515
- // Reposition the overlay and do not close on scroll while the visual viewport is resizing.
516
- // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.
517
- let isResizing = (0, $6Zb2x$react.useRef)(false);
518
- (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
519
- let timeout;
520
- let onResize = ()=>{
521
- isResizing.current = true;
522
- clearTimeout(timeout);
523
- timeout = setTimeout(()=>{
524
- isResizing.current = false;
525
- }, 500);
526
- updatePosition();
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
- };
533
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener("resize", onResize);
534
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.addEventListener("scroll", onScroll);
535
- return ()=>{
536
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener("resize", onResize);
537
- $cd94b4896dd97759$var$visualViewport === null || $cd94b4896dd97759$var$visualViewport === void 0 ? void 0 : $cd94b4896dd97759$var$visualViewport.removeEventListener("scroll", onScroll);
538
- };
539
- }, [
540
- updatePosition
541
- ]);
542
- let close = (0, $6Zb2x$react.useCallback)(()=>{
543
- if (!isResizing.current) onClose();
544
- }, [
545
- onClose,
546
- isResizing
547
- ]);
548
- // When scrolling a parent scrollable region of the trigger (other than the body),
549
- // we hide the popover. Otherwise, its position would be incorrect.
550
- (0, $9a8aa1b0b336ea3a$export$18fc8428861184da)({
551
- triggerRef: targetRef,
552
- isOpen: isOpen,
553
- onClose: onClose && close
554
- });
555
- return {
556
- overlayProps: {
557
- style: {
558
- position: "absolute",
559
- zIndex: 100000,
560
- ...position.position,
561
- maxHeight: position.maxHeight
562
- }
563
- },
564
- placement: position.placement,
565
- arrowProps: {
566
- "aria-hidden": "true",
567
- role: "presentation",
568
- style: {
569
- left: position.arrowOffsetLeft,
570
- top: position.arrowOffsetTop
571
- }
572
- },
573
- updatePosition: updatePosition
574
- };
575
- }
576
- function $cd94b4896dd97759$var$useResize(onResize) {
577
- (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
578
- window.addEventListener("resize", onResize, false);
579
- return ()=>{
580
- window.removeEventListener("resize", onResize, false);
581
- };
582
- }, [
583
- onResize
584
- ]);
585
- }
586
- function $cd94b4896dd97759$var$translateRTL(position, direction) {
587
- if (direction === "rtl") return position.replace("start", "right").replace("end", "left");
588
- return position.replace("start", "left").replace("end", "right");
589
- }
590
-
591
-
18
+ $parcel$export(module.exports, "useOverlayPosition", () => $cd94b4896dd97759$exports.useOverlayPosition);
19
+ $parcel$export(module.exports, "useOverlay", () => $82711f9cb668ecdb$exports.useOverlay);
20
+ $parcel$export(module.exports, "useOverlayTrigger", () => $b4878eb6316f670a$exports.useOverlayTrigger);
21
+ $parcel$export(module.exports, "usePreventScroll", () => $5c2f5cd01815d369$exports.usePreventScroll);
22
+ $parcel$export(module.exports, "ModalProvider", () => $0775ea8ea6a0565e$exports.ModalProvider);
23
+ $parcel$export(module.exports, "useModalProvider", () => $0775ea8ea6a0565e$exports.useModalProvider);
24
+ $parcel$export(module.exports, "OverlayProvider", () => $0775ea8ea6a0565e$exports.OverlayProvider);
25
+ $parcel$export(module.exports, "OverlayContainer", () => $0775ea8ea6a0565e$exports.OverlayContainer);
26
+ $parcel$export(module.exports, "useModal", () => $0775ea8ea6a0565e$exports.useModal);
27
+ $parcel$export(module.exports, "DismissButton", () => $f69bb3e6457495cc$exports.DismissButton);
28
+ $parcel$export(module.exports, "ariaHideOutside", () => $08ef1685902b6011$exports.ariaHideOutside);
29
+ $parcel$export(module.exports, "usePopover", () => $6c2dfcdee3e15e20$exports.usePopover);
30
+ $parcel$export(module.exports, "useModalOverlay", () => $11b7e0b04b421e95$exports.useModalOverlay);
31
+ $parcel$export(module.exports, "Overlay", () => $745edbb83ab4296f$exports.Overlay);
32
+ $parcel$export(module.exports, "useOverlayFocusContain", () => $745edbb83ab4296f$exports.useOverlayFocusContain);
33
+ $parcel$export(module.exports, "UNSTABLE_PortalProvider", () => $d7347c25ab757295$exports.UNSTABLE_PortalProvider);
34
+ $parcel$export(module.exports, "useUNSTABLE_PortalContext", () => $d7347c25ab757295$exports.useUNSTABLE_PortalContext);
592
35
  /*
593
36
  * Copyright 2020 Adobe. All rights reserved.
594
37
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -602,973 +45,11 @@ function $cd94b4896dd97759$var$translateRTL(position, direction) {
602
45
  */
603
46
 
604
47
 
605
- const $82711f9cb668ecdb$var$visibleOverlays = [];
606
- function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
607
- let { onClose: onClose, shouldCloseOnBlur: shouldCloseOnBlur, isOpen: isOpen, isDismissable: isDismissable = false, isKeyboardDismissDisabled: isKeyboardDismissDisabled = false, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside } = props;
608
- // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.
609
- (0, $6Zb2x$react.useEffect)(()=>{
610
- if (isOpen) $82711f9cb668ecdb$var$visibleOverlays.push(ref);
611
- return ()=>{
612
- let index = $82711f9cb668ecdb$var$visibleOverlays.indexOf(ref);
613
- if (index >= 0) $82711f9cb668ecdb$var$visibleOverlays.splice(index, 1);
614
- };
615
- }, [
616
- isOpen,
617
- ref
618
- ]);
619
- // Only hide the overlay when it is the topmost visible overlay in the stack
620
- let onHide = ()=>{
621
- if ($82711f9cb668ecdb$var$visibleOverlays[$82711f9cb668ecdb$var$visibleOverlays.length - 1] === ref && onClose) onClose();
622
- };
623
- let onInteractOutsideStart = (e)=>{
624
- if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
625
- if ($82711f9cb668ecdb$var$visibleOverlays[$82711f9cb668ecdb$var$visibleOverlays.length - 1] === ref) {
626
- e.stopPropagation();
627
- e.preventDefault();
628
- }
629
- }
630
- };
631
- let onInteractOutside = (e)=>{
632
- if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target)) {
633
- if ($82711f9cb668ecdb$var$visibleOverlays[$82711f9cb668ecdb$var$visibleOverlays.length - 1] === ref) {
634
- e.stopPropagation();
635
- e.preventDefault();
636
- }
637
- onHide();
638
- }
639
- };
640
- // Handle the escape key
641
- let onKeyDown = (e)=>{
642
- if (e.key === "Escape" && !isKeyboardDismissDisabled) {
643
- e.stopPropagation();
644
- e.preventDefault();
645
- onHide();
646
- }
647
- };
648
- // Handle clicking outside the overlay to close it
649
- (0, $6Zb2x$reactariainteractions.useInteractOutside)({
650
- ref: ref,
651
- onInteractOutside: isDismissable && isOpen ? onInteractOutside : null,
652
- onInteractOutsideStart: onInteractOutsideStart
653
- });
654
- let { focusWithinProps: focusWithinProps } = (0, $6Zb2x$reactariainteractions.useFocusWithin)({
655
- isDisabled: !shouldCloseOnBlur,
656
- onBlurWithin: (e)=>{
657
- // Do not close if relatedTarget is null, which means focus is lost to the body.
658
- // That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.
659
- // Clicking on the body to close the overlay should already be handled by useInteractOutside.
660
- // https://github.com/adobe/react-spectrum/issues/4130
661
- // https://github.com/adobe/react-spectrum/issues/4922
662
- //
663
- // If focus is moving into a child focus scope (e.g. menu inside a dialog),
664
- // do not close the outer overlay. At this point, the active scope should
665
- // still be the outer overlay, since blur events run before focus.
666
- if (!e.relatedTarget || (0, $6Zb2x$reactariafocus.isElementInChildOfActiveScope)(e.relatedTarget)) return;
667
- if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget)) onClose();
668
- }
669
- });
670
- let onPointerDownUnderlay = (e)=>{
671
- // fixes a firefox issue that starts text selection https://bugzilla.mozilla.org/show_bug.cgi?id=1675846
672
- if (e.target === e.currentTarget) e.preventDefault();
673
- };
674
- return {
675
- overlayProps: {
676
- onKeyDown: onKeyDown,
677
- ...focusWithinProps
678
- },
679
- underlayProps: {
680
- onPointerDown: onPointerDownUnderlay
681
- }
682
- };
683
- }
684
-
685
-
686
- /*
687
- * Copyright 2020 Adobe. All rights reserved.
688
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
689
- * you may not use this file except in compliance with the License. You may obtain a copy
690
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
691
- *
692
- * Unless required by applicable law or agreed to in writing, software distributed under
693
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
694
- * OF ANY KIND, either express or implied. See the License for the specific language
695
- * governing permissions and limitations under the License.
696
- */
697
-
698
-
699
- function $b4878eb6316f670a$export$f9d5c8beee7d008d(props, state, ref) {
700
- let { type: type } = props;
701
- let { isOpen: isOpen } = state;
702
- // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll
703
- // without forcing users to pass onClose.
704
- (0, $6Zb2x$react.useEffect)(()=>{
705
- if (ref && ref.current) (0, $9a8aa1b0b336ea3a$export$f6211563215e3b37).set(ref.current, state.close);
706
- });
707
- // Aria 1.1 supports multiple values for aria-haspopup other than just menus.
708
- // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup
709
- // However, we only add it for menus for now because screen readers often
710
- // announce it as a menu even for other values.
711
- let ariaHasPopup = undefined;
712
- if (type === "menu") ariaHasPopup = true;
713
- else if (type === "listbox") ariaHasPopup = "listbox";
714
- let overlayId = (0, $6Zb2x$reactariautils.useId)();
715
- return {
716
- triggerProps: {
717
- "aria-haspopup": ariaHasPopup,
718
- "aria-expanded": isOpen,
719
- "aria-controls": isOpen ? overlayId : null,
720
- onPress: state.toggle
721
- },
722
- overlayProps: {
723
- id: overlayId
724
- }
725
- };
726
- }
727
-
728
48
 
729
- /*
730
- * Copyright 2020 Adobe. All rights reserved.
731
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
732
- * you may not use this file except in compliance with the License. You may obtain a copy
733
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
734
- *
735
- * Unless required by applicable law or agreed to in writing, software distributed under
736
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
737
- * OF ANY KIND, either express or implied. See the License for the specific language
738
- * governing permissions and limitations under the License.
739
- */
740
- // @ts-ignore
741
- const $5c2f5cd01815d369$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
742
- // HTML input types that do not cause the software keyboard to appear.
743
- const $5c2f5cd01815d369$var$nonTextInputTypes = new Set([
744
- "checkbox",
745
- "radio",
746
- "range",
747
- "color",
748
- "file",
749
- "image",
750
- "button",
751
- "submit",
752
- "reset"
753
- ]);
754
- // The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position
755
- let $5c2f5cd01815d369$var$preventScrollCount = 0;
756
- let $5c2f5cd01815d369$var$restore;
757
- function $5c2f5cd01815d369$export$ee0f7cc6afcd1c18(options = {}) {
758
- let { isDisabled: isDisabled } = options;
759
- (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
760
- if (isDisabled) return;
761
- $5c2f5cd01815d369$var$preventScrollCount++;
762
- if ($5c2f5cd01815d369$var$preventScrollCount === 1) {
763
- if ((0, $6Zb2x$reactariautils.isIOS)()) $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollMobileSafari();
764
- else $5c2f5cd01815d369$var$restore = $5c2f5cd01815d369$var$preventScrollStandard();
765
- }
766
- return ()=>{
767
- $5c2f5cd01815d369$var$preventScrollCount--;
768
- if ($5c2f5cd01815d369$var$preventScrollCount === 0) $5c2f5cd01815d369$var$restore();
769
- };
770
- }, [
771
- isDisabled
772
- ]);
773
- }
774
- // For most browsers, all we need to do is set `overflow: hidden` on the root element, and
775
- // add some padding to prevent the page from shifting when the scrollbar is hidden.
776
- function $5c2f5cd01815d369$var$preventScrollStandard() {
777
- return (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, "overflow", "hidden"));
778
- }
779
- // Mobile Safari is a whole different beast. Even with overflow: hidden,
780
- // it still scrolls the page in many situations:
781
- //
782
- // 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.
783
- // 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of
784
- // it, so it becomes scrollable.
785
- // 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.
786
- // This may cause even fixed position elements to scroll off the screen.
787
- // 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always
788
- // scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.
789
- //
790
- // In order to work around these cases, and prevent scrolling without jankiness, we do a few things:
791
- //
792
- // 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling
793
- // on the window.
794
- // 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at
795
- // the top or bottom. Work around a bug where this does not work when the element does not actually overflow
796
- // by preventing default in a `touchmove` event.
797
- // 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.
798
- // 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top
799
- // of the page, which prevents it from scrolling the page. After the input is focused, scroll the element
800
- // into view ourselves, without scrolling the whole page.
801
- // 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the
802
- // same visually, but makes the actual scroll position always zero. This is required to make all of the
803
- // above work or Safari will still try to scroll the page when focusing an input.
804
- // 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting
805
- // to navigate to an input with the next/previous buttons that's outside a modal.
806
- function $5c2f5cd01815d369$var$preventScrollMobileSafari() {
807
- let scrollable;
808
- let restoreScrollableStyles;
809
- let onTouchStart = (e)=>{
810
- // Store the nearest scrollable parent element from the element that the user touched.
811
- scrollable = (0, $6Zb2x$reactariautils.getScrollParent)(e.target, true);
812
- if (scrollable === document.documentElement && scrollable === document.body) return;
813
- // Prevent scrolling up when at the top and scrolling down when at the bottom
814
- // of a nested scrollable area, otherwise mobile Safari will start scrolling
815
- // the window instead.
816
- if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === "auto") restoreScrollableStyles = $5c2f5cd01815d369$var$setStyle(scrollable, "overscrollBehavior", "contain");
817
- };
818
- let onTouchMove = (e)=>{
819
- // Prevent scrolling the window.
820
- if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
821
- e.preventDefault();
822
- return;
823
- }
824
- // overscroll-behavior should prevent scroll chaining, but currently does not
825
- // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452
826
- // This checks that both the width and height do not overflow, otherwise we might
827
- // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to
828
- // the element will prevent vertical page scrolling. We can't add that automatically
829
- // because it must be set before the touchstart event.
830
- if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) e.preventDefault();
831
- };
832
- let onTouchEnd = (e)=>{
833
- let target = e.target;
834
- // Apply this change if we're not already focused on the target element
835
- if ($5c2f5cd01815d369$var$willOpenKeyboard(target) && target !== document.activeElement) {
836
- e.preventDefault();
837
- setupStyles();
838
- // Apply a transform to trick Safari into thinking the input is at the top of the page
839
- // so it doesn't try to scroll it into view. When tapping on an input, this needs to
840
- // be done before the "focus" event, so we have to focus the element ourselves.
841
- target.style.transform = "translateY(-2000px)";
842
- target.focus();
843
- requestAnimationFrame(()=>{
844
- target.style.transform = "";
845
- });
846
- }
847
- if (restoreScrollableStyles) restoreScrollableStyles();
848
- };
849
- let onFocus = (e)=>{
850
- let target = e.target;
851
- if ($5c2f5cd01815d369$var$willOpenKeyboard(target)) {
852
- setupStyles();
853
- // Transform also needs to be applied in the focus event in cases where focus moves
854
- // other than tapping on an input directly, e.g. the next/previous buttons in the
855
- // software keyboard. In these cases, it seems applying the transform in the focus event
856
- // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️
857
- target.style.transform = "translateY(-2000px)";
858
- requestAnimationFrame(()=>{
859
- target.style.transform = "";
860
- // This will have prevented the browser from scrolling the focused element into view,
861
- // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.
862
- if ($5c2f5cd01815d369$var$visualViewport) {
863
- if ($5c2f5cd01815d369$var$visualViewport.height < window.innerHeight) // If the keyboard is already visible, do this after one additional frame
864
- // to wait for the transform to be removed.
865
- requestAnimationFrame(()=>{
866
- $5c2f5cd01815d369$var$scrollIntoView(target);
867
- });
868
- else // Otherwise, wait for the visual viewport to resize before scrolling so we can
869
- // measure the correct position to scroll to.
870
- $5c2f5cd01815d369$var$visualViewport.addEventListener("resize", ()=>$5c2f5cd01815d369$var$scrollIntoView(target), {
871
- once: true
872
- });
873
- }
874
- });
875
- }
876
- };
877
- let restoreStyles = null;
878
- let setupStyles = ()=>{
879
- if (restoreStyles) return;
880
- let onWindowScroll = ()=>{
881
- // Last resort. If the window scrolled, scroll it back to the top.
882
- // It should always be at the top because the body will have a negative margin (see below).
883
- window.scrollTo(0, 0);
884
- };
885
- // Record the original scroll position so we can restore it.
886
- // Then apply a negative margin to the body to offset it by the scroll position. This will
887
- // enable us to scroll the window to the top, which is required for the rest of this to work.
888
- let scrollX = window.pageXOffset;
889
- let scrollY = window.pageYOffset;
890
- restoreStyles = (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(window, "scroll", onWindowScroll), $5c2f5cd01815d369$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $5c2f5cd01815d369$var$setStyle(document.documentElement, "overflow", "hidden"), $5c2f5cd01815d369$var$setStyle(document.body, "marginTop", `-${scrollY}px`), ()=>{
891
- window.scrollTo(scrollX, scrollY);
892
- });
893
- // Scroll to the top. The negative margin on the body will make this appear the same.
894
- window.scrollTo(0, 0);
895
- };
896
- let removeEvents = (0, $6Zb2x$reactariautils.chain)($5c2f5cd01815d369$var$addEvent(document, "touchstart", onTouchStart, {
897
- passive: false,
898
- capture: true
899
- }), $5c2f5cd01815d369$var$addEvent(document, "touchmove", onTouchMove, {
900
- passive: false,
901
- capture: true
902
- }), $5c2f5cd01815d369$var$addEvent(document, "touchend", onTouchEnd, {
903
- passive: false,
904
- capture: true
905
- }), $5c2f5cd01815d369$var$addEvent(document, "focus", onFocus, true));
906
- return ()=>{
907
- // Restore styles and scroll the page back to where it was.
908
- restoreScrollableStyles === null || restoreScrollableStyles === void 0 ? void 0 : restoreScrollableStyles();
909
- restoreStyles === null || restoreStyles === void 0 ? void 0 : restoreStyles();
910
- removeEvents();
911
- };
912
- }
913
- // Sets a CSS property on an element, and returns a function to revert it to the previous value.
914
- function $5c2f5cd01815d369$var$setStyle(element, style, value) {
915
- let cur = element.style[style];
916
- element.style[style] = value;
917
- return ()=>{
918
- element.style[style] = cur;
919
- };
920
- }
921
- // Adds an event listener to an element, and returns a function to remove it.
922
- function $5c2f5cd01815d369$var$addEvent(target, event, handler, options) {
923
- target.addEventListener(event, handler, options);
924
- return ()=>{
925
- target.removeEventListener(event, handler, options);
926
- };
927
- }
928
- function $5c2f5cd01815d369$var$scrollIntoView(target) {
929
- let root = document.scrollingElement || document.documentElement;
930
- while(target && target !== root){
931
- // Find the parent scrollable element and adjust the scroll position if the target is not already in view.
932
- let scrollable = (0, $6Zb2x$reactariautils.getScrollParent)(target);
933
- if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== target) {
934
- let scrollableTop = scrollable.getBoundingClientRect().top;
935
- let targetTop = target.getBoundingClientRect().top;
936
- if (targetTop > scrollableTop + target.clientHeight) scrollable.scrollTop += targetTop - scrollableTop;
937
- }
938
- target = scrollable.parentElement;
939
- }
940
- }
941
- function $5c2f5cd01815d369$var$willOpenKeyboard(target) {
942
- return target instanceof HTMLInputElement && !$5c2f5cd01815d369$var$nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
943
- }
944
-
945
-
946
- /*
947
- * Copyright 2020 Adobe. All rights reserved.
948
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
949
- * you may not use this file except in compliance with the License. You may obtain a copy
950
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
951
- *
952
- * Unless required by applicable law or agreed to in writing, software distributed under
953
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
954
- * OF ANY KIND, either express or implied. See the License for the specific language
955
- * governing permissions and limitations under the License.
956
- */
957
-
958
-
959
- const $0775ea8ea6a0565e$var$Context = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
960
- function $0775ea8ea6a0565e$export$178405afcd8c5eb(props) {
961
- let { children: children } = props;
962
- let parent = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
963
- let [modalCount, setModalCount] = (0, $6Zb2x$react.useState)(0);
964
- let context = (0, $6Zb2x$react.useMemo)(()=>({
965
- parent: parent,
966
- modalCount: modalCount,
967
- addModal () {
968
- setModalCount((count)=>count + 1);
969
- if (parent) parent.addModal();
970
- },
971
- removeModal () {
972
- setModalCount((count)=>count - 1);
973
- if (parent) parent.removeModal();
974
- }
975
- }), [
976
- parent,
977
- modalCount
978
- ]);
979
- return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$var$Context.Provider, {
980
- value: context
981
- }, children);
982
- }
983
- function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
984
- let context = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
985
- return {
986
- modalProviderProps: {
987
- "aria-hidden": context && context.modalCount > 0 ? true : null
988
- }
989
- };
990
- }
991
- /**
992
- * Creates a root node that will be aria-hidden if there are other modals open.
993
- */ function $0775ea8ea6a0565e$var$OverlayContainerDOM(props) {
994
- let { modalProviderProps: modalProviderProps } = $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0();
995
- return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement("div", {
996
- "data-overlay-container": true,
997
- ...props,
998
- ...modalProviderProps
999
- });
1000
- }
1001
- function $0775ea8ea6a0565e$export$bf688221f59024e5(props) {
1002
- return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$export$178405afcd8c5eb, null, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$var$OverlayContainerDOM, props));
1003
- }
1004
- function $0775ea8ea6a0565e$export$b47c3594eab58386(props) {
1005
- let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
1006
- let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
1007
- (0, ($parcel$interopDefault($6Zb2x$react))).useEffect(()=>{
1008
- if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
1009
- }, [
1010
- portalContainer
1011
- ]);
1012
- if (!portalContainer) return null;
1013
- let contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($0775ea8ea6a0565e$export$bf688221f59024e5, rest);
1014
- return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
1015
- }
1016
- function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
1017
- // Add aria-hidden to all parent providers on mount, and restore on unmount.
1018
- let context = (0, $6Zb2x$react.useContext)($0775ea8ea6a0565e$var$Context);
1019
- if (!context) throw new Error("Modal is not contained within a provider");
1020
- (0, $6Zb2x$react.useEffect)(()=>{
1021
- if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
1022
- // The immediate context is from the provider containing this modal, so we only
1023
- // want to trigger aria-hidden on its parents not on the modal provider itself.
1024
- context.parent.addModal();
1025
- return ()=>{
1026
- if (context && context.parent) context.parent.removeModal();
1027
- };
1028
- }, [
1029
- context,
1030
- context.parent,
1031
- options === null || options === void 0 ? void 0 : options.isDisabled
1032
- ]);
1033
- return {
1034
- modalProps: {
1035
- "data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
1036
- }
1037
- };
1038
- }
1039
-
1040
-
1041
- /*
1042
- * Copyright 2020 Adobe. All rights reserved.
1043
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1044
- * you may not use this file except in compliance with the License. You may obtain a copy
1045
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
1046
- *
1047
- * Unless required by applicable law or agreed to in writing, software distributed under
1048
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1049
- * OF ANY KIND, either express or implied. See the License for the specific language
1050
- * governing permissions and limitations under the License.
1051
- */ var $90f032faf016e1fb$exports = {};
1052
- var $4393d9b86d3ad278$exports = {};
1053
- $4393d9b86d3ad278$exports = {
1054
- "dismiss": `\u{62A}\u{62C}\u{627}\u{647}\u{644}`
1055
- };
1056
49
 
1057
50
 
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
- };
1062
51
 
1063
52
 
1064
- var $55d3567b59d09782$exports = {};
1065
- $55d3567b59d09782$exports = {
1066
- "dismiss": `Odstranit`
1067
- };
1068
-
1069
-
1070
- var $0e419a7be7773c16$exports = {};
1071
- $0e419a7be7773c16$exports = {
1072
- "dismiss": `Luk`
1073
- };
1074
-
1075
-
1076
- var $be606513c8356c34$exports = {};
1077
- $be606513c8356c34$exports = {
1078
- "dismiss": `Schlie\xdfen`
1079
- };
1080
-
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
- };
1086
-
1087
-
1088
- var $0360f2a6534752c1$exports = {};
1089
- $0360f2a6534752c1$exports = {
1090
- "dismiss": `Dismiss`
1091
- };
1092
-
1093
-
1094
- var $92bf4fdecfeb6a61$exports = {};
1095
- $92bf4fdecfeb6a61$exports = {
1096
- "dismiss": `Descartar`
1097
- };
1098
-
1099
-
1100
- var $7c02fa9b9c598043$exports = {};
1101
- $7c02fa9b9c598043$exports = {
1102
- "dismiss": `L\xf5peta`
1103
- };
1104
-
1105
-
1106
- var $ba53535dcca59343$exports = {};
1107
- $ba53535dcca59343$exports = {
1108
- "dismiss": `Hylk\xe4\xe4`
1109
- };
1110
-
1111
-
1112
- var $2fbbcddf7d252cb7$exports = {};
1113
- $2fbbcddf7d252cb7$exports = {
1114
- "dismiss": `Rejeter`
1115
- };
1116
-
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
-
1129
-
1130
- var $8dbe4363bfbba3f9$exports = {};
1131
- $8dbe4363bfbba3f9$exports = {
1132
- "dismiss": `Elutas\xedt\xe1s`
1133
- };
1134
-
1135
-
1136
- var $90a445da1ad273e7$exports = {};
1137
- $90a445da1ad273e7$exports = {
1138
- "dismiss": `Ignora`
1139
- };
1140
-
1141
-
1142
- var $e1ebf18259c9b1ee$exports = {};
1143
- $e1ebf18259c9b1ee$exports = {
1144
- "dismiss": `\u{9589}\u{3058}\u{308B}`
1145
- };
1146
-
1147
-
1148
- var $765893642f3b4f72$exports = {};
1149
- $765893642f3b4f72$exports = {
1150
- "dismiss": `\u{BB34}\u{C2DC}`
1151
- };
1152
-
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
- };
1176
-
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
-
1255
-
1256
- $90f032faf016e1fb$exports = {
1257
- "ar-AE": $4393d9b86d3ad278$exports,
1258
- "bg-BG": $254224013ae06959$exports,
1259
- "cs-CZ": $55d3567b59d09782$exports,
1260
- "da-DK": $0e419a7be7773c16$exports,
1261
- "de-DE": $be606513c8356c34$exports,
1262
- "el-GR": $7d99787e5bd26f87$exports,
1263
- "en-US": $0360f2a6534752c1$exports,
1264
- "es-ES": $92bf4fdecfeb6a61$exports,
1265
- "et-EE": $7c02fa9b9c598043$exports,
1266
- "fi-FI": $ba53535dcca59343$exports,
1267
- "fr-FR": $2fbbcddf7d252cb7$exports,
1268
- "he-IL": $0a1f0520e07d3596$exports,
1269
- "hr-HR": $f7be5df1487823a9$exports,
1270
- "hu-HU": $8dbe4363bfbba3f9$exports,
1271
- "it-IT": $90a445da1ad273e7$exports,
1272
- "ja-JP": $e1ebf18259c9b1ee$exports,
1273
- "ko-KR": $765893642f3b4f72$exports,
1274
- "lt-LT": $af73ba24f63febd1$exports,
1275
- "lv-LV": $97aac9f6740ee412$exports,
1276
- "nb-NO": $92fbe76e196d7e0a$exports,
1277
- "nl-NL": $44399897afb701ce$exports,
1278
- "pl-PL": $d679e258664d7384$exports,
1279
- "pt-BR": $b51fc2992648966b$exports,
1280
- "pt-PT": $6abbc540dcd5f78c$exports,
1281
- "ro-RO": $6cbc0c9bf574473b$exports,
1282
- "ru-RU": $009edbe58be6525b$exports,
1283
- "sk-SK": $01cf6095489e78f7$exports,
1284
- "sl-SI": $33fd5a1a3753e83f$exports,
1285
- "sr-SP": $6b9373a558e74e84$exports,
1286
- "sv-SE": $90008194c3db7fce$exports,
1287
- "tr-TR": $e29d21290b4ce15c$exports,
1288
- "uk-UA": $96139c59e8ba3f85$exports,
1289
- "zh-CN": $052554192ea8e826$exports,
1290
- "zh-TW": $3f3b5d798a5abdbc$exports
1291
- };
1292
-
1293
-
1294
-
1295
-
1296
-
1297
-
1298
- function $f69bb3e6457495cc$export$2317d149ed6f78c4(props) {
1299
- let { onDismiss: onDismiss, ...otherProps } = props;
1300
- let stringFormatter = (0, $6Zb2x$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($90f032faf016e1fb$exports))), "@react-aria/overlays");
1301
- let labels = (0, $6Zb2x$reactariautils.useLabels)(otherProps, stringFormatter.format("dismiss"));
1302
- let onClick = ()=>{
1303
- if (onDismiss) onDismiss();
1304
- };
1305
- return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariavisuallyhidden.VisuallyHidden), null, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement("button", {
1306
- ...labels,
1307
- tabIndex: -1,
1308
- onClick: onClick,
1309
- style: {
1310
- width: 1,
1311
- height: 1
1312
- }
1313
- }));
1314
- }
1315
-
1316
-
1317
- /*
1318
- * Copyright 2020 Adobe. All rights reserved.
1319
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1320
- * you may not use this file except in compliance with the License. You may obtain a copy
1321
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
1322
- *
1323
- * Unless required by applicable law or agreed to in writing, software distributed under
1324
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1325
- * OF ANY KIND, either express or implied. See the License for the specific language
1326
- * governing permissions and limitations under the License.
1327
- */ // Keeps a ref count of all hidden elements. Added to when hiding an element, and
1328
- // subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
1329
- let $08ef1685902b6011$var$refCountMap = new WeakMap();
1330
- let $08ef1685902b6011$var$observerStack = [];
1331
- function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body) {
1332
- let visibleNodes = new Set(targets);
1333
- let hiddenNodes = new Set();
1334
- let walk = (root)=>{
1335
- // Keep live announcer and top layer elements (e.g. toasts) visible.
1336
- for (let element of root.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))visibleNodes.add(element);
1337
- let acceptNode = (node)=>{
1338
- // Skip this node and its children if it is one of the target nodes, or a live announcer.
1339
- // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
1340
- // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
1341
- // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
1342
- if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
1343
- // Skip this node but continue to children if one of the targets is inside the node.
1344
- for (let target of visibleNodes){
1345
- if (node.contains(target)) return NodeFilter.FILTER_SKIP;
1346
- }
1347
- return NodeFilter.FILTER_ACCEPT;
1348
- };
1349
- let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
1350
- acceptNode: acceptNode
1351
- });
1352
- // TreeWalker does not include the root.
1353
- let acceptRoot = acceptNode(root);
1354
- if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
1355
- if (acceptRoot !== NodeFilter.FILTER_REJECT) {
1356
- let node = walker.nextNode();
1357
- while(node != null){
1358
- hide(node);
1359
- node = walker.nextNode();
1360
- }
1361
- }
1362
- };
1363
- let hide = (node)=>{
1364
- var _refCountMap_get;
1365
- let refCount = (_refCountMap_get = $08ef1685902b6011$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
1366
- // If already aria-hidden, and the ref count is zero, then this element
1367
- // was already hidden and there's nothing for us to do.
1368
- if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
1369
- if (refCount === 0) node.setAttribute("aria-hidden", "true");
1370
- hiddenNodes.add(node);
1371
- $08ef1685902b6011$var$refCountMap.set(node, refCount + 1);
1372
- };
1373
- // If there is already a MutationObserver listening from a previous call,
1374
- // disconnect it so the new on takes over.
1375
- if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].disconnect();
1376
- walk(root);
1377
- let observer = new MutationObserver((changes)=>{
1378
- for (let change of changes){
1379
- if (change.type !== "childList" || change.addedNodes.length === 0) continue;
1380
- // If the parent element of the added nodes is not within one of the targets,
1381
- // and not already inside a hidden node, hide all of the new children.
1382
- if (![
1383
- ...visibleNodes,
1384
- ...hiddenNodes
1385
- ].some((node)=>node.contains(change.target))) {
1386
- for (let node of change.removedNodes)if (node instanceof Element) {
1387
- visibleNodes.delete(node);
1388
- hiddenNodes.delete(node);
1389
- }
1390
- for (let node of change.addedNodes){
1391
- if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node);
1392
- else if (node instanceof Element) walk(node);
1393
- }
1394
- }
1395
- }
1396
- });
1397
- observer.observe(root, {
1398
- childList: true,
1399
- subtree: true
1400
- });
1401
- let observerWrapper = {
1402
- observe () {
1403
- observer.observe(root, {
1404
- childList: true,
1405
- subtree: true
1406
- });
1407
- },
1408
- disconnect () {
1409
- observer.disconnect();
1410
- }
1411
- };
1412
- $08ef1685902b6011$var$observerStack.push(observerWrapper);
1413
- return ()=>{
1414
- observer.disconnect();
1415
- for (let node of hiddenNodes){
1416
- let count = $08ef1685902b6011$var$refCountMap.get(node);
1417
- if (count === 1) {
1418
- node.removeAttribute("aria-hidden");
1419
- $08ef1685902b6011$var$refCountMap.delete(node);
1420
- } else $08ef1685902b6011$var$refCountMap.set(node, count - 1);
1421
- }
1422
- // Remove this observer from the stack, and start the previous one.
1423
- if (observerWrapper === $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1]) {
1424
- $08ef1685902b6011$var$observerStack.pop();
1425
- if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].observe();
1426
- } else $08ef1685902b6011$var$observerStack.splice($08ef1685902b6011$var$observerStack.indexOf(observerWrapper), 1);
1427
- };
1428
- }
1429
-
1430
-
1431
- /*
1432
- * Copyright 2022 Adobe. All rights reserved.
1433
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1434
- * you may not use this file except in compliance with the License. You may obtain a copy
1435
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
1436
- *
1437
- * Unless required by applicable law or agreed to in writing, software distributed under
1438
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1439
- * OF ANY KIND, either express or implied. See the License for the specific language
1440
- * governing permissions and limitations under the License.
1441
- */
1442
-
1443
-
1444
-
1445
-
1446
- function $6c2dfcdee3e15e20$export$542a6fd13ac93354(props, state) {
1447
- let { triggerRef: triggerRef, popoverRef: popoverRef, isNonModal: isNonModal, isKeyboardDismissDisabled: isKeyboardDismissDisabled, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, ...otherProps } = props;
1448
- let { overlayProps: overlayProps, underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
1449
- isOpen: state.isOpen,
1450
- onClose: state.close,
1451
- shouldCloseOnBlur: true,
1452
- isDismissable: !isNonModal,
1453
- isKeyboardDismissDisabled: isKeyboardDismissDisabled,
1454
- shouldCloseOnInteractOutside: shouldCloseOnInteractOutside
1455
- }, popoverRef);
1456
- let { overlayProps: positionProps, arrowProps: arrowProps, placement: placement } = (0, $cd94b4896dd97759$export$d39e1813b3bdd0e1)({
1457
- ...otherProps,
1458
- targetRef: triggerRef,
1459
- overlayRef: popoverRef,
1460
- isOpen: state.isOpen,
1461
- onClose: isNonModal ? state.close : null
1462
- });
1463
- (0, $5c2f5cd01815d369$export$ee0f7cc6afcd1c18)({
1464
- isDisabled: isNonModal || !state.isOpen
1465
- });
1466
- (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
1467
- if (state.isOpen && !isNonModal && popoverRef.current) return (0, $08ef1685902b6011$export$1c3ebcada18427bf)([
1468
- popoverRef.current
1469
- ]);
1470
- }, [
1471
- isNonModal,
1472
- state.isOpen,
1473
- popoverRef
1474
- ]);
1475
- return {
1476
- popoverProps: (0, $6Zb2x$reactariautils.mergeProps)(overlayProps, positionProps),
1477
- arrowProps: arrowProps,
1478
- underlayProps: underlayProps,
1479
- placement: placement
1480
- };
1481
- }
1482
-
1483
-
1484
- /*
1485
- * Copyright 2022 Adobe. All rights reserved.
1486
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1487
- * you may not use this file except in compliance with the License. You may obtain a copy
1488
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
1489
- *
1490
- * Unless required by applicable law or agreed to in writing, software distributed under
1491
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1492
- * OF ANY KIND, either express or implied. See the License for the specific language
1493
- * governing permissions and limitations under the License.
1494
- */
1495
-
1496
-
1497
-
1498
- /*
1499
- * Copyright 2022 Adobe. All rights reserved.
1500
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1501
- * you may not use this file except in compliance with the License. You may obtain a copy
1502
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
1503
- *
1504
- * Unless required by applicable law or agreed to in writing, software distributed under
1505
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1506
- * OF ANY KIND, either express or implied. See the License for the specific language
1507
- * governing permissions and limitations under the License.
1508
- */
1509
-
1510
-
1511
-
1512
-
1513
-
1514
- const $745edbb83ab4296f$export$a2200b96afd16271 = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createContext(null);
1515
- function $745edbb83ab4296f$export$c6fdb837b070b4ff(props) {
1516
- let isSSR = (0, $6Zb2x$reactariassr.useIsSSR)();
1517
- let { portalContainer: portalContainer = isSSR ? null : document.body, isExiting: isExiting } = props;
1518
- let [contain, setContain] = (0, $6Zb2x$react.useState)(false);
1519
- let contextValue = (0, $6Zb2x$react.useMemo)(()=>({
1520
- contain: contain,
1521
- setContain: setContain
1522
- }), [
1523
- contain,
1524
- setContain
1525
- ]);
1526
- if (!portalContainer) return null;
1527
- let contents = props.children;
1528
- if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariafocus.FocusScope), {
1529
- restoreFocus: true,
1530
- contain: contain && !isExiting
1531
- }, contents);
1532
- contents = /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement($745edbb83ab4296f$export$a2200b96afd16271.Provider, {
1533
- value: contextValue
1534
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$react))).createElement((0, $6Zb2x$reactariainteractions.ClearPressResponder), null, contents));
1535
- return /*#__PURE__*/ (0, ($parcel$interopDefault($6Zb2x$reactdom))).createPortal(contents, portalContainer);
1536
- }
1537
- function $745edbb83ab4296f$export$14c98a7594375490() {
1538
- let ctx = (0, $6Zb2x$react.useContext)($745edbb83ab4296f$export$a2200b96afd16271);
1539
- let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
1540
- (0, $6Zb2x$reactariautils.useLayoutEffect)(()=>{
1541
- setContain === null || setContain === void 0 ? void 0 : setContain(true);
1542
- }, [
1543
- setContain
1544
- ]);
1545
- }
1546
-
1547
-
1548
-
1549
- function $11b7e0b04b421e95$export$dbc0f175b25fb0fb(props, state, ref) {
1550
- let { overlayProps: overlayProps, underlayProps: underlayProps } = (0, $82711f9cb668ecdb$export$ea8f71083e90600f)({
1551
- ...props,
1552
- isOpen: state.isOpen,
1553
- onClose: state.close
1554
- }, ref);
1555
- (0, $5c2f5cd01815d369$export$ee0f7cc6afcd1c18)({
1556
- isDisabled: !state.isOpen
1557
- });
1558
- (0, $745edbb83ab4296f$export$14c98a7594375490)();
1559
- (0, $6Zb2x$react.useEffect)(()=>{
1560
- if (state.isOpen) return (0, $08ef1685902b6011$export$1c3ebcada18427bf)([
1561
- ref.current
1562
- ]);
1563
- }, [
1564
- state.isOpen,
1565
- ref
1566
- ]);
1567
- return {
1568
- modalProps: (0, $6Zb2x$reactariautils.mergeProps)(overlayProps),
1569
- underlayProps: underlayProps
1570
- };
1571
- }
1572
53
 
1573
54
 
1574
55