@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
@@ -0,0 +1,121 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "ariaHideOutside", () => $08ef1685902b6011$export$1c3ebcada18427bf);
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */ // Keeps a ref count of all hidden elements. Added to when hiding an element, and
18
+ // subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
19
+ let $08ef1685902b6011$var$refCountMap = new WeakMap();
20
+ let $08ef1685902b6011$var$observerStack = [];
21
+ function $08ef1685902b6011$export$1c3ebcada18427bf(targets, root = document.body) {
22
+ let visibleNodes = new Set(targets);
23
+ let hiddenNodes = new Set();
24
+ let walk = (root)=>{
25
+ // Keep live announcer and top layer elements (e.g. toasts) visible.
26
+ for (let element of root.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))visibleNodes.add(element);
27
+ let acceptNode = (node)=>{
28
+ // Skip this node and its children if it is one of the target nodes, or a live announcer.
29
+ // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
30
+ // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
31
+ // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
32
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
33
+ // Skip this node but continue to children if one of the targets is inside the node.
34
+ for (let target of visibleNodes){
35
+ if (node.contains(target)) return NodeFilter.FILTER_SKIP;
36
+ }
37
+ return NodeFilter.FILTER_ACCEPT;
38
+ };
39
+ let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
40
+ acceptNode: acceptNode
41
+ });
42
+ // TreeWalker does not include the root.
43
+ let acceptRoot = acceptNode(root);
44
+ if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
45
+ if (acceptRoot !== NodeFilter.FILTER_REJECT) {
46
+ let node = walker.nextNode();
47
+ while(node != null){
48
+ hide(node);
49
+ node = walker.nextNode();
50
+ }
51
+ }
52
+ };
53
+ let hide = (node)=>{
54
+ var _refCountMap_get;
55
+ let refCount = (_refCountMap_get = $08ef1685902b6011$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
56
+ // If already aria-hidden, and the ref count is zero, then this element
57
+ // was already hidden and there's nothing for us to do.
58
+ if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
59
+ if (refCount === 0) node.setAttribute("aria-hidden", "true");
60
+ hiddenNodes.add(node);
61
+ $08ef1685902b6011$var$refCountMap.set(node, refCount + 1);
62
+ };
63
+ // If there is already a MutationObserver listening from a previous call,
64
+ // disconnect it so the new on takes over.
65
+ if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].disconnect();
66
+ walk(root);
67
+ let observer = new MutationObserver((changes)=>{
68
+ for (let change of changes){
69
+ if (change.type !== "childList" || change.addedNodes.length === 0) continue;
70
+ // If the parent element of the added nodes is not within one of the targets,
71
+ // and not already inside a hidden node, hide all of the new children.
72
+ if (![
73
+ ...visibleNodes,
74
+ ...hiddenNodes
75
+ ].some((node)=>node.contains(change.target))) {
76
+ for (let node of change.removedNodes)if (node instanceof Element) {
77
+ visibleNodes.delete(node);
78
+ hiddenNodes.delete(node);
79
+ }
80
+ for (let node of change.addedNodes){
81
+ if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node);
82
+ else if (node instanceof Element) walk(node);
83
+ }
84
+ }
85
+ }
86
+ });
87
+ observer.observe(root, {
88
+ childList: true,
89
+ subtree: true
90
+ });
91
+ let observerWrapper = {
92
+ observe () {
93
+ observer.observe(root, {
94
+ childList: true,
95
+ subtree: true
96
+ });
97
+ },
98
+ disconnect () {
99
+ observer.disconnect();
100
+ }
101
+ };
102
+ $08ef1685902b6011$var$observerStack.push(observerWrapper);
103
+ return ()=>{
104
+ observer.disconnect();
105
+ for (let node of hiddenNodes){
106
+ let count = $08ef1685902b6011$var$refCountMap.get(node);
107
+ if (count === 1) {
108
+ node.removeAttribute("aria-hidden");
109
+ $08ef1685902b6011$var$refCountMap.delete(node);
110
+ } else $08ef1685902b6011$var$refCountMap.set(node, count - 1);
111
+ }
112
+ // Remove this observer from the stack, and start the previous one.
113
+ if (observerWrapper === $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1]) {
114
+ $08ef1685902b6011$var$observerStack.pop();
115
+ if ($08ef1685902b6011$var$observerStack.length) $08ef1685902b6011$var$observerStack[$08ef1685902b6011$var$observerStack.length - 1].observe();
116
+ } else $08ef1685902b6011$var$observerStack.splice($08ef1685902b6011$var$observerStack.indexOf(observerWrapper), 1);
117
+ };
118
+ }
119
+
120
+
121
+ //# sourceMappingURL=ariaHideOutside.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAED,iFAAiF;AACjF,uFAAuF;AACvF,IAAI,oCAAc,IAAI;AACtB,IAAI,sCAAgB,EAAE;AAUf,SAAS,0CAAgB,OAAkB,EAAE,OAAO,SAAS,IAAI;IACtE,IAAI,eAAe,IAAI,IAAa;IACpC,IAAI,cAAc,IAAI;IAEtB,IAAI,OAAO,CAAC;QACV,oEAAoE;QACpE,KAAK,IAAI,WAAW,KAAK,gBAAgB,CAAC,sDACxC,aAAa,GAAG,CAAC;QAGnB,IAAI,aAAa,CAAC;YAChB,yFAAyF;YACzF,2FAA2F;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020 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\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>();\nlet observerStack = [];\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[], root = document.body) {\n let visibleNodes = new Set<Element>(targets);\n let hiddenNodes = new Set<Element>();\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 visibleNodes.has(node) ||\n (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 (node.contains(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 (node.getAttribute('aria-hidden') === 'true' && refCount === 0) {\n return;\n }\n\n if (refCount === 0) {\n node.setAttribute('aria-hidden', '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' || change.addedNodes.length === 0) {\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 (![...visibleNodes, ...hiddenNodes].some(node => node.contains(change.target))) {\n for (let node of change.removedNodes) {\n if (node instanceof Element) {\n visibleNodes.delete(node);\n hiddenNodes.delete(node);\n }\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 = {\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 () => {\n observer.disconnect();\n\n for (let node of hiddenNodes) {\n let count = refCountMap.get(node);\n if (count === 1) {\n node.removeAttribute('aria-hidden');\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"],"names":[],"version":3,"file":"ariaHideOutside.main.js.map"}
@@ -0,0 +1,116 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ // Keeps a ref count of all hidden elements. Added to when hiding an element, and
12
+ // subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
13
+ let $5e3802645cc19319$var$refCountMap = new WeakMap();
14
+ let $5e3802645cc19319$var$observerStack = [];
15
+ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body) {
16
+ let visibleNodes = new Set(targets);
17
+ let hiddenNodes = new Set();
18
+ let walk = (root)=>{
19
+ // Keep live announcer and top layer elements (e.g. toasts) visible.
20
+ for (let element of root.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))visibleNodes.add(element);
21
+ let acceptNode = (node)=>{
22
+ // Skip this node and its children if it is one of the target nodes, or a live announcer.
23
+ // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
24
+ // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
25
+ // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
26
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
27
+ // Skip this node but continue to children if one of the targets is inside the node.
28
+ for (let target of visibleNodes){
29
+ if (node.contains(target)) return NodeFilter.FILTER_SKIP;
30
+ }
31
+ return NodeFilter.FILTER_ACCEPT;
32
+ };
33
+ let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
34
+ acceptNode: acceptNode
35
+ });
36
+ // TreeWalker does not include the root.
37
+ let acceptRoot = acceptNode(root);
38
+ if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
39
+ if (acceptRoot !== NodeFilter.FILTER_REJECT) {
40
+ let node = walker.nextNode();
41
+ while(node != null){
42
+ hide(node);
43
+ node = walker.nextNode();
44
+ }
45
+ }
46
+ };
47
+ let hide = (node)=>{
48
+ var _refCountMap_get;
49
+ let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
50
+ // If already aria-hidden, and the ref count is zero, then this element
51
+ // was already hidden and there's nothing for us to do.
52
+ if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
53
+ if (refCount === 0) node.setAttribute("aria-hidden", "true");
54
+ hiddenNodes.add(node);
55
+ $5e3802645cc19319$var$refCountMap.set(node, refCount + 1);
56
+ };
57
+ // If there is already a MutationObserver listening from a previous call,
58
+ // disconnect it so the new on takes over.
59
+ if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].disconnect();
60
+ walk(root);
61
+ let observer = new MutationObserver((changes)=>{
62
+ for (let change of changes){
63
+ if (change.type !== "childList" || change.addedNodes.length === 0) continue;
64
+ // If the parent element of the added nodes is not within one of the targets,
65
+ // and not already inside a hidden node, hide all of the new children.
66
+ if (![
67
+ ...visibleNodes,
68
+ ...hiddenNodes
69
+ ].some((node)=>node.contains(change.target))) {
70
+ for (let node of change.removedNodes)if (node instanceof Element) {
71
+ visibleNodes.delete(node);
72
+ hiddenNodes.delete(node);
73
+ }
74
+ for (let node of change.addedNodes){
75
+ if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node);
76
+ else if (node instanceof Element) walk(node);
77
+ }
78
+ }
79
+ }
80
+ });
81
+ observer.observe(root, {
82
+ childList: true,
83
+ subtree: true
84
+ });
85
+ let observerWrapper = {
86
+ observe () {
87
+ observer.observe(root, {
88
+ childList: true,
89
+ subtree: true
90
+ });
91
+ },
92
+ disconnect () {
93
+ observer.disconnect();
94
+ }
95
+ };
96
+ $5e3802645cc19319$var$observerStack.push(observerWrapper);
97
+ return ()=>{
98
+ observer.disconnect();
99
+ for (let node of hiddenNodes){
100
+ let count = $5e3802645cc19319$var$refCountMap.get(node);
101
+ if (count === 1) {
102
+ node.removeAttribute("aria-hidden");
103
+ $5e3802645cc19319$var$refCountMap.delete(node);
104
+ } else $5e3802645cc19319$var$refCountMap.set(node, count - 1);
105
+ }
106
+ // Remove this observer from the stack, and start the previous one.
107
+ if (observerWrapper === $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1]) {
108
+ $5e3802645cc19319$var$observerStack.pop();
109
+ if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].observe();
110
+ } else $5e3802645cc19319$var$observerStack.splice($5e3802645cc19319$var$observerStack.indexOf(observerWrapper), 1);
111
+ };
112
+ }
113
+
114
+
115
+ export {$5e3802645cc19319$export$1c3ebcada18427bf as ariaHideOutside};
116
+ //# sourceMappingURL=ariaHideOutside.mjs.map
@@ -0,0 +1,116 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */ // Keeps a ref count of all hidden elements. Added to when hiding an element, and
12
+ // subtracted from when showing it again. When it reaches zero, aria-hidden is removed.
13
+ let $5e3802645cc19319$var$refCountMap = new WeakMap();
14
+ let $5e3802645cc19319$var$observerStack = [];
15
+ function $5e3802645cc19319$export$1c3ebcada18427bf(targets, root = document.body) {
16
+ let visibleNodes = new Set(targets);
17
+ let hiddenNodes = new Set();
18
+ let walk = (root)=>{
19
+ // Keep live announcer and top layer elements (e.g. toasts) visible.
20
+ for (let element of root.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))visibleNodes.add(element);
21
+ let acceptNode = (node)=>{
22
+ // Skip this node and its children if it is one of the target nodes, or a live announcer.
23
+ // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is
24
+ // made for elements with role="row" since VoiceOver on iOS has issues hiding elements with role="row".
25
+ // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).
26
+ if (visibleNodes.has(node) || hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute("role") !== "row") return NodeFilter.FILTER_REJECT;
27
+ // Skip this node but continue to children if one of the targets is inside the node.
28
+ for (let target of visibleNodes){
29
+ if (node.contains(target)) return NodeFilter.FILTER_SKIP;
30
+ }
31
+ return NodeFilter.FILTER_ACCEPT;
32
+ };
33
+ let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
34
+ acceptNode: acceptNode
35
+ });
36
+ // TreeWalker does not include the root.
37
+ let acceptRoot = acceptNode(root);
38
+ if (acceptRoot === NodeFilter.FILTER_ACCEPT) hide(root);
39
+ if (acceptRoot !== NodeFilter.FILTER_REJECT) {
40
+ let node = walker.nextNode();
41
+ while(node != null){
42
+ hide(node);
43
+ node = walker.nextNode();
44
+ }
45
+ }
46
+ };
47
+ let hide = (node)=>{
48
+ var _refCountMap_get;
49
+ let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap.get(node)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
50
+ // If already aria-hidden, and the ref count is zero, then this element
51
+ // was already hidden and there's nothing for us to do.
52
+ if (node.getAttribute("aria-hidden") === "true" && refCount === 0) return;
53
+ if (refCount === 0) node.setAttribute("aria-hidden", "true");
54
+ hiddenNodes.add(node);
55
+ $5e3802645cc19319$var$refCountMap.set(node, refCount + 1);
56
+ };
57
+ // If there is already a MutationObserver listening from a previous call,
58
+ // disconnect it so the new on takes over.
59
+ if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].disconnect();
60
+ walk(root);
61
+ let observer = new MutationObserver((changes)=>{
62
+ for (let change of changes){
63
+ if (change.type !== "childList" || change.addedNodes.length === 0) continue;
64
+ // If the parent element of the added nodes is not within one of the targets,
65
+ // and not already inside a hidden node, hide all of the new children.
66
+ if (![
67
+ ...visibleNodes,
68
+ ...hiddenNodes
69
+ ].some((node)=>node.contains(change.target))) {
70
+ for (let node of change.removedNodes)if (node instanceof Element) {
71
+ visibleNodes.delete(node);
72
+ hiddenNodes.delete(node);
73
+ }
74
+ for (let node of change.addedNodes){
75
+ if ((node instanceof HTMLElement || node instanceof SVGElement) && (node.dataset.liveAnnouncer === "true" || node.dataset.reactAriaTopLayer === "true")) visibleNodes.add(node);
76
+ else if (node instanceof Element) walk(node);
77
+ }
78
+ }
79
+ }
80
+ });
81
+ observer.observe(root, {
82
+ childList: true,
83
+ subtree: true
84
+ });
85
+ let observerWrapper = {
86
+ observe () {
87
+ observer.observe(root, {
88
+ childList: true,
89
+ subtree: true
90
+ });
91
+ },
92
+ disconnect () {
93
+ observer.disconnect();
94
+ }
95
+ };
96
+ $5e3802645cc19319$var$observerStack.push(observerWrapper);
97
+ return ()=>{
98
+ observer.disconnect();
99
+ for (let node of hiddenNodes){
100
+ let count = $5e3802645cc19319$var$refCountMap.get(node);
101
+ if (count === 1) {
102
+ node.removeAttribute("aria-hidden");
103
+ $5e3802645cc19319$var$refCountMap.delete(node);
104
+ } else $5e3802645cc19319$var$refCountMap.set(node, count - 1);
105
+ }
106
+ // Remove this observer from the stack, and start the previous one.
107
+ if (observerWrapper === $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1]) {
108
+ $5e3802645cc19319$var$observerStack.pop();
109
+ if ($5e3802645cc19319$var$observerStack.length) $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].observe();
110
+ } else $5e3802645cc19319$var$observerStack.splice($5e3802645cc19319$var$observerStack.indexOf(observerWrapper), 1);
111
+ };
112
+ }
113
+
114
+
115
+ export {$5e3802645cc19319$export$1c3ebcada18427bf as ariaHideOutside};
116
+ //# sourceMappingURL=ariaHideOutside.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"AAAA;;;;;;;;;;CAUC,GAED,iFAAiF;AACjF,uFAAuF;AACvF,IAAI,oCAAc,IAAI;AACtB,IAAI,sCAAgB,EAAE;AAUf,SAAS,0CAAgB,OAAkB,EAAE,OAAO,SAAS,IAAI;IACtE,IAAI,eAAe,IAAI,IAAa;IACpC,IAAI,cAAc,IAAI;IAEtB,IAAI,OAAO,CAAC;QACV,oEAAoE;QACpE,KAAK,IAAI,WAAW,KAAK,gBAAgB,CAAC,sDACxC,aAAa,GAAG,CAAC;QAGnB,IAAI,aAAa,CAAC;YAChB,yFAAyF;YACzF,2FAA2F;YAC3F,uGAAuG;YACvG,2GAA2G;YAC3G,IACE,aAAa,GAAG,CAAC,SAChB,YAAY,GAAG,CAAC,KAAK,aAAa,KAAK,KAAK,aAAa,CAAC,YAAY,CAAC,YAAY,OAEpF,OAAO,WAAW,aAAa;YAGjC,oFAAoF;YACpF,KAAK,IAAI,UAAU,aAAc;gBAC/B,IAAI,KAAK,QAAQ,CAAC,SAChB,OAAO,WAAW,WAA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,IACE,AAAC,CAAA,gBAAgB,eAAe,gBAAgB,UAAS,KACxD,CAAA,KAAK,OAAO,CAAC,aAAa,KAAK,UAAU,KAAK,OAAO,CAAC,iBAAiB,KAAK,MAAK,GAElF,aAAa,GAAG,CAAC;yBACZ,IAAI,gBAAgB,SACzB,KAAK;gBAET;YACF;QACF;IACF;IAEA,SAAS,OAAO,CAAC,MAAM;QAAC,WAAW;QAAM,SAAS;IAAI;IAEtD,IAAI,kBAAkB;QACpB;YACE,SAAS,OAAO,CAAC,MAAM;gBAAC,WAAW;gBAAM,SAAS;YAAI;QACxD;QACA;YACE,SAAS,UAAU;QACrB;IACF;IAEA,oCAAc,IAAI,CAAC;IAEnB,OAAO;QACL,SAAS,UAAU;QAEnB,KAAK,IAAI,QAAQ,YAAa;YAC5B,IAAI,QAAQ,kCAAY,GAAG,CAAC;YAC5B,IAAI,UAAU,GAAG;gBACf,KAAK,eAAe,CAAC;gBACrB,kCAAY,MAAM,CAAC;YACrB,OACE,kCAAY,GAAG,CAAC,MAAM,QAAQ;QAElC;QAEA,mEAAmE;QACnE,IAAI,oBAAoB,mCAAa,CAAC,oCAAc,MAAM,GAAG,EAAE,EAAE;YAC/D,oCAAc,GAAG;YACjB,IAAI,oCAAc,MAAM,EACtB,mCAAa,CAAC,oCAAc,MAAM,GAAG,EAAE,CAAC,OAAO;QAEnD,OACE,oCAAc,MAAM,CAAC,oCAAc,OAAO,CAAC,kBAAkB;IAEjE;AACF","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\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>();\nlet observerStack = [];\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[], root = document.body) {\n let visibleNodes = new Set<Element>(targets);\n let hiddenNodes = new Set<Element>();\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 visibleNodes.has(node) ||\n (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 (node.contains(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 (node.getAttribute('aria-hidden') === 'true' && refCount === 0) {\n return;\n }\n\n if (refCount === 0) {\n node.setAttribute('aria-hidden', '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' || change.addedNodes.length === 0) {\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 (![...visibleNodes, ...hiddenNodes].some(node => node.contains(change.target))) {\n for (let node of change.removedNodes) {\n if (node instanceof Element) {\n visibleNodes.delete(node);\n hiddenNodes.delete(node);\n }\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 = {\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 () => {\n observer.disconnect();\n\n for (let node of hiddenNodes) {\n let count = refCountMap.get(node);\n if (count === 1) {\n node.removeAttribute('aria-hidden');\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"],"names":[],"version":3,"file":"ariaHideOutside.module.js.map"}
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,8 @@
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.mjs.map
@@ -0,0 +1,8 @@
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
@@ -0,0 +1 @@
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"}