@react-aria/aria-modal-polyfill 3.6.2-nightly.3599 → 3.6.2-nightly.3603

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.
package/dist/main.js CHANGED
@@ -5,10 +5,19 @@ function $parcel$export(e, n, v, s) {
5
5
  }
6
6
 
7
7
  $parcel$export(module.exports, "watchModals", () => $5670f73d6b18f643$export$11dddb85aae73809);
8
-
9
- const $5670f73d6b18f643$var$currentDocument = typeof document !== 'undefined' ? document : undefined;
10
- function $5670f73d6b18f643$export$11dddb85aae73809(selector = 'body', { document: document = $5670f73d6b18f643$var$currentDocument } = {
11
- }) {
8
+ /*
9
+ * Copyright 2020 Adobe. All rights reserved.
10
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License. You may obtain a copy
12
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software distributed under
15
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
16
+ * OF ANY KIND, either express or implied. See the License for the specific language
17
+ * governing permissions and limitations under the License.
18
+ */
19
+ const $5670f73d6b18f643$var$currentDocument = typeof document !== "undefined" ? document : undefined;
20
+ function $5670f73d6b18f643$export$11dddb85aae73809(selector = "body", { document: document1 = $5670f73d6b18f643$var$currentDocument } = {}) {
12
21
  /**
13
22
  * Listen for additions to the child list of the selected element (defaults to body). This is where providers render modal portals.
14
23
  * When one is added, see if there is a modal inside it, if there is, then hide everything else from screen readers.
@@ -16,16 +25,16 @@ function $5670f73d6b18f643$export$11dddb85aae73809(selector = 'body', { document
16
25
  *
17
26
  * If a modal container is removed, then undo the hiding based on the last hide others. Check if there are any other modals still around, and
18
27
  * hide based on the last one added.
19
- */ let target = document.querySelector(selector);
28
+ */ let target = document1.querySelector(selector);
20
29
  let config = {
21
30
  childList: true
22
31
  };
23
32
  let modalContainers = [];
24
33
  let undo;
25
34
  let observer = new MutationObserver((mutationRecord)=>{
26
- const liveAnnouncer = document.querySelector('[data-live-announcer="true"]');
35
+ const liveAnnouncer = document1.querySelector('[data-live-announcer="true"]');
27
36
  for (let mutation of mutationRecord){
28
- if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
37
+ if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
29
38
  let addNode = Array.from(mutation.addedNodes).find((node)=>{
30
39
  var ref;
31
40
  return (ref = node.querySelector) === null || ref === void 0 ? void 0 : ref.call(node, '[aria-modal="true"], [data-ismodal="true"]');
@@ -34,23 +43,21 @@ function $5670f73d6b18f643$export$11dddb85aae73809(selector = 'body', { document
34
43
  modalContainers.push(addNode);
35
44
  let modal = addNode.querySelector('[aria-modal="true"], [data-ismodal="true"]');
36
45
  undo === null || undo === void 0 ? void 0 : undo();
37
- undo = $26G9B$ariahidden.hideOthers([
46
+ undo = (0, $26G9B$ariahidden.hideOthers)([
38
47
  modal,
39
48
  liveAnnouncer
40
49
  ]);
41
50
  }
42
- } else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {
51
+ } else if (mutation.type === "childList" && mutation.removedNodes.length > 0) {
43
52
  let removedNodes = Array.from(mutation.removedNodes);
44
- let nodeIndexRemove = modalContainers.findIndex((container)=>removedNodes.includes(container)
45
- );
53
+ let nodeIndexRemove = modalContainers.findIndex((container)=>removedNodes.includes(container));
46
54
  if (nodeIndexRemove >= 0) {
47
55
  undo();
48
- modalContainers = modalContainers.filter((val, i)=>i !== nodeIndexRemove
49
- );
56
+ modalContainers = modalContainers.filter((val, i)=>i !== nodeIndexRemove);
50
57
  if (modalContainers.length > 0) {
51
- let modal = modalContainers[modalContainers.length - 1].querySelector('[aria-modal="true"], [data-ismodal="true"]');
52
- undo = $26G9B$ariahidden.hideOthers([
53
- modal,
58
+ let modal1 = modalContainers[modalContainers.length - 1].querySelector('[aria-modal="true"], [data-ismodal="true"]');
59
+ undo = (0, $26G9B$ariahidden.hideOthers)([
60
+ modal1,
54
61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packages/@react-aria/aria-modal-polyfill/src/index.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 {hideOthers} from 'aria-hidden';\n\ntype Revert = () => void;\n\nconst currentDocument = typeof document !== 'undefined' ? document : undefined;\n\n/**\n * Acts as a polyfill for `aria-modal` by watching for added modals and hiding any surrounding DOM elements with `aria-hidden`.\n */\nexport function watchModals(selector:string = 'body', {document = currentDocument} = {}): Revert {\n /**\n * Listen for additions to the child list of the selected element (defaults to body). This is where providers render modal portals.\n * When one is added, see if there is a modal inside it, if there is, then hide everything else from screen readers.\n * If there was already a modal open and a new one was added, undo everything that the previous modal had hidden and hide based on the new one.\n *\n * If a modal container is removed, then undo the hiding based on the last hide others. Check if there are any other modals still around, and\n * hide based on the last one added.\n */\n let target = document.querySelector(selector);\n let config = {childList: true};\n let modalContainers = [];\n let undo: Revert | undefined;\n\n let observer = new MutationObserver((mutationRecord) => {\n const liveAnnouncer: HTMLElement = document.querySelector('[data-live-announcer=\"true\"]');\n for (let mutation of mutationRecord) {\n if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {\n let addNode: Element = (Array.from(mutation.addedNodes).find((node: any) => node.querySelector?.('[aria-modal=\"true\"], [data-ismodal=\"true\"]')) as HTMLElement);\n if (addNode) {\n modalContainers.push(addNode);\n let modal = addNode.querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]') as HTMLElement;\n undo?.();\n undo = hideOthers([modal, liveAnnouncer]);\n }\n } else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {\n let removedNodes = Array.from(mutation.removedNodes);\n let nodeIndexRemove = modalContainers.findIndex(container => removedNodes.includes(container));\n if (nodeIndexRemove >= 0) {\n undo();\n modalContainers = modalContainers.filter((val, i) => i !== nodeIndexRemove);\n if (modalContainers.length > 0) {\n let modal = modalContainers[modalContainers.length - 1].querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]');\n undo = hideOthers([modal, liveAnnouncer]);\n } else {\n undo = undefined;\n }\n }\n }\n }\n });\n observer.observe(target, config);\n return () => {\n undo?.();\n observer.disconnect();\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAED;AAIA,MAAM,wCAAkB,OAAO,aAAa,cAAc,WAAW,SAAS;AAKvE,SAAS,0CAAY,WAAkB,MAAM,EAAE,EAAC,UAAA,YAAW,qCAAe,CAAA,EAAC,GAAG,CAAC,CAAC,EAAU;IAC/F;;;;;;;GAOC,GACD,IAAI,SAAS,UAAS,aAAa,CAAC;IACpC,IAAI,SAAS;QAAC,WAAW,IAAI;IAAA;IAC7B,IAAI,kBAAkB,EAAE;IACxB,IAAI;IAEJ,IAAI,WAAW,IAAI,iBAAiB,CAAC,iBAAmB;QACtD,MAAM,gBAA8B,UAAS,aAAa,CAAC;QAC3D,KAAK,IAAI,YAAY,eAAgB;YACnC,IAAI,SAAS,IAAI,KAAK,eAAe,SAAS,UAAU,CAAC,MAAM,GAAG,GAAG;gBACnE,IAAI,UAAoB,MAAM,IAAI,CAAC,SAAS,UAAU,EAAE,IAAI,CAAC,CAAC;wBAAc;oBAAA,OAAA,CAAA,MAAA,KAAK,aAAa,cAAlB,iBAAA,KAAA,IAAA,IAAA,KAAA,MAAqB;;gBACjG,IAAI,SAAS;oBACX,gBAAgB,IAAI,CAAC;oBACrB,IAAI,QAAQ,QAAQ,aAAa,CAAC;oBAClC,iBAAA,kBAAA,KAAA,IAAA;oBACA,OAAO,CAAA,GAAA,4BAAS,EAAE;wBAAC;wBAAO;qBAAc;gBAC1C,CAAC;YACH,OAAO,IAAI,SAAS,IAAI,KAAK,eAAe,SAAS,YAAY,CAAC,MAAM,GAAG,GAAG;gBAC5E,IAAI,eAAe,MAAM,IAAI,CAAC,SAAS,YAAY;gBACnD,IAAI,kBAAkB,gBAAgB,SAAS,CAAC,CAAA,YAAa,aAAa,QAAQ,CAAC;gBACnF,IAAI,mBAAmB,GAAG;oBACxB;oBACA,kBAAkB,gBAAgB,MAAM,CAAC,CAAC,KAAK,IAAM,MAAM;oBAC3D,IAAI,gBAAgB,MAAM,GAAG,GAAG;wBAC9B,IAAI,SAAQ,eAAe,CAAC,gBAAgB,MAAM,GAAG,EAAE,CAAC,aAAa,CAAC;wBACtE,OAAO,CAAA,GAAA,4BAAS,EAAE;4BAAC;4BAAO;yBAAc;oBAC1C,OACE,OAAO;gBAEX,CAAC;YACH,CAAC;QACH;IACF;IACA,SAAS,OAAO,CAAC,QAAQ;IACzB,OAAO,IAAM;QACX,iBAAA,kBAAA,KAAA,IAAA;QACA,SAAS,UAAU;IACrB;AACF","sources":["packages/@react-aria/aria-modal-polyfill/src/index.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 {hideOthers} from 'aria-hidden';\n\ntype Revert = () => void;\n\nconst currentDocument = typeof document !== 'undefined' ? document : undefined;\n\n/**\n * Acts as a polyfill for `aria-modal` by watching for added modals and hiding any surrounding DOM elements with `aria-hidden`.\n */\nexport function watchModals(selector:string = 'body', {document = currentDocument} = {}): Revert {\n /**\n * Listen for additions to the child list of the selected element (defaults to body). This is where providers render modal portals.\n * When one is added, see if there is a modal inside it, if there is, then hide everything else from screen readers.\n * If there was already a modal open and a new one was added, undo everything that the previous modal had hidden and hide based on the new one.\n *\n * If a modal container is removed, then undo the hiding based on the last hide others. Check if there are any other modals still around, and\n * hide based on the last one added.\n */\n let target = document.querySelector(selector);\n let config = {childList: true};\n let modalContainers = [];\n let undo: Revert | undefined;\n\n let observer = new MutationObserver((mutationRecord) => {\n const liveAnnouncer: HTMLElement = document.querySelector('[data-live-announcer=\"true\"]');\n for (let mutation of mutationRecord) {\n if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {\n let addNode: Element = (Array.from(mutation.addedNodes).find((node: any) => node.querySelector?.('[aria-modal=\"true\"], [data-ismodal=\"true\"]')) as HTMLElement);\n if (addNode) {\n modalContainers.push(addNode);\n let modal = addNode.querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]') as HTMLElement;\n undo?.();\n undo = hideOthers([modal, liveAnnouncer]);\n }\n } else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {\n let removedNodes = Array.from(mutation.removedNodes);\n let nodeIndexRemove = modalContainers.findIndex(container => removedNodes.includes(container));\n if (nodeIndexRemove >= 0) {\n undo();\n modalContainers = modalContainers.filter((val, i) => i !== nodeIndexRemove);\n if (modalContainers.length > 0) {\n let modal = modalContainers[modalContainers.length - 1].querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]');\n undo = hideOthers([modal, liveAnnouncer]);\n } else {\n undo = undefined;\n }\n }\n }\n }\n });\n observer.observe(target, config);\n return () => {\n undo?.();\n observer.disconnect();\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.mjs CHANGED
@@ -1,9 +1,18 @@
1
1
  import {hideOthers as $hRMXz$hideOthers} from "aria-hidden";
2
2
 
3
-
4
- const $0ba7c906f8d7a5d9$var$currentDocument = typeof document !== 'undefined' ? document : undefined;
5
- function $0ba7c906f8d7a5d9$export$11dddb85aae73809(selector = 'body', { document: document = $0ba7c906f8d7a5d9$var$currentDocument } = {
6
- }) {
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 $0ba7c906f8d7a5d9$var$currentDocument = typeof document !== "undefined" ? document : undefined;
15
+ function $0ba7c906f8d7a5d9$export$11dddb85aae73809(selector = "body", { document: document1 = $0ba7c906f8d7a5d9$var$currentDocument } = {}) {
7
16
  /**
8
17
  * Listen for additions to the child list of the selected element (defaults to body). This is where providers render modal portals.
9
18
  * When one is added, see if there is a modal inside it, if there is, then hide everything else from screen readers.
@@ -11,16 +20,16 @@ function $0ba7c906f8d7a5d9$export$11dddb85aae73809(selector = 'body', { document
11
20
  *
12
21
  * If a modal container is removed, then undo the hiding based on the last hide others. Check if there are any other modals still around, and
13
22
  * hide based on the last one added.
14
- */ let target = document.querySelector(selector);
23
+ */ let target = document1.querySelector(selector);
15
24
  let config = {
16
25
  childList: true
17
26
  };
18
27
  let modalContainers = [];
19
28
  let undo;
20
29
  let observer = new MutationObserver((mutationRecord)=>{
21
- const liveAnnouncer = document.querySelector('[data-live-announcer="true"]');
30
+ const liveAnnouncer = document1.querySelector('[data-live-announcer="true"]');
22
31
  for (let mutation of mutationRecord){
23
- if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
32
+ if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
24
33
  let addNode = Array.from(mutation.addedNodes).find((node)=>{
25
34
  var ref;
26
35
  return (ref = node.querySelector) === null || ref === void 0 ? void 0 : ref.call(node, '[aria-modal="true"], [data-ismodal="true"]');
@@ -29,23 +38,21 @@ function $0ba7c906f8d7a5d9$export$11dddb85aae73809(selector = 'body', { document
29
38
  modalContainers.push(addNode);
30
39
  let modal = addNode.querySelector('[aria-modal="true"], [data-ismodal="true"]');
31
40
  undo === null || undo === void 0 ? void 0 : undo();
32
- undo = $hRMXz$hideOthers([
41
+ undo = (0, $hRMXz$hideOthers)([
33
42
  modal,
34
43
  liveAnnouncer
35
44
  ]);
36
45
  }
37
- } else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {
46
+ } else if (mutation.type === "childList" && mutation.removedNodes.length > 0) {
38
47
  let removedNodes = Array.from(mutation.removedNodes);
39
- let nodeIndexRemove = modalContainers.findIndex((container)=>removedNodes.includes(container)
40
- );
48
+ let nodeIndexRemove = modalContainers.findIndex((container)=>removedNodes.includes(container));
41
49
  if (nodeIndexRemove >= 0) {
42
50
  undo();
43
- modalContainers = modalContainers.filter((val, i)=>i !== nodeIndexRemove
44
- );
51
+ modalContainers = modalContainers.filter((val, i)=>i !== nodeIndexRemove);
45
52
  if (modalContainers.length > 0) {
46
- let modal = modalContainers[modalContainers.length - 1].querySelector('[aria-modal="true"], [data-ismodal="true"]');
47
- undo = $hRMXz$hideOthers([
48
- modal,
53
+ let modal1 = modalContainers[modalContainers.length - 1].querySelector('[aria-modal="true"], [data-ismodal="true"]');
54
+ undo = (0, $hRMXz$hideOthers)([
55
+ modal1,
49
56
  liveAnnouncer
50
57
  ]);
51
58
  } else undo = undefined;
@@ -1 +1 @@
1
- {"mappings":";;;AAgBA,KAAK,CAAC,qCAAe,GAAG,MAAM,CAAC,QAAQ,KAAK,CAAW,aAAG,QAAQ,GAAG,SAAS;SAK9D,yCAAW,CAAC,QAAe,GAAG,CAAM,OAAE,CAAC,WAAA,QAAQ,GAAG,qCAAe,EAAA,CAAC,GAAG,CAAC;AAAA,CAAC,EAAU,CAAC;IAChG,EAOG,AAPH;;;;;;;GAOG,AAPH,EAOG,CACH,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ;IAC5C,GAAG,CAAC,MAAM,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BACnD,GAAG,CAAC,eAAe,GAAG,eAAe,CAAC,SAAS,EAAC,SAAS,GAAI,YAAY,CAAC,QAAQ,CAAC,SAAS;;gBAC5F,EAAE,EAAE,eAAe,IAAI,CAAC,EAAE,CAAC;oBACzB,IAAI;oBACJ,eAAe,GAAG,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAK,CAAC,KAAK,eAAe;;oBAC1E,EAAE,EAAE,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC/B,GAAG,CAAC,KAAK,GAAG,eAAe,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,aAAa,CAAC,CAA4C;wBAClH,IAAI,GAAG,iBAAU,CAAC,CAAC;4BAAA,KAAK;4BAAE,aAAa;wBAAA,CAAC;oBAC1C,CAAC,MACC,IAAI,GAAG,SAAS;gBAEpB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM;IAC/B,MAAM,KAAO,CAAC;QACZ,IAAI,aAAJ,IAAI,KAAJ,IAAI,CAAJ,CAAQ,GAAR,IAAI,CAAJ,CAAQ,GAAR,IAAI;QACJ,QAAQ,CAAC,UAAU;IACrB,CAAC;AACH,CAAC","sources":["packages/@react-aria/aria-modal-polyfill/src/index.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 {hideOthers} from 'aria-hidden';\n\ntype Revert = () => void;\n\nconst currentDocument = typeof document !== 'undefined' ? document : undefined;\n\n/**\n * Acts as a polyfill for `aria-modal` by watching for added modals and hiding any surrounding DOM elements with `aria-hidden`.\n */\nexport function watchModals(selector:string = 'body', {document = currentDocument} = {}): Revert {\n /**\n * Listen for additions to the child list of the selected element (defaults to body). This is where providers render modal portals.\n * When one is added, see if there is a modal inside it, if there is, then hide everything else from screen readers.\n * If there was already a modal open and a new one was added, undo everything that the previous modal had hidden and hide based on the new one.\n *\n * If a modal container is removed, then undo the hiding based on the last hide others. Check if there are any other modals still around, and\n * hide based on the last one added.\n */\n let target = document.querySelector(selector);\n let config = {childList: true};\n let modalContainers = [];\n let undo: Revert | undefined;\n\n let observer = new MutationObserver((mutationRecord) => {\n const liveAnnouncer: HTMLElement = document.querySelector('[data-live-announcer=\"true\"]');\n for (let mutation of mutationRecord) {\n if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {\n let addNode: Element = (Array.from(mutation.addedNodes).find((node: any) => node.querySelector?.('[aria-modal=\"true\"], [data-ismodal=\"true\"]')) as HTMLElement);\n if (addNode) {\n modalContainers.push(addNode);\n let modal = addNode.querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]') as HTMLElement;\n undo?.();\n undo = hideOthers([modal, liveAnnouncer]);\n }\n } else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {\n let removedNodes = Array.from(mutation.removedNodes);\n let nodeIndexRemove = modalContainers.findIndex(container => removedNodes.includes(container));\n if (nodeIndexRemove >= 0) {\n undo();\n modalContainers = modalContainers.filter((val, i) => i !== nodeIndexRemove);\n if (modalContainers.length > 0) {\n let modal = modalContainers[modalContainers.length - 1].querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]');\n undo = hideOthers([modal, liveAnnouncer]);\n } else {\n undo = undefined;\n }\n }\n }\n }\n });\n observer.observe(target, config);\n return () => {\n undo?.();\n observer.disconnect();\n };\n}\n"],"names":[],"version":3,"file":"module.mjs.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC,GAED;AAIA,MAAM,wCAAkB,OAAO,aAAa,cAAc,WAAW,SAAS;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S,EAAE;4BAAC;4BAAO;yBAAc;oBAC1C,OACE,OAAO;gBAEX,CAAC;YACH,CAAC;QACH;IACF;IACA,SAAS,OAAO,CAAC,QAAQ;IACzB,OAAO,IAAM;QACX,iBAAA,kBAAA,KAAA,IAAA;QACA,SAAS,UAAU;IACrB;AACF","sources":["packages/@react-aria/aria-modal-polyfill/src/index.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 {hideOthers} from 'aria-hidden';\n\ntype Revert = () => void;\n\nconst currentDocument = typeof document !== 'undefined' ? document : undefined;\n\n/**\n * Acts as a polyfill for `aria-modal` by watching for added modals and hiding any surrounding DOM elements with `aria-hidden`.\n */\nexport function watchModals(selector:string = 'body', {document = currentDocument} = {}): Revert {\n /**\n * Listen for additions to the child list of the selected element (defaults to body). This is where providers render modal portals.\n * When one is added, see if there is a modal inside it, if there is, then hide everything else from screen readers.\n * If there was already a modal open and a new one was added, undo everything that the previous modal had hidden and hide based on the new one.\n *\n * If a modal container is removed, then undo the hiding based on the last hide others. Check if there are any other modals still around, and\n * hide based on the last one added.\n */\n let target = document.querySelector(selector);\n let config = {childList: true};\n let modalContainers = [];\n let undo: Revert | undefined;\n\n let observer = new MutationObserver((mutationRecord) => {\n const liveAnnouncer: HTMLElement = document.querySelector('[data-live-announcer=\"true\"]');\n for (let mutation of mutationRecord) {\n if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {\n let addNode: Element = (Array.from(mutation.addedNodes).find((node: any) => node.querySelector?.('[aria-modal=\"true\"], [data-ismodal=\"true\"]')) as HTMLElement);\n if (addNode) {\n modalContainers.push(addNode);\n let modal = addNode.querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]') as HTMLElement;\n undo?.();\n undo = hideOthers([modal, liveAnnouncer]);\n }\n } else if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {\n let removedNodes = Array.from(mutation.removedNodes);\n let nodeIndexRemove = modalContainers.findIndex(container => removedNodes.includes(container));\n if (nodeIndexRemove >= 0) {\n undo();\n modalContainers = modalContainers.filter((val, i) => i !== nodeIndexRemove);\n if (modalContainers.length > 0) {\n let modal = modalContainers[modalContainers.length - 1].querySelector('[aria-modal=\"true\"], [data-ismodal=\"true\"]');\n undo = hideOthers([modal, liveAnnouncer]);\n } else {\n undo = undefined;\n }\n }\n }\n }\n });\n observer.observe(target, config);\n return () => {\n undo?.();\n observer.disconnect();\n };\n}\n"],"names":[],"version":3,"file":"module.mjs.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/aria-modal-polyfill",
3
- "version": "3.6.2-nightly.3599+b35d5c02f",
3
+ "version": "3.6.2-nightly.3603+22cb32d32",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,8 +22,8 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@babel/runtime": "^7.6.2",
26
- "@react-types/shared": "3.0.0-nightly.1899+b35d5c02f",
25
+ "@react-types/shared": "3.0.0-nightly.1903+22cb32d32",
26
+ "@swc/helpers": "^0.4.14",
27
27
  "aria-hidden": "^1.1.1"
28
28
  },
29
29
  "peerDependencies": {
@@ -32,5 +32,5 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "b35d5c02fe900badccd0cf1a8f23bb593419f238"
35
+ "gitHead": "22cb32d329e66c60f55d4fc4025d1d44bb015d71"
36
36
  }