@react-aria/dialog 3.5.12 → 3.5.14

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/import.mjs CHANGED
@@ -1,19 +1,6 @@
1
- import {useSlotId as $m1DSs$useSlotId, filterDOMProps as $m1DSs$filterDOMProps} from "@react-aria/utils";
2
- import {focusSafely as $m1DSs$focusSafely} from "@react-aria/focus";
3
- import {useRef as $m1DSs$useRef, useEffect as $m1DSs$useEffect} from "react";
4
- import {useOverlayFocusContain as $m1DSs$useOverlayFocusContain} from "@react-aria/overlays";
1
+ import {useDialog as $40df3f8667284809$export$d55e7ee900f34e93} from "./useDialog.mjs";
5
2
 
6
3
  /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */ /*
17
4
  * Copyright 2020 Adobe. All rights reserved.
18
5
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
6
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -26,65 +13,5 @@ import {useOverlayFocusContain as $m1DSs$useOverlayFocusContain} from "@react-ar
26
13
  */
27
14
 
28
15
 
29
-
30
- function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
31
- let { role: role = "dialog" } = props;
32
- let titleId = (0, $m1DSs$useSlotId)();
33
- titleId = props["aria-label"] ? undefined : titleId;
34
- let isRefocusing = (0, $m1DSs$useRef)(false);
35
- // Focus the dialog itself on mount, unless a child element is already focused.
36
- (0, $m1DSs$useEffect)(()=>{
37
- if (ref.current && !ref.current.contains(document.activeElement)) {
38
- (0, $m1DSs$focusSafely)(ref.current);
39
- // Safari on iOS does not move the VoiceOver cursor to the dialog
40
- // or announce that it has opened until it has rendered. A workaround
41
- // is to wait for half a second, then blur and re-focus the dialog.
42
- let timeout = setTimeout(()=>{
43
- if (document.activeElement === ref.current) {
44
- isRefocusing.current = true;
45
- if (ref.current) {
46
- ref.current.blur();
47
- (0, $m1DSs$focusSafely)(ref.current);
48
- }
49
- isRefocusing.current = false;
50
- }
51
- }, 500);
52
- return ()=>{
53
- clearTimeout(timeout);
54
- };
55
- }
56
- }, [
57
- ref
58
- ]);
59
- (0, $m1DSs$useOverlayFocusContain)();
60
- // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
61
- // on mount when inside an iframe, no matter which element we programmatically focus.
62
- // See https://bugs.webkit.org/show_bug.cgi?id=211934.
63
- // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
64
- // even without aria-modal on the dialog itself.
65
- return {
66
- dialogProps: {
67
- ...(0, $m1DSs$filterDOMProps)(props, {
68
- labelable: true
69
- }),
70
- role: role,
71
- tabIndex: -1,
72
- "aria-labelledby": props["aria-labelledby"] || titleId,
73
- // Prevent blur events from reaching useOverlay, which may cause
74
- // popovers to close. Since focus is contained within the dialog,
75
- // we don't want this to occur due to the above useEffect.
76
- onBlur: (e)=>{
77
- if (isRefocusing.current) e.stopPropagation();
78
- }
79
- },
80
- titleProps: {
81
- id: titleId
82
- }
83
- };
84
- }
85
-
86
-
87
-
88
-
89
16
  export {$40df3f8667284809$export$d55e7ee900f34e93 as useDialog};
90
17
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,25 +1,12 @@
1
- var $6vrKB$reactariautils = require("@react-aria/utils");
2
- var $6vrKB$reactariafocus = require("@react-aria/focus");
3
- var $6vrKB$react = require("react");
4
- var $6vrKB$reactariaoverlays = require("@react-aria/overlays");
1
+ var $e7b76b4fae4e4c55$exports = require("./useDialog.main.js");
5
2
 
6
3
 
7
4
  function $parcel$export(e, n, v, s) {
8
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
6
  }
10
7
 
11
- $parcel$export(module.exports, "useDialog", () => $e7b76b4fae4e4c55$export$d55e7ee900f34e93);
8
+ $parcel$export(module.exports, "useDialog", () => $e7b76b4fae4e4c55$exports.useDialog);
12
9
  /*
13
- * Copyright 2020 Adobe. All rights reserved.
14
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License. You may obtain a copy
16
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software distributed under
19
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
- * OF ANY KIND, either express or implied. See the License for the specific language
21
- * governing permissions and limitations under the License.
22
- */ /*
23
10
  * Copyright 2020 Adobe. All rights reserved.
24
11
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
25
12
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -32,64 +19,4 @@ $parcel$export(module.exports, "useDialog", () => $e7b76b4fae4e4c55$export$d55e7
32
19
  */
33
20
 
34
21
 
35
-
36
- function $e7b76b4fae4e4c55$export$d55e7ee900f34e93(props, ref) {
37
- let { role: role = "dialog" } = props;
38
- let titleId = (0, $6vrKB$reactariautils.useSlotId)();
39
- titleId = props["aria-label"] ? undefined : titleId;
40
- let isRefocusing = (0, $6vrKB$react.useRef)(false);
41
- // Focus the dialog itself on mount, unless a child element is already focused.
42
- (0, $6vrKB$react.useEffect)(()=>{
43
- if (ref.current && !ref.current.contains(document.activeElement)) {
44
- (0, $6vrKB$reactariafocus.focusSafely)(ref.current);
45
- // Safari on iOS does not move the VoiceOver cursor to the dialog
46
- // or announce that it has opened until it has rendered. A workaround
47
- // is to wait for half a second, then blur and re-focus the dialog.
48
- let timeout = setTimeout(()=>{
49
- if (document.activeElement === ref.current) {
50
- isRefocusing.current = true;
51
- if (ref.current) {
52
- ref.current.blur();
53
- (0, $6vrKB$reactariafocus.focusSafely)(ref.current);
54
- }
55
- isRefocusing.current = false;
56
- }
57
- }, 500);
58
- return ()=>{
59
- clearTimeout(timeout);
60
- };
61
- }
62
- }, [
63
- ref
64
- ]);
65
- (0, $6vrKB$reactariaoverlays.useOverlayFocusContain)();
66
- // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
67
- // on mount when inside an iframe, no matter which element we programmatically focus.
68
- // See https://bugs.webkit.org/show_bug.cgi?id=211934.
69
- // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
70
- // even without aria-modal on the dialog itself.
71
- return {
72
- dialogProps: {
73
- ...(0, $6vrKB$reactariautils.filterDOMProps)(props, {
74
- labelable: true
75
- }),
76
- role: role,
77
- tabIndex: -1,
78
- "aria-labelledby": props["aria-labelledby"] || titleId,
79
- // Prevent blur events from reaching useOverlay, which may cause
80
- // popovers to close. Since focus is contained within the dialog,
81
- // we don't want this to occur due to the above useEffect.
82
- onBlur: (e)=>{
83
- if (isRefocusing.current) e.stopPropagation();
84
- }
85
- },
86
- titleProps: {
87
- id: titleId
88
- }
89
- };
90
- }
91
-
92
-
93
-
94
-
95
22
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;;AAqBM,SAAS,0CAAU,KAAsB,EAAE,GAAgC;IAChF,IAAI,QAAC,OAAO,UAAS,GAAG;IACxB,IAAI,UAA8B,CAAA,GAAA,+BAAQ;IAC1C,UAAU,KAAK,CAAC,aAAa,GAAG,YAAY;IAE5C,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAE1B,+EAA+E;IAC/E,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,aAAa,GAAG;YAChE,CAAA,GAAA,iCAAU,EAAE,IAAI,OAAO;YAEvB,iEAAiE;YACjE,qEAAqE;YACrE,mEAAmE;YACnE,IAAI,UAAU,WAAW;gBACvB,IAAI,SAAS,aAAa,KAAK,IAAI,OAAO,EAAE;oBAC1C,aAAa,OAAO,GAAG;oBACvB,IAAI,IAAI,OAAO,EAAE;wBACf,IAAI,OAAO,CAAC,IAAI;wBAChB,CAAA,GAAA,iCAAU,EAAE,IAAI,OAAO;oBACzB;oBACA,aAAa,OAAO,GAAG;gBACzB;YACF,GAAG;YAEH,OAAO;gBACL,aAAa;YACf;QACF;IACF,GAAG;QAAC;KAAI;IAER,CAAA,GAAA,+CAAqB;IAErB,sGAAsG;IACtG,qFAAqF;IACrF,sDAAsD;IACtD,qGAAqG;IACrG,gDAAgD;IAChD,OAAO;QACL,aAAa;YACX,GAAG,CAAA,GAAA,oCAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,UAAU;YACV,mBAAmB,KAAK,CAAC,kBAAkB,IAAI;YAC/C,gEAAgE;YAChE,iEAAiE;YACjE,0DAA0D;YAC1D,QAAQ,CAAA;gBACN,IAAI,aAAa,OAAO,EACtB,EAAE,eAAe;YAErB;QACF;QACA,YAAY;YACV,IAAI;QACN;IACF;AACF;;CD/EC","sources":["packages/@react-aria/dialog/src/index.ts","packages/@react-aria/dialog/src/useDialog.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 */\nexport {useDialog} from './useDialog';\nexport type {AriaDialogProps} from '@react-types/dialog';\nexport type {DialogAria} from './useDialog';\n","/*\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 {AriaDialogProps} from '@react-types/dialog';\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useOverlayFocusContain} from '@react-aria/overlays';\n\nexport interface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: DOMAttributes,\n\n /** Props for the dialog title element. */\n titleProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a dialog component.\n * A dialog is an overlay shown above other content in an application.\n */\nexport function useDialog(props: AriaDialogProps, ref: RefObject<FocusableElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId: string | undefined = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\n\n let isRefocusing = useRef(false);\n\n // Focus the dialog itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n\n // Safari on iOS does not move the VoiceOver cursor to the dialog\n // or announce that it has opened until it has rendered. A workaround\n // is to wait for half a second, then blur and re-focus the dialog.\n let timeout = setTimeout(() => {\n if (document.activeElement === ref.current) {\n isRefocusing.current = true;\n if (ref.current) {\n ref.current.blur();\n focusSafely(ref.current);\n }\n isRefocusing.current = false;\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\n\n useOverlayFocusContain();\n\n // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused\n // on mount when inside an iframe, no matter which element we programmatically focus.\n // See https://bugs.webkit.org/show_bug.cgi?id=211934.\n // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal\n // even without aria-modal on the dialog itself.\n return {\n dialogProps: {\n ...filterDOMProps(props, {labelable: true}),\n role,\n tabIndex: -1,\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n // Prevent blur events from reaching useOverlay, which may cause\n // popovers to close. Since focus is contained within the dialog,\n // we don't want this to occur due to the above useEffect.\n onBlur: e => {\n if (isRefocusing.current) {\n e.stopPropagation();\n }\n }\n },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/dialog/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 */\nexport {useDialog} from './useDialog';\nexport type {AriaDialogProps} from '@react-types/dialog';\nexport type {DialogAria} from './useDialog';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,19 +1,6 @@
1
- import {useSlotId as $m1DSs$useSlotId, filterDOMProps as $m1DSs$filterDOMProps} from "@react-aria/utils";
2
- import {focusSafely as $m1DSs$focusSafely} from "@react-aria/focus";
3
- import {useRef as $m1DSs$useRef, useEffect as $m1DSs$useEffect} from "react";
4
- import {useOverlayFocusContain as $m1DSs$useOverlayFocusContain} from "@react-aria/overlays";
1
+ import {useDialog as $40df3f8667284809$export$d55e7ee900f34e93} from "./useDialog.module.js";
5
2
 
6
3
  /*
7
- * Copyright 2020 Adobe. All rights reserved.
8
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
- * you may not use this file except in compliance with the License. You may obtain a copy
10
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software distributed under
13
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
- * OF ANY KIND, either express or implied. See the License for the specific language
15
- * governing permissions and limitations under the License.
16
- */ /*
17
4
  * Copyright 2020 Adobe. All rights reserved.
18
5
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
6
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -26,65 +13,5 @@ import {useOverlayFocusContain as $m1DSs$useOverlayFocusContain} from "@react-ar
26
13
  */
27
14
 
28
15
 
29
-
30
- function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
31
- let { role: role = "dialog" } = props;
32
- let titleId = (0, $m1DSs$useSlotId)();
33
- titleId = props["aria-label"] ? undefined : titleId;
34
- let isRefocusing = (0, $m1DSs$useRef)(false);
35
- // Focus the dialog itself on mount, unless a child element is already focused.
36
- (0, $m1DSs$useEffect)(()=>{
37
- if (ref.current && !ref.current.contains(document.activeElement)) {
38
- (0, $m1DSs$focusSafely)(ref.current);
39
- // Safari on iOS does not move the VoiceOver cursor to the dialog
40
- // or announce that it has opened until it has rendered. A workaround
41
- // is to wait for half a second, then blur and re-focus the dialog.
42
- let timeout = setTimeout(()=>{
43
- if (document.activeElement === ref.current) {
44
- isRefocusing.current = true;
45
- if (ref.current) {
46
- ref.current.blur();
47
- (0, $m1DSs$focusSafely)(ref.current);
48
- }
49
- isRefocusing.current = false;
50
- }
51
- }, 500);
52
- return ()=>{
53
- clearTimeout(timeout);
54
- };
55
- }
56
- }, [
57
- ref
58
- ]);
59
- (0, $m1DSs$useOverlayFocusContain)();
60
- // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
61
- // on mount when inside an iframe, no matter which element we programmatically focus.
62
- // See https://bugs.webkit.org/show_bug.cgi?id=211934.
63
- // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
64
- // even without aria-modal on the dialog itself.
65
- return {
66
- dialogProps: {
67
- ...(0, $m1DSs$filterDOMProps)(props, {
68
- labelable: true
69
- }),
70
- role: role,
71
- tabIndex: -1,
72
- "aria-labelledby": props["aria-labelledby"] || titleId,
73
- // Prevent blur events from reaching useOverlay, which may cause
74
- // popovers to close. Since focus is contained within the dialog,
75
- // we don't want this to occur due to the above useEffect.
76
- onBlur: (e)=>{
77
- if (isRefocusing.current) e.stopPropagation();
78
- }
79
- },
80
- titleProps: {
81
- id: titleId
82
- }
83
- };
84
- }
85
-
86
-
87
-
88
-
89
16
  export {$40df3f8667284809$export$d55e7ee900f34e93 as useDialog};
90
17
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;;;;AAqBM,SAAS,0CAAU,KAAsB,EAAE,GAAgC;IAChF,IAAI,QAAC,OAAO,UAAS,GAAG;IACxB,IAAI,UAA8B,CAAA,GAAA,gBAAQ;IAC1C,UAAU,KAAK,CAAC,aAAa,GAAG,YAAY;IAE5C,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAE1B,+EAA+E;IAC/E,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,aAAa,GAAG;YAChE,CAAA,GAAA,kBAAU,EAAE,IAAI,OAAO;YAEvB,iEAAiE;YACjE,qEAAqE;YACrE,mEAAmE;YACnE,IAAI,UAAU,WAAW;gBACvB,IAAI,SAAS,aAAa,KAAK,IAAI,OAAO,EAAE;oBAC1C,aAAa,OAAO,GAAG;oBACvB,IAAI,IAAI,OAAO,EAAE;wBACf,IAAI,OAAO,CAAC,IAAI;wBAChB,CAAA,GAAA,kBAAU,EAAE,IAAI,OAAO;oBACzB;oBACA,aAAa,OAAO,GAAG;gBACzB;YACF,GAAG;YAEH,OAAO;gBACL,aAAa;YACf;QACF;IACF,GAAG;QAAC;KAAI;IAER,CAAA,GAAA,6BAAqB;IAErB,sGAAsG;IACtG,qFAAqF;IACrF,sDAAsD;IACtD,qGAAqG;IACrG,gDAAgD;IAChD,OAAO;QACL,aAAa;YACX,GAAG,CAAA,GAAA,qBAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,UAAU;YACV,mBAAmB,KAAK,CAAC,kBAAkB,IAAI;YAC/C,gEAAgE;YAChE,iEAAiE;YACjE,0DAA0D;YAC1D,QAAQ,CAAA;gBACN,IAAI,aAAa,OAAO,EACtB,EAAE,eAAe;YAErB;QACF;QACA,YAAY;YACV,IAAI;QACN;IACF;AACF;;CD/EC","sources":["packages/@react-aria/dialog/src/index.ts","packages/@react-aria/dialog/src/useDialog.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 */\nexport {useDialog} from './useDialog';\nexport type {AriaDialogProps} from '@react-types/dialog';\nexport type {DialogAria} from './useDialog';\n","/*\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 {AriaDialogProps} from '@react-types/dialog';\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useOverlayFocusContain} from '@react-aria/overlays';\n\nexport interface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: DOMAttributes,\n\n /** Props for the dialog title element. */\n titleProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a dialog component.\n * A dialog is an overlay shown above other content in an application.\n */\nexport function useDialog(props: AriaDialogProps, ref: RefObject<FocusableElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId: string | undefined = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\n\n let isRefocusing = useRef(false);\n\n // Focus the dialog itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n\n // Safari on iOS does not move the VoiceOver cursor to the dialog\n // or announce that it has opened until it has rendered. A workaround\n // is to wait for half a second, then blur and re-focus the dialog.\n let timeout = setTimeout(() => {\n if (document.activeElement === ref.current) {\n isRefocusing.current = true;\n if (ref.current) {\n ref.current.blur();\n focusSafely(ref.current);\n }\n isRefocusing.current = false;\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\n\n useOverlayFocusContain();\n\n // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused\n // on mount when inside an iframe, no matter which element we programmatically focus.\n // See https://bugs.webkit.org/show_bug.cgi?id=211934.\n // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal\n // even without aria-modal on the dialog itself.\n return {\n dialogProps: {\n ...filterDOMProps(props, {labelable: true}),\n role,\n tabIndex: -1,\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n // Prevent blur events from reaching useOverlay, which may cause\n // popovers to close. Since focus is contained within the dialog,\n // we don't want this to occur due to the above useEffect.\n onBlur: e => {\n if (isRefocusing.current) {\n e.stopPropagation();\n }\n }\n },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/dialog/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 */\nexport {useDialog} from './useDialog';\nexport type {AriaDialogProps} from '@react-types/dialog';\nexport type {DialogAria} from './useDialog';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,83 @@
1
+ var $HoXek$reactariautils = require("@react-aria/utils");
2
+ var $HoXek$reactariafocus = require("@react-aria/focus");
3
+ var $HoXek$react = require("react");
4
+ var $HoXek$reactariaoverlays = require("@react-aria/overlays");
5
+
6
+
7
+ function $parcel$export(e, n, v, s) {
8
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
+ }
10
+
11
+ $parcel$export(module.exports, "useDialog", () => $e7b76b4fae4e4c55$export$d55e7ee900f34e93);
12
+ /*
13
+ * Copyright 2020 Adobe. All rights reserved.
14
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
+ * you may not use this file except in compliance with the License. You may obtain a copy
16
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software distributed under
19
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
+ * OF ANY KIND, either express or implied. See the License for the specific language
21
+ * governing permissions and limitations under the License.
22
+ */
23
+
24
+
25
+
26
+ function $e7b76b4fae4e4c55$export$d55e7ee900f34e93(props, ref) {
27
+ let { role: role = 'dialog' } = props;
28
+ let titleId = (0, $HoXek$reactariautils.useSlotId)();
29
+ titleId = props['aria-label'] ? undefined : titleId;
30
+ let isRefocusing = (0, $HoXek$react.useRef)(false);
31
+ // Focus the dialog itself on mount, unless a child element is already focused.
32
+ (0, $HoXek$react.useEffect)(()=>{
33
+ if (ref.current && !ref.current.contains(document.activeElement)) {
34
+ (0, $HoXek$reactariafocus.focusSafely)(ref.current);
35
+ // Safari on iOS does not move the VoiceOver cursor to the dialog
36
+ // or announce that it has opened until it has rendered. A workaround
37
+ // is to wait for half a second, then blur and re-focus the dialog.
38
+ let timeout = setTimeout(()=>{
39
+ if (document.activeElement === ref.current) {
40
+ isRefocusing.current = true;
41
+ if (ref.current) {
42
+ ref.current.blur();
43
+ (0, $HoXek$reactariafocus.focusSafely)(ref.current);
44
+ }
45
+ isRefocusing.current = false;
46
+ }
47
+ }, 500);
48
+ return ()=>{
49
+ clearTimeout(timeout);
50
+ };
51
+ }
52
+ }, [
53
+ ref
54
+ ]);
55
+ (0, $HoXek$reactariaoverlays.useOverlayFocusContain)();
56
+ // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
57
+ // on mount when inside an iframe, no matter which element we programmatically focus.
58
+ // See https://bugs.webkit.org/show_bug.cgi?id=211934.
59
+ // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
60
+ // even without aria-modal on the dialog itself.
61
+ return {
62
+ dialogProps: {
63
+ ...(0, $HoXek$reactariautils.filterDOMProps)(props, {
64
+ labelable: true
65
+ }),
66
+ role: role,
67
+ tabIndex: -1,
68
+ 'aria-labelledby': props['aria-labelledby'] || titleId,
69
+ // Prevent blur events from reaching useOverlay, which may cause
70
+ // popovers to close. Since focus is contained within the dialog,
71
+ // we don't want this to occur due to the above useEffect.
72
+ onBlur: (e)=>{
73
+ if (isRefocusing.current) e.stopPropagation();
74
+ }
75
+ },
76
+ titleProps: {
77
+ id: titleId
78
+ }
79
+ };
80
+ }
81
+
82
+
83
+ //# sourceMappingURL=useDialog.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAqBM,SAAS,0CAAU,KAAsB,EAAE,GAAgC;IAChF,IAAI,QAAC,OAAO,UAAS,GAAG;IACxB,IAAI,UAA8B,CAAA,GAAA,+BAAQ;IAC1C,UAAU,KAAK,CAAC,aAAa,GAAG,YAAY;IAE5C,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAE1B,+EAA+E;IAC/E,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,aAAa,GAAG;YAChE,CAAA,GAAA,iCAAU,EAAE,IAAI,OAAO;YAEvB,iEAAiE;YACjE,qEAAqE;YACrE,mEAAmE;YACnE,IAAI,UAAU,WAAW;gBACvB,IAAI,SAAS,aAAa,KAAK,IAAI,OAAO,EAAE;oBAC1C,aAAa,OAAO,GAAG;oBACvB,IAAI,IAAI,OAAO,EAAE;wBACf,IAAI,OAAO,CAAC,IAAI;wBAChB,CAAA,GAAA,iCAAU,EAAE,IAAI,OAAO;oBACzB;oBACA,aAAa,OAAO,GAAG;gBACzB;YACF,GAAG;YAEH,OAAO;gBACL,aAAa;YACf;QACF;IACF,GAAG;QAAC;KAAI;IAER,CAAA,GAAA,+CAAqB;IAErB,sGAAsG;IACtG,qFAAqF;IACrF,sDAAsD;IACtD,qGAAqG;IACrG,gDAAgD;IAChD,OAAO;QACL,aAAa;YACX,GAAG,CAAA,GAAA,oCAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,UAAU;YACV,mBAAmB,KAAK,CAAC,kBAAkB,IAAI;YAC/C,gEAAgE;YAChE,iEAAiE;YACjE,0DAA0D;YAC1D,QAAQ,CAAA;gBACN,IAAI,aAAa,OAAO,EACtB,EAAE,eAAe;YAErB;QACF;QACA,YAAY;YACV,IAAI;QACN;IACF;AACF","sources":["packages/@react-aria/dialog/src/useDialog.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 {AriaDialogProps} from '@react-types/dialog';\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useOverlayFocusContain} from '@react-aria/overlays';\n\nexport interface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: DOMAttributes,\n\n /** Props for the dialog title element. */\n titleProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a dialog component.\n * A dialog is an overlay shown above other content in an application.\n */\nexport function useDialog(props: AriaDialogProps, ref: RefObject<FocusableElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId: string | undefined = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\n\n let isRefocusing = useRef(false);\n\n // Focus the dialog itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n\n // Safari on iOS does not move the VoiceOver cursor to the dialog\n // or announce that it has opened until it has rendered. A workaround\n // is to wait for half a second, then blur and re-focus the dialog.\n let timeout = setTimeout(() => {\n if (document.activeElement === ref.current) {\n isRefocusing.current = true;\n if (ref.current) {\n ref.current.blur();\n focusSafely(ref.current);\n }\n isRefocusing.current = false;\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\n\n useOverlayFocusContain();\n\n // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused\n // on mount when inside an iframe, no matter which element we programmatically focus.\n // See https://bugs.webkit.org/show_bug.cgi?id=211934.\n // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal\n // even without aria-modal on the dialog itself.\n return {\n dialogProps: {\n ...filterDOMProps(props, {labelable: true}),\n role,\n tabIndex: -1,\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n // Prevent blur events from reaching useOverlay, which may cause\n // popovers to close. Since focus is contained within the dialog,\n // we don't want this to occur due to the above useEffect.\n onBlur: e => {\n if (isRefocusing.current) {\n e.stopPropagation();\n }\n }\n },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":[],"version":3,"file":"useDialog.main.js.map"}
@@ -0,0 +1,78 @@
1
+ import {useSlotId as $i6df2$useSlotId, filterDOMProps as $i6df2$filterDOMProps} from "@react-aria/utils";
2
+ import {focusSafely as $i6df2$focusSafely} from "@react-aria/focus";
3
+ import {useRef as $i6df2$useRef, useEffect as $i6df2$useEffect} from "react";
4
+ import {useOverlayFocusContain as $i6df2$useOverlayFocusContain} from "@react-aria/overlays";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
21
+ let { role: role = 'dialog' } = props;
22
+ let titleId = (0, $i6df2$useSlotId)();
23
+ titleId = props['aria-label'] ? undefined : titleId;
24
+ let isRefocusing = (0, $i6df2$useRef)(false);
25
+ // Focus the dialog itself on mount, unless a child element is already focused.
26
+ (0, $i6df2$useEffect)(()=>{
27
+ if (ref.current && !ref.current.contains(document.activeElement)) {
28
+ (0, $i6df2$focusSafely)(ref.current);
29
+ // Safari on iOS does not move the VoiceOver cursor to the dialog
30
+ // or announce that it has opened until it has rendered. A workaround
31
+ // is to wait for half a second, then blur and re-focus the dialog.
32
+ let timeout = setTimeout(()=>{
33
+ if (document.activeElement === ref.current) {
34
+ isRefocusing.current = true;
35
+ if (ref.current) {
36
+ ref.current.blur();
37
+ (0, $i6df2$focusSafely)(ref.current);
38
+ }
39
+ isRefocusing.current = false;
40
+ }
41
+ }, 500);
42
+ return ()=>{
43
+ clearTimeout(timeout);
44
+ };
45
+ }
46
+ }, [
47
+ ref
48
+ ]);
49
+ (0, $i6df2$useOverlayFocusContain)();
50
+ // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
51
+ // on mount when inside an iframe, no matter which element we programmatically focus.
52
+ // See https://bugs.webkit.org/show_bug.cgi?id=211934.
53
+ // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
54
+ // even without aria-modal on the dialog itself.
55
+ return {
56
+ dialogProps: {
57
+ ...(0, $i6df2$filterDOMProps)(props, {
58
+ labelable: true
59
+ }),
60
+ role: role,
61
+ tabIndex: -1,
62
+ 'aria-labelledby': props['aria-labelledby'] || titleId,
63
+ // Prevent blur events from reaching useOverlay, which may cause
64
+ // popovers to close. Since focus is contained within the dialog,
65
+ // we don't want this to occur due to the above useEffect.
66
+ onBlur: (e)=>{
67
+ if (isRefocusing.current) e.stopPropagation();
68
+ }
69
+ },
70
+ titleProps: {
71
+ id: titleId
72
+ }
73
+ };
74
+ }
75
+
76
+
77
+ export {$40df3f8667284809$export$d55e7ee900f34e93 as useDialog};
78
+ //# sourceMappingURL=useDialog.module.js.map
@@ -0,0 +1,78 @@
1
+ import {useSlotId as $i6df2$useSlotId, filterDOMProps as $i6df2$filterDOMProps} from "@react-aria/utils";
2
+ import {focusSafely as $i6df2$focusSafely} from "@react-aria/focus";
3
+ import {useRef as $i6df2$useRef, useEffect as $i6df2$useEffect} from "react";
4
+ import {useOverlayFocusContain as $i6df2$useOverlayFocusContain} from "@react-aria/overlays";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
21
+ let { role: role = 'dialog' } = props;
22
+ let titleId = (0, $i6df2$useSlotId)();
23
+ titleId = props['aria-label'] ? undefined : titleId;
24
+ let isRefocusing = (0, $i6df2$useRef)(false);
25
+ // Focus the dialog itself on mount, unless a child element is already focused.
26
+ (0, $i6df2$useEffect)(()=>{
27
+ if (ref.current && !ref.current.contains(document.activeElement)) {
28
+ (0, $i6df2$focusSafely)(ref.current);
29
+ // Safari on iOS does not move the VoiceOver cursor to the dialog
30
+ // or announce that it has opened until it has rendered. A workaround
31
+ // is to wait for half a second, then blur and re-focus the dialog.
32
+ let timeout = setTimeout(()=>{
33
+ if (document.activeElement === ref.current) {
34
+ isRefocusing.current = true;
35
+ if (ref.current) {
36
+ ref.current.blur();
37
+ (0, $i6df2$focusSafely)(ref.current);
38
+ }
39
+ isRefocusing.current = false;
40
+ }
41
+ }, 500);
42
+ return ()=>{
43
+ clearTimeout(timeout);
44
+ };
45
+ }
46
+ }, [
47
+ ref
48
+ ]);
49
+ (0, $i6df2$useOverlayFocusContain)();
50
+ // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
51
+ // on mount when inside an iframe, no matter which element we programmatically focus.
52
+ // See https://bugs.webkit.org/show_bug.cgi?id=211934.
53
+ // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
54
+ // even without aria-modal on the dialog itself.
55
+ return {
56
+ dialogProps: {
57
+ ...(0, $i6df2$filterDOMProps)(props, {
58
+ labelable: true
59
+ }),
60
+ role: role,
61
+ tabIndex: -1,
62
+ 'aria-labelledby': props['aria-labelledby'] || titleId,
63
+ // Prevent blur events from reaching useOverlay, which may cause
64
+ // popovers to close. Since focus is contained within the dialog,
65
+ // we don't want this to occur due to the above useEffect.
66
+ onBlur: (e)=>{
67
+ if (isRefocusing.current) e.stopPropagation();
68
+ }
69
+ },
70
+ titleProps: {
71
+ id: titleId
72
+ }
73
+ };
74
+ }
75
+
76
+
77
+ export {$40df3f8667284809$export$d55e7ee900f34e93 as useDialog};
78
+ //# sourceMappingURL=useDialog.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAqBM,SAAS,0CAAU,KAAsB,EAAE,GAAgC;IAChF,IAAI,QAAC,OAAO,UAAS,GAAG;IACxB,IAAI,UAA8B,CAAA,GAAA,gBAAQ;IAC1C,UAAU,KAAK,CAAC,aAAa,GAAG,YAAY;IAE5C,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAE1B,+EAA+E;IAC/E,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,IAAI,OAAO,IAAI,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,aAAa,GAAG;YAChE,CAAA,GAAA,kBAAU,EAAE,IAAI,OAAO;YAEvB,iEAAiE;YACjE,qEAAqE;YACrE,mEAAmE;YACnE,IAAI,UAAU,WAAW;gBACvB,IAAI,SAAS,aAAa,KAAK,IAAI,OAAO,EAAE;oBAC1C,aAAa,OAAO,GAAG;oBACvB,IAAI,IAAI,OAAO,EAAE;wBACf,IAAI,OAAO,CAAC,IAAI;wBAChB,CAAA,GAAA,kBAAU,EAAE,IAAI,OAAO;oBACzB;oBACA,aAAa,OAAO,GAAG;gBACzB;YACF,GAAG;YAEH,OAAO;gBACL,aAAa;YACf;QACF;IACF,GAAG;QAAC;KAAI;IAER,CAAA,GAAA,6BAAqB;IAErB,sGAAsG;IACtG,qFAAqF;IACrF,sDAAsD;IACtD,qGAAqG;IACrG,gDAAgD;IAChD,OAAO;QACL,aAAa;YACX,GAAG,CAAA,GAAA,qBAAa,EAAE,OAAO;gBAAC,WAAW;YAAI,EAAE;kBAC3C;YACA,UAAU;YACV,mBAAmB,KAAK,CAAC,kBAAkB,IAAI;YAC/C,gEAAgE;YAChE,iEAAiE;YACjE,0DAA0D;YAC1D,QAAQ,CAAA;gBACN,IAAI,aAAa,OAAO,EACtB,EAAE,eAAe;YAErB;QACF;QACA,YAAY;YACV,IAAI;QACN;IACF;AACF","sources":["packages/@react-aria/dialog/src/useDialog.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 {AriaDialogProps} from '@react-types/dialog';\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {RefObject, useEffect, useRef} from 'react';\nimport {useOverlayFocusContain} from '@react-aria/overlays';\n\nexport interface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: DOMAttributes,\n\n /** Props for the dialog title element. */\n titleProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a dialog component.\n * A dialog is an overlay shown above other content in an application.\n */\nexport function useDialog(props: AriaDialogProps, ref: RefObject<FocusableElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId: string | undefined = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\n\n let isRefocusing = useRef(false);\n\n // Focus the dialog itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n\n // Safari on iOS does not move the VoiceOver cursor to the dialog\n // or announce that it has opened until it has rendered. A workaround\n // is to wait for half a second, then blur and re-focus the dialog.\n let timeout = setTimeout(() => {\n if (document.activeElement === ref.current) {\n isRefocusing.current = true;\n if (ref.current) {\n ref.current.blur();\n focusSafely(ref.current);\n }\n isRefocusing.current = false;\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\n\n useOverlayFocusContain();\n\n // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused\n // on mount when inside an iframe, no matter which element we programmatically focus.\n // See https://bugs.webkit.org/show_bug.cgi?id=211934.\n // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal\n // even without aria-modal on the dialog itself.\n return {\n dialogProps: {\n ...filterDOMProps(props, {labelable: true}),\n role,\n tabIndex: -1,\n 'aria-labelledby': props['aria-labelledby'] || titleId,\n // Prevent blur events from reaching useOverlay, which may cause\n // popovers to close. Since focus is contained within the dialog,\n // we don't want this to occur due to the above useEffect.\n onBlur: e => {\n if (isRefocusing.current) {\n e.stopPropagation();\n }\n }\n },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":[],"version":3,"file":"useDialog.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/dialog",
3
- "version": "3.5.12",
3
+ "version": "3.5.14",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -26,15 +26,15 @@
26
26
  "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
27
27
  },
28
28
  "dependencies": {
29
- "@react-aria/focus": "^3.16.2",
30
- "@react-aria/overlays": "^3.21.1",
31
- "@react-aria/utils": "^3.23.2",
32
- "@react-types/dialog": "^3.5.8",
33
- "@react-types/shared": "^3.22.1",
29
+ "@react-aria/focus": "^3.17.1",
30
+ "@react-aria/overlays": "^3.22.1",
31
+ "@react-aria/utils": "^3.24.1",
32
+ "@react-types/dialog": "^3.5.10",
33
+ "@react-types/shared": "^3.23.1",
34
34
  "@swc/helpers": "^0.5.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "de9f84a22583fc741c29b341d14cd35ef4cca161"
39
+ "gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
40
40
  }