@react-aria/overlays 3.31.1 → 3.32.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 (263) hide show
  1. package/dist/import.mjs +12 -12
  2. package/dist/main.js +28 -28
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +12 -12
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +19 -0
  7. package/package.json +15 -21
  8. package/src/index.ts +19 -22
  9. package/dist/DismissButton.main.js +0 -51
  10. package/dist/DismissButton.main.js.map +0 -1
  11. package/dist/DismissButton.mjs +0 -46
  12. package/dist/DismissButton.module.js +0 -46
  13. package/dist/DismissButton.module.js.map +0 -1
  14. package/dist/Overlay.main.js +0 -73
  15. package/dist/Overlay.main.js.map +0 -1
  16. package/dist/Overlay.mjs +0 -63
  17. package/dist/Overlay.module.js +0 -63
  18. package/dist/Overlay.module.js.map +0 -1
  19. package/dist/PortalProvider.main.js +0 -41
  20. package/dist/PortalProvider.main.js.map +0 -1
  21. package/dist/PortalProvider.mjs +0 -31
  22. package/dist/PortalProvider.module.js +0 -31
  23. package/dist/PortalProvider.module.js.map +0 -1
  24. package/dist/ar-AE.main.js +0 -6
  25. package/dist/ar-AE.main.js.map +0 -1
  26. package/dist/ar-AE.mjs +0 -8
  27. package/dist/ar-AE.module.js +0 -8
  28. package/dist/ar-AE.module.js.map +0 -1
  29. package/dist/ariaHideOutside.main.js +0 -152
  30. package/dist/ariaHideOutside.main.js.map +0 -1
  31. package/dist/ariaHideOutside.mjs +0 -146
  32. package/dist/ariaHideOutside.module.js +0 -146
  33. package/dist/ariaHideOutside.module.js.map +0 -1
  34. package/dist/bg-BG.main.js +0 -6
  35. package/dist/bg-BG.main.js.map +0 -1
  36. package/dist/bg-BG.mjs +0 -8
  37. package/dist/bg-BG.module.js +0 -8
  38. package/dist/bg-BG.module.js.map +0 -1
  39. package/dist/calculatePosition.main.js +0 -414
  40. package/dist/calculatePosition.main.js.map +0 -1
  41. package/dist/calculatePosition.mjs +0 -408
  42. package/dist/calculatePosition.module.js +0 -408
  43. package/dist/calculatePosition.module.js.map +0 -1
  44. package/dist/cs-CZ.main.js +0 -6
  45. package/dist/cs-CZ.main.js.map +0 -1
  46. package/dist/cs-CZ.mjs +0 -8
  47. package/dist/cs-CZ.module.js +0 -8
  48. package/dist/cs-CZ.module.js.map +0 -1
  49. package/dist/da-DK.main.js +0 -6
  50. package/dist/da-DK.main.js.map +0 -1
  51. package/dist/da-DK.mjs +0 -8
  52. package/dist/da-DK.module.js +0 -8
  53. package/dist/da-DK.module.js.map +0 -1
  54. package/dist/de-DE.main.js +0 -6
  55. package/dist/de-DE.main.js.map +0 -1
  56. package/dist/de-DE.mjs +0 -8
  57. package/dist/de-DE.module.js +0 -8
  58. package/dist/de-DE.module.js.map +0 -1
  59. package/dist/el-GR.main.js +0 -6
  60. package/dist/el-GR.main.js.map +0 -1
  61. package/dist/el-GR.mjs +0 -8
  62. package/dist/el-GR.module.js +0 -8
  63. package/dist/el-GR.module.js.map +0 -1
  64. package/dist/en-US.main.js +0 -6
  65. package/dist/en-US.main.js.map +0 -1
  66. package/dist/en-US.mjs +0 -8
  67. package/dist/en-US.module.js +0 -8
  68. package/dist/en-US.module.js.map +0 -1
  69. package/dist/es-ES.main.js +0 -6
  70. package/dist/es-ES.main.js.map +0 -1
  71. package/dist/es-ES.mjs +0 -8
  72. package/dist/es-ES.module.js +0 -8
  73. package/dist/es-ES.module.js.map +0 -1
  74. package/dist/et-EE.main.js +0 -6
  75. package/dist/et-EE.main.js.map +0 -1
  76. package/dist/et-EE.mjs +0 -8
  77. package/dist/et-EE.module.js +0 -8
  78. package/dist/et-EE.module.js.map +0 -1
  79. package/dist/fi-FI.main.js +0 -6
  80. package/dist/fi-FI.main.js.map +0 -1
  81. package/dist/fi-FI.mjs +0 -8
  82. package/dist/fi-FI.module.js +0 -8
  83. package/dist/fi-FI.module.js.map +0 -1
  84. package/dist/fr-FR.main.js +0 -6
  85. package/dist/fr-FR.main.js.map +0 -1
  86. package/dist/fr-FR.mjs +0 -8
  87. package/dist/fr-FR.module.js +0 -8
  88. package/dist/fr-FR.module.js.map +0 -1
  89. package/dist/he-IL.main.js +0 -6
  90. package/dist/he-IL.main.js.map +0 -1
  91. package/dist/he-IL.mjs +0 -8
  92. package/dist/he-IL.module.js +0 -8
  93. package/dist/he-IL.module.js.map +0 -1
  94. package/dist/hr-HR.main.js +0 -6
  95. package/dist/hr-HR.main.js.map +0 -1
  96. package/dist/hr-HR.mjs +0 -8
  97. package/dist/hr-HR.module.js +0 -8
  98. package/dist/hr-HR.module.js.map +0 -1
  99. package/dist/hu-HU.main.js +0 -6
  100. package/dist/hu-HU.main.js.map +0 -1
  101. package/dist/hu-HU.mjs +0 -8
  102. package/dist/hu-HU.module.js +0 -8
  103. package/dist/hu-HU.module.js.map +0 -1
  104. package/dist/intlStrings.main.js +0 -108
  105. package/dist/intlStrings.main.js.map +0 -1
  106. package/dist/intlStrings.mjs +0 -110
  107. package/dist/intlStrings.module.js +0 -110
  108. package/dist/intlStrings.module.js.map +0 -1
  109. package/dist/it-IT.main.js +0 -6
  110. package/dist/it-IT.main.js.map +0 -1
  111. package/dist/it-IT.mjs +0 -8
  112. package/dist/it-IT.module.js +0 -8
  113. package/dist/it-IT.module.js.map +0 -1
  114. package/dist/ja-JP.main.js +0 -6
  115. package/dist/ja-JP.main.js.map +0 -1
  116. package/dist/ja-JP.mjs +0 -8
  117. package/dist/ja-JP.module.js +0 -8
  118. package/dist/ja-JP.module.js.map +0 -1
  119. package/dist/ko-KR.main.js +0 -6
  120. package/dist/ko-KR.main.js.map +0 -1
  121. package/dist/ko-KR.mjs +0 -8
  122. package/dist/ko-KR.module.js +0 -8
  123. package/dist/ko-KR.module.js.map +0 -1
  124. package/dist/lt-LT.main.js +0 -6
  125. package/dist/lt-LT.main.js.map +0 -1
  126. package/dist/lt-LT.mjs +0 -8
  127. package/dist/lt-LT.module.js +0 -8
  128. package/dist/lt-LT.module.js.map +0 -1
  129. package/dist/lv-LV.main.js +0 -6
  130. package/dist/lv-LV.main.js.map +0 -1
  131. package/dist/lv-LV.mjs +0 -8
  132. package/dist/lv-LV.module.js +0 -8
  133. package/dist/lv-LV.module.js.map +0 -1
  134. package/dist/nb-NO.main.js +0 -6
  135. package/dist/nb-NO.main.js.map +0 -1
  136. package/dist/nb-NO.mjs +0 -8
  137. package/dist/nb-NO.module.js +0 -8
  138. package/dist/nb-NO.module.js.map +0 -1
  139. package/dist/nl-NL.main.js +0 -6
  140. package/dist/nl-NL.main.js.map +0 -1
  141. package/dist/nl-NL.mjs +0 -8
  142. package/dist/nl-NL.module.js +0 -8
  143. package/dist/nl-NL.module.js.map +0 -1
  144. package/dist/pl-PL.main.js +0 -6
  145. package/dist/pl-PL.main.js.map +0 -1
  146. package/dist/pl-PL.mjs +0 -8
  147. package/dist/pl-PL.module.js +0 -8
  148. package/dist/pl-PL.module.js.map +0 -1
  149. package/dist/pt-BR.main.js +0 -6
  150. package/dist/pt-BR.main.js.map +0 -1
  151. package/dist/pt-BR.mjs +0 -8
  152. package/dist/pt-BR.module.js +0 -8
  153. package/dist/pt-BR.module.js.map +0 -1
  154. package/dist/pt-PT.main.js +0 -6
  155. package/dist/pt-PT.main.js.map +0 -1
  156. package/dist/pt-PT.mjs +0 -8
  157. package/dist/pt-PT.module.js +0 -8
  158. package/dist/pt-PT.module.js.map +0 -1
  159. package/dist/ro-RO.main.js +0 -6
  160. package/dist/ro-RO.main.js.map +0 -1
  161. package/dist/ro-RO.mjs +0 -8
  162. package/dist/ro-RO.module.js +0 -8
  163. package/dist/ro-RO.module.js.map +0 -1
  164. package/dist/ru-RU.main.js +0 -6
  165. package/dist/ru-RU.main.js.map +0 -1
  166. package/dist/ru-RU.mjs +0 -8
  167. package/dist/ru-RU.module.js +0 -8
  168. package/dist/ru-RU.module.js.map +0 -1
  169. package/dist/sk-SK.main.js +0 -6
  170. package/dist/sk-SK.main.js.map +0 -1
  171. package/dist/sk-SK.mjs +0 -8
  172. package/dist/sk-SK.module.js +0 -8
  173. package/dist/sk-SK.module.js.map +0 -1
  174. package/dist/sl-SI.main.js +0 -6
  175. package/dist/sl-SI.main.js.map +0 -1
  176. package/dist/sl-SI.mjs +0 -8
  177. package/dist/sl-SI.module.js +0 -8
  178. package/dist/sl-SI.module.js.map +0 -1
  179. package/dist/sr-SP.main.js +0 -6
  180. package/dist/sr-SP.main.js.map +0 -1
  181. package/dist/sr-SP.mjs +0 -8
  182. package/dist/sr-SP.module.js +0 -8
  183. package/dist/sr-SP.module.js.map +0 -1
  184. package/dist/sv-SE.main.js +0 -6
  185. package/dist/sv-SE.main.js.map +0 -1
  186. package/dist/sv-SE.mjs +0 -8
  187. package/dist/sv-SE.module.js +0 -8
  188. package/dist/sv-SE.module.js.map +0 -1
  189. package/dist/tr-TR.main.js +0 -6
  190. package/dist/tr-TR.main.js.map +0 -1
  191. package/dist/tr-TR.mjs +0 -8
  192. package/dist/tr-TR.module.js +0 -8
  193. package/dist/tr-TR.module.js.map +0 -1
  194. package/dist/types.d.ts +0 -355
  195. package/dist/types.d.ts.map +0 -1
  196. package/dist/uk-UA.main.js +0 -6
  197. package/dist/uk-UA.main.js.map +0 -1
  198. package/dist/uk-UA.mjs +0 -8
  199. package/dist/uk-UA.module.js +0 -8
  200. package/dist/uk-UA.module.js.map +0 -1
  201. package/dist/useCloseOnScroll.main.js +0 -52
  202. package/dist/useCloseOnScroll.main.js.map +0 -1
  203. package/dist/useCloseOnScroll.mjs +0 -46
  204. package/dist/useCloseOnScroll.module.js +0 -46
  205. package/dist/useCloseOnScroll.module.js.map +0 -1
  206. package/dist/useModal.main.js +0 -118
  207. package/dist/useModal.main.js.map +0 -1
  208. package/dist/useModal.mjs +0 -105
  209. package/dist/useModal.module.js +0 -105
  210. package/dist/useModal.module.js.map +0 -1
  211. package/dist/useModalOverlay.main.js +0 -57
  212. package/dist/useModalOverlay.main.js.map +0 -1
  213. package/dist/useModalOverlay.mjs +0 -52
  214. package/dist/useModalOverlay.module.js +0 -52
  215. package/dist/useModalOverlay.module.js.map +0 -1
  216. package/dist/useOverlay.main.js +0 -111
  217. package/dist/useOverlay.main.js.map +0 -1
  218. package/dist/useOverlay.mjs +0 -106
  219. package/dist/useOverlay.module.js +0 -106
  220. package/dist/useOverlay.module.js.map +0 -1
  221. package/dist/useOverlayPosition.main.js +0 -225
  222. package/dist/useOverlayPosition.main.js.map +0 -1
  223. package/dist/useOverlayPosition.mjs +0 -220
  224. package/dist/useOverlayPosition.module.js +0 -220
  225. package/dist/useOverlayPosition.module.js.map +0 -1
  226. package/dist/useOverlayTrigger.main.js +0 -54
  227. package/dist/useOverlayTrigger.main.js.map +0 -1
  228. package/dist/useOverlayTrigger.mjs +0 -49
  229. package/dist/useOverlayTrigger.module.js +0 -49
  230. package/dist/useOverlayTrigger.module.js.map +0 -1
  231. package/dist/usePopover.main.js +0 -77
  232. package/dist/usePopover.main.js.map +0 -1
  233. package/dist/usePopover.mjs +0 -72
  234. package/dist/usePopover.module.js +0 -72
  235. package/dist/usePopover.module.js.map +0 -1
  236. package/dist/usePreventScroll.main.js +0 -215
  237. package/dist/usePreventScroll.main.js.map +0 -1
  238. package/dist/usePreventScroll.mjs +0 -210
  239. package/dist/usePreventScroll.module.js +0 -210
  240. package/dist/usePreventScroll.module.js.map +0 -1
  241. package/dist/zh-CN.main.js +0 -6
  242. package/dist/zh-CN.main.js.map +0 -1
  243. package/dist/zh-CN.mjs +0 -8
  244. package/dist/zh-CN.module.js +0 -8
  245. package/dist/zh-CN.module.js.map +0 -1
  246. package/dist/zh-TW.main.js +0 -6
  247. package/dist/zh-TW.main.js.map +0 -1
  248. package/dist/zh-TW.mjs +0 -8
  249. package/dist/zh-TW.module.js +0 -8
  250. package/dist/zh-TW.module.js.map +0 -1
  251. package/src/DismissButton.tsx +0 -52
  252. package/src/Overlay.tsx +0 -95
  253. package/src/PortalProvider.tsx +0 -41
  254. package/src/ariaHideOutside.ts +0 -221
  255. package/src/calculatePosition.ts +0 -680
  256. package/src/useCloseOnScroll.ts +0 -65
  257. package/src/useModal.tsx +0 -197
  258. package/src/useModalOverlay.ts +0 -69
  259. package/src/useOverlay.ts +0 -169
  260. package/src/useOverlayPosition.ts +0 -327
  261. package/src/useOverlayTrigger.ts +0 -72
  262. package/src/usePopover.ts +0 -138
  263. package/src/usePreventScroll.ts +0 -273
@@ -1,146 +0,0 @@
1
- import {getOwnerWindow as $fF94N$getOwnerWindow, nodeContains as $fF94N$nodeContains} from "@react-aria/utils";
2
-
3
- /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- const $5e3802645cc19319$var$supportsInert = typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype;
15
- // Keeps a ref count of all hidden elements. Added to when hiding an element, and
16
- // subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
17
- let $5e3802645cc19319$var$refCountMap = new WeakMap();
18
- let $5e3802645cc19319$var$observerStack = [];
19
- function $5e3802645cc19319$export$1c3ebcada18427bf(targets, options) {
20
- let windowObj = (0, $fF94N$getOwnerWindow)(targets === null || targets === void 0 ? void 0 : targets[0]);
21
- let opts = options instanceof windowObj.Element ? {
22
- root: options
23
- } : options;
24
- var _opts_root;
25
- let root = (_opts_root = opts === null || opts === void 0 ? void 0 : opts.root) !== null && _opts_root !== void 0 ? _opts_root : document.body;
26
- let shouldUseInert = (opts === null || opts === void 0 ? void 0 : opts.shouldUseInert) && $5e3802645cc19319$var$supportsInert;
27
- let visibleNodes = new Set(targets);
28
- let hiddenNodes = new Set();
29
- let getHidden = (element)=>{
30
- return shouldUseInert && element instanceof windowObj.HTMLElement ? element.inert : element.getAttribute('aria-hidden') === 'true';
31
- };
32
- let setHidden = (element, hidden)=>{
33
- if (shouldUseInert && element instanceof windowObj.HTMLElement) element.inert = hidden;
34
- else if (hidden) element.setAttribute('aria-hidden', 'true');
35
- else {
36
- element.removeAttribute('aria-hidden');
37
- if (element instanceof windowObj.HTMLElement) // We only ever call setHidden with hidden = false when the nodeCount is 1 aka
38
- // we are trying to make the element visible to screen readers again, so remove inert as well
39
- element.inert = false;
40
- }
41
- };
42
- let walk = (root)=>{
43
- // Keep live announcer and top layer elements (e.g. toasts) visible.
44
- for (let element of root.querySelectorAll('[data-live-announcer], [data-react-aria-top-layer]'))visibleNodes.add(element);
45
- let acceptNode = (node)=>{
46
- // Skip this node and its children if it is one of the target nodes, or a live announcer.
47
- // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
48
- // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
49
- // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
50
- if (hiddenNodes.has(node) || visibleNodes.has(node) || node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row') return NodeFilter.FILTER_REJECT;
51
- // Skip this node but continue to children if one of the targets is inside the node.
52
- for (let target of visibleNodes){
53
- if ((0, $fF94N$nodeContains)(node, target)) return NodeFilter.FILTER_SKIP;
54
- }
55
- return NodeFilter.FILTER_ACCEPT;
56
- };
57
- let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
58
- acceptNode: acceptNode
59
- });
60
- // TreeWalker does not include the root.
61
- let acceptRoot = acceptNode(root);
62
- if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
63
- if (acceptRoot !== NodeFilter.FILTER_REJECT) {
64
- let node = walker.nextNode();
65
- while(node != null){
66
- hide(node);
67
- node = walker.nextNode();
68
- }
69
- }
70
- };
71
- let hide = (node)=>{
72
- var _refCountMap_get;
73
- let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
74
- // If already aria-hidden, and the ref count is zero, then this element
75
- // was already hidden and there's nothing for us to do.
76
- if (getHidden(node) && refCount === 0) return;
77
- if (refCount === 0) setHidden(node, true);
78
- hiddenNodes.add(node);
79
- $5e3802645cc19319$var$refCountMap.set(node, refCount + 1);
80
- };
81
- // If there is already a MutationObserver listening from a previous call,
82
- // disconnect it so the new on takes over.
83
- if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].disconnect();
84
- walk(root);
85
- let observer = new MutationObserver((changes)=>{
86
- for (let change of changes){
87
- if (change.type !== 'childList') continue;
88
- // If the parent element of the added nodes is not within one of the targets,
89
- // and not already inside a hidden node, hide all of the new children.
90
- if (change.target.isConnected && ![
91
- ...visibleNodes,
92
- ...hiddenNodes
93
- ].some((node)=>(0, $fF94N$nodeContains)(node, change.target))) for (let node of change.addedNodes){
94
- if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')) visibleNodes.add(node);
95
- else if (node instanceof Element) walk(node);
96
- }
97
- }
98
- });
99
- observer.observe(root, {
100
- childList: true,
101
- subtree: true
102
- });
103
- let observerWrapper = {
104
- visibleNodes: visibleNodes,
105
- hiddenNodes: hiddenNodes,
106
- observe () {
107
- observer.observe(root, {
108
- childList: true,
109
- subtree: true
110
- });
111
- },
112
- disconnect () {
113
- observer.disconnect();
114
- }
115
- };
116
- $5e3802645cc19319$var$observerStack.push(observerWrapper);
117
- return ()=>{
118
- observer.disconnect();
119
- for (let node of hiddenNodes){
120
- let count = $5e3802645cc19319$var$refCountMap.get(node);
121
- if (count == null) continue;
122
- if (count === 1) {
123
- setHidden(node, false);
124
- $5e3802645cc19319$var$refCountMap.delete(node);
125
- } else $5e3802645cc19319$var$refCountMap.set(node, count - 1);
126
- }
127
- // Remove this observer from the stack, and start the previous one.
128
- if (observerWrapper === $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1]) {
129
- $5e3802645cc19319$var$observerStack.pop();
130
- if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].observe();
131
- } else $5e3802645cc19319$var$observerStack.splice($5e3802645cc19319$var$observerStack.indexOf(observerWrapper), 1);
132
- };
133
- }
134
- function $5e3802645cc19319$export$1020fa7f77e17884(element) {
135
- let observer = $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1];
136
- if (observer && !observer.visibleNodes.has(element)) {
137
- observer.visibleNodes.add(element);
138
- return ()=>{
139
- observer.visibleNodes.delete(element);
140
- };
141
- }
142
- }
143
-
144
-
145
- export {$5e3802645cc19319$export$1c3ebcada18427bf as ariaHideOutside, $5e3802645cc19319$export$1020fa7f77e17884 as keepVisible};
146
- //# sourceMappingURL=ariaHideOutside.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":"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","sources":["packages/@react-aria/overlays/src/ariaHideOutside.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getOwnerWindow, nodeContains} from '@react-aria/utils';\nconst supportsInert = typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype;\n\ninterface AriaHideOutsideOptions {\n root?: Element,\n shouldUseInert?: boolean\n}\n\n// Keeps a ref count of all hidden elements. Added to when hiding an element, and\n// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.\nlet refCountMap = new WeakMap<Element, number>();\ninterface ObserverWrapper {\n visibleNodes: Set<Element>,\n hiddenNodes: Set<Element>,\n observe: () => void,\n disconnect: () => void\n}\nlet observerStack: Array<ObserverWrapper> = [];\n\n/**\n * Hides all elements in the DOM outside the given targets from screen readers using aria-hidden,\n * and returns a function to revert these changes. In addition, changes to the DOM are watched\n * and new elements outside the targets are automatically hidden.\n * @param targets - The elements that should remain visible.\n * @param root - Nothing will be hidden above this element.\n * @returns - A function to restore all hidden elements.\n */\nexport function ariaHideOutside(targets: Element[], options?: AriaHideOutsideOptions | Element) {\n let windowObj = getOwnerWindow(targets?.[0]);\n let opts = options instanceof windowObj.Element ? {root: options} : options;\n let root = opts?.root ?? document.body;\n let shouldUseInert = opts?.shouldUseInert && supportsInert;\n let visibleNodes = new Set<Element>(targets);\n let hiddenNodes = new Set<Element>();\n\n let getHidden = (element: Element) => {\n return shouldUseInert && element instanceof windowObj.HTMLElement ? element.inert : element.getAttribute('aria-hidden') === 'true';\n };\n\n let setHidden = (element: Element, hidden: boolean) => {\n if (shouldUseInert && element instanceof windowObj.HTMLElement) {\n element.inert = hidden;\n } else if (hidden) {\n element.setAttribute('aria-hidden', 'true');\n } else {\n element.removeAttribute('aria-hidden');\n if (element instanceof windowObj.HTMLElement) {\n // We only ever call setHidden with hidden = false when the nodeCount is 1 aka\n // we are trying to make the element visible to screen readers again, so remove inert as well\n element.inert = false;\n }\n }\n };\n\n let walk = (root: Element) => {\n // Keep live announcer and top layer elements (e.g. toasts) visible.\n for (let element of root.querySelectorAll('[data-live-announcer], [data-react-aria-top-layer]')) {\n visibleNodes.add(element);\n }\n\n let acceptNode = (node: Element) => {\n // Skip this node and its children if it is one of the target nodes, or a live announcer.\n // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is\n // made for elements with role=\"row\" since VoiceOver on iOS has issues hiding elements with role=\"row\".\n // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).\n if (\n hiddenNodes.has(node) ||\n visibleNodes.has(node) ||\n (node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== 'row')\n ) {\n return NodeFilter.FILTER_REJECT;\n }\n\n // Skip this node but continue to children if one of the targets is inside the node.\n for (let target of visibleNodes) {\n if (nodeContains(node, target)) {\n return NodeFilter.FILTER_SKIP;\n }\n }\n\n return NodeFilter.FILTER_ACCEPT;\n };\n\n let walker = document.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n {acceptNode}\n );\n\n // TreeWalker does not include the root.\n let acceptRoot = acceptNode(root);\n if (acceptRoot === NodeFilter.FILTER_ACCEPT) {\n hide(root);\n }\n\n if (acceptRoot !== NodeFilter.FILTER_REJECT) {\n let node = walker.nextNode() as Element;\n while (node != null) {\n hide(node);\n node = walker.nextNode() as Element;\n }\n }\n };\n\n let hide = (node: Element) => {\n let refCount = refCountMap.get(node) ?? 0;\n\n // If already aria-hidden, and the ref count is zero, then this element\n // was already hidden and there's nothing for us to do.\n if (getHidden(node) && refCount === 0) {\n return;\n }\n\n if (refCount === 0) {\n setHidden(node, true);\n }\n\n hiddenNodes.add(node);\n refCountMap.set(node, refCount + 1);\n };\n\n // If there is already a MutationObserver listening from a previous call,\n // disconnect it so the new on takes over.\n if (observerStack.length) {\n observerStack[observerStack.length - 1].disconnect();\n }\n\n walk(root);\n\n let observer = new MutationObserver(changes => {\n for (let change of changes) {\n if (change.type !== 'childList') {\n continue;\n }\n\n // If the parent element of the added nodes is not within one of the targets,\n // and not already inside a hidden node, hide all of the new children.\n if (\n change.target.isConnected &&\n ![...visibleNodes, ...hiddenNodes].some((node) =>\n nodeContains(node, change.target)\n )\n ) {\n for (let node of change.addedNodes) {\n if (\n (node instanceof HTMLElement || node instanceof SVGElement) &&\n (node.dataset.liveAnnouncer === 'true' || node.dataset.reactAriaTopLayer === 'true')\n ) {\n visibleNodes.add(node);\n } else if (node instanceof Element) {\n walk(node);\n }\n }\n }\n }\n });\n\n observer.observe(root, {childList: true, subtree: true});\n\n let observerWrapper: ObserverWrapper = {\n visibleNodes,\n hiddenNodes,\n observe() {\n observer.observe(root, {childList: true, subtree: true});\n },\n disconnect() {\n observer.disconnect();\n }\n };\n\n observerStack.push(observerWrapper);\n\n return (): void => {\n observer.disconnect();\n\n for (let node of hiddenNodes) {\n let count = refCountMap.get(node);\n if (count == null) {\n continue;\n }\n if (count === 1) {\n setHidden(node, false);\n refCountMap.delete(node);\n } else {\n refCountMap.set(node, count - 1);\n }\n }\n\n // Remove this observer from the stack, and start the previous one.\n if (observerWrapper === observerStack[observerStack.length - 1]) {\n observerStack.pop();\n if (observerStack.length) {\n observerStack[observerStack.length - 1].observe();\n }\n } else {\n observerStack.splice(observerStack.indexOf(observerWrapper), 1);\n }\n };\n}\n\nexport function keepVisible(element: Element): (() => void) | undefined {\n let observer = observerStack[observerStack.length - 1];\n if (observer && !observer.visibleNodes.has(element)) {\n observer.visibleNodes.add(element);\n return () => {\n observer.visibleNodes.delete(element);\n };\n }\n}\n"],"names":[],"version":3,"file":"ariaHideOutside.module.js.map"}
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- "dismiss": `\u{41E}\u{442}\u{445}\u{432}\u{44A}\u{440}\u{43B}\u{44F}\u{43D}\u{435}`
3
- };
4
-
5
-
6
- //# sourceMappingURL=bg-BG.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,sEAAU,CAAC;AAC3C","sources":["packages/@react-aria/overlays/intl/bg-BG.json"],"sourcesContent":["{\n \"dismiss\": \"Отхвърляне\"\n}\n"],"names":[],"version":3,"file":"bg-BG.main.js.map"}
package/dist/bg-BG.mjs DELETED
@@ -1,8 +0,0 @@
1
- var $d11f19852b941573$exports = {};
2
- $d11f19852b941573$exports = {
3
- "dismiss": `\u{41E}\u{442}\u{445}\u{432}\u{44A}\u{440}\u{43B}\u{44F}\u{43D}\u{435}`
4
- };
5
-
6
-
7
- export {$d11f19852b941573$exports as default};
8
- //# sourceMappingURL=bg-BG.module.js.map
@@ -1,8 +0,0 @@
1
- var $d11f19852b941573$exports = {};
2
- $d11f19852b941573$exports = {
3
- "dismiss": `\u{41E}\u{442}\u{445}\u{432}\u{44A}\u{440}\u{43B}\u{44F}\u{43D}\u{435}`
4
- };
5
-
6
-
7
- export {$d11f19852b941573$exports as default};
8
- //# sourceMappingURL=bg-BG.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,sEAAU,CAAC;AAC3C","sources":["packages/@react-aria/overlays/intl/bg-BG.json"],"sourcesContent":["{\n \"dismiss\": \"Отхвърляне\"\n}\n"],"names":[],"version":3,"file":"bg-BG.module.js.map"}
@@ -1,414 +0,0 @@
1
- var $6E71I$reactariautils = require("@react-aria/utils");
2
-
3
-
4
- function $parcel$export(e, n, v, s) {
5
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
- }
7
-
8
- $parcel$export(module.exports, "calculatePosition", () => $5935ba4d7da2c103$export$b3ceb0cbf1056d98);
9
- $parcel$export(module.exports, "getRect", () => $5935ba4d7da2c103$export$4b834cebd9e5cebe);
10
- /*
11
- * Copyright 2020 Adobe. All rights reserved.
12
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License. You may obtain a copy
14
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software distributed under
17
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
18
- * OF ANY KIND, either express or implied. See the License for the specific language
19
- * governing permissions and limitations under the License.
20
- */
21
- const $5935ba4d7da2c103$var$AXIS = {
22
- top: 'top',
23
- bottom: 'top',
24
- left: 'left',
25
- right: 'left'
26
- };
27
- const $5935ba4d7da2c103$var$FLIPPED_DIRECTION = {
28
- top: 'bottom',
29
- bottom: 'top',
30
- left: 'right',
31
- right: 'left'
32
- };
33
- const $5935ba4d7da2c103$var$CROSS_AXIS = {
34
- top: 'left',
35
- left: 'top'
36
- };
37
- const $5935ba4d7da2c103$var$AXIS_SIZE = {
38
- top: 'height',
39
- left: 'width'
40
- };
41
- const $5935ba4d7da2c103$var$TOTAL_SIZE = {
42
- width: 'totalWidth',
43
- height: 'totalHeight'
44
- };
45
- const $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE = {};
46
- let $5935ba4d7da2c103$var$getVisualViewport = ()=>typeof document !== 'undefined' ? window.visualViewport : null;
47
- function $5935ba4d7da2c103$var$getContainerDimensions(containerNode, visualViewport) {
48
- let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top = 0, left = 0;
49
- let scroll = {};
50
- var _visualViewport_scale;
51
- let isPinchZoomedIn = ((_visualViewport_scale = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1;
52
- // In the case where the container is `html` or `body` and the container doesn't have something like `position: relative`,
53
- // then position absolute will be positioned relative to the viewport, also known as the `initial containing block`.
54
- // That's why we use the visual viewport instead.
55
- if (containerNode.tagName === 'BODY' || containerNode.tagName === 'HTML') {
56
- let documentElement = document.documentElement;
57
- totalWidth = documentElement.clientWidth;
58
- totalHeight = documentElement.clientHeight;
59
- var _visualViewport_width;
60
- width = (_visualViewport_width = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
61
- var _visualViewport_height;
62
- height = (_visualViewport_height = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
63
- scroll.top = documentElement.scrollTop || containerNode.scrollTop;
64
- scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
65
- // The goal of the below is to get a top/left value that represents the top/left of the visual viewport with
66
- // respect to the layout viewport origin. This combined with the scrollTop/scrollLeft will allow us to calculate
67
- // coordinates/values with respect to the visual viewport or with respect to the layout viewport.
68
- if (visualViewport) {
69
- top = visualViewport.offsetTop;
70
- left = visualViewport.offsetLeft;
71
- }
72
- } else {
73
- ({ width: width, height: height, top: top, left: left } = $5935ba4d7da2c103$var$getOffset(containerNode, false));
74
- scroll.top = containerNode.scrollTop;
75
- scroll.left = containerNode.scrollLeft;
76
- totalWidth = width;
77
- totalHeight = height;
78
- }
79
- if ((0, $6E71I$reactariautils.isWebKit)() && (containerNode.tagName === 'BODY' || containerNode.tagName === 'HTML') && isPinchZoomedIn) {
80
- // Safari will report a non-zero scrollTop/Left for the non-scrolling body/HTML element when pinch zoomed in unlike other browsers.
81
- // Set to zero for parity calculations so we get consistent positioning of overlays across all browsers.
82
- // Also switch to visualViewport.pageTop/pageLeft so that we still accomodate for scroll positioning for body/HTML elements that are actually scrollable
83
- // before pinch zoom happens
84
- scroll.top = 0;
85
- scroll.left = 0;
86
- var _visualViewport_pageTop;
87
- top = (_visualViewport_pageTop = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0;
88
- var _visualViewport_pageLeft;
89
- left = (_visualViewport_pageLeft = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0;
90
- }
91
- return {
92
- width: width,
93
- height: height,
94
- totalWidth: totalWidth,
95
- totalHeight: totalHeight,
96
- scroll: scroll,
97
- top: top,
98
- left: left
99
- };
100
- }
101
- function $5935ba4d7da2c103$var$getScroll(node) {
102
- return {
103
- top: node.scrollTop,
104
- left: node.scrollLeft,
105
- width: node.scrollWidth,
106
- height: node.scrollHeight
107
- };
108
- }
109
- // Determines the amount of space required when moving the overlay to ensure it remains in the boundary
110
- function $5935ba4d7da2c103$var$getDelta(axis, offset, size, // The dimensions of the boundary element that the popover is
111
- // positioned within (most of the time this is the <body>).
112
- boundaryDimensions, // The dimensions of the containing block element that the popover is
113
- // positioned relative to (e.g. parent with position: relative).
114
- // Usually this is the same as the boundary element, but if the popover
115
- // is portaled somewhere other than the body and has an ancestor with
116
- // position: relative/absolute, it will be different.
117
- containerDimensions, padding, containerOffsetWithBoundary) {
118
- var _containerDimensions_scroll_axis;
119
- let containerScroll = (_containerDimensions_scroll_axis = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis !== void 0 ? _containerDimensions_scroll_axis : 0;
120
- // The height/width of the boundary. Matches the axis along which we are adjusting the overlay position
121
- let boundarySize = boundaryDimensions[$5935ba4d7da2c103$var$AXIS_SIZE[axis]];
122
- // Calculate the edges of the boundary (accomodating for the boundary padding) and the edges of the overlay.
123
- // Note that these values are with respect to the visual viewport (aka 0,0 is the top left of the viewport)
124
- let boundaryStartEdge = containerOffsetWithBoundary[axis] + boundaryDimensions.scroll[$5935ba4d7da2c103$var$AXIS[axis]] + padding;
125
- let boundaryEndEdge = containerOffsetWithBoundary[axis] + boundaryDimensions.scroll[$5935ba4d7da2c103$var$AXIS[axis]] + boundarySize - padding;
126
- // transformed value of the left edge of the overlay
127
- let startEdgeOffset = offset - containerScroll + boundaryDimensions.scroll[$5935ba4d7da2c103$var$AXIS[axis]] + containerOffsetWithBoundary[axis] - boundaryDimensions[$5935ba4d7da2c103$var$AXIS[axis]];
128
- // transformed value of the right edge of the overlay
129
- let endEdgeOffset = offset - containerScroll + size + boundaryDimensions.scroll[$5935ba4d7da2c103$var$AXIS[axis]] + containerOffsetWithBoundary[axis] - boundaryDimensions[$5935ba4d7da2c103$var$AXIS[axis]];
130
- // If any of the overlay edges falls outside of the boundary, shift the overlay the required amount to align one of the overlay's
131
- // edges with the closest boundary edge.
132
- if (startEdgeOffset < boundaryStartEdge) return boundaryStartEdge - startEdgeOffset;
133
- else if (endEdgeOffset > boundaryEndEdge) return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
134
- else return 0;
135
- }
136
- function $5935ba4d7da2c103$var$getMargins(node) {
137
- let style = window.getComputedStyle(node);
138
- return {
139
- top: parseInt(style.marginTop, 10) || 0,
140
- bottom: parseInt(style.marginBottom, 10) || 0,
141
- left: parseInt(style.marginLeft, 10) || 0,
142
- right: parseInt(style.marginRight, 10) || 0
143
- };
144
- }
145
- function $5935ba4d7da2c103$var$parsePlacement(input) {
146
- if ($5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input]) return $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input];
147
- let [placement, crossPlacement] = input.split(' ');
148
- let axis = $5935ba4d7da2c103$var$AXIS[placement] || 'right';
149
- let crossAxis = $5935ba4d7da2c103$var$CROSS_AXIS[axis];
150
- if (!$5935ba4d7da2c103$var$AXIS[crossPlacement]) crossPlacement = 'center';
151
- let size = $5935ba4d7da2c103$var$AXIS_SIZE[axis];
152
- let crossSize = $5935ba4d7da2c103$var$AXIS_SIZE[crossAxis];
153
- $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input] = {
154
- placement: placement,
155
- crossPlacement: crossPlacement,
156
- axis: axis,
157
- crossAxis: crossAxis,
158
- size: size,
159
- crossSize: crossSize
160
- };
161
- return $5935ba4d7da2c103$var$PARSED_PLACEMENT_CACHE[input];
162
- }
163
- function $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions) {
164
- let { placement: placement, crossPlacement: crossPlacement, axis: axis, crossAxis: crossAxis, size: size, crossSize: crossSize } = placementInfo;
165
- let position = {};
166
- var _childOffset_crossAxis;
167
- // button position
168
- position[crossAxis] = (_childOffset_crossAxis = childOffset[crossAxis]) !== null && _childOffset_crossAxis !== void 0 ? _childOffset_crossAxis : 0;
169
- var _childOffset_crossSize, _overlaySize_crossSize, _childOffset_crossSize1, _overlaySize_crossSize1;
170
- if (crossPlacement === 'center') // + (button size / 2) - (overlay size / 2)
171
- // at this point the overlay center should match the button center
172
- position[crossAxis] += (((_childOffset_crossSize = childOffset[crossSize]) !== null && _childOffset_crossSize !== void 0 ? _childOffset_crossSize : 0) - ((_overlaySize_crossSize = overlaySize[crossSize]) !== null && _overlaySize_crossSize !== void 0 ? _overlaySize_crossSize : 0)) / 2;
173
- else if (crossPlacement !== crossAxis) // + (button size) - (overlay size)
174
- // at this point the overlay bottom should match the button bottom
175
- position[crossAxis] += ((_childOffset_crossSize1 = childOffset[crossSize]) !== null && _childOffset_crossSize1 !== void 0 ? _childOffset_crossSize1 : 0) - ((_overlaySize_crossSize1 = overlaySize[crossSize]) !== null && _overlaySize_crossSize1 !== void 0 ? _overlaySize_crossSize1 : 0);
176
- /* else {
177
- the overlay top should match the button top
178
- } */
179
- position[crossAxis] += crossOffset;
180
- // overlay top or left overlapping arrow with button bottom or right
181
- const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
182
- // overlay bottom or right overlapping arrow with button top or left
183
- const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
184
- position[crossAxis] = (0, $6E71I$reactariautils.clamp)(position[crossAxis], minPosition, maxPosition);
185
- // 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.
186
- if (placement === axis) {
187
- // If the container is positioned (non-static), then we use the container's actual
188
- // height, as `bottom` will be relative to this height. But if the container is static,
189
- // then it can only be the `document.body`, and `bottom` will be relative to _its_
190
- // container.
191
- let containerHeight = isContainerPositioned ? containerDimensions[size] : containerDimensions[$5935ba4d7da2c103$var$TOTAL_SIZE[size]];
192
- position[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset);
193
- } else position[axis] = Math.floor(childOffset[axis] + childOffset[size] + offset);
194
- return position;
195
- }
196
- function $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport) {
197
- var _position_bottom, _containerDimensions_scroll_top;
198
- // For cases where position is set via "bottom" instead of "top", we need to calculate the true overlay top
199
- // with respect to the container.
200
- let overlayTop = (position.top != null ? position.top : containerDimensions[$5935ba4d7da2c103$var$TOTAL_SIZE.height] - ((_position_bottom = position.bottom) !== null && _position_bottom !== void 0 ? _position_bottom : 0) - overlayHeight) - ((_containerDimensions_scroll_top = containerDimensions.scroll.top) !== null && _containerDimensions_scroll_top !== void 0 ? _containerDimensions_scroll_top : 0);
201
- // calculate the dimentions of the "boundingRect" which is most restrictive top/bottom of the boundaryRect and the visual view port
202
- let boundaryToContainerTransformOffset = isContainerDescendentOfBoundary ? containerOffsetWithBoundary.top : 0;
203
- var _visualViewport_offsetTop, _visualViewport_offsetTop1, _visualViewport_height;
204
- let boundingRect = {
205
- // This should be boundary top in container coord system vs viewport top in container coord system
206
- // For the viewport top, there are several cases
207
- // 1. pinchzoom case where we want the viewports offset top as top here
208
- // 2. case where container is offset from the boundary and is contained by the boundary. In this case the top we want here is NOT 0, we want to take boundary's top even though is is a negative number OR the visual viewport, whichever is more restrictive
209
- top: Math.max(boundaryDimensions.top + boundaryToContainerTransformOffset, ((_visualViewport_offsetTop = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.offsetTop) !== null && _visualViewport_offsetTop !== void 0 ? _visualViewport_offsetTop : boundaryDimensions.top) + boundaryToContainerTransformOffset),
210
- bottom: Math.min(boundaryDimensions.top + boundaryDimensions.height + boundaryToContainerTransformOffset, ((_visualViewport_offsetTop1 = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.offsetTop) !== null && _visualViewport_offsetTop1 !== void 0 ? _visualViewport_offsetTop1 : 0) + ((_visualViewport_height = visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : 0))
211
- };
212
- var _margins_top, _margins_bottom, _margins_top1, _margins_bottom1;
213
- let maxHeight = heightGrowthDirection !== 'top' ? // We want the distance between the top of the overlay to the bottom of the boundary
214
- Math.max(0, boundingRect.bottom // this is the bottom of the boundary
215
- - overlayTop // this is the top of the overlay
216
- - (((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0) + padding // save additional space for margin and padding
217
- )) : Math.max(0, overlayTop + overlayHeight // this is the bottom of the overlay
218
- - boundingRect.top // this is the top of the boundary
219
- - (((_margins_top1 = margins.top) !== null && _margins_top1 !== void 0 ? _margins_top1 : 0) + ((_margins_bottom1 = margins.bottom) !== null && _margins_bottom1 !== void 0 ? _margins_bottom1 : 0) + padding // save additional space for margin and padding
220
- ));
221
- return maxHeight;
222
- }
223
- function $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo, containerDimensions, isContainerDescendentOfBoundary) {
224
- let { placement: placement, axis: axis, size: size } = placementInfo;
225
- var _containerDimensions_scroll_axis, _margins_axis;
226
- if (placement === axis) return Math.max(0, childOffset[axis] // trigger start
227
- - ((_containerDimensions_scroll_axis = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis !== void 0 ? _containerDimensions_scroll_axis : 0 // transform trigger position to be with respect to viewport 0,0
228
- ) - (boundaryDimensions[axis] + (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0) // boundary start
229
- ) - ((_margins_axis = margins[axis]) !== null && _margins_axis !== void 0 ? _margins_axis : 0 // margins usually for arrows or other decorations
230
- ) - margins[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] - padding); // padding between overlay and boundary
231
- var _containerDimensions_scroll_axis1, _margins_axis1;
232
- return Math.max(0, boundaryDimensions[size] + boundaryDimensions[axis] + (isContainerDescendentOfBoundary ? containerOffsetWithBoundary[axis] : 0) - childOffset[axis] - childOffset[size] + ((_containerDimensions_scroll_axis1 = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis1 !== void 0 ? _containerDimensions_scroll_axis1 : 0) - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$5935ba4d7da2c103$var$FLIPPED_DIRECTION[axis]] - padding);
233
- }
234
- function $5935ba4d7da2c103$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport) {
235
- let placementInfo = $5935ba4d7da2c103$var$parsePlacement(placementInput);
236
- let { size: size, crossAxis: crossAxis, crossSize: crossSize, placement: placement, crossPlacement: crossPlacement } = placementInfo;
237
- let position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
238
- let normalizedOffset = offset;
239
- let space = $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, placementInfo, containerDimensions, isContainerDescendentOfBoundary);
240
- // Check if the scroll size of the overlay is greater than the available space to determine if we need to flip
241
- if (flip && overlaySize[size] > space) {
242
- let flippedPlacementInfo = $5935ba4d7da2c103$var$parsePlacement(`${$5935ba4d7da2c103$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
243
- let flippedPosition = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
244
- let flippedSpace = $5935ba4d7da2c103$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset, flippedPlacementInfo, containerDimensions, isContainerDescendentOfBoundary);
245
- // If the available space for the flipped position is greater than the original available space, flip.
246
- if (flippedSpace > space) {
247
- placementInfo = flippedPlacementInfo;
248
- position = flippedPosition;
249
- normalizedOffset = offset;
250
- }
251
- }
252
- // Determine the direction the height of the overlay can grow so that we can choose how to calculate the max height
253
- let heightGrowthDirection = 'bottom';
254
- if (placementInfo.axis === 'top') {
255
- if (placementInfo.placement === 'top') heightGrowthDirection = 'top';
256
- else if (placementInfo.placement === 'bottom') heightGrowthDirection = 'bottom';
257
- } else if (placementInfo.crossAxis === 'top') {
258
- if (placementInfo.crossPlacement === 'top') heightGrowthDirection = 'bottom';
259
- else if (placementInfo.crossPlacement === 'bottom') heightGrowthDirection = 'top';
260
- }
261
- let delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
262
- position[crossAxis] += delta;
263
- let maxHeight = $5935ba4d7da2c103$var$getMaxHeight(position, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection, containerDimensions, isContainerDescendentOfBoundary, visualViewport);
264
- if (userSetMaxHeight && userSetMaxHeight < maxHeight) maxHeight = userSetMaxHeight;
265
- overlaySize.height = Math.min(overlaySize.height, maxHeight);
266
- position = $5935ba4d7da2c103$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset, containerDimensions);
267
- delta = $5935ba4d7da2c103$var$getDelta(crossAxis, position[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
268
- position[crossAxis] += delta;
269
- let arrowPosition = {};
270
- // All values are transformed so that 0 is at the top/left of the overlay depending on the orientation
271
- // Prefer the arrow being in the center of the trigger/overlay anchor element
272
- // childOffset[crossAxis] + .5 * childOffset[crossSize] = absolute position with respect to the trigger's coordinate system that would place the arrow in the center of the trigger
273
- // position[crossAxis] - margins[AXIS[crossAxis]] = value use to transform the position to a value with respect to the overlay's coordinate system. A child element's (aka arrow) position absolute's "0"
274
- // is positioned after the margin of its parent (aka overlay) so we need to subtract it to get the proper coordinate transform
275
- let origin = childOffset[crossAxis] - position[crossAxis] - margins[$5935ba4d7da2c103$var$AXIS[crossAxis]];
276
- let preferredArrowPosition = origin + .5 * childOffset[crossSize];
277
- // Min/Max position limits for the arrow with respect to the overlay
278
- const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
279
- var _margins_left, _margins_right, _margins_top, _margins_bottom;
280
- // overlaySize[crossSize] - margins = true size of the overlay
281
- const overlayMargin = $5935ba4d7da2c103$var$AXIS[crossAxis] === 'left' ? ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0) : ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
282
- const arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;
283
- // Min/Max position limits for the arrow with respect to the trigger/overlay anchor element
284
- // Same margin accomodation done here as well as for the preferredArrowPosition
285
- const arrowOverlappingChildMinEdge = childOffset[crossAxis] + arrowSize / 2 - (position[crossAxis] + margins[$5935ba4d7da2c103$var$AXIS[crossAxis]]);
286
- const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - arrowSize / 2 - (position[crossAxis] + margins[$5935ba4d7da2c103$var$AXIS[crossAxis]]);
287
- // Clamp the arrow positioning so that it always is within the bounds of the anchor and the overlay
288
- const arrowPositionOverlappingChild = (0, $6E71I$reactariautils.clamp)(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
289
- arrowPosition[crossAxis] = (0, $6E71I$reactariautils.clamp)(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
290
- // If there is an arrow, use that as the origin so that animations are smooth.
291
- // Otherwise use the target edge.
292
- ({ placement: placement, crossPlacement: crossPlacement } = placementInfo);
293
- if (arrowSize) origin = arrowPosition[crossAxis];
294
- else if (crossPlacement === 'right') origin += childOffset[crossSize];
295
- else if (crossPlacement === 'center') origin += childOffset[crossSize] / 2;
296
- let crossOrigin = placement === 'left' || placement === 'top' ? overlaySize[size] : 0;
297
- let triggerAnchorPoint = {
298
- x: placement === 'top' || placement === 'bottom' ? origin : crossOrigin,
299
- y: placement === 'left' || placement === 'right' ? origin : crossOrigin
300
- };
301
- return {
302
- position: position,
303
- maxHeight: maxHeight,
304
- arrowOffsetLeft: arrowPosition.left,
305
- arrowOffsetTop: arrowPosition.top,
306
- placement: placement,
307
- triggerAnchorPoint: triggerAnchorPoint
308
- };
309
- }
310
- function $5935ba4d7da2c103$export$b3ceb0cbf1056d98(opts) {
311
- 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;
312
- let visualViewport = $5935ba4d7da2c103$var$getVisualViewport();
313
- let container = overlayNode instanceof HTMLElement ? $5935ba4d7da2c103$var$getContainingBlock(overlayNode) : document.documentElement;
314
- let isViewportContainer = container === document.documentElement;
315
- const containerPositionStyle = window.getComputedStyle(container).position;
316
- let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== 'static';
317
- let childOffset = isViewportContainer ? $5935ba4d7da2c103$var$getOffset(targetNode, false) : $5935ba4d7da2c103$var$getPosition(targetNode, container, false);
318
- if (!isViewportContainer) {
319
- let { marginTop: marginTop, marginLeft: marginLeft } = window.getComputedStyle(targetNode);
320
- childOffset.top += parseInt(marginTop, 10) || 0;
321
- childOffset.left += parseInt(marginLeft, 10) || 0;
322
- }
323
- let overlaySize = $5935ba4d7da2c103$var$getOffset(overlayNode, true);
324
- let margins = $5935ba4d7da2c103$var$getMargins(overlayNode);
325
- var _margins_left, _margins_right;
326
- overlaySize.width += ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0);
327
- var _margins_top, _margins_bottom;
328
- overlaySize.height += ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
329
- let scrollSize = $5935ba4d7da2c103$var$getScroll(scrollNode);
330
- // Note that due to logic inside getContainerDimensions, for cases where the boundary element is the body, we will return
331
- // a height/width that matches the visual viewport size rather than the body's height/width (aka for zoom it will be zoom adjusted size)
332
- // and a top/left that is adjusted as well (will return the top/left of the zoomed in viewport, or 0,0 for a non-zoomed body)
333
- // Otherwise this returns the height/width of a arbitrary boundary element, and its top/left with respect to the viewport (NOTE THIS MEANS IT DOESNT INCLUDE SCROLL)
334
- let boundaryDimensions = $5935ba4d7da2c103$var$getContainerDimensions(boundaryElement, visualViewport);
335
- let containerDimensions = $5935ba4d7da2c103$var$getContainerDimensions(container, visualViewport);
336
- // If the container is the HTML element wrapping the body element, the retrieved scrollTop/scrollLeft will be equal to the
337
- // 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
338
- // by the container scroll since they are essentially the same containing element and thus in the same coordinate system
339
- let containerOffsetWithBoundary = $5935ba4d7da2c103$var$getPosition(boundaryElement, container, false);
340
- let isContainerDescendentOfBoundary = (0, $6E71I$reactariautils.nodeContains)(boundaryElement, container);
341
- return $5935ba4d7da2c103$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset, isContainerDescendentOfBoundary, visualViewport);
342
- }
343
- function $5935ba4d7da2c103$export$4b834cebd9e5cebe(node, ignoreScale) {
344
- let { top: top, left: left, width: width, height: height } = node.getBoundingClientRect();
345
- // Use offsetWidth and offsetHeight if this is an HTML element, so that
346
- // the size is not affected by scale transforms.
347
- if (ignoreScale && node instanceof node.ownerDocument.defaultView.HTMLElement) {
348
- width = node.offsetWidth;
349
- height = node.offsetHeight;
350
- }
351
- return {
352
- top: top,
353
- left: left,
354
- width: width,
355
- height: height
356
- };
357
- }
358
- function $5935ba4d7da2c103$var$getOffset(node, ignoreScale) {
359
- let { top: top, left: left, width: width, height: height } = $5935ba4d7da2c103$export$4b834cebd9e5cebe(node, ignoreScale);
360
- let { scrollTop: scrollTop, scrollLeft: scrollLeft, clientTop: clientTop, clientLeft: clientLeft } = document.documentElement;
361
- return {
362
- top: top + scrollTop - clientTop,
363
- left: left + scrollLeft - clientLeft,
364
- width: width,
365
- height: height
366
- };
367
- }
368
- function $5935ba4d7da2c103$var$getPosition(node, parent, ignoreScale) {
369
- let style = window.getComputedStyle(node);
370
- let offset;
371
- if (style.position === 'fixed') offset = $5935ba4d7da2c103$export$4b834cebd9e5cebe(node, ignoreScale);
372
- else {
373
- offset = $5935ba4d7da2c103$var$getOffset(node, ignoreScale);
374
- let parentOffset = $5935ba4d7da2c103$var$getOffset(parent, ignoreScale);
375
- let parentStyle = window.getComputedStyle(parent);
376
- parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
377
- parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
378
- offset.top -= parentOffset.top;
379
- offset.left -= parentOffset.left;
380
- }
381
- offset.top -= parseInt(style.marginTop, 10) || 0;
382
- offset.left -= parseInt(style.marginLeft, 10) || 0;
383
- return offset;
384
- }
385
- // Returns the containing block of an element, which is the element that
386
- // this element will be positioned relative to.
387
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block
388
- function $5935ba4d7da2c103$var$getContainingBlock(node) {
389
- // The offsetParent of an element in most cases equals the containing block.
390
- // https://w3c.github.io/csswg-drafts/cssom-view/#dom-htmlelement-offsetparent
391
- let offsetParent = node.offsetParent;
392
- // The offsetParent algorithm terminates at the document body,
393
- // even if the body is not a containing block. Double check that
394
- // and use the documentElement if so.
395
- if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === 'static' && !$5935ba4d7da2c103$var$isContainingBlock(offsetParent)) offsetParent = document.documentElement;
396
- // TODO(later): handle table elements?
397
- // The offsetParent can be null if the element has position: fixed, or a few other cases.
398
- // We have to walk up the tree manually in this case because fixed positioned elements
399
- // are still positioned relative to their containing block, which is not always the viewport.
400
- if (offsetParent == null) {
401
- offsetParent = node.parentElement;
402
- while(offsetParent && !$5935ba4d7da2c103$var$isContainingBlock(offsetParent))offsetParent = offsetParent.parentElement;
403
- }
404
- // Fall back to the viewport.
405
- return offsetParent || document.documentElement;
406
- }
407
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
408
- function $5935ba4d7da2c103$var$isContainingBlock(node) {
409
- let style = window.getComputedStyle(node);
410
- return style.transform !== 'none' || /transform|perspective/.test(style.willChange) || style.filter !== 'none' || style.contain === 'paint' || 'backdropFilter' in style && style.backdropFilter !== 'none' || 'WebkitBackdropFilter' in style && style.WebkitBackdropFilter !== 'none';
411
- }
412
-
413
-
414
- //# sourceMappingURL=calculatePosition.main.js.map