@react-aria/dialog 3.1.4 → 3.1.7

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
@@ -1,68 +1,78 @@
1
- var {
2
- useEffect
3
- } = require("react");
1
+ var $6vrKB$reactariautils = require("@react-aria/utils");
2
+ var $6vrKB$reactariafocus = require("@react-aria/focus");
3
+ var $6vrKB$react = require("react");
4
4
 
5
- var {
6
- focusSafely
7
- } = require("@react-aria/focus");
8
-
9
- var {
10
- filterDOMProps,
11
- useSlotId
12
- } = require("@react-aria/utils");
5
+ function $parcel$exportWildcard(dest, source) {
6
+ Object.keys(source).forEach(function(key) {
7
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
8
+ return;
9
+ }
13
10
 
14
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
11
+ Object.defineProperty(dest, key, {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return source[key];
15
+ }
16
+ });
17
+ });
15
18
 
16
- function $parcel$interopDefault(a) {
17
- return a && a.__esModule ? a.default : a;
19
+ return dest;
20
+ }
21
+ function $parcel$export(e, n, v, s) {
22
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
18
23
  }
24
+ var $e7b76b4fae4e4c55$exports = {};
19
25
 
20
- /**
21
- * Provides the behavior and accessibility implementation for a dialog component.
22
- * A dialog is an overlay shown above other content in an application.
23
- */
24
- function useDialog(props, ref) {
25
- let {
26
- role = 'dialog'
27
- } = props;
28
- let titleId = useSlotId();
29
- titleId = props['aria-label'] ? undefined : titleId; // Focus the dialog itself on mount, unless a child element is already focused.
26
+ $parcel$export($e7b76b4fae4e4c55$exports, "useDialog", () => $e7b76b4fae4e4c55$export$d55e7ee900f34e93);
30
27
 
31
- useEffect(() => {
32
- if (ref.current && !ref.current.contains(document.activeElement)) {
33
- focusSafely(ref.current); // Safari on iOS does not move the VoiceOver cursor to the dialog
34
- // or announce that it has opened until it has rendered. A workaround
35
- // is to wait for half a second, then blur and re-focus the dialog.
36
28
 
37
- let timeout = setTimeout(() => {
38
- if (document.activeElement === ref.current) {
39
- ref.current.blur();
40
- focusSafely(ref.current);
41
- }
42
- }, 500);
43
- return () => {
44
- clearTimeout(timeout);
45
- };
46
- }
47
- }, [ref]); // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
48
- // on mount when inside an iframe, no matter which element we programmatically focus.
49
- // See https://bugs.webkit.org/show_bug.cgi?id=211934.
50
- // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
51
- // even without aria-modal on the dialog itself.
52
29
 
53
- return {
54
- dialogProps: _babelRuntimeHelpersExtends({}, filterDOMProps(props, {
55
- labelable: true
56
- }), {
57
- role,
58
- tabIndex: -1,
59
- 'aria-labelledby': props['aria-labelledby'] || titleId
60
- }),
61
- titleProps: {
62
- id: titleId
63
- }
64
- };
30
+ function $e7b76b4fae4e4c55$export$d55e7ee900f34e93(props, ref) {
31
+ let { role: role = 'dialog' } = props;
32
+ let titleId = $6vrKB$reactariautils.useSlotId();
33
+ titleId = props['aria-label'] ? undefined : titleId;
34
+ // Focus the dialog itself on mount, unless a child element is already focused.
35
+ $6vrKB$react.useEffect(()=>{
36
+ if (ref.current && !ref.current.contains(document.activeElement)) {
37
+ $6vrKB$reactariafocus.focusSafely(ref.current);
38
+ // Safari on iOS does not move the VoiceOver cursor to the dialog
39
+ // or announce that it has opened until it has rendered. A workaround
40
+ // is to wait for half a second, then blur and re-focus the dialog.
41
+ let timeout = setTimeout(()=>{
42
+ if (document.activeElement === ref.current) {
43
+ ref.current.blur();
44
+ $6vrKB$reactariafocus.focusSafely(ref.current);
45
+ }
46
+ }, 500);
47
+ return ()=>{
48
+ clearTimeout(timeout);
49
+ };
50
+ }
51
+ }, [
52
+ ref
53
+ ]);
54
+ // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
55
+ // on mount when inside an iframe, no matter which element we programmatically focus.
56
+ // See https://bugs.webkit.org/show_bug.cgi?id=211934.
57
+ // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
58
+ // even without aria-modal on the dialog itself.
59
+ return {
60
+ dialogProps: {
61
+ ...$6vrKB$reactariautils.filterDOMProps(props, {
62
+ labelable: true
63
+ }),
64
+ role: role,
65
+ tabIndex: -1,
66
+ 'aria-labelledby': props['aria-labelledby'] || titleId
67
+ },
68
+ titleProps: {
69
+ id: titleId
70
+ }
71
+ };
65
72
  }
66
73
 
67
- exports.useDialog = useDialog;
74
+
75
+ $parcel$exportWildcard(module.exports, $e7b76b4fae4e4c55$exports);
76
+
77
+
68
78
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;ACuBD;;;;AAIO,SAASG,SAAT,CAAmBC,KAAnB,EAA2CC,GAA3C,EAAoF;AACzF,MAAI;AAACC,IAAAA,IAAI,GAAG;AAAR,MAAoBF,KAAxB;AACA,MAAIG,OAAO,GAAGC,SAAS,EAAvB;AACAD,EAAAA,OAAO,GAAGH,KAAK,CAAC,YAAD,CAAL,GAAsBK,SAAtB,GAAkCF,OAA5C,CAHyF,CAKzF;;AACAG,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIL,GAAG,CAACM,OAAJ,IAAe,CAACN,GAAG,CAACM,OAAJ,CAAYC,QAAZ,CAAqBC,QAAQ,CAACC,aAA9B,CAApB,EAAkE;AAChEC,MAAAA,WAAW,CAACV,GAAG,CAACM,OAAL,CAAX,CADgE,CAGhE;AACA;AACA;;AACA,UAAIK,OAAO,GAAGC,UAAU,CAAC,MAAM;AAC7B,YAAIJ,QAAQ,CAACC,aAAT,KAA2BT,GAAG,CAACM,OAAnC,EAA4C;AAC1CN,UAAAA,GAAG,CAACM,OAAJ,CAAYO,IAAZ;AACAH,UAAAA,WAAW,CAACV,GAAG,CAACM,OAAL,CAAX;AACD;AACF,OALuB,EAKrB,GALqB,CAAxB;AAOA,aAAO,MAAM;AACXQ,QAAAA,YAAY,CAACH,OAAD,CAAZ;AACD,OAFD;AAGD;AACF,GAlBQ,EAkBN,CAACX,GAAD,CAlBM,CAAT,CANyF,CA0BzF;AACA;AACA;AACA;AACA;;AACA,SAAO;AACLe,IAAAA,WAAW,kCACNC,cAAc,CAACjB,KAAD,EAAQ;AAACkB,MAAAA,SAAS,EAAE;AAAZ,KAAR,CADR;AAEThB,MAAAA,IAFS;AAGTiB,MAAAA,QAAQ,EAAE,CAAC,CAHF;AAIT,yBAAmBnB,KAAK,CAAC,iBAAD,CAAL,IAA4BG;AAJtC,MADN;AAOLiB,IAAAA,UAAU,EAAE;AACVC,MAAAA,EAAE,EAAElB;AADM;AAPP,GAAP;AAWD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/@react-aria/dialog/src/useDialog.ts"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\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 {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useEffect} from 'react';\n\ninterface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the dialog title element. */\n titleProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\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 ref.current.blur();\n focusSafely(ref.current);\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\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 },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":["$parcel$interopDefault","a","__esModule","default","useDialog","props","ref","role","titleId","useSlotId","undefined","useEffect","current","contains","document","activeElement","focusSafely","timeout","setTimeout","blur","clearTimeout","dialogProps","filterDOMProps","labelable","tabIndex","titleProps","id"],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;SC6BgB,yCAAS,CAAC,KAAsB,EAAE,GAA2B,EAAc,CAAC;IAC1F,GAAG,CAAC,CAAC,OAAA,IAAI,GAAG,CAAQ,SAAA,CAAC,GAAG,KAAK;IAC7B,GAAG,CAAC,OAAO,GAAG,+BAAS;IACvB,OAAO,GAAG,KAAK,CAAC,CAAY,eAAI,SAAS,GAAG,OAAO;IAEnD,EAA+E,AAA/E,6EAA+E;IAC/E,sBAAS,KAAO,CAAC;QACf,EAAE,EAAE,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,GAAG,CAAC;YACjE,iCAAW,CAAC,GAAG,CAAC,OAAO;YAEvB,EAAiE,AAAjE,+DAAiE;YACjE,EAAqE,AAArE,mEAAqE;YACrE,EAAmE,AAAnE,iEAAmE;YACnE,GAAG,CAAC,OAAO,GAAG,UAAU,KAAO,CAAC;gBAC9B,EAAE,EAAE,QAAQ,CAAC,aAAa,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;oBAC3C,GAAG,CAAC,OAAO,CAAC,IAAI;oBAChB,iCAAW,CAAC,GAAG,CAAC,OAAO;gBACzB,CAAC;YACH,CAAC,EAAE,GAAG;YAEN,MAAM,KAAO,CAAC;gBACZ,YAAY,CAAC,OAAO;YACtB,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC;QAAA,GAAG;IAAA,CAAC;IAER,EAAsG,AAAtG,oGAAsG;IACtG,EAAqF,AAArF,mFAAqF;IACrF,EAAsD,AAAtD,oDAAsD;IACtD,EAAqG,AAArG,mGAAqG;IACrG,EAAgD,AAAhD,8CAAgD;IAChD,MAAM,CAAC,CAAC;QACN,WAAW,EAAE,CAAC;eACT,oCAAc,CAAC,KAAK,EAAE,CAAC;gBAAA,SAAS,EAAE,IAAI;YAAA,CAAC;kBAC1C,IAAI;YACJ,QAAQ,EAAE,EAAE;YACZ,CAAiB,kBAAE,KAAK,CAAC,CAAiB,qBAAK,OAAO;QACxD,CAAC;QACD,UAAU,EAAE,CAAC;YACX,EAAE,EAAE,OAAO;QACb,CAAC;IACH,CAAC;AACH,CAAC","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 */\n\nexport * 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 {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useEffect} from 'react';\n\ninterface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the dialog title element. */\n titleProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\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 ref.current.blur();\n focusSafely(ref.current);\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\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 },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,52 +1,62 @@
1
- import { useEffect } from "react";
2
- import { focusSafely } from "@react-aria/focus";
3
- import { filterDOMProps, useSlotId } from "@react-aria/utils";
4
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
5
-
6
- /**
7
- * Provides the behavior and accessibility implementation for a dialog component.
8
- * A dialog is an overlay shown above other content in an application.
9
- */
10
- export function useDialog(props, ref) {
11
- let {
12
- role = 'dialog'
13
- } = props;
14
- let titleId = useSlotId();
15
- titleId = props['aria-label'] ? undefined : titleId; // Focus the dialog itself on mount, unless a child element is already focused.
16
-
17
- useEffect(() => {
18
- if (ref.current && !ref.current.contains(document.activeElement)) {
19
- focusSafely(ref.current); // Safari on iOS does not move the VoiceOver cursor to the dialog
20
- // or announce that it has opened until it has rendered. A workaround
21
- // is to wait for half a second, then blur and re-focus the dialog.
22
-
23
- let timeout = setTimeout(() => {
24
- if (document.activeElement === ref.current) {
25
- ref.current.blur();
26
- focusSafely(ref.current);
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 {useEffect as $m1DSs$useEffect} from "react";
4
+
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
+ }
8
+ var $40df3f8667284809$exports = {};
9
+
10
+ $parcel$export($40df3f8667284809$exports, "useDialog", () => $40df3f8667284809$export$d55e7ee900f34e93);
11
+
12
+
13
+
14
+ function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
15
+ let { role: role = 'dialog' } = props;
16
+ let titleId = $m1DSs$useSlotId();
17
+ titleId = props['aria-label'] ? undefined : titleId;
18
+ // Focus the dialog itself on mount, unless a child element is already focused.
19
+ $m1DSs$useEffect(()=>{
20
+ if (ref.current && !ref.current.contains(document.activeElement)) {
21
+ $m1DSs$focusSafely(ref.current);
22
+ // Safari on iOS does not move the VoiceOver cursor to the dialog
23
+ // or announce that it has opened until it has rendered. A workaround
24
+ // is to wait for half a second, then blur and re-focus the dialog.
25
+ let timeout = setTimeout(()=>{
26
+ if (document.activeElement === ref.current) {
27
+ ref.current.blur();
28
+ $m1DSs$focusSafely(ref.current);
29
+ }
30
+ }, 500);
31
+ return ()=>{
32
+ clearTimeout(timeout);
33
+ };
27
34
  }
28
- }, 500);
29
- return () => {
30
- clearTimeout(timeout);
31
- };
32
- }
33
- }, [ref]); // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
34
- // on mount when inside an iframe, no matter which element we programmatically focus.
35
- // See https://bugs.webkit.org/show_bug.cgi?id=211934.
36
- // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
37
- // even without aria-modal on the dialog itself.
38
-
39
- return {
40
- dialogProps: _babelRuntimeHelpersEsmExtends({}, filterDOMProps(props, {
41
- labelable: true
42
- }), {
43
- role,
44
- tabIndex: -1,
45
- 'aria-labelledby': props['aria-labelledby'] || titleId
46
- }),
47
- titleProps: {
48
- id: titleId
49
- }
50
- };
35
+ }, [
36
+ ref
37
+ ]);
38
+ // We do not use aria-modal due to a Safari bug which forces the first focusable element to be focused
39
+ // on mount when inside an iframe, no matter which element we programmatically focus.
40
+ // See https://bugs.webkit.org/show_bug.cgi?id=211934.
41
+ // useModal sets aria-hidden on all elements outside the dialog, so the dialog will behave as a modal
42
+ // even without aria-modal on the dialog itself.
43
+ return {
44
+ dialogProps: {
45
+ ...$m1DSs$filterDOMProps(props, {
46
+ labelable: true
47
+ }),
48
+ role: role,
49
+ tabIndex: -1,
50
+ 'aria-labelledby': props['aria-labelledby'] || titleId
51
+ },
52
+ titleProps: {
53
+ id: titleId
54
+ }
55
+ };
51
56
  }
57
+
58
+
59
+
60
+
61
+ export {$40df3f8667284809$export$d55e7ee900f34e93 as useDialog};
52
62
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;AAyBA;;;;OAIO,SAASA,SAAT,CAAmBC,KAAnB,EAA2CC,GAA3C,EAAoF;AACzF,MAAI;AAACC,IAAAA,IAAI,GAAG;AAAR,MAAoBF,KAAxB;AACA,MAAIG,OAAO,GAAGC,SAAS,EAAvB;AACAD,EAAAA,OAAO,GAAGH,KAAK,CAAC,YAAD,CAAL,GAAsBK,SAAtB,GAAkCF,OAA5C,CAHyF,CAKzF;;AACAG,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIL,GAAG,CAACM,OAAJ,IAAe,CAACN,GAAG,CAACM,OAAJ,CAAYC,QAAZ,CAAqBC,QAAQ,CAACC,aAA9B,CAApB,EAAkE;AAChEC,MAAAA,WAAW,CAACV,GAAG,CAACM,OAAL,CAAX,CADgE,CAGhE;AACA;AACA;;AACA,UAAIK,OAAO,GAAGC,UAAU,CAAC,MAAM;AAC7B,YAAIJ,QAAQ,CAACC,aAAT,KAA2BT,GAAG,CAACM,OAAnC,EAA4C;AAC1CN,UAAAA,GAAG,CAACM,OAAJ,CAAYO,IAAZ;AACAH,UAAAA,WAAW,CAACV,GAAG,CAACM,OAAL,CAAX;AACD;AACF,OALuB,EAKrB,GALqB,CAAxB;AAOA,aAAO,MAAM;AACXQ,QAAAA,YAAY,CAACH,OAAD,CAAZ;AACD,OAFD;AAGD;AACF,GAlBQ,EAkBN,CAACX,GAAD,CAlBM,CAAT,CANyF,CA0BzF;AACA;AACA;AACA;AACA;;AACA,SAAO;AACLe,IAAAA,WAAW,qCACNC,cAAc,CAACjB,KAAD,EAAQ;AAACkB,MAAAA,SAAS,EAAE;AAAZ,KAAR,CADR;AAEThB,MAAAA,IAFS;AAGTiB,MAAAA,QAAQ,EAAE,CAAC,CAHF;AAIT,yBAAmBnB,KAAK,CAAC,iBAAD,CAAL,IAA4BG;AAJtC,MADN;AAOLiB,IAAAA,UAAU,EAAE;AACVC,MAAAA,EAAE,EAAElB;AADM;AAPP,GAAP;AAWD","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 {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useEffect} from 'react';\n\ninterface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the dialog title element. */\n titleProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\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 ref.current.blur();\n focusSafely(ref.current);\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\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 },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":["useDialog","props","ref","role","titleId","useSlotId","undefined","useEffect","current","contains","document","activeElement","focusSafely","timeout","setTimeout","blur","clearTimeout","dialogProps","filterDOMProps","labelable","tabIndex","titleProps","id"],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;SC6BgB,yCAAS,CAAC,KAAsB,EAAE,GAA2B,EAAc,CAAC;IAC1F,GAAG,CAAC,CAAC,OAAA,IAAI,GAAG,CAAQ,SAAA,CAAC,GAAG,KAAK;IAC7B,GAAG,CAAC,OAAO,GAAG,gBAAS;IACvB,OAAO,GAAG,KAAK,CAAC,CAAY,eAAI,SAAS,GAAG,OAAO;IAEnD,EAA+E,AAA/E,6EAA+E;IAC/E,gBAAS,KAAO,CAAC;QACf,EAAE,EAAE,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,GAAG,CAAC;YACjE,kBAAW,CAAC,GAAG,CAAC,OAAO;YAEvB,EAAiE,AAAjE,+DAAiE;YACjE,EAAqE,AAArE,mEAAqE;YACrE,EAAmE,AAAnE,iEAAmE;YACnE,GAAG,CAAC,OAAO,GAAG,UAAU,KAAO,CAAC;gBAC9B,EAAE,EAAE,QAAQ,CAAC,aAAa,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;oBAC3C,GAAG,CAAC,OAAO,CAAC,IAAI;oBAChB,kBAAW,CAAC,GAAG,CAAC,OAAO;gBACzB,CAAC;YACH,CAAC,EAAE,GAAG;YAEN,MAAM,KAAO,CAAC;gBACZ,YAAY,CAAC,OAAO;YACtB,CAAC;QACH,CAAC;IACH,CAAC,EAAE,CAAC;QAAA,GAAG;IAAA,CAAC;IAER,EAAsG,AAAtG,oGAAsG;IACtG,EAAqF,AAArF,mFAAqF;IACrF,EAAsD,AAAtD,oDAAsD;IACtD,EAAqG,AAArG,mGAAqG;IACrG,EAAgD,AAAhD,8CAAgD;IAChD,MAAM,CAAC,CAAC;QACN,WAAW,EAAE,CAAC;eACT,qBAAc,CAAC,KAAK,EAAE,CAAC;gBAAA,SAAS,EAAE,IAAI;YAAA,CAAC;kBAC1C,IAAI;YACJ,QAAQ,EAAE,EAAE;YACZ,CAAiB,kBAAE,KAAK,CAAC,CAAiB,qBAAK,OAAO;QACxD,CAAC;QACD,UAAU,EAAE,CAAC;YACX,EAAE,EAAE,OAAO;QACb,CAAC;IACH,CAAC;AACH,CAAC","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 */\n\nexport * 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 {filterDOMProps, useSlotId} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useEffect} from 'react';\n\ninterface DialogAria {\n /** Props for the dialog container element. */\n dialogProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the dialog title element. */\n titleProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): DialogAria {\n let {role = 'dialog'} = props;\n let titleId = useSlotId();\n titleId = props['aria-label'] ? undefined : titleId;\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 ref.current.blur();\n focusSafely(ref.current);\n }\n }, 500);\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [ref]);\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 },\n titleProps: {\n id: titleId\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -1 +1 @@
1
- {"mappings":"A;A;AAiBA;IACE,8CAA8C;IAC9C,WAAW,EAAE,eAAe,WAAW,CAAC,CAAC;IAEzC,0CAA0C;IAC1C,UAAU,EAAE,eAAe,WAAW,CAAC,CAAA;CACxC;AAED;A;A;GAGG;AACH,0BAA0B,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,UAAU,CA0CzF","sources":["./packages/@react-aria/dialog/src/packages/@react-aria/dialog/src/useDialog.ts","./packages/@react-aria/dialog/src/packages/@react-aria/dialog/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAiBA;IACE,8CAA8C;IAC9C,WAAW,EAAE,eAAe,WAAW,CAAC,CAAC;IAEzC,0CAA0C;IAC1C,UAAU,EAAE,eAAe,WAAW,CAAC,CAAA;CACxC;AAED;;;GAGG;AACH,0BAA0B,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,UAAU,CA0CzF","sources":["packages/@react-aria/dialog/src/packages/@react-aria/dialog/src/useDialog.ts","packages/@react-aria/dialog/src/packages/@react-aria/dialog/src/index.ts","packages/@react-aria/dialog/src/index.ts"],"sourcesContent":[null,null,"/*\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\nexport * from './useDialog';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/dialog",
3
- "version": "3.1.4",
3
+ "version": "3.1.7",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7.6.2",
24
- "@react-aria/focus": "^3.4.1",
25
- "@react-aria/utils": "^3.8.2",
26
- "@react-stately/overlays": "^3.1.3",
27
- "@react-types/dialog": "^3.3.1"
24
+ "@react-aria/focus": "^3.5.3",
25
+ "@react-aria/utils": "^3.11.3",
26
+ "@react-stately/overlays": "^3.1.6",
27
+ "@react-types/dialog": "^3.3.4"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
- "gitHead": "9204e1b8cb61dac767e91087fb16203611dc67c5"
32
+ "gitHead": "ed8d8d984c2f7f2c31e8b18795b97858a95e4729"
33
33
  }