This commit is contained in:
201
node_modules/@react-aria/focus/LICENSE
generated
vendored
Normal file
201
node_modules/@react-aria/focus/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Adobe
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
3
node_modules/@react-aria/focus/README.md
generated
vendored
Normal file
3
node_modules/@react-aria/focus/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @react-aria/focus
|
||||
|
||||
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
|
||||
44
node_modules/@react-aria/focus/dist/FocusRing.main.js
generated
vendored
Normal file
44
node_modules/@react-aria/focus/dist/FocusRing.main.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
var $581a96d6eb128c1b$exports = require("./useFocusRing.main.js");
|
||||
var $hE1Ku$clsx = require("clsx");
|
||||
var $hE1Ku$reactariautils = require("@react-aria/utils");
|
||||
var $hE1Ku$react = require("react");
|
||||
|
||||
|
||||
function $parcel$interopDefault(a) {
|
||||
return a && a.__esModule ? a.default : a;
|
||||
}
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "FocusRing", () => $dfd8c70b928eb1b3$export$1a38b4ad7f578e1d);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function $dfd8c70b928eb1b3$export$1a38b4ad7f578e1d(props) {
|
||||
let { children: children, focusClass: focusClass, focusRingClass: focusRingClass } = props;
|
||||
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $581a96d6eb128c1b$exports.useFocusRing)(props);
|
||||
let child = (0, ($parcel$interopDefault($hE1Ku$react))).Children.only(children);
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($hE1Ku$react))).cloneElement(child, (0, $hE1Ku$reactariautils.mergeProps)(child.props, {
|
||||
...focusProps,
|
||||
className: (0, ($parcel$interopDefault($hE1Ku$clsx)))({
|
||||
[focusClass || '']: isFocused,
|
||||
[focusRingClass || '']: isFocusVisible
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=FocusRing.main.js.map
|
||||
1
node_modules/@react-aria/focus/dist/FocusRing.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/FocusRing.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAgCM,SAAS,0CAAU,KAAqB;IAC7C,IAAI,YAAC,QAAQ,cAAE,UAAU,kBAAE,cAAc,EAAC,GAAG;IAC7C,IAAI,aAAC,SAAS,kBAAE,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,sCAAW,EAAE;IAC3D,IAAI,QAAQ,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,qBAAO,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,OAAO,CAAA,GAAA,gCAAS,EAAE,MAAM,KAAK,EAAS;QAC9D,GAAG,UAAU;QACb,WAAW,CAAA,GAAA,qCAAG,EAAE;YACd,CAAC,cAAc,GAAG,EAAE;YACpB,CAAC,kBAAkB,GAAG,EAAE;QAC1B;IACF;AACF","sources":["packages/@react-aria/focus/src/FocusRing.tsx"],"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 clsx from 'clsx';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement} from 'react';\nimport {useFocusRing} from './useFocusRing';\n\nexport interface FocusRingProps {\n /** Child element to apply CSS classes to. */\n children: ReactElement,\n /** CSS class to apply when the element is focused. */\n focusClass?: string,\n /** CSS class to apply when the element has keyboard focus. */\n focusRingClass?: string,\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default false\n */\n within?: boolean,\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> {\n let {children, focusClass, focusRingClass} = props;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);\n let child = React.Children.only(children);\n\n return React.cloneElement(child, mergeProps(child.props as any, {\n ...focusProps,\n className: clsx({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n"],"names":[],"version":3,"file":"FocusRing.main.js.map"}
|
||||
35
node_modules/@react-aria/focus/dist/FocusRing.mjs
generated
vendored
Normal file
35
node_modules/@react-aria/focus/dist/FocusRing.mjs
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import {useFocusRing as $f7dceffc5ad7768b$export$4e328f61c538687f} from "./useFocusRing.mjs";
|
||||
import $hAmeg$clsx from "clsx";
|
||||
import {mergeProps as $hAmeg$mergeProps} from "@react-aria/utils";
|
||||
import $hAmeg$react from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function $907718708eab68af$export$1a38b4ad7f578e1d(props) {
|
||||
let { children: children, focusClass: focusClass, focusRingClass: focusRingClass } = props;
|
||||
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $f7dceffc5ad7768b$export$4e328f61c538687f)(props);
|
||||
let child = (0, $hAmeg$react).Children.only(children);
|
||||
return /*#__PURE__*/ (0, $hAmeg$react).cloneElement(child, (0, $hAmeg$mergeProps)(child.props, {
|
||||
...focusProps,
|
||||
className: (0, $hAmeg$clsx)({
|
||||
[focusClass || '']: isFocused,
|
||||
[focusRingClass || '']: isFocusVisible
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
export {$907718708eab68af$export$1a38b4ad7f578e1d as FocusRing};
|
||||
//# sourceMappingURL=FocusRing.module.js.map
|
||||
35
node_modules/@react-aria/focus/dist/FocusRing.module.js
generated
vendored
Normal file
35
node_modules/@react-aria/focus/dist/FocusRing.module.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import {useFocusRing as $f7dceffc5ad7768b$export$4e328f61c538687f} from "./useFocusRing.module.js";
|
||||
import $hAmeg$clsx from "clsx";
|
||||
import {mergeProps as $hAmeg$mergeProps} from "@react-aria/utils";
|
||||
import $hAmeg$react from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function $907718708eab68af$export$1a38b4ad7f578e1d(props) {
|
||||
let { children: children, focusClass: focusClass, focusRingClass: focusRingClass } = props;
|
||||
let { isFocused: isFocused, isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $f7dceffc5ad7768b$export$4e328f61c538687f)(props);
|
||||
let child = (0, $hAmeg$react).Children.only(children);
|
||||
return /*#__PURE__*/ (0, $hAmeg$react).cloneElement(child, (0, $hAmeg$mergeProps)(child.props, {
|
||||
...focusProps,
|
||||
className: (0, $hAmeg$clsx)({
|
||||
[focusClass || '']: isFocused,
|
||||
[focusRingClass || '']: isFocusVisible
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
export {$907718708eab68af$export$1a38b4ad7f578e1d as FocusRing};
|
||||
//# sourceMappingURL=FocusRing.module.js.map
|
||||
1
node_modules/@react-aria/focus/dist/FocusRing.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/FocusRing.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAgCM,SAAS,0CAAU,KAAqB;IAC7C,IAAI,YAAC,QAAQ,cAAE,UAAU,kBAAE,cAAc,EAAC,GAAG;IAC7C,IAAI,aAAC,SAAS,kBAAE,cAAc,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE;IAC3D,IAAI,QAAQ,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,qBAAO,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,OAAO,CAAA,GAAA,iBAAS,EAAE,MAAM,KAAK,EAAS;QAC9D,GAAG,UAAU;QACb,WAAW,CAAA,GAAA,WAAG,EAAE;YACd,CAAC,cAAc,GAAG,EAAE;YACpB,CAAC,kBAAkB,GAAG,EAAE;QAC1B;IACF;AACF","sources":["packages/@react-aria/focus/src/FocusRing.tsx"],"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 clsx from 'clsx';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement} from 'react';\nimport {useFocusRing} from './useFocusRing';\n\nexport interface FocusRingProps {\n /** Child element to apply CSS classes to. */\n children: ReactElement,\n /** CSS class to apply when the element is focused. */\n focusClass?: string,\n /** CSS class to apply when the element has keyboard focus. */\n focusRingClass?: string,\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default false\n */\n within?: boolean,\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> {\n let {children, focusClass, focusRingClass} = props;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);\n let child = React.Children.only(children);\n\n return React.cloneElement(child, mergeProps(child.props as any, {\n ...focusProps,\n className: clsx({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n"],"names":[],"version":3,"file":"FocusRing.module.js.map"}
|
||||
739
node_modules/@react-aria/focus/dist/FocusScope.main.js
generated
vendored
Normal file
739
node_modules/@react-aria/focus/dist/FocusScope.main.js
generated
vendored
Normal file
@@ -0,0 +1,739 @@
|
||||
var $d5156037ad898a4d$exports = require("./isElementVisible.main.js");
|
||||
var $euGna$reactariautils = require("@react-aria/utils");
|
||||
var $euGna$reactariainteractions = require("@react-aria/interactions");
|
||||
var $euGna$react = require("react");
|
||||
|
||||
|
||||
function $parcel$interopDefault(a) {
|
||||
return a && a.__esModule ? a.default : a;
|
||||
}
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "FocusScope", () => $a7a032acae3ddda9$export$20e40289641fbbb6);
|
||||
$parcel$export(module.exports, "useFocusManager", () => $a7a032acae3ddda9$export$10c5169755ce7bd7);
|
||||
$parcel$export(module.exports, "getFocusableTreeWalker", () => $a7a032acae3ddda9$export$2d6ec8fc375ceafa);
|
||||
$parcel$export(module.exports, "isElementInChildOfActiveScope", () => $a7a032acae3ddda9$export$1258395f99bf9cbf);
|
||||
$parcel$export(module.exports, "createFocusManager", () => $a7a032acae3ddda9$export$c5251b9e124bf29);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const $a7a032acae3ddda9$var$FocusContext = /*#__PURE__*/ (0, ($parcel$interopDefault($euGna$react))).createContext(null);
|
||||
const $a7a032acae3ddda9$var$RESTORE_FOCUS_EVENT = 'react-aria-focus-scope-restore';
|
||||
let $a7a032acae3ddda9$var$activeScope = null;
|
||||
function $a7a032acae3ddda9$export$20e40289641fbbb6(props) {
|
||||
let { children: children, contain: contain, restoreFocus: restoreFocus, autoFocus: autoFocus } = props;
|
||||
let startRef = (0, $euGna$react.useRef)(null);
|
||||
let endRef = (0, $euGna$react.useRef)(null);
|
||||
let scopeRef = (0, $euGna$react.useRef)([]);
|
||||
let { parentNode: parentNode } = (0, $euGna$react.useContext)($a7a032acae3ddda9$var$FocusContext) || {};
|
||||
// Create a tree node here so we can add children to it even before it is added to the tree.
|
||||
let node = (0, $euGna$react.useMemo)(()=>new $a7a032acae3ddda9$var$TreeNode({
|
||||
scopeRef: scopeRef
|
||||
}), [
|
||||
scopeRef
|
||||
]);
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
// If a new scope mounts outside the active scope, (e.g. DialogContainer launched from a menu),
|
||||
// use the active scope as the parent instead of the parent from context. Layout effects run bottom
|
||||
// up, so if the parent is not yet added to the tree, don't do this. Only the outer-most FocusScope
|
||||
// that is being added should get the activeScope as its parent.
|
||||
let parent = parentNode || $a7a032acae3ddda9$export$d06fae2ee68b101e.root;
|
||||
if ($a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(parent.scopeRef) && $a7a032acae3ddda9$var$activeScope && !$a7a032acae3ddda9$var$isAncestorScope($a7a032acae3ddda9$var$activeScope, parent.scopeRef)) {
|
||||
let activeNode = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode($a7a032acae3ddda9$var$activeScope);
|
||||
if (activeNode) parent = activeNode;
|
||||
}
|
||||
// Add the node to the parent, and to the tree.
|
||||
parent.addChild(node);
|
||||
$a7a032acae3ddda9$export$d06fae2ee68b101e.addNode(node);
|
||||
}, [
|
||||
node,
|
||||
parentNode
|
||||
]);
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
let node = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (node) node.contain = !!contain;
|
||||
}, [
|
||||
contain
|
||||
]);
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
var _startRef_current;
|
||||
// Find all rendered nodes between the sentinels and add them to the scope.
|
||||
let node = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
|
||||
let nodes = [];
|
||||
let stopPropagation = (e)=>e.stopPropagation();
|
||||
while(node && node !== endRef.current){
|
||||
nodes.push(node);
|
||||
// Stop custom restore focus event from propagating to parent focus scopes.
|
||||
node.addEventListener($a7a032acae3ddda9$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
node = node.nextSibling;
|
||||
}
|
||||
scopeRef.current = nodes;
|
||||
return ()=>{
|
||||
for (let node of nodes)node.removeEventListener($a7a032acae3ddda9$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
};
|
||||
}, [
|
||||
children
|
||||
]);
|
||||
$a7a032acae3ddda9$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
|
||||
$a7a032acae3ddda9$var$useFocusContainment(scopeRef, contain);
|
||||
$a7a032acae3ddda9$var$useRestoreFocus(scopeRef, restoreFocus, contain);
|
||||
$a7a032acae3ddda9$var$useAutoFocus(scopeRef, autoFocus);
|
||||
// This needs to be an effect so that activeScope is updated after the FocusScope tree is complete.
|
||||
// It cannot be a useLayoutEffect because the parent of this node hasn't been attached in the tree yet.
|
||||
(0, $euGna$react.useEffect)(()=>{
|
||||
const activeElement = (0, $euGna$reactariautils.getActiveElement)((0, $euGna$reactariautils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined));
|
||||
let scope = null;
|
||||
if ($a7a032acae3ddda9$var$isElementInScope(activeElement, scopeRef.current)) {
|
||||
// We need to traverse the focusScope tree and find the bottom most scope that
|
||||
// contains the active element and set that as the activeScope.
|
||||
for (let node of $a7a032acae3ddda9$export$d06fae2ee68b101e.traverse())if (node.scopeRef && $a7a032acae3ddda9$var$isElementInScope(activeElement, node.scopeRef.current)) scope = node;
|
||||
if (scope === $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scopeRef)) $a7a032acae3ddda9$var$activeScope = scope.scopeRef;
|
||||
}
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
// This layout effect cleanup is so that the tree node is removed synchronously with react before the RAF
|
||||
// in useRestoreFocus cleanup runs.
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
return ()=>{
|
||||
var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
|
||||
var _focusScopeTree_getTreeNode_parent_scopeRef;
|
||||
// Scope may have been re-parented.
|
||||
let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
|
||||
if ((scopeRef === $a7a032acae3ddda9$var$activeScope || $a7a032acae3ddda9$var$isAncestorScope(scopeRef, $a7a032acae3ddda9$var$activeScope)) && (!parentScope || $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(parentScope))) $a7a032acae3ddda9$var$activeScope = parentScope;
|
||||
$a7a032acae3ddda9$export$d06fae2ee68b101e.removeTreeNode(scopeRef);
|
||||
};
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
let focusManager = (0, $euGna$react.useMemo)(()=>$a7a032acae3ddda9$var$createFocusManagerForScope(scopeRef), []);
|
||||
let value = (0, $euGna$react.useMemo)(()=>({
|
||||
focusManager: focusManager,
|
||||
parentNode: node
|
||||
}), [
|
||||
node,
|
||||
focusManager
|
||||
]);
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($euGna$react))).createElement($a7a032acae3ddda9$var$FocusContext.Provider, {
|
||||
value: value
|
||||
}, /*#__PURE__*/ (0, ($parcel$interopDefault($euGna$react))).createElement("span", {
|
||||
"data-focus-scope-start": true,
|
||||
hidden: true,
|
||||
ref: startRef
|
||||
}), children, /*#__PURE__*/ (0, ($parcel$interopDefault($euGna$react))).createElement("span", {
|
||||
"data-focus-scope-end": true,
|
||||
hidden: true,
|
||||
ref: endRef
|
||||
}));
|
||||
}
|
||||
function $a7a032acae3ddda9$export$10c5169755ce7bd7() {
|
||||
var _useContext;
|
||||
return (_useContext = (0, $euGna$react.useContext)($a7a032acae3ddda9$var$FocusContext)) === null || _useContext === void 0 ? void 0 : _useContext.focusManager;
|
||||
}
|
||||
function $a7a032acae3ddda9$var$createFocusManagerForScope(scopeRef) {
|
||||
return {
|
||||
focusNext (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
|
||||
var _scope_;
|
||||
let node = from || (0, $euGna$reactariautils.getActiveElement)((0, $euGna$reactariautils.getOwnerDocument)((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : undefined));
|
||||
let sentinel = scope[0].previousElementSibling;
|
||||
let scopeRoot = $a7a032acae3ddda9$var$getScopeRoot(scope);
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = $a7a032acae3ddda9$var$isElementInScope(node, scope) ? node : sentinel;
|
||||
let nextNode = walker.nextNode();
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
if (nextNode) $a7a032acae3ddda9$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
|
||||
var _scope_;
|
||||
let node = from || (0, $euGna$reactariautils.getActiveElement)((0, $euGna$reactariautils.getOwnerDocument)((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : undefined));
|
||||
let sentinel = scope[scope.length - 1].nextElementSibling;
|
||||
let scopeRoot = $a7a032acae3ddda9$var$getScopeRoot(scope);
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = $a7a032acae3ddda9$var$isElementInScope(node, scope) ? node : sentinel;
|
||||
let previousNode = walker.previousNode();
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
previousNode = walker.previousNode();
|
||||
}
|
||||
if (previousNode) $a7a032acae3ddda9$var$focusElement(previousNode, true);
|
||||
return previousNode;
|
||||
},
|
||||
focusFirst (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { tabbable: tabbable, accept: accept } = opts;
|
||||
let scopeRoot = $a7a032acae3ddda9$var$getScopeRoot(scope);
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = scope[0].previousElementSibling;
|
||||
let nextNode = walker.nextNode();
|
||||
if (nextNode) $a7a032acae3ddda9$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusLast (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { tabbable: tabbable, accept: accept } = opts;
|
||||
let scopeRoot = $a7a032acae3ddda9$var$getScopeRoot(scope);
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = scope[scope.length - 1].nextElementSibling;
|
||||
let previousNode = walker.previousNode();
|
||||
if (previousNode) $a7a032acae3ddda9$var$focusElement(previousNode, true);
|
||||
return previousNode;
|
||||
}
|
||||
};
|
||||
}
|
||||
function $a7a032acae3ddda9$var$getScopeRoot(scope) {
|
||||
return scope[0].parentElement;
|
||||
}
|
||||
function $a7a032acae3ddda9$var$shouldContainFocus(scopeRef) {
|
||||
let scope = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode($a7a032acae3ddda9$var$activeScope);
|
||||
while(scope && scope.scopeRef !== scopeRef){
|
||||
if (scope.contain) return false;
|
||||
scope = scope.parent;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function $a7a032acae3ddda9$var$useFocusContainment(scopeRef, contain) {
|
||||
let focusedNode = (0, $euGna$react.useRef)(undefined);
|
||||
let raf = (0, $euGna$react.useRef)(undefined);
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
let scope = scopeRef.current;
|
||||
if (!contain) {
|
||||
// if contain was changed, then we should cancel any ongoing waits to pull focus back into containment
|
||||
if (raf.current) {
|
||||
cancelAnimationFrame(raf.current);
|
||||
raf.current = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const ownerDocument = (0, $euGna$reactariautils.getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
// Handle the Tab key to contain focus within the scope
|
||||
let onKeyDown = (e)=>{
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$a7a032acae3ddda9$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
||||
let focusedElement = (0, $euGna$reactariautils.getActiveElement)(ownerDocument);
|
||||
let scope = scopeRef.current;
|
||||
if (!scope || !$a7a032acae3ddda9$var$isElementInScope(focusedElement, scope)) return;
|
||||
let scopeRoot = $a7a032acae3ddda9$var$getScopeRoot(scope);
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: true
|
||||
}, scope);
|
||||
if (!focusedElement) return;
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
if (!nextElement) {
|
||||
walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;
|
||||
nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
}
|
||||
e.preventDefault();
|
||||
if (nextElement) $a7a032acae3ddda9$var$focusElement(nextElement, true);
|
||||
};
|
||||
let onFocus = (e)=>{
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!$a7a032acae3ddda9$var$activeScope || $a7a032acae3ddda9$var$isAncestorScope($a7a032acae3ddda9$var$activeScope, scopeRef)) && $a7a032acae3ddda9$var$isElementInScope((0, $euGna$reactariautils.getEventTarget)(e), scopeRef.current)) {
|
||||
$a7a032acae3ddda9$var$activeScope = scopeRef;
|
||||
focusedNode.current = (0, $euGna$reactariautils.getEventTarget)(e);
|
||||
} else if ($a7a032acae3ddda9$var$shouldContainFocus(scopeRef) && !$a7a032acae3ddda9$var$isElementInChildScope((0, $euGna$reactariautils.getEventTarget)(e), scopeRef)) {
|
||||
// If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),
|
||||
// restore focus to the previously focused node or the first tabbable element in the active scope.
|
||||
if (focusedNode.current) focusedNode.current.focus();
|
||||
else if ($a7a032acae3ddda9$var$activeScope && $a7a032acae3ddda9$var$activeScope.current) $a7a032acae3ddda9$var$focusFirstInScope($a7a032acae3ddda9$var$activeScope.current);
|
||||
} else if ($a7a032acae3ddda9$var$shouldContainFocus(scopeRef)) focusedNode.current = (0, $euGna$reactariautils.getEventTarget)(e);
|
||||
};
|
||||
let onBlur = (e)=>{
|
||||
// Firefox doesn't shift focus back to the Dialog properly without this
|
||||
if (raf.current) cancelAnimationFrame(raf.current);
|
||||
raf.current = requestAnimationFrame(()=>{
|
||||
// Patches infinite focus coersion loop for Android Talkback where the user isn't able to move the virtual cursor
|
||||
// if within a containing focus scope. Bug filed against Chrome: https://issuetracker.google.com/issues/384844019.
|
||||
// Note that this means focus can leave focus containing modals due to this, but it is isolated to Chrome Talkback.
|
||||
let modality = (0, $euGna$reactariainteractions.getInteractionModality)();
|
||||
let shouldSkipFocusRestore = (modality === 'virtual' || modality === null) && (0, $euGna$reactariautils.isAndroid)() && (0, $euGna$reactariautils.isChrome)();
|
||||
// Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe
|
||||
let activeElement = (0, $euGna$reactariautils.getActiveElement)(ownerDocument);
|
||||
if (!shouldSkipFocusRestore && activeElement && $a7a032acae3ddda9$var$shouldContainFocus(scopeRef) && !$a7a032acae3ddda9$var$isElementInChildScope(activeElement, scopeRef)) {
|
||||
$a7a032acae3ddda9$var$activeScope = scopeRef;
|
||||
let target = (0, $euGna$reactariautils.getEventTarget)(e);
|
||||
if (target && target.isConnected) {
|
||||
var _focusedNode_current;
|
||||
focusedNode.current = target;
|
||||
(_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
|
||||
} else if ($a7a032acae3ddda9$var$activeScope.current) $a7a032acae3ddda9$var$focusFirstInScope($a7a032acae3ddda9$var$activeScope.current);
|
||||
}
|
||||
});
|
||||
};
|
||||
ownerDocument.addEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusout', onBlur, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusout', onBlur, false));
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
contain
|
||||
]);
|
||||
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
return ()=>{
|
||||
if (raf.current) cancelAnimationFrame(raf.current);
|
||||
};
|
||||
}, [
|
||||
raf
|
||||
]);
|
||||
}
|
||||
function $a7a032acae3ddda9$var$isElementInAnyScope(element) {
|
||||
return $a7a032acae3ddda9$var$isElementInChildScope(element);
|
||||
}
|
||||
function $a7a032acae3ddda9$var$isElementInScope(element, scope) {
|
||||
if (!element) return false;
|
||||
if (!scope) return false;
|
||||
return scope.some((node)=>node.contains(element));
|
||||
}
|
||||
function $a7a032acae3ddda9$var$isElementInChildScope(element, scope = null) {
|
||||
// If the element is within a top layer element (e.g. toasts), always allow moving focus there.
|
||||
if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) return true;
|
||||
// node.contains in isElementInScope covers child scopes that are also DOM children,
|
||||
// but does not cover child scopes in portals.
|
||||
for (let { scopeRef: s } of $a7a032acae3ddda9$export$d06fae2ee68b101e.traverse($a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scope))){
|
||||
if (s && $a7a032acae3ddda9$var$isElementInScope(element, s.current)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function $a7a032acae3ddda9$export$1258395f99bf9cbf(element) {
|
||||
return $a7a032acae3ddda9$var$isElementInChildScope(element, $a7a032acae3ddda9$var$activeScope);
|
||||
}
|
||||
function $a7a032acae3ddda9$var$isAncestorScope(ancestor, scope) {
|
||||
var _focusScopeTree_getTreeNode;
|
||||
let parent = (_focusScopeTree_getTreeNode = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
|
||||
while(parent){
|
||||
if (parent.scopeRef === ancestor) return true;
|
||||
parent = parent.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function $a7a032acae3ddda9$var$focusElement(element, scroll = false) {
|
||||
if (element != null && !scroll) try {
|
||||
(0, $euGna$reactariainteractions.focusSafely)(element);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
else if (element != null) try {
|
||||
element.focus();
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
function $a7a032acae3ddda9$var$getFirstInScope(scope, tabbable = true) {
|
||||
let sentinel = scope[0].previousElementSibling;
|
||||
let scopeRoot = $a7a032acae3ddda9$var$getScopeRoot(scope);
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable
|
||||
}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
let nextNode = walker.nextNode();
|
||||
// If the scope does not contain a tabbable element, use the first focusable element.
|
||||
if (tabbable && !nextNode) {
|
||||
scopeRoot = $a7a032acae3ddda9$var$getScopeRoot(scope);
|
||||
walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: false
|
||||
}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
return nextNode;
|
||||
}
|
||||
function $a7a032acae3ddda9$var$focusFirstInScope(scope, tabbable = true) {
|
||||
$a7a032acae3ddda9$var$focusElement($a7a032acae3ddda9$var$getFirstInScope(scope, tabbable));
|
||||
}
|
||||
function $a7a032acae3ddda9$var$useAutoFocus(scopeRef, autoFocus) {
|
||||
const autoFocusRef = (0, ($parcel$interopDefault($euGna$react))).useRef(autoFocus);
|
||||
(0, $euGna$react.useEffect)(()=>{
|
||||
if (autoFocusRef.current) {
|
||||
$a7a032acae3ddda9$var$activeScope = scopeRef;
|
||||
const ownerDocument = (0, $euGna$reactariautils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!$a7a032acae3ddda9$var$isElementInScope((0, $euGna$reactariautils.getActiveElement)(ownerDocument), $a7a032acae3ddda9$var$activeScope.current) && scopeRef.current) $a7a032acae3ddda9$var$focusFirstInScope(scopeRef.current);
|
||||
}
|
||||
autoFocusRef.current = false;
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
}
|
||||
function $a7a032acae3ddda9$var$useActiveScopeTracker(scopeRef, restore, contain) {
|
||||
// tracks the active scope, in case restore and contain are both false.
|
||||
// if either are true, this is tracked in useRestoreFocus or useFocusContainment.
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
if (restore || contain) return;
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = (0, $euGna$reactariautils.getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
let onFocus = (e)=>{
|
||||
let target = (0, $euGna$reactariautils.getEventTarget)(e);
|
||||
if ($a7a032acae3ddda9$var$isElementInScope(target, scopeRef.current)) $a7a032acae3ddda9$var$activeScope = scopeRef;
|
||||
else if (!$a7a032acae3ddda9$var$isElementInAnyScope(target)) $a7a032acae3ddda9$var$activeScope = null;
|
||||
};
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restore,
|
||||
contain
|
||||
]);
|
||||
}
|
||||
function $a7a032acae3ddda9$var$shouldRestoreFocus(scopeRef) {
|
||||
let scope = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode($a7a032acae3ddda9$var$activeScope);
|
||||
while(scope && scope.scopeRef !== scopeRef){
|
||||
if (scope.nodeToRestore) return false;
|
||||
scope = scope.parent;
|
||||
}
|
||||
return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
|
||||
}
|
||||
function $a7a032acae3ddda9$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
|
||||
// create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
const nodeToRestoreRef = (0, $euGna$react.useRef)(typeof document !== 'undefined' ? (0, $euGna$reactariautils.getActiveElement)((0, $euGna$reactariautils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined)) : null);
|
||||
// restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus
|
||||
// restoring-non-containing scopes should only care if they become active so they can perform the restore
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = (0, $euGna$reactariautils.getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
if (!restoreFocus || contain) return;
|
||||
let onFocus = ()=>{
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!$a7a032acae3ddda9$var$activeScope || $a7a032acae3ddda9$var$isAncestorScope($a7a032acae3ddda9$var$activeScope, scopeRef)) && $a7a032acae3ddda9$var$isElementInScope((0, $euGna$reactariautils.getActiveElement)(ownerDocument), scopeRef.current)) $a7a032acae3ddda9$var$activeScope = scopeRef;
|
||||
};
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [
|
||||
scopeRef,
|
||||
contain
|
||||
]);
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
const ownerDocument = (0, $euGna$reactariautils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!restoreFocus) return;
|
||||
// Handle the Tab key so that tabbing out of the scope goes to the next element
|
||||
// after the node that had focus when the scope mounted. This is important when
|
||||
// using portals for overlays, so that focus goes to the expected element when
|
||||
// tabbing out of the overlay.
|
||||
let onKeyDown = (e)=>{
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$a7a032acae3ddda9$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
||||
let focusedElement = ownerDocument.activeElement;
|
||||
if (!$a7a032acae3ddda9$var$isElementInChildScope(focusedElement, scopeRef) || !$a7a032acae3ddda9$var$shouldRestoreFocus(scopeRef)) return;
|
||||
let treeNode = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
// Create a DOM tree walker that matches all tabbable elements
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(ownerDocument.body, {
|
||||
tabbable: true
|
||||
});
|
||||
// Find the next tabbable element after the currently focused element
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
|
||||
nodeToRestore = undefined;
|
||||
treeNode.nodeToRestore = undefined;
|
||||
}
|
||||
// If there is no next element, or it is outside the current scope, move focus to the
|
||||
// next element after the node to restore to instead.
|
||||
if ((!nextElement || !$a7a032acae3ddda9$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
|
||||
walker.currentNode = nodeToRestore;
|
||||
// Skip over elements within the scope, in case the scope immediately follows the node to restore.
|
||||
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
while ($a7a032acae3ddda9$var$isElementInChildScope(nextElement, scopeRef));
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (nextElement) $a7a032acae3ddda9$var$focusElement(nextElement, true);
|
||||
else // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)
|
||||
// then move focus to the body.
|
||||
// Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)
|
||||
if (!$a7a032acae3ddda9$var$isElementInAnyScope(nodeToRestore)) focusedElement.blur();
|
||||
else $a7a032acae3ddda9$var$focusElement(nodeToRestore, true);
|
||||
}
|
||||
};
|
||||
if (!contain) ownerDocument.addEventListener('keydown', onKeyDown, true);
|
||||
return ()=>{
|
||||
if (!contain) ownerDocument.removeEventListener('keydown', onKeyDown, true);
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restoreFocus,
|
||||
contain
|
||||
]);
|
||||
// useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.
|
||||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{
|
||||
const ownerDocument = (0, $euGna$reactariautils.getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!restoreFocus) return;
|
||||
let treeNode = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
var _nodeToRestoreRef_current;
|
||||
treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : undefined;
|
||||
return ()=>{
|
||||
let treeNode = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
// if we already lost focus to the body and this was the active scope, then we should attempt to restore
|
||||
let activeElement = (0, $euGna$reactariautils.getActiveElement)(ownerDocument);
|
||||
if (restoreFocus && nodeToRestore && (activeElement && $a7a032acae3ddda9$var$isElementInChildScope(activeElement, scopeRef) || activeElement === ownerDocument.body && $a7a032acae3ddda9$var$shouldRestoreFocus(scopeRef))) {
|
||||
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it
|
||||
let clonedTree = $a7a032acae3ddda9$export$d06fae2ee68b101e.clone();
|
||||
requestAnimationFrame(()=>{
|
||||
// Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere
|
||||
if (ownerDocument.activeElement === ownerDocument.body) {
|
||||
// look up the tree starting with our scope to find a nodeToRestore still in the DOM
|
||||
let treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while(treeNode){
|
||||
if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {
|
||||
$a7a032acae3ddda9$var$restoreFocusToElement(treeNode.nodeToRestore);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
// If no nodeToRestore was found, focus the first element in the nearest
|
||||
// ancestor scope that is still in the tree.
|
||||
treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while(treeNode){
|
||||
if (treeNode.scopeRef && treeNode.scopeRef.current && $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(treeNode.scopeRef)) {
|
||||
let node = $a7a032acae3ddda9$var$getFirstInScope(treeNode.scopeRef.current, true);
|
||||
$a7a032acae3ddda9$var$restoreFocusToElement(node);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restoreFocus
|
||||
]);
|
||||
}
|
||||
function $a7a032acae3ddda9$var$restoreFocusToElement(node) {
|
||||
// Dispatch a custom event that parent elements can intercept to customize focus restoration.
|
||||
// For example, virtualized collection components reuse DOM elements, so the original element
|
||||
// might still exist in the DOM but representing a different item.
|
||||
if (node.dispatchEvent(new CustomEvent($a7a032acae3ddda9$var$RESTORE_FOCUS_EVENT, {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}))) $a7a032acae3ddda9$var$focusElement(node);
|
||||
}
|
||||
function $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, opts, scope) {
|
||||
let filter = (opts === null || opts === void 0 ? void 0 : opts.tabbable) ? (0, $euGna$reactariautils.isTabbable) : (0, $euGna$reactariautils.isFocusable);
|
||||
// Ensure that root is an Element or fall back appropriately
|
||||
let rootElement = (root === null || root === void 0 ? void 0 : root.nodeType) === Node.ELEMENT_NODE ? root : null;
|
||||
// Determine the document to use
|
||||
let doc = (0, $euGna$reactariautils.getOwnerDocument)(rootElement);
|
||||
// Create a TreeWalker, ensuring the root is an Element or Document
|
||||
let walker = (0, $euGna$reactariautils.createShadowTreeWalker)(doc, root || doc, NodeFilter.SHOW_ELEMENT, {
|
||||
acceptNode (node) {
|
||||
var _opts_from;
|
||||
// Skip nodes inside the starting node.
|
||||
if (opts === null || opts === void 0 ? void 0 : (_opts_from = opts.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node)) return NodeFilter.FILTER_REJECT;
|
||||
if (filter(node) && (0, $d5156037ad898a4d$exports.isElementVisible)(node) && (!scope || $a7a032acae3ddda9$var$isElementInScope(node, scope)) && (!(opts === null || opts === void 0 ? void 0 : opts.accept) || opts.accept(node))) return NodeFilter.FILTER_ACCEPT;
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
});
|
||||
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
|
||||
return walker;
|
||||
}
|
||||
function $a7a032acae3ddda9$export$c5251b9e124bf29(ref, defaultOptions = {}) {
|
||||
return {
|
||||
focusNext (opts = {}) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
|
||||
let node = from || (0, $euGna$reactariautils.getActiveElement)((0, $euGna$reactariautils.getOwnerDocument)(root));
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
if (root.contains(node)) walker.currentNode = node;
|
||||
let nextNode = walker.nextNode();
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
if (nextNode) $a7a032acae3ddda9$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
|
||||
let node = from || (0, $euGna$reactariautils.getActiveElement)((0, $euGna$reactariautils.getOwnerDocument)(root));
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
if (root.contains(node)) walker.currentNode = node;
|
||||
else {
|
||||
let next = $a7a032acae3ddda9$var$last(walker);
|
||||
if (next) $a7a032acae3ddda9$var$focusElement(next, true);
|
||||
return next !== null && next !== void 0 ? next : null;
|
||||
}
|
||||
let previousNode = walker.previousNode();
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
let lastNode = $a7a032acae3ddda9$var$last(walker);
|
||||
if (!lastNode) // couldn't wrap
|
||||
return null;
|
||||
previousNode = lastNode;
|
||||
}
|
||||
if (previousNode) $a7a032acae3ddda9$var$focusElement(previousNode, true);
|
||||
return previousNode !== null && previousNode !== void 0 ? previousNode : null;
|
||||
},
|
||||
focusFirst (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
let nextNode = walker.nextNode();
|
||||
if (nextNode) $a7a032acae3ddda9$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusLast (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
|
||||
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
let next = $a7a032acae3ddda9$var$last(walker);
|
||||
if (next) $a7a032acae3ddda9$var$focusElement(next, true);
|
||||
return next !== null && next !== void 0 ? next : null;
|
||||
}
|
||||
};
|
||||
}
|
||||
function $a7a032acae3ddda9$var$last(walker) {
|
||||
let next = undefined;
|
||||
let last;
|
||||
do {
|
||||
last = walker.lastChild();
|
||||
if (last) next = last;
|
||||
}while (last);
|
||||
return next;
|
||||
}
|
||||
class $a7a032acae3ddda9$var$Tree {
|
||||
get size() {
|
||||
return this.fastMap.size;
|
||||
}
|
||||
getTreeNode(data) {
|
||||
return this.fastMap.get(data);
|
||||
}
|
||||
addTreeNode(scopeRef, parent, nodeToRestore) {
|
||||
let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
|
||||
if (!parentNode) return;
|
||||
let node = new $a7a032acae3ddda9$var$TreeNode({
|
||||
scopeRef: scopeRef
|
||||
});
|
||||
parentNode.addChild(node);
|
||||
node.parent = parentNode;
|
||||
this.fastMap.set(scopeRef, node);
|
||||
if (nodeToRestore) node.nodeToRestore = nodeToRestore;
|
||||
}
|
||||
addNode(node) {
|
||||
this.fastMap.set(node.scopeRef, node);
|
||||
}
|
||||
removeTreeNode(scopeRef) {
|
||||
// never remove the root
|
||||
if (scopeRef === null) return;
|
||||
let node = this.fastMap.get(scopeRef);
|
||||
if (!node) return;
|
||||
let parentNode = node.parent;
|
||||
// when we remove a scope, check if any sibling scopes are trying to restore focus to something inside the scope we're removing
|
||||
// if we are, then replace the siblings restore with the restore from the scope we're removing
|
||||
for (let current of this.traverse())if (current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef && node.scopeRef.current && $a7a032acae3ddda9$var$isElementInScope(current.nodeToRestore, node.scopeRef.current)) current.nodeToRestore = node.nodeToRestore;
|
||||
let children = node.children;
|
||||
if (parentNode) {
|
||||
parentNode.removeChild(node);
|
||||
if (children.size > 0) children.forEach((child)=>parentNode && parentNode.addChild(child));
|
||||
}
|
||||
this.fastMap.delete(node.scopeRef);
|
||||
}
|
||||
// Pre Order Depth First
|
||||
*traverse(node = this.root) {
|
||||
if (node.scopeRef != null) yield node;
|
||||
if (node.children.size > 0) for (let child of node.children)yield* this.traverse(child);
|
||||
}
|
||||
clone() {
|
||||
var _node_parent;
|
||||
let newTree = new $a7a032acae3ddda9$var$Tree();
|
||||
var _node_parent_scopeRef;
|
||||
for (let node of this.traverse())newTree.addTreeNode(node.scopeRef, (_node_parent_scopeRef = (_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node.nodeToRestore);
|
||||
return newTree;
|
||||
}
|
||||
constructor(){
|
||||
this.fastMap = new Map();
|
||||
this.root = new $a7a032acae3ddda9$var$TreeNode({
|
||||
scopeRef: null
|
||||
});
|
||||
this.fastMap.set(null, this.root);
|
||||
}
|
||||
}
|
||||
class $a7a032acae3ddda9$var$TreeNode {
|
||||
addChild(node) {
|
||||
this.children.add(node);
|
||||
node.parent = this;
|
||||
}
|
||||
removeChild(node) {
|
||||
this.children.delete(node);
|
||||
node.parent = undefined;
|
||||
}
|
||||
constructor(props){
|
||||
this.children = new Set();
|
||||
this.contain = false;
|
||||
this.scopeRef = props.scopeRef;
|
||||
}
|
||||
}
|
||||
let $a7a032acae3ddda9$export$d06fae2ee68b101e = new $a7a032acae3ddda9$var$Tree();
|
||||
|
||||
|
||||
//# sourceMappingURL=FocusScope.main.js.map
|
||||
1
node_modules/@react-aria/focus/dist/FocusScope.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/FocusScope.main.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
726
node_modules/@react-aria/focus/dist/FocusScope.mjs
generated
vendored
Normal file
726
node_modules/@react-aria/focus/dist/FocusScope.mjs
generated
vendored
Normal file
@@ -0,0 +1,726 @@
|
||||
import {isElementVisible as $645f2e67b85a24c9$export$e989c0fffaa6b27a} from "./isElementVisible.mjs";
|
||||
import {useLayoutEffect as $cgawC$useLayoutEffect, getActiveElement as $cgawC$getActiveElement, getOwnerDocument as $cgawC$getOwnerDocument, getEventTarget as $cgawC$getEventTarget, isAndroid as $cgawC$isAndroid, isChrome as $cgawC$isChrome, isTabbable as $cgawC$isTabbable, isFocusable as $cgawC$isFocusable, createShadowTreeWalker as $cgawC$createShadowTreeWalker} from "@react-aria/utils";
|
||||
import {getInteractionModality as $cgawC$getInteractionModality, focusSafely as $cgawC$focusSafely} from "@react-aria/interactions";
|
||||
import $cgawC$react, {useRef as $cgawC$useRef, useContext as $cgawC$useContext, useMemo as $cgawC$useMemo, useEffect as $cgawC$useEffect} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const $9bf71ea28793e738$var$FocusContext = /*#__PURE__*/ (0, $cgawC$react).createContext(null);
|
||||
const $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT = 'react-aria-focus-scope-restore';
|
||||
let $9bf71ea28793e738$var$activeScope = null;
|
||||
function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
|
||||
let { children: children, contain: contain, restoreFocus: restoreFocus, autoFocus: autoFocus } = props;
|
||||
let startRef = (0, $cgawC$useRef)(null);
|
||||
let endRef = (0, $cgawC$useRef)(null);
|
||||
let scopeRef = (0, $cgawC$useRef)([]);
|
||||
let { parentNode: parentNode } = (0, $cgawC$useContext)($9bf71ea28793e738$var$FocusContext) || {};
|
||||
// Create a tree node here so we can add children to it even before it is added to the tree.
|
||||
let node = (0, $cgawC$useMemo)(()=>new $9bf71ea28793e738$var$TreeNode({
|
||||
scopeRef: scopeRef
|
||||
}), [
|
||||
scopeRef
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
// If a new scope mounts outside the active scope, (e.g. DialogContainer launched from a menu),
|
||||
// use the active scope as the parent instead of the parent from context. Layout effects run bottom
|
||||
// up, so if the parent is not yet added to the tree, don't do this. Only the outer-most FocusScope
|
||||
// that is being added should get the activeScope as its parent.
|
||||
let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e.root;
|
||||
if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope && !$9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, parent.scopeRef)) {
|
||||
let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
||||
if (activeNode) parent = activeNode;
|
||||
}
|
||||
// Add the node to the parent, and to the tree.
|
||||
parent.addChild(node);
|
||||
$9bf71ea28793e738$export$d06fae2ee68b101e.addNode(node);
|
||||
}, [
|
||||
node,
|
||||
parentNode
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
let node = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (node) node.contain = !!contain;
|
||||
}, [
|
||||
contain
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
var _startRef_current;
|
||||
// Find all rendered nodes between the sentinels and add them to the scope.
|
||||
let node = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
|
||||
let nodes = [];
|
||||
let stopPropagation = (e)=>e.stopPropagation();
|
||||
while(node && node !== endRef.current){
|
||||
nodes.push(node);
|
||||
// Stop custom restore focus event from propagating to parent focus scopes.
|
||||
node.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
node = node.nextSibling;
|
||||
}
|
||||
scopeRef.current = nodes;
|
||||
return ()=>{
|
||||
for (let node of nodes)node.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
};
|
||||
}, [
|
||||
children
|
||||
]);
|
||||
$9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
|
||||
$9bf71ea28793e738$var$useFocusContainment(scopeRef, contain);
|
||||
$9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain);
|
||||
$9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus);
|
||||
// This needs to be an effect so that activeScope is updated after the FocusScope tree is complete.
|
||||
// It cannot be a useLayoutEffect because the parent of this node hasn't been attached in the tree yet.
|
||||
(0, $cgawC$useEffect)(()=>{
|
||||
const activeElement = (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined));
|
||||
let scope = null;
|
||||
if ($9bf71ea28793e738$var$isElementInScope(activeElement, scopeRef.current)) {
|
||||
// We need to traverse the focusScope tree and find the bottom most scope that
|
||||
// contains the active element and set that as the activeScope.
|
||||
for (let node of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse())if (node.scopeRef && $9bf71ea28793e738$var$isElementInScope(activeElement, node.scopeRef.current)) scope = node;
|
||||
if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) $9bf71ea28793e738$var$activeScope = scope.scopeRef;
|
||||
}
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
// This layout effect cleanup is so that the tree node is removed synchronously with react before the RAF
|
||||
// in useRestoreFocus cleanup runs.
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
return ()=>{
|
||||
var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
|
||||
var _focusScopeTree_getTreeNode_parent_scopeRef;
|
||||
// Scope may have been re-parented.
|
||||
let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
|
||||
if ((scopeRef === $9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope(scopeRef, $9bf71ea28793e738$var$activeScope)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parentScope))) $9bf71ea28793e738$var$activeScope = parentScope;
|
||||
$9bf71ea28793e738$export$d06fae2ee68b101e.removeTreeNode(scopeRef);
|
||||
};
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
let focusManager = (0, $cgawC$useMemo)(()=>$9bf71ea28793e738$var$createFocusManagerForScope(scopeRef), []);
|
||||
let value = (0, $cgawC$useMemo)(()=>({
|
||||
focusManager: focusManager,
|
||||
parentNode: node
|
||||
}), [
|
||||
node,
|
||||
focusManager
|
||||
]);
|
||||
return /*#__PURE__*/ (0, $cgawC$react).createElement($9bf71ea28793e738$var$FocusContext.Provider, {
|
||||
value: value
|
||||
}, /*#__PURE__*/ (0, $cgawC$react).createElement("span", {
|
||||
"data-focus-scope-start": true,
|
||||
hidden: true,
|
||||
ref: startRef
|
||||
}), children, /*#__PURE__*/ (0, $cgawC$react).createElement("span", {
|
||||
"data-focus-scope-end": true,
|
||||
hidden: true,
|
||||
ref: endRef
|
||||
}));
|
||||
}
|
||||
function $9bf71ea28793e738$export$10c5169755ce7bd7() {
|
||||
var _useContext;
|
||||
return (_useContext = (0, $cgawC$useContext)($9bf71ea28793e738$var$FocusContext)) === null || _useContext === void 0 ? void 0 : _useContext.focusManager;
|
||||
}
|
||||
function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
||||
return {
|
||||
focusNext (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
|
||||
var _scope_;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : undefined));
|
||||
let sentinel = scope[0].previousElementSibling;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
|
||||
let nextNode = walker.nextNode();
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
|
||||
var _scope_;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : undefined));
|
||||
let sentinel = scope[scope.length - 1].nextElementSibling;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
|
||||
let previousNode = walker.previousNode();
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
previousNode = walker.previousNode();
|
||||
}
|
||||
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
||||
return previousNode;
|
||||
},
|
||||
focusFirst (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { tabbable: tabbable, accept: accept } = opts;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = scope[0].previousElementSibling;
|
||||
let nextNode = walker.nextNode();
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusLast (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { tabbable: tabbable, accept: accept } = opts;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = scope[scope.length - 1].nextElementSibling;
|
||||
let previousNode = walker.previousNode();
|
||||
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
||||
return previousNode;
|
||||
}
|
||||
};
|
||||
}
|
||||
function $9bf71ea28793e738$var$getScopeRoot(scope) {
|
||||
return scope[0].parentElement;
|
||||
}
|
||||
function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
|
||||
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
||||
while(scope && scope.scopeRef !== scopeRef){
|
||||
if (scope.contain) return false;
|
||||
scope = scope.parent;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
||||
let focusedNode = (0, $cgawC$useRef)(undefined);
|
||||
let raf = (0, $cgawC$useRef)(undefined);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
let scope = scopeRef.current;
|
||||
if (!contain) {
|
||||
// if contain was changed, then we should cancel any ongoing waits to pull focus back into containment
|
||||
if (raf.current) {
|
||||
cancelAnimationFrame(raf.current);
|
||||
raf.current = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
// Handle the Tab key to contain focus within the scope
|
||||
let onKeyDown = (e)=>{
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
||||
let focusedElement = (0, $cgawC$getActiveElement)(ownerDocument);
|
||||
let scope = scopeRef.current;
|
||||
if (!scope || !$9bf71ea28793e738$var$isElementInScope(focusedElement, scope)) return;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: true
|
||||
}, scope);
|
||||
if (!focusedElement) return;
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
if (!nextElement) {
|
||||
walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;
|
||||
nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
}
|
||||
e.preventDefault();
|
||||
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
||||
};
|
||||
let onFocus = (e)=>{
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope((0, $cgawC$getEventTarget)(e), scopeRef.current)) {
|
||||
$9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
focusedNode.current = (0, $cgawC$getEventTarget)(e);
|
||||
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope((0, $cgawC$getEventTarget)(e), scopeRef)) {
|
||||
// If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),
|
||||
// restore focus to the previously focused node or the first tabbable element in the active scope.
|
||||
if (focusedNode.current) focusedNode.current.focus();
|
||||
else if ($9bf71ea28793e738$var$activeScope && $9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
|
||||
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef)) focusedNode.current = (0, $cgawC$getEventTarget)(e);
|
||||
};
|
||||
let onBlur = (e)=>{
|
||||
// Firefox doesn't shift focus back to the Dialog properly without this
|
||||
if (raf.current) cancelAnimationFrame(raf.current);
|
||||
raf.current = requestAnimationFrame(()=>{
|
||||
// Patches infinite focus coersion loop for Android Talkback where the user isn't able to move the virtual cursor
|
||||
// if within a containing focus scope. Bug filed against Chrome: https://issuetracker.google.com/issues/384844019.
|
||||
// Note that this means focus can leave focus containing modals due to this, but it is isolated to Chrome Talkback.
|
||||
let modality = (0, $cgawC$getInteractionModality)();
|
||||
let shouldSkipFocusRestore = (modality === 'virtual' || modality === null) && (0, $cgawC$isAndroid)() && (0, $cgawC$isChrome)();
|
||||
// Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe
|
||||
let activeElement = (0, $cgawC$getActiveElement)(ownerDocument);
|
||||
if (!shouldSkipFocusRestore && activeElement && $9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef)) {
|
||||
$9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
let target = (0, $cgawC$getEventTarget)(e);
|
||||
if (target && target.isConnected) {
|
||||
var _focusedNode_current;
|
||||
focusedNode.current = target;
|
||||
(_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
|
||||
} else if ($9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
|
||||
}
|
||||
});
|
||||
};
|
||||
ownerDocument.addEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusout', onBlur, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusout', onBlur, false));
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
contain
|
||||
]);
|
||||
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
return ()=>{
|
||||
if (raf.current) cancelAnimationFrame(raf.current);
|
||||
};
|
||||
}, [
|
||||
raf
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$isElementInAnyScope(element) {
|
||||
return $9bf71ea28793e738$var$isElementInChildScope(element);
|
||||
}
|
||||
function $9bf71ea28793e738$var$isElementInScope(element, scope) {
|
||||
if (!element) return false;
|
||||
if (!scope) return false;
|
||||
return scope.some((node)=>node.contains(element));
|
||||
}
|
||||
function $9bf71ea28793e738$var$isElementInChildScope(element, scope = null) {
|
||||
// If the element is within a top layer element (e.g. toasts), always allow moving focus there.
|
||||
if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) return true;
|
||||
// node.contains in isElementInScope covers child scopes that are also DOM children,
|
||||
// but does not cover child scopes in portals.
|
||||
for (let { scopeRef: s } of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope))){
|
||||
if (s && $9bf71ea28793e738$var$isElementInScope(element, s.current)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function $9bf71ea28793e738$export$1258395f99bf9cbf(element) {
|
||||
return $9bf71ea28793e738$var$isElementInChildScope(element, $9bf71ea28793e738$var$activeScope);
|
||||
}
|
||||
function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
|
||||
var _focusScopeTree_getTreeNode;
|
||||
let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
|
||||
while(parent){
|
||||
if (parent.scopeRef === ancestor) return true;
|
||||
parent = parent.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function $9bf71ea28793e738$var$focusElement(element, scroll = false) {
|
||||
if (element != null && !scroll) try {
|
||||
(0, $cgawC$focusSafely)(element);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
else if (element != null) try {
|
||||
element.focus();
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
function $9bf71ea28793e738$var$getFirstInScope(scope, tabbable = true) {
|
||||
let sentinel = scope[0].previousElementSibling;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable
|
||||
}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
let nextNode = walker.nextNode();
|
||||
// If the scope does not contain a tabbable element, use the first focusable element.
|
||||
if (tabbable && !nextNode) {
|
||||
scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: false
|
||||
}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
return nextNode;
|
||||
}
|
||||
function $9bf71ea28793e738$var$focusFirstInScope(scope, tabbable = true) {
|
||||
$9bf71ea28793e738$var$focusElement($9bf71ea28793e738$var$getFirstInScope(scope, tabbable));
|
||||
}
|
||||
function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
|
||||
const autoFocusRef = (0, $cgawC$react).useRef(autoFocus);
|
||||
(0, $cgawC$useEffect)(()=>{
|
||||
if (autoFocusRef.current) {
|
||||
$9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!$9bf71ea28793e738$var$isElementInScope((0, $cgawC$getActiveElement)(ownerDocument), $9bf71ea28793e738$var$activeScope.current) && scopeRef.current) $9bf71ea28793e738$var$focusFirstInScope(scopeRef.current);
|
||||
}
|
||||
autoFocusRef.current = false;
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain) {
|
||||
// tracks the active scope, in case restore and contain are both false.
|
||||
// if either are true, this is tracked in useRestoreFocus or useFocusContainment.
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
if (restore || contain) return;
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
let onFocus = (e)=>{
|
||||
let target = (0, $cgawC$getEventTarget)(e);
|
||||
if ($9bf71ea28793e738$var$isElementInScope(target, scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
else if (!$9bf71ea28793e738$var$isElementInAnyScope(target)) $9bf71ea28793e738$var$activeScope = null;
|
||||
};
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restore,
|
||||
contain
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef) {
|
||||
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
||||
while(scope && scope.scopeRef !== scopeRef){
|
||||
if (scope.nodeToRestore) return false;
|
||||
scope = scope.parent;
|
||||
}
|
||||
return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
|
||||
}
|
||||
function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
|
||||
// create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
const nodeToRestoreRef = (0, $cgawC$useRef)(typeof document !== 'undefined' ? (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined)) : null);
|
||||
// restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus
|
||||
// restoring-non-containing scopes should only care if they become active so they can perform the restore
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
if (!restoreFocus || contain) return;
|
||||
let onFocus = ()=>{
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope((0, $cgawC$getActiveElement)(ownerDocument), scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
};
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [
|
||||
scopeRef,
|
||||
contain
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!restoreFocus) return;
|
||||
// Handle the Tab key so that tabbing out of the scope goes to the next element
|
||||
// after the node that had focus when the scope mounted. This is important when
|
||||
// using portals for overlays, so that focus goes to the expected element when
|
||||
// tabbing out of the overlay.
|
||||
let onKeyDown = (e)=>{
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
||||
let focusedElement = ownerDocument.activeElement;
|
||||
if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef)) return;
|
||||
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
// Create a DOM tree walker that matches all tabbable elements
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ownerDocument.body, {
|
||||
tabbable: true
|
||||
});
|
||||
// Find the next tabbable element after the currently focused element
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
|
||||
nodeToRestore = undefined;
|
||||
treeNode.nodeToRestore = undefined;
|
||||
}
|
||||
// If there is no next element, or it is outside the current scope, move focus to the
|
||||
// next element after the node to restore to instead.
|
||||
if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
|
||||
walker.currentNode = nodeToRestore;
|
||||
// Skip over elements within the scope, in case the scope immediately follows the node to restore.
|
||||
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef));
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
||||
else // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)
|
||||
// then move focus to the body.
|
||||
// Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)
|
||||
if (!$9bf71ea28793e738$var$isElementInAnyScope(nodeToRestore)) focusedElement.blur();
|
||||
else $9bf71ea28793e738$var$focusElement(nodeToRestore, true);
|
||||
}
|
||||
};
|
||||
if (!contain) ownerDocument.addEventListener('keydown', onKeyDown, true);
|
||||
return ()=>{
|
||||
if (!contain) ownerDocument.removeEventListener('keydown', onKeyDown, true);
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restoreFocus,
|
||||
contain
|
||||
]);
|
||||
// useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!restoreFocus) return;
|
||||
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
var _nodeToRestoreRef_current;
|
||||
treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : undefined;
|
||||
return ()=>{
|
||||
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
// if we already lost focus to the body and this was the active scope, then we should attempt to restore
|
||||
let activeElement = (0, $cgawC$getActiveElement)(ownerDocument);
|
||||
if (restoreFocus && nodeToRestore && (activeElement && $9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef) || activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
|
||||
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it
|
||||
let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone();
|
||||
requestAnimationFrame(()=>{
|
||||
// Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere
|
||||
if (ownerDocument.activeElement === ownerDocument.body) {
|
||||
// look up the tree starting with our scope to find a nodeToRestore still in the DOM
|
||||
let treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while(treeNode){
|
||||
if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {
|
||||
$9bf71ea28793e738$var$restoreFocusToElement(treeNode.nodeToRestore);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
// If no nodeToRestore was found, focus the first element in the nearest
|
||||
// ancestor scope that is still in the tree.
|
||||
treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while(treeNode){
|
||||
if (treeNode.scopeRef && treeNode.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(treeNode.scopeRef)) {
|
||||
let node = $9bf71ea28793e738$var$getFirstInScope(treeNode.scopeRef.current, true);
|
||||
$9bf71ea28793e738$var$restoreFocusToElement(node);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restoreFocus
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$restoreFocusToElement(node) {
|
||||
// Dispatch a custom event that parent elements can intercept to customize focus restoration.
|
||||
// For example, virtualized collection components reuse DOM elements, so the original element
|
||||
// might still exist in the DOM but representing a different item.
|
||||
if (node.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}))) $9bf71ea28793e738$var$focusElement(node);
|
||||
}
|
||||
function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
|
||||
let filter = (opts === null || opts === void 0 ? void 0 : opts.tabbable) ? (0, $cgawC$isTabbable) : (0, $cgawC$isFocusable);
|
||||
// Ensure that root is an Element or fall back appropriately
|
||||
let rootElement = (root === null || root === void 0 ? void 0 : root.nodeType) === Node.ELEMENT_NODE ? root : null;
|
||||
// Determine the document to use
|
||||
let doc = (0, $cgawC$getOwnerDocument)(rootElement);
|
||||
// Create a TreeWalker, ensuring the root is an Element or Document
|
||||
let walker = (0, $cgawC$createShadowTreeWalker)(doc, root || doc, NodeFilter.SHOW_ELEMENT, {
|
||||
acceptNode (node) {
|
||||
var _opts_from;
|
||||
// Skip nodes inside the starting node.
|
||||
if (opts === null || opts === void 0 ? void 0 : (_opts_from = opts.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node)) return NodeFilter.FILTER_REJECT;
|
||||
if (filter(node) && (0, $645f2e67b85a24c9$export$e989c0fffaa6b27a)(node) && (!scope || $9bf71ea28793e738$var$isElementInScope(node, scope)) && (!(opts === null || opts === void 0 ? void 0 : opts.accept) || opts.accept(node))) return NodeFilter.FILTER_ACCEPT;
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
});
|
||||
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
|
||||
return walker;
|
||||
}
|
||||
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {}) {
|
||||
return {
|
||||
focusNext (opts = {}) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(root));
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
if (root.contains(node)) walker.currentNode = node;
|
||||
let nextNode = walker.nextNode();
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(root));
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
if (root.contains(node)) walker.currentNode = node;
|
||||
else {
|
||||
let next = $9bf71ea28793e738$var$last(walker);
|
||||
if (next) $9bf71ea28793e738$var$focusElement(next, true);
|
||||
return next !== null && next !== void 0 ? next : null;
|
||||
}
|
||||
let previousNode = walker.previousNode();
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
let lastNode = $9bf71ea28793e738$var$last(walker);
|
||||
if (!lastNode) // couldn't wrap
|
||||
return null;
|
||||
previousNode = lastNode;
|
||||
}
|
||||
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
||||
return previousNode !== null && previousNode !== void 0 ? previousNode : null;
|
||||
},
|
||||
focusFirst (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
let nextNode = walker.nextNode();
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusLast (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
let next = $9bf71ea28793e738$var$last(walker);
|
||||
if (next) $9bf71ea28793e738$var$focusElement(next, true);
|
||||
return next !== null && next !== void 0 ? next : null;
|
||||
}
|
||||
};
|
||||
}
|
||||
function $9bf71ea28793e738$var$last(walker) {
|
||||
let next = undefined;
|
||||
let last;
|
||||
do {
|
||||
last = walker.lastChild();
|
||||
if (last) next = last;
|
||||
}while (last);
|
||||
return next;
|
||||
}
|
||||
class $9bf71ea28793e738$var$Tree {
|
||||
get size() {
|
||||
return this.fastMap.size;
|
||||
}
|
||||
getTreeNode(data) {
|
||||
return this.fastMap.get(data);
|
||||
}
|
||||
addTreeNode(scopeRef, parent, nodeToRestore) {
|
||||
let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
|
||||
if (!parentNode) return;
|
||||
let node = new $9bf71ea28793e738$var$TreeNode({
|
||||
scopeRef: scopeRef
|
||||
});
|
||||
parentNode.addChild(node);
|
||||
node.parent = parentNode;
|
||||
this.fastMap.set(scopeRef, node);
|
||||
if (nodeToRestore) node.nodeToRestore = nodeToRestore;
|
||||
}
|
||||
addNode(node) {
|
||||
this.fastMap.set(node.scopeRef, node);
|
||||
}
|
||||
removeTreeNode(scopeRef) {
|
||||
// never remove the root
|
||||
if (scopeRef === null) return;
|
||||
let node = this.fastMap.get(scopeRef);
|
||||
if (!node) return;
|
||||
let parentNode = node.parent;
|
||||
// when we remove a scope, check if any sibling scopes are trying to restore focus to something inside the scope we're removing
|
||||
// if we are, then replace the siblings restore with the restore from the scope we're removing
|
||||
for (let current of this.traverse())if (current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef && node.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node.scopeRef.current)) current.nodeToRestore = node.nodeToRestore;
|
||||
let children = node.children;
|
||||
if (parentNode) {
|
||||
parentNode.removeChild(node);
|
||||
if (children.size > 0) children.forEach((child)=>parentNode && parentNode.addChild(child));
|
||||
}
|
||||
this.fastMap.delete(node.scopeRef);
|
||||
}
|
||||
// Pre Order Depth First
|
||||
*traverse(node = this.root) {
|
||||
if (node.scopeRef != null) yield node;
|
||||
if (node.children.size > 0) for (let child of node.children)yield* this.traverse(child);
|
||||
}
|
||||
clone() {
|
||||
var _node_parent;
|
||||
let newTree = new $9bf71ea28793e738$var$Tree();
|
||||
var _node_parent_scopeRef;
|
||||
for (let node of this.traverse())newTree.addTreeNode(node.scopeRef, (_node_parent_scopeRef = (_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node.nodeToRestore);
|
||||
return newTree;
|
||||
}
|
||||
constructor(){
|
||||
this.fastMap = new Map();
|
||||
this.root = new $9bf71ea28793e738$var$TreeNode({
|
||||
scopeRef: null
|
||||
});
|
||||
this.fastMap.set(null, this.root);
|
||||
}
|
||||
}
|
||||
class $9bf71ea28793e738$var$TreeNode {
|
||||
addChild(node) {
|
||||
this.children.add(node);
|
||||
node.parent = this;
|
||||
}
|
||||
removeChild(node) {
|
||||
this.children.delete(node);
|
||||
node.parent = undefined;
|
||||
}
|
||||
constructor(props){
|
||||
this.children = new Set();
|
||||
this.contain = false;
|
||||
this.scopeRef = props.scopeRef;
|
||||
}
|
||||
}
|
||||
let $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree();
|
||||
|
||||
|
||||
export {$9bf71ea28793e738$export$20e40289641fbbb6 as FocusScope, $9bf71ea28793e738$export$d06fae2ee68b101e as focusScopeTree, $9bf71ea28793e738$export$10c5169755ce7bd7 as useFocusManager, $9bf71ea28793e738$export$2d6ec8fc375ceafa as getFocusableTreeWalker, $9bf71ea28793e738$export$1258395f99bf9cbf as isElementInChildOfActiveScope, $9bf71ea28793e738$export$c5251b9e124bf29 as createFocusManager};
|
||||
//# sourceMappingURL=FocusScope.module.js.map
|
||||
726
node_modules/@react-aria/focus/dist/FocusScope.module.js
generated
vendored
Normal file
726
node_modules/@react-aria/focus/dist/FocusScope.module.js
generated
vendored
Normal file
@@ -0,0 +1,726 @@
|
||||
import {isElementVisible as $645f2e67b85a24c9$export$e989c0fffaa6b27a} from "./isElementVisible.module.js";
|
||||
import {useLayoutEffect as $cgawC$useLayoutEffect, getActiveElement as $cgawC$getActiveElement, getOwnerDocument as $cgawC$getOwnerDocument, getEventTarget as $cgawC$getEventTarget, isAndroid as $cgawC$isAndroid, isChrome as $cgawC$isChrome, isTabbable as $cgawC$isTabbable, isFocusable as $cgawC$isFocusable, createShadowTreeWalker as $cgawC$createShadowTreeWalker} from "@react-aria/utils";
|
||||
import {getInteractionModality as $cgawC$getInteractionModality, focusSafely as $cgawC$focusSafely} from "@react-aria/interactions";
|
||||
import $cgawC$react, {useRef as $cgawC$useRef, useContext as $cgawC$useContext, useMemo as $cgawC$useMemo, useEffect as $cgawC$useEffect} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const $9bf71ea28793e738$var$FocusContext = /*#__PURE__*/ (0, $cgawC$react).createContext(null);
|
||||
const $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT = 'react-aria-focus-scope-restore';
|
||||
let $9bf71ea28793e738$var$activeScope = null;
|
||||
function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
|
||||
let { children: children, contain: contain, restoreFocus: restoreFocus, autoFocus: autoFocus } = props;
|
||||
let startRef = (0, $cgawC$useRef)(null);
|
||||
let endRef = (0, $cgawC$useRef)(null);
|
||||
let scopeRef = (0, $cgawC$useRef)([]);
|
||||
let { parentNode: parentNode } = (0, $cgawC$useContext)($9bf71ea28793e738$var$FocusContext) || {};
|
||||
// Create a tree node here so we can add children to it even before it is added to the tree.
|
||||
let node = (0, $cgawC$useMemo)(()=>new $9bf71ea28793e738$var$TreeNode({
|
||||
scopeRef: scopeRef
|
||||
}), [
|
||||
scopeRef
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
// If a new scope mounts outside the active scope, (e.g. DialogContainer launched from a menu),
|
||||
// use the active scope as the parent instead of the parent from context. Layout effects run bottom
|
||||
// up, so if the parent is not yet added to the tree, don't do this. Only the outer-most FocusScope
|
||||
// that is being added should get the activeScope as its parent.
|
||||
let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e.root;
|
||||
if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope && !$9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, parent.scopeRef)) {
|
||||
let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
||||
if (activeNode) parent = activeNode;
|
||||
}
|
||||
// Add the node to the parent, and to the tree.
|
||||
parent.addChild(node);
|
||||
$9bf71ea28793e738$export$d06fae2ee68b101e.addNode(node);
|
||||
}, [
|
||||
node,
|
||||
parentNode
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
let node = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (node) node.contain = !!contain;
|
||||
}, [
|
||||
contain
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
var _startRef_current;
|
||||
// Find all rendered nodes between the sentinels and add them to the scope.
|
||||
let node = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
|
||||
let nodes = [];
|
||||
let stopPropagation = (e)=>e.stopPropagation();
|
||||
while(node && node !== endRef.current){
|
||||
nodes.push(node);
|
||||
// Stop custom restore focus event from propagating to parent focus scopes.
|
||||
node.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
node = node.nextSibling;
|
||||
}
|
||||
scopeRef.current = nodes;
|
||||
return ()=>{
|
||||
for (let node of nodes)node.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
};
|
||||
}, [
|
||||
children
|
||||
]);
|
||||
$9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
|
||||
$9bf71ea28793e738$var$useFocusContainment(scopeRef, contain);
|
||||
$9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain);
|
||||
$9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus);
|
||||
// This needs to be an effect so that activeScope is updated after the FocusScope tree is complete.
|
||||
// It cannot be a useLayoutEffect because the parent of this node hasn't been attached in the tree yet.
|
||||
(0, $cgawC$useEffect)(()=>{
|
||||
const activeElement = (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined));
|
||||
let scope = null;
|
||||
if ($9bf71ea28793e738$var$isElementInScope(activeElement, scopeRef.current)) {
|
||||
// We need to traverse the focusScope tree and find the bottom most scope that
|
||||
// contains the active element and set that as the activeScope.
|
||||
for (let node of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse())if (node.scopeRef && $9bf71ea28793e738$var$isElementInScope(activeElement, node.scopeRef.current)) scope = node;
|
||||
if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) $9bf71ea28793e738$var$activeScope = scope.scopeRef;
|
||||
}
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
// This layout effect cleanup is so that the tree node is removed synchronously with react before the RAF
|
||||
// in useRestoreFocus cleanup runs.
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
return ()=>{
|
||||
var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
|
||||
var _focusScopeTree_getTreeNode_parent_scopeRef;
|
||||
// Scope may have been re-parented.
|
||||
let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
|
||||
if ((scopeRef === $9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope(scopeRef, $9bf71ea28793e738$var$activeScope)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parentScope))) $9bf71ea28793e738$var$activeScope = parentScope;
|
||||
$9bf71ea28793e738$export$d06fae2ee68b101e.removeTreeNode(scopeRef);
|
||||
};
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
let focusManager = (0, $cgawC$useMemo)(()=>$9bf71ea28793e738$var$createFocusManagerForScope(scopeRef), []);
|
||||
let value = (0, $cgawC$useMemo)(()=>({
|
||||
focusManager: focusManager,
|
||||
parentNode: node
|
||||
}), [
|
||||
node,
|
||||
focusManager
|
||||
]);
|
||||
return /*#__PURE__*/ (0, $cgawC$react).createElement($9bf71ea28793e738$var$FocusContext.Provider, {
|
||||
value: value
|
||||
}, /*#__PURE__*/ (0, $cgawC$react).createElement("span", {
|
||||
"data-focus-scope-start": true,
|
||||
hidden: true,
|
||||
ref: startRef
|
||||
}), children, /*#__PURE__*/ (0, $cgawC$react).createElement("span", {
|
||||
"data-focus-scope-end": true,
|
||||
hidden: true,
|
||||
ref: endRef
|
||||
}));
|
||||
}
|
||||
function $9bf71ea28793e738$export$10c5169755ce7bd7() {
|
||||
var _useContext;
|
||||
return (_useContext = (0, $cgawC$useContext)($9bf71ea28793e738$var$FocusContext)) === null || _useContext === void 0 ? void 0 : _useContext.focusManager;
|
||||
}
|
||||
function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
||||
return {
|
||||
focusNext (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
|
||||
var _scope_;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : undefined));
|
||||
let sentinel = scope[0].previousElementSibling;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
|
||||
let nextNode = walker.nextNode();
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { from: from, tabbable: tabbable, wrap: wrap, accept: accept } = opts;
|
||||
var _scope_;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : undefined));
|
||||
let sentinel = scope[scope.length - 1].nextElementSibling;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
|
||||
let previousNode = walker.previousNode();
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
previousNode = walker.previousNode();
|
||||
}
|
||||
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
||||
return previousNode;
|
||||
},
|
||||
focusFirst (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { tabbable: tabbable, accept: accept } = opts;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = scope[0].previousElementSibling;
|
||||
let nextNode = walker.nextNode();
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusLast (opts = {}) {
|
||||
let scope = scopeRef.current;
|
||||
let { tabbable: tabbable, accept: accept } = opts;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
}, scope);
|
||||
walker.currentNode = scope[scope.length - 1].nextElementSibling;
|
||||
let previousNode = walker.previousNode();
|
||||
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
||||
return previousNode;
|
||||
}
|
||||
};
|
||||
}
|
||||
function $9bf71ea28793e738$var$getScopeRoot(scope) {
|
||||
return scope[0].parentElement;
|
||||
}
|
||||
function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
|
||||
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
||||
while(scope && scope.scopeRef !== scopeRef){
|
||||
if (scope.contain) return false;
|
||||
scope = scope.parent;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
||||
let focusedNode = (0, $cgawC$useRef)(undefined);
|
||||
let raf = (0, $cgawC$useRef)(undefined);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
let scope = scopeRef.current;
|
||||
if (!contain) {
|
||||
// if contain was changed, then we should cancel any ongoing waits to pull focus back into containment
|
||||
if (raf.current) {
|
||||
cancelAnimationFrame(raf.current);
|
||||
raf.current = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
// Handle the Tab key to contain focus within the scope
|
||||
let onKeyDown = (e)=>{
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
||||
let focusedElement = (0, $cgawC$getActiveElement)(ownerDocument);
|
||||
let scope = scopeRef.current;
|
||||
if (!scope || !$9bf71ea28793e738$var$isElementInScope(focusedElement, scope)) return;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: true
|
||||
}, scope);
|
||||
if (!focusedElement) return;
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
if (!nextElement) {
|
||||
walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;
|
||||
nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
}
|
||||
e.preventDefault();
|
||||
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
||||
};
|
||||
let onFocus = (e)=>{
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope((0, $cgawC$getEventTarget)(e), scopeRef.current)) {
|
||||
$9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
focusedNode.current = (0, $cgawC$getEventTarget)(e);
|
||||
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope((0, $cgawC$getEventTarget)(e), scopeRef)) {
|
||||
// If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),
|
||||
// restore focus to the previously focused node or the first tabbable element in the active scope.
|
||||
if (focusedNode.current) focusedNode.current.focus();
|
||||
else if ($9bf71ea28793e738$var$activeScope && $9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
|
||||
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef)) focusedNode.current = (0, $cgawC$getEventTarget)(e);
|
||||
};
|
||||
let onBlur = (e)=>{
|
||||
// Firefox doesn't shift focus back to the Dialog properly without this
|
||||
if (raf.current) cancelAnimationFrame(raf.current);
|
||||
raf.current = requestAnimationFrame(()=>{
|
||||
// Patches infinite focus coersion loop for Android Talkback where the user isn't able to move the virtual cursor
|
||||
// if within a containing focus scope. Bug filed against Chrome: https://issuetracker.google.com/issues/384844019.
|
||||
// Note that this means focus can leave focus containing modals due to this, but it is isolated to Chrome Talkback.
|
||||
let modality = (0, $cgawC$getInteractionModality)();
|
||||
let shouldSkipFocusRestore = (modality === 'virtual' || modality === null) && (0, $cgawC$isAndroid)() && (0, $cgawC$isChrome)();
|
||||
// Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe
|
||||
let activeElement = (0, $cgawC$getActiveElement)(ownerDocument);
|
||||
if (!shouldSkipFocusRestore && activeElement && $9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef)) {
|
||||
$9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
let target = (0, $cgawC$getEventTarget)(e);
|
||||
if (target && target.isConnected) {
|
||||
var _focusedNode_current;
|
||||
focusedNode.current = target;
|
||||
(_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
|
||||
} else if ($9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
|
||||
}
|
||||
});
|
||||
};
|
||||
ownerDocument.addEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusout', onBlur, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusout', onBlur, false));
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
contain
|
||||
]);
|
||||
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
return ()=>{
|
||||
if (raf.current) cancelAnimationFrame(raf.current);
|
||||
};
|
||||
}, [
|
||||
raf
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$isElementInAnyScope(element) {
|
||||
return $9bf71ea28793e738$var$isElementInChildScope(element);
|
||||
}
|
||||
function $9bf71ea28793e738$var$isElementInScope(element, scope) {
|
||||
if (!element) return false;
|
||||
if (!scope) return false;
|
||||
return scope.some((node)=>node.contains(element));
|
||||
}
|
||||
function $9bf71ea28793e738$var$isElementInChildScope(element, scope = null) {
|
||||
// If the element is within a top layer element (e.g. toasts), always allow moving focus there.
|
||||
if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) return true;
|
||||
// node.contains in isElementInScope covers child scopes that are also DOM children,
|
||||
// but does not cover child scopes in portals.
|
||||
for (let { scopeRef: s } of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope))){
|
||||
if (s && $9bf71ea28793e738$var$isElementInScope(element, s.current)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function $9bf71ea28793e738$export$1258395f99bf9cbf(element) {
|
||||
return $9bf71ea28793e738$var$isElementInChildScope(element, $9bf71ea28793e738$var$activeScope);
|
||||
}
|
||||
function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
|
||||
var _focusScopeTree_getTreeNode;
|
||||
let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
|
||||
while(parent){
|
||||
if (parent.scopeRef === ancestor) return true;
|
||||
parent = parent.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function $9bf71ea28793e738$var$focusElement(element, scroll = false) {
|
||||
if (element != null && !scroll) try {
|
||||
(0, $cgawC$focusSafely)(element);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
else if (element != null) try {
|
||||
element.focus();
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
function $9bf71ea28793e738$var$getFirstInScope(scope, tabbable = true) {
|
||||
let sentinel = scope[0].previousElementSibling;
|
||||
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: tabbable
|
||||
}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
let nextNode = walker.nextNode();
|
||||
// If the scope does not contain a tabbable element, use the first focusable element.
|
||||
if (tabbable && !nextNode) {
|
||||
scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
||||
walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, {
|
||||
tabbable: false
|
||||
}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
return nextNode;
|
||||
}
|
||||
function $9bf71ea28793e738$var$focusFirstInScope(scope, tabbable = true) {
|
||||
$9bf71ea28793e738$var$focusElement($9bf71ea28793e738$var$getFirstInScope(scope, tabbable));
|
||||
}
|
||||
function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
|
||||
const autoFocusRef = (0, $cgawC$react).useRef(autoFocus);
|
||||
(0, $cgawC$useEffect)(()=>{
|
||||
if (autoFocusRef.current) {
|
||||
$9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!$9bf71ea28793e738$var$isElementInScope((0, $cgawC$getActiveElement)(ownerDocument), $9bf71ea28793e738$var$activeScope.current) && scopeRef.current) $9bf71ea28793e738$var$focusFirstInScope(scopeRef.current);
|
||||
}
|
||||
autoFocusRef.current = false;
|
||||
}, [
|
||||
scopeRef
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain) {
|
||||
// tracks the active scope, in case restore and contain are both false.
|
||||
// if either are true, this is tracked in useRestoreFocus or useFocusContainment.
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
if (restore || contain) return;
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
let onFocus = (e)=>{
|
||||
let target = (0, $cgawC$getEventTarget)(e);
|
||||
if ($9bf71ea28793e738$var$isElementInScope(target, scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
else if (!$9bf71ea28793e738$var$isElementInAnyScope(target)) $9bf71ea28793e738$var$activeScope = null;
|
||||
};
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restore,
|
||||
contain
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef) {
|
||||
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
||||
while(scope && scope.scopeRef !== scopeRef){
|
||||
if (scope.nodeToRestore) return false;
|
||||
scope = scope.parent;
|
||||
}
|
||||
return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
|
||||
}
|
||||
function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
|
||||
// create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
const nodeToRestoreRef = (0, $cgawC$useRef)(typeof document !== 'undefined' ? (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined)) : null);
|
||||
// restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus
|
||||
// restoring-non-containing scopes should only care if they become active so they can perform the restore
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scope ? scope[0] : undefined);
|
||||
if (!restoreFocus || contain) return;
|
||||
let onFocus = ()=>{
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope((0, $cgawC$getActiveElement)(ownerDocument), scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
||||
};
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.addEventListener('focusin', onFocus, false));
|
||||
return ()=>{
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope === null || scope === void 0 ? void 0 : scope.forEach((element)=>element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [
|
||||
scopeRef,
|
||||
contain
|
||||
]);
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!restoreFocus) return;
|
||||
// Handle the Tab key so that tabbing out of the scope goes to the next element
|
||||
// after the node that had focus when the scope mounted. This is important when
|
||||
// using portals for overlays, so that focus goes to the expected element when
|
||||
// tabbing out of the overlay.
|
||||
let onKeyDown = (e)=>{
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
||||
let focusedElement = ownerDocument.activeElement;
|
||||
if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef)) return;
|
||||
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
// Create a DOM tree walker that matches all tabbable elements
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ownerDocument.body, {
|
||||
tabbable: true
|
||||
});
|
||||
// Find the next tabbable element after the currently focused element
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
|
||||
nodeToRestore = undefined;
|
||||
treeNode.nodeToRestore = undefined;
|
||||
}
|
||||
// If there is no next element, or it is outside the current scope, move focus to the
|
||||
// next element after the node to restore to instead.
|
||||
if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
|
||||
walker.currentNode = nodeToRestore;
|
||||
// Skip over elements within the scope, in case the scope immediately follows the node to restore.
|
||||
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
||||
while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef));
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
||||
else // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)
|
||||
// then move focus to the body.
|
||||
// Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)
|
||||
if (!$9bf71ea28793e738$var$isElementInAnyScope(nodeToRestore)) focusedElement.blur();
|
||||
else $9bf71ea28793e738$var$focusElement(nodeToRestore, true);
|
||||
}
|
||||
};
|
||||
if (!contain) ownerDocument.addEventListener('keydown', onKeyDown, true);
|
||||
return ()=>{
|
||||
if (!contain) ownerDocument.removeEventListener('keydown', onKeyDown, true);
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restoreFocus,
|
||||
contain
|
||||
]);
|
||||
// useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.
|
||||
(0, $cgawC$useLayoutEffect)(()=>{
|
||||
const ownerDocument = (0, $cgawC$getOwnerDocument)(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!restoreFocus) return;
|
||||
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
var _nodeToRestoreRef_current;
|
||||
treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : undefined;
|
||||
return ()=>{
|
||||
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
||||
if (!treeNode) return;
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
// if we already lost focus to the body and this was the active scope, then we should attempt to restore
|
||||
let activeElement = (0, $cgawC$getActiveElement)(ownerDocument);
|
||||
if (restoreFocus && nodeToRestore && (activeElement && $9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef) || activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
|
||||
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it
|
||||
let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone();
|
||||
requestAnimationFrame(()=>{
|
||||
// Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere
|
||||
if (ownerDocument.activeElement === ownerDocument.body) {
|
||||
// look up the tree starting with our scope to find a nodeToRestore still in the DOM
|
||||
let treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while(treeNode){
|
||||
if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {
|
||||
$9bf71ea28793e738$var$restoreFocusToElement(treeNode.nodeToRestore);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
// If no nodeToRestore was found, focus the first element in the nearest
|
||||
// ancestor scope that is still in the tree.
|
||||
treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while(treeNode){
|
||||
if (treeNode.scopeRef && treeNode.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(treeNode.scopeRef)) {
|
||||
let node = $9bf71ea28793e738$var$getFirstInScope(treeNode.scopeRef.current, true);
|
||||
$9bf71ea28793e738$var$restoreFocusToElement(node);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [
|
||||
scopeRef,
|
||||
restoreFocus
|
||||
]);
|
||||
}
|
||||
function $9bf71ea28793e738$var$restoreFocusToElement(node) {
|
||||
// Dispatch a custom event that parent elements can intercept to customize focus restoration.
|
||||
// For example, virtualized collection components reuse DOM elements, so the original element
|
||||
// might still exist in the DOM but representing a different item.
|
||||
if (node.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}))) $9bf71ea28793e738$var$focusElement(node);
|
||||
}
|
||||
function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
|
||||
let filter = (opts === null || opts === void 0 ? void 0 : opts.tabbable) ? (0, $cgawC$isTabbable) : (0, $cgawC$isFocusable);
|
||||
// Ensure that root is an Element or fall back appropriately
|
||||
let rootElement = (root === null || root === void 0 ? void 0 : root.nodeType) === Node.ELEMENT_NODE ? root : null;
|
||||
// Determine the document to use
|
||||
let doc = (0, $cgawC$getOwnerDocument)(rootElement);
|
||||
// Create a TreeWalker, ensuring the root is an Element or Document
|
||||
let walker = (0, $cgawC$createShadowTreeWalker)(doc, root || doc, NodeFilter.SHOW_ELEMENT, {
|
||||
acceptNode (node) {
|
||||
var _opts_from;
|
||||
// Skip nodes inside the starting node.
|
||||
if (opts === null || opts === void 0 ? void 0 : (_opts_from = opts.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node)) return NodeFilter.FILTER_REJECT;
|
||||
if (filter(node) && (0, $645f2e67b85a24c9$export$e989c0fffaa6b27a)(node) && (!scope || $9bf71ea28793e738$var$isElementInScope(node, scope)) && (!(opts === null || opts === void 0 ? void 0 : opts.accept) || opts.accept(node))) return NodeFilter.FILTER_ACCEPT;
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
});
|
||||
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
|
||||
return walker;
|
||||
}
|
||||
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {}) {
|
||||
return {
|
||||
focusNext (opts = {}) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(root));
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
if (root.contains(node)) walker.currentNode = node;
|
||||
let nextNode = walker.nextNode();
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { from: from, tabbable: tabbable = defaultOptions.tabbable, wrap: wrap = defaultOptions.wrap, accept: accept = defaultOptions.accept } = opts;
|
||||
let node = from || (0, $cgawC$getActiveElement)((0, $cgawC$getOwnerDocument)(root));
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
if (root.contains(node)) walker.currentNode = node;
|
||||
else {
|
||||
let next = $9bf71ea28793e738$var$last(walker);
|
||||
if (next) $9bf71ea28793e738$var$focusElement(next, true);
|
||||
return next !== null && next !== void 0 ? next : null;
|
||||
}
|
||||
let previousNode = walker.previousNode();
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
let lastNode = $9bf71ea28793e738$var$last(walker);
|
||||
if (!lastNode) // couldn't wrap
|
||||
return null;
|
||||
previousNode = lastNode;
|
||||
}
|
||||
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
||||
return previousNode !== null && previousNode !== void 0 ? previousNode : null;
|
||||
},
|
||||
focusFirst (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
let nextNode = walker.nextNode();
|
||||
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
||||
return nextNode;
|
||||
},
|
||||
focusLast (opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) return null;
|
||||
let { tabbable: tabbable = defaultOptions.tabbable, accept: accept = defaultOptions.accept } = opts;
|
||||
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
||||
tabbable: tabbable,
|
||||
accept: accept
|
||||
});
|
||||
let next = $9bf71ea28793e738$var$last(walker);
|
||||
if (next) $9bf71ea28793e738$var$focusElement(next, true);
|
||||
return next !== null && next !== void 0 ? next : null;
|
||||
}
|
||||
};
|
||||
}
|
||||
function $9bf71ea28793e738$var$last(walker) {
|
||||
let next = undefined;
|
||||
let last;
|
||||
do {
|
||||
last = walker.lastChild();
|
||||
if (last) next = last;
|
||||
}while (last);
|
||||
return next;
|
||||
}
|
||||
class $9bf71ea28793e738$var$Tree {
|
||||
get size() {
|
||||
return this.fastMap.size;
|
||||
}
|
||||
getTreeNode(data) {
|
||||
return this.fastMap.get(data);
|
||||
}
|
||||
addTreeNode(scopeRef, parent, nodeToRestore) {
|
||||
let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
|
||||
if (!parentNode) return;
|
||||
let node = new $9bf71ea28793e738$var$TreeNode({
|
||||
scopeRef: scopeRef
|
||||
});
|
||||
parentNode.addChild(node);
|
||||
node.parent = parentNode;
|
||||
this.fastMap.set(scopeRef, node);
|
||||
if (nodeToRestore) node.nodeToRestore = nodeToRestore;
|
||||
}
|
||||
addNode(node) {
|
||||
this.fastMap.set(node.scopeRef, node);
|
||||
}
|
||||
removeTreeNode(scopeRef) {
|
||||
// never remove the root
|
||||
if (scopeRef === null) return;
|
||||
let node = this.fastMap.get(scopeRef);
|
||||
if (!node) return;
|
||||
let parentNode = node.parent;
|
||||
// when we remove a scope, check if any sibling scopes are trying to restore focus to something inside the scope we're removing
|
||||
// if we are, then replace the siblings restore with the restore from the scope we're removing
|
||||
for (let current of this.traverse())if (current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef && node.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node.scopeRef.current)) current.nodeToRestore = node.nodeToRestore;
|
||||
let children = node.children;
|
||||
if (parentNode) {
|
||||
parentNode.removeChild(node);
|
||||
if (children.size > 0) children.forEach((child)=>parentNode && parentNode.addChild(child));
|
||||
}
|
||||
this.fastMap.delete(node.scopeRef);
|
||||
}
|
||||
// Pre Order Depth First
|
||||
*traverse(node = this.root) {
|
||||
if (node.scopeRef != null) yield node;
|
||||
if (node.children.size > 0) for (let child of node.children)yield* this.traverse(child);
|
||||
}
|
||||
clone() {
|
||||
var _node_parent;
|
||||
let newTree = new $9bf71ea28793e738$var$Tree();
|
||||
var _node_parent_scopeRef;
|
||||
for (let node of this.traverse())newTree.addTreeNode(node.scopeRef, (_node_parent_scopeRef = (_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node.nodeToRestore);
|
||||
return newTree;
|
||||
}
|
||||
constructor(){
|
||||
this.fastMap = new Map();
|
||||
this.root = new $9bf71ea28793e738$var$TreeNode({
|
||||
scopeRef: null
|
||||
});
|
||||
this.fastMap.set(null, this.root);
|
||||
}
|
||||
}
|
||||
class $9bf71ea28793e738$var$TreeNode {
|
||||
addChild(node) {
|
||||
this.children.add(node);
|
||||
node.parent = this;
|
||||
}
|
||||
removeChild(node) {
|
||||
this.children.delete(node);
|
||||
node.parent = undefined;
|
||||
}
|
||||
constructor(props){
|
||||
this.children = new Set();
|
||||
this.contain = false;
|
||||
this.scopeRef = props.scopeRef;
|
||||
}
|
||||
}
|
||||
let $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree();
|
||||
|
||||
|
||||
export {$9bf71ea28793e738$export$20e40289641fbbb6 as FocusScope, $9bf71ea28793e738$export$d06fae2ee68b101e as focusScopeTree, $9bf71ea28793e738$export$10c5169755ce7bd7 as useFocusManager, $9bf71ea28793e738$export$2d6ec8fc375ceafa as getFocusableTreeWalker, $9bf71ea28793e738$export$1258395f99bf9cbf as isElementInChildOfActiveScope, $9bf71ea28793e738$export$c5251b9e124bf29 as createFocusManager};
|
||||
//# sourceMappingURL=FocusScope.module.js.map
|
||||
1
node_modules/@react-aria/focus/dist/FocusScope.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/FocusScope.module.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
29
node_modules/@react-aria/focus/dist/import.mjs
generated
vendored
Normal file
29
node_modules/@react-aria/focus/dist/import.mjs
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import {createFocusManager as $9bf71ea28793e738$export$c5251b9e124bf29, FocusScope as $9bf71ea28793e738$export$20e40289641fbbb6, getFocusableTreeWalker as $9bf71ea28793e738$export$2d6ec8fc375ceafa, isElementInChildOfActiveScope as $9bf71ea28793e738$export$1258395f99bf9cbf, useFocusManager as $9bf71ea28793e738$export$10c5169755ce7bd7} from "./FocusScope.mjs";
|
||||
import {FocusRing as $907718708eab68af$export$1a38b4ad7f578e1d} from "./FocusRing.mjs";
|
||||
import {useFocusRing as $f7dceffc5ad7768b$export$4e328f61c538687f} from "./useFocusRing.mjs";
|
||||
import {useHasTabbableChild as $83013635b024ae3d$export$eac1895992b9f3d6} from "./useHasTabbableChild.mjs";
|
||||
import {dispatchVirtualBlur as $55f9b1ae81f22853$export$6c5dc7e81d2cc29a, dispatchVirtualFocus as $55f9b1ae81f22853$export$2b35b76d2e30e129, getVirtuallyFocusedElement as $55f9b1ae81f22853$export$759df0d867455a91, moveVirtualFocus as $55f9b1ae81f22853$export$76e4e37e5339496d} from "./virtualFocus.mjs";
|
||||
import {isFocusable as $d48f97c9d1a8e323$re_export$isFocusable} from "@react-aria/utils";
|
||||
import {FocusableProvider as $d48f97c9d1a8e323$re_export$FocusableProvider, Focusable as $d48f97c9d1a8e323$re_export$Focusable, useFocusable as $d48f97c9d1a8e323$re_export$useFocusable, focusSafely as $d48f97c9d1a8e323$re_export$focusSafely} from "@react-aria/interactions";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export {$9bf71ea28793e738$export$20e40289641fbbb6 as FocusScope, $9bf71ea28793e738$export$10c5169755ce7bd7 as useFocusManager, $9bf71ea28793e738$export$2d6ec8fc375ceafa as getFocusableTreeWalker, $9bf71ea28793e738$export$c5251b9e124bf29 as createFocusManager, $9bf71ea28793e738$export$1258395f99bf9cbf as isElementInChildOfActiveScope, $907718708eab68af$export$1a38b4ad7f578e1d as FocusRing, $f7dceffc5ad7768b$export$4e328f61c538687f as useFocusRing, $83013635b024ae3d$export$eac1895992b9f3d6 as useHasTabbableChild, $55f9b1ae81f22853$export$76e4e37e5339496d as moveVirtualFocus, $55f9b1ae81f22853$export$6c5dc7e81d2cc29a as dispatchVirtualBlur, $55f9b1ae81f22853$export$2b35b76d2e30e129 as dispatchVirtualFocus, $55f9b1ae81f22853$export$759df0d867455a91 as getVirtuallyFocusedElement, $d48f97c9d1a8e323$re_export$isFocusable as isFocusable, $d48f97c9d1a8e323$re_export$FocusableProvider as FocusableProvider, $d48f97c9d1a8e323$re_export$Focusable as Focusable, $d48f97c9d1a8e323$re_export$useFocusable as useFocusable, $d48f97c9d1a8e323$re_export$focusSafely as focusSafely};
|
||||
//# sourceMappingURL=module.js.map
|
||||
41
node_modules/@react-aria/focus/dist/isElementVisible.main.js
generated
vendored
Normal file
41
node_modules/@react-aria/focus/dist/isElementVisible.main.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
var $fhpU6$reactariautils = require("@react-aria/utils");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "isElementVisible", () => $d5156037ad898a4d$export$e989c0fffaa6b27a);
|
||||
/*
|
||||
* Copyright 2021 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
function $d5156037ad898a4d$var$isStyleVisible(element) {
|
||||
const windowObject = (0, $fhpU6$reactariautils.getOwnerWindow)(element);
|
||||
if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return false;
|
||||
let { display: display, visibility: visibility } = element.style;
|
||||
let isVisible = display !== 'none' && visibility !== 'hidden' && visibility !== 'collapse';
|
||||
if (isVisible) {
|
||||
const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
|
||||
let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);
|
||||
isVisible = computedDisplay !== 'none' && computedVisibility !== 'hidden' && computedVisibility !== 'collapse';
|
||||
}
|
||||
return isVisible;
|
||||
}
|
||||
function $d5156037ad898a4d$var$isAttributeVisible(element, childElement) {
|
||||
return !element.hasAttribute('hidden') && // Ignore HiddenSelect when tree walking.
|
||||
!element.hasAttribute('data-react-aria-prevent-focus') && (element.nodeName === 'DETAILS' && childElement && childElement.nodeName !== 'SUMMARY' ? element.hasAttribute('open') : true);
|
||||
}
|
||||
function $d5156037ad898a4d$export$e989c0fffaa6b27a(element, childElement) {
|
||||
return element.nodeName !== '#comment' && $d5156037ad898a4d$var$isStyleVisible(element) && $d5156037ad898a4d$var$isAttributeVisible(element, childElement) && (!element.parentElement || $d5156037ad898a4d$export$e989c0fffaa6b27a(element.parentElement, element));
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=isElementVisible.main.js.map
|
||||
1
node_modules/@react-aria/focus/dist/isElementVisible.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/isElementVisible.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAID,SAAS,qCAAe,OAAgB;IACtC,MAAM,eAAe,CAAA,GAAA,oCAAa,EAAE;IACpC,IAAI,CAAE,CAAA,mBAAmB,aAAa,WAAW,AAAD,KAAM,CAAE,CAAA,mBAAmB,aAAa,UAAU,AAAD,GAC/F,OAAO;IAGT,IAAI,WAAC,OAAO,cAAE,UAAU,EAAC,GAAG,QAAQ,KAAK;IAEzC,IAAI,YACF,YAAY,UACZ,eAAe,YACf,eAAe;IAGjB,IAAI,WAAW;QACb,MAAM,oBAAC,gBAAgB,EAAC,GAAG,QAAQ,aAAa,CAAC,WAAW;QAC5D,IAAI,EAAC,SAAS,eAAe,EAAE,YAAY,kBAAkB,EAAC,GAAG,iBAAiB;QAElF,YACE,oBAAoB,UACpB,uBAAuB,YACvB,uBAAuB;IAE3B;IAEA,OAAO;AACT;AAEA,SAAS,yCAAmB,OAAgB,EAAE,YAAsB;IAClE,OACE,CAAC,QAAQ,YAAY,CAAC,aACtB,yCAAyC;IACzC,CAAC,QAAQ,YAAY,CAAC,oCACrB,CAAA,QAAQ,QAAQ,KAAK,aACpB,gBACA,aAAa,QAAQ,KAAK,YACxB,QAAQ,YAAY,CAAC,UACrB,IAAG;AAEX;AAQO,SAAS,0CAAiB,OAAgB,EAAE,YAAsB;IACvE,OACE,QAAQ,QAAQ,KAAK,cACrB,qCAAe,YACf,yCAAmB,SAAS,iBAC3B,CAAA,CAAC,QAAQ,aAAa,IAAI,0CAAiB,QAAQ,aAAa,EAAE,QAAO;AAE9E","sources":["packages/@react-aria/focus/src/isElementVisible.ts"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getOwnerWindow} from '@react-aria/utils';\n\nfunction isStyleVisible(element: Element) {\n const windowObject = getOwnerWindow(element);\n if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView as unknown as Window;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n // Ignore HiddenSelect when tree walking.\n !element.hasAttribute('data-react-aria-prevent-focus') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and\n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */\nexport function isElementVisible(element: Element, childElement?: Element): boolean {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n"],"names":[],"version":3,"file":"isElementVisible.main.js.map"}
|
||||
36
node_modules/@react-aria/focus/dist/isElementVisible.mjs
generated
vendored
Normal file
36
node_modules/@react-aria/focus/dist/isElementVisible.mjs
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import {getOwnerWindow as $djhjW$getOwnerWindow} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2021 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
function $645f2e67b85a24c9$var$isStyleVisible(element) {
|
||||
const windowObject = (0, $djhjW$getOwnerWindow)(element);
|
||||
if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return false;
|
||||
let { display: display, visibility: visibility } = element.style;
|
||||
let isVisible = display !== 'none' && visibility !== 'hidden' && visibility !== 'collapse';
|
||||
if (isVisible) {
|
||||
const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
|
||||
let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);
|
||||
isVisible = computedDisplay !== 'none' && computedVisibility !== 'hidden' && computedVisibility !== 'collapse';
|
||||
}
|
||||
return isVisible;
|
||||
}
|
||||
function $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) {
|
||||
return !element.hasAttribute('hidden') && // Ignore HiddenSelect when tree walking.
|
||||
!element.hasAttribute('data-react-aria-prevent-focus') && (element.nodeName === 'DETAILS' && childElement && childElement.nodeName !== 'SUMMARY' ? element.hasAttribute('open') : true);
|
||||
}
|
||||
function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element, childElement) {
|
||||
return element.nodeName !== '#comment' && $645f2e67b85a24c9$var$isStyleVisible(element) && $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) && (!element.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element.parentElement, element));
|
||||
}
|
||||
|
||||
|
||||
export {$645f2e67b85a24c9$export$e989c0fffaa6b27a as isElementVisible};
|
||||
//# sourceMappingURL=isElementVisible.module.js.map
|
||||
36
node_modules/@react-aria/focus/dist/isElementVisible.module.js
generated
vendored
Normal file
36
node_modules/@react-aria/focus/dist/isElementVisible.module.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import {getOwnerWindow as $djhjW$getOwnerWindow} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2021 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
function $645f2e67b85a24c9$var$isStyleVisible(element) {
|
||||
const windowObject = (0, $djhjW$getOwnerWindow)(element);
|
||||
if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) return false;
|
||||
let { display: display, visibility: visibility } = element.style;
|
||||
let isVisible = display !== 'none' && visibility !== 'hidden' && visibility !== 'collapse';
|
||||
if (isVisible) {
|
||||
const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
|
||||
let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle(element);
|
||||
isVisible = computedDisplay !== 'none' && computedVisibility !== 'hidden' && computedVisibility !== 'collapse';
|
||||
}
|
||||
return isVisible;
|
||||
}
|
||||
function $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) {
|
||||
return !element.hasAttribute('hidden') && // Ignore HiddenSelect when tree walking.
|
||||
!element.hasAttribute('data-react-aria-prevent-focus') && (element.nodeName === 'DETAILS' && childElement && childElement.nodeName !== 'SUMMARY' ? element.hasAttribute('open') : true);
|
||||
}
|
||||
function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element, childElement) {
|
||||
return element.nodeName !== '#comment' && $645f2e67b85a24c9$var$isStyleVisible(element) && $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) && (!element.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element.parentElement, element));
|
||||
}
|
||||
|
||||
|
||||
export {$645f2e67b85a24c9$export$e989c0fffaa6b27a as isElementVisible};
|
||||
//# sourceMappingURL=isElementVisible.module.js.map
|
||||
1
node_modules/@react-aria/focus/dist/isElementVisible.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/isElementVisible.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAID,SAAS,qCAAe,OAAgB;IACtC,MAAM,eAAe,CAAA,GAAA,qBAAa,EAAE;IACpC,IAAI,CAAE,CAAA,mBAAmB,aAAa,WAAW,AAAD,KAAM,CAAE,CAAA,mBAAmB,aAAa,UAAU,AAAD,GAC/F,OAAO;IAGT,IAAI,WAAC,OAAO,cAAE,UAAU,EAAC,GAAG,QAAQ,KAAK;IAEzC,IAAI,YACF,YAAY,UACZ,eAAe,YACf,eAAe;IAGjB,IAAI,WAAW;QACb,MAAM,oBAAC,gBAAgB,EAAC,GAAG,QAAQ,aAAa,CAAC,WAAW;QAC5D,IAAI,EAAC,SAAS,eAAe,EAAE,YAAY,kBAAkB,EAAC,GAAG,iBAAiB;QAElF,YACE,oBAAoB,UACpB,uBAAuB,YACvB,uBAAuB;IAE3B;IAEA,OAAO;AACT;AAEA,SAAS,yCAAmB,OAAgB,EAAE,YAAsB;IAClE,OACE,CAAC,QAAQ,YAAY,CAAC,aACtB,yCAAyC;IACzC,CAAC,QAAQ,YAAY,CAAC,oCACrB,CAAA,QAAQ,QAAQ,KAAK,aACpB,gBACA,aAAa,QAAQ,KAAK,YACxB,QAAQ,YAAY,CAAC,UACrB,IAAG;AAEX;AAQO,SAAS,0CAAiB,OAAgB,EAAE,YAAsB;IACvE,OACE,QAAQ,QAAQ,KAAK,cACrB,qCAAe,YACf,yCAAmB,SAAS,iBAC3B,CAAA,CAAC,QAAQ,aAAa,IAAI,0CAAiB,QAAQ,aAAa,EAAE,QAAO;AAE9E","sources":["packages/@react-aria/focus/src/isElementVisible.ts"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getOwnerWindow} from '@react-aria/utils';\n\nfunction isStyleVisible(element: Element) {\n const windowObject = getOwnerWindow(element);\n if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView as unknown as Window;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n // Ignore HiddenSelect when tree walking.\n !element.hasAttribute('data-react-aria-prevent-focus') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and\n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */\nexport function isElementVisible(element: Element, childElement?: Element): boolean {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n"],"names":[],"version":3,"file":"isElementVisible.module.js.map"}
|
||||
50
node_modules/@react-aria/focus/dist/main.js
generated
vendored
Normal file
50
node_modules/@react-aria/focus/dist/main.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var $a7a032acae3ddda9$exports = require("./FocusScope.main.js");
|
||||
var $dfd8c70b928eb1b3$exports = require("./FocusRing.main.js");
|
||||
var $581a96d6eb128c1b$exports = require("./useFocusRing.main.js");
|
||||
var $259c6413a286f2e6$exports = require("./useHasTabbableChild.main.js");
|
||||
var $a756eb2d3b28d089$exports = require("./virtualFocus.main.js");
|
||||
var $aB6Cp$reactariautils = require("@react-aria/utils");
|
||||
var $aB6Cp$reactariainteractions = require("@react-aria/interactions");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "FocusScope", () => $a7a032acae3ddda9$exports.FocusScope);
|
||||
$parcel$export(module.exports, "useFocusManager", () => $a7a032acae3ddda9$exports.useFocusManager);
|
||||
$parcel$export(module.exports, "getFocusableTreeWalker", () => $a7a032acae3ddda9$exports.getFocusableTreeWalker);
|
||||
$parcel$export(module.exports, "createFocusManager", () => $a7a032acae3ddda9$exports.createFocusManager);
|
||||
$parcel$export(module.exports, "isElementInChildOfActiveScope", () => $a7a032acae3ddda9$exports.isElementInChildOfActiveScope);
|
||||
$parcel$export(module.exports, "FocusRing", () => $dfd8c70b928eb1b3$exports.FocusRing);
|
||||
$parcel$export(module.exports, "useFocusRing", () => $581a96d6eb128c1b$exports.useFocusRing);
|
||||
$parcel$export(module.exports, "useHasTabbableChild", () => $259c6413a286f2e6$exports.useHasTabbableChild);
|
||||
$parcel$export(module.exports, "moveVirtualFocus", () => $a756eb2d3b28d089$exports.moveVirtualFocus);
|
||||
$parcel$export(module.exports, "dispatchVirtualBlur", () => $a756eb2d3b28d089$exports.dispatchVirtualBlur);
|
||||
$parcel$export(module.exports, "dispatchVirtualFocus", () => $a756eb2d3b28d089$exports.dispatchVirtualFocus);
|
||||
$parcel$export(module.exports, "getVirtuallyFocusedElement", () => $a756eb2d3b28d089$exports.getVirtuallyFocusedElement);
|
||||
$parcel$export(module.exports, "isFocusable", () => $aB6Cp$reactariautils.isFocusable);
|
||||
$parcel$export(module.exports, "FocusableProvider", () => $aB6Cp$reactariainteractions.FocusableProvider);
|
||||
$parcel$export(module.exports, "Focusable", () => $aB6Cp$reactariainteractions.Focusable);
|
||||
$parcel$export(module.exports, "useFocusable", () => $aB6Cp$reactariainteractions.useFocusable);
|
||||
$parcel$export(module.exports, "focusSafely", () => $aB6Cp$reactariainteractions.focusSafely);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
node_modules/@react-aria/focus/dist/main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/focus/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\nexport {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager, isElementInChildOfActiveScope} from './FocusScope';\nexport {FocusRing} from './FocusRing';\nexport {useFocusRing} from './useFocusRing';\nexport {useHasTabbableChild} from './useHasTabbableChild';\nexport {moveVirtualFocus, dispatchVirtualBlur, dispatchVirtualFocus, getVirtuallyFocusedElement} from './virtualFocus';\n// For backward compatibility.\nexport {isFocusable} from '@react-aria/utils';\nexport {FocusableProvider, Focusable, useFocusable, focusSafely} from '@react-aria/interactions';\n\nexport type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';\nexport type {FocusRingProps} from './FocusRing';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from '@react-aria/interactions';\nexport type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';\n"],"names":[],"version":3,"file":"main.js.map"}
|
||||
29
node_modules/@react-aria/focus/dist/module.js
generated
vendored
Normal file
29
node_modules/@react-aria/focus/dist/module.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import {createFocusManager as $9bf71ea28793e738$export$c5251b9e124bf29, FocusScope as $9bf71ea28793e738$export$20e40289641fbbb6, getFocusableTreeWalker as $9bf71ea28793e738$export$2d6ec8fc375ceafa, isElementInChildOfActiveScope as $9bf71ea28793e738$export$1258395f99bf9cbf, useFocusManager as $9bf71ea28793e738$export$10c5169755ce7bd7} from "./FocusScope.module.js";
|
||||
import {FocusRing as $907718708eab68af$export$1a38b4ad7f578e1d} from "./FocusRing.module.js";
|
||||
import {useFocusRing as $f7dceffc5ad7768b$export$4e328f61c538687f} from "./useFocusRing.module.js";
|
||||
import {useHasTabbableChild as $83013635b024ae3d$export$eac1895992b9f3d6} from "./useHasTabbableChild.module.js";
|
||||
import {dispatchVirtualBlur as $55f9b1ae81f22853$export$6c5dc7e81d2cc29a, dispatchVirtualFocus as $55f9b1ae81f22853$export$2b35b76d2e30e129, getVirtuallyFocusedElement as $55f9b1ae81f22853$export$759df0d867455a91, moveVirtualFocus as $55f9b1ae81f22853$export$76e4e37e5339496d} from "./virtualFocus.module.js";
|
||||
import {isFocusable as $d48f97c9d1a8e323$re_export$isFocusable} from "@react-aria/utils";
|
||||
import {FocusableProvider as $d48f97c9d1a8e323$re_export$FocusableProvider, Focusable as $d48f97c9d1a8e323$re_export$Focusable, useFocusable as $d48f97c9d1a8e323$re_export$useFocusable, focusSafely as $d48f97c9d1a8e323$re_export$focusSafely} from "@react-aria/interactions";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export {$9bf71ea28793e738$export$20e40289641fbbb6 as FocusScope, $9bf71ea28793e738$export$10c5169755ce7bd7 as useFocusManager, $9bf71ea28793e738$export$2d6ec8fc375ceafa as getFocusableTreeWalker, $9bf71ea28793e738$export$c5251b9e124bf29 as createFocusManager, $9bf71ea28793e738$export$1258395f99bf9cbf as isElementInChildOfActiveScope, $907718708eab68af$export$1a38b4ad7f578e1d as FocusRing, $f7dceffc5ad7768b$export$4e328f61c538687f as useFocusRing, $83013635b024ae3d$export$eac1895992b9f3d6 as useHasTabbableChild, $55f9b1ae81f22853$export$76e4e37e5339496d as moveVirtualFocus, $55f9b1ae81f22853$export$6c5dc7e81d2cc29a as dispatchVirtualBlur, $55f9b1ae81f22853$export$2b35b76d2e30e129 as dispatchVirtualFocus, $55f9b1ae81f22853$export$759df0d867455a91 as getVirtuallyFocusedElement, $d48f97c9d1a8e323$re_export$isFocusable as isFocusable, $d48f97c9d1a8e323$re_export$FocusableProvider as FocusableProvider, $d48f97c9d1a8e323$re_export$Focusable as Focusable, $d48f97c9d1a8e323$re_export$useFocusable as useFocusable, $d48f97c9d1a8e323$re_export$focusSafely as focusSafely};
|
||||
//# sourceMappingURL=module.js.map
|
||||
1
node_modules/@react-aria/focus/dist/module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/focus/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\nexport {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager, isElementInChildOfActiveScope} from './FocusScope';\nexport {FocusRing} from './FocusRing';\nexport {useFocusRing} from './useFocusRing';\nexport {useHasTabbableChild} from './useHasTabbableChild';\nexport {moveVirtualFocus, dispatchVirtualBlur, dispatchVirtualFocus, getVirtuallyFocusedElement} from './virtualFocus';\n// For backward compatibility.\nexport {isFocusable} from '@react-aria/utils';\nexport {FocusableProvider, Focusable, useFocusable, focusSafely} from '@react-aria/interactions';\n\nexport type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';\nexport type {FocusRingProps} from './FocusRing';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from '@react-aria/interactions';\nexport type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';\n"],"names":[],"version":3,"file":"module.js.map"}
|
||||
133
node_modules/@react-aria/focus/dist/types.d.ts
generated
vendored
Normal file
133
node_modules/@react-aria/focus/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
import { ShadowTreeWalker } from "@react-aria/utils";
|
||||
import { FocusableElement, RefObject, DOMAttributes } from "@react-types/shared";
|
||||
import React, { JSX, ReactNode, ReactElement } from "react";
|
||||
export interface FocusScopeProps {
|
||||
/** The contents of the focus scope. */
|
||||
children: ReactNode;
|
||||
/**
|
||||
* Whether to contain focus inside the scope, so users cannot
|
||||
* move focus outside, for example in a modal dialog.
|
||||
*/
|
||||
contain?: boolean;
|
||||
/**
|
||||
* Whether to restore focus back to the element that was focused
|
||||
* when the focus scope mounted, after the focus scope unmounts.
|
||||
*/
|
||||
restoreFocus?: boolean;
|
||||
/** Whether to auto focus the first focusable element in the focus scope on mount. */
|
||||
autoFocus?: boolean;
|
||||
}
|
||||
export interface FocusManagerOptions {
|
||||
/** The element to start searching from. The currently focused element by default. */
|
||||
from?: Element;
|
||||
/** Whether to only include tabbable elements, or all focusable elements. */
|
||||
tabbable?: boolean;
|
||||
/** Whether focus should wrap around when it reaches the end of the scope. */
|
||||
wrap?: boolean;
|
||||
/** A callback that determines whether the given element is focused. */
|
||||
accept?: (node: Element) => boolean;
|
||||
}
|
||||
export interface FocusManager {
|
||||
/** Moves focus to the next focusable or tabbable element in the focus scope. */
|
||||
focusNext(opts?: FocusManagerOptions): FocusableElement | null;
|
||||
/** Moves focus to the previous focusable or tabbable element in the focus scope. */
|
||||
focusPrevious(opts?: FocusManagerOptions): FocusableElement | null;
|
||||
/** Moves focus to the first focusable or tabbable element in the focus scope. */
|
||||
focusFirst(opts?: FocusManagerOptions): FocusableElement | null;
|
||||
/** Moves focus to the last focusable or tabbable element in the focus scope. */
|
||||
focusLast(opts?: FocusManagerOptions): FocusableElement | null;
|
||||
}
|
||||
/**
|
||||
* A FocusScope manages focus for its descendants. It supports containing focus inside
|
||||
* the scope, restoring focus to the previously focused element on unmount, and auto
|
||||
* focusing children on mount. It also acts as a container for a programmatic focus
|
||||
* management interface that can be used to move focus forward and back in response
|
||||
* to user events.
|
||||
*/
|
||||
export function FocusScope(props: FocusScopeProps): JSX.Element;
|
||||
/**
|
||||
* Returns a FocusManager interface for the parent FocusScope.
|
||||
* A FocusManager can be used to programmatically move focus within
|
||||
* a FocusScope, e.g. in response to user events like keyboard navigation.
|
||||
*/
|
||||
export function useFocusManager(): FocusManager | undefined;
|
||||
/** @private */
|
||||
export function isElementInChildOfActiveScope(element: Element): boolean;
|
||||
/**
|
||||
* Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}
|
||||
* that matches all focusable/tabbable elements.
|
||||
*/
|
||||
export function getFocusableTreeWalker(root: Element, opts?: FocusManagerOptions, scope?: Element[]): ShadowTreeWalker | TreeWalker;
|
||||
/**
|
||||
* Creates a FocusManager object that can be used to move focus within an element.
|
||||
*/
|
||||
export function createFocusManager(ref: RefObject<Element | null>, defaultOptions?: FocusManagerOptions): FocusManager;
|
||||
export interface AriaFocusRingProps {
|
||||
/**
|
||||
* Whether to show the focus ring when something
|
||||
* inside the container element has focus (true), or
|
||||
* only if the container itself has focus (false).
|
||||
* @default 'false'
|
||||
*/
|
||||
within?: boolean;
|
||||
/** Whether the element is a text input. */
|
||||
isTextInput?: boolean;
|
||||
/** Whether the element will be auto focused. */
|
||||
autoFocus?: boolean;
|
||||
}
|
||||
export interface FocusRingAria {
|
||||
/** Whether the element is currently focused. */
|
||||
isFocused: boolean;
|
||||
/** Whether keyboard focus should be visible. */
|
||||
isFocusVisible: boolean;
|
||||
/** Props to apply to the container element with the focus ring. */
|
||||
focusProps: DOMAttributes;
|
||||
}
|
||||
/**
|
||||
* Determines whether a focus ring should be shown to indicate keyboard focus.
|
||||
* Focus rings are visible only when the user is interacting with a keyboard,
|
||||
* not with a mouse, touch, or other input methods.
|
||||
*/
|
||||
export function useFocusRing(props?: AriaFocusRingProps): FocusRingAria;
|
||||
export interface FocusRingProps {
|
||||
/** Child element to apply CSS classes to. */
|
||||
children: ReactElement;
|
||||
/** CSS class to apply when the element is focused. */
|
||||
focusClass?: string;
|
||||
/** CSS class to apply when the element has keyboard focus. */
|
||||
focusRingClass?: string;
|
||||
/**
|
||||
* Whether to show the focus ring when something
|
||||
* inside the container element has focus (true), or
|
||||
* only if the container itself has focus (false).
|
||||
* @default false
|
||||
*/
|
||||
within?: boolean;
|
||||
/** Whether the element is a text input. */
|
||||
isTextInput?: boolean;
|
||||
/** Whether the element will be auto focused. */
|
||||
autoFocus?: boolean;
|
||||
}
|
||||
/**
|
||||
* A utility component that applies a CSS class when an element has keyboard focus.
|
||||
* Focus rings are visible only when the user is interacting with a keyboard,
|
||||
* not with a mouse, touch, or other input methods.
|
||||
*/
|
||||
export function FocusRing(props: FocusRingProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
||||
interface AriaHasTabbableChildOptions {
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
/**
|
||||
* Returns whether an element has a tabbable child, and updates as children change.
|
||||
* @private
|
||||
*/
|
||||
export function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean;
|
||||
export function moveVirtualFocus(to: Element | null): void;
|
||||
export function dispatchVirtualBlur(from: Element, to: Element | null): void;
|
||||
export function dispatchVirtualFocus(to: Element, from: Element | null): void;
|
||||
export function getVirtuallyFocusedElement(document: Document): Element | null;
|
||||
export { isFocusable } from '@react-aria/utils';
|
||||
export { FocusableProvider, Focusable, useFocusable, focusSafely } from '@react-aria/interactions';
|
||||
export type { FocusableAria, FocusableOptions, FocusableProviderProps } from '@react-aria/interactions';
|
||||
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/@react-aria/focus/dist/types.d.ts.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/types.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;AC6BA;IACE,uCAAuC;IACvC,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,qFAAqF;IACrF,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;IACE,qFAAqF;IACrF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAA;CACpC;AAED;IACE,gFAAgF;IAChF,SAAS,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAC/D,oFAAoF;IACpF,aAAa,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,IAAI,CAAC;IACnE,iFAAiF;IACjF,UAAU,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,IAAI,CAAC;IAChE,gFAAgF;IAChF,SAAS,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,IAAI,CAAA;CAC/D;AAgBD;;;;;;GAMG;AACH,2BAA2B,KAAK,EAAE,eAAe,GAAG,IAAI,OAAO,CAgH9D;AAED;;;;GAIG;AACH,mCAAmC,YAAY,GAAG,SAAS,CAE1D;AAuOD,eAAe;AACf,8CAA8C,OAAO,EAAE,OAAO,GAAG,OAAO,CAEvE;AA+RD;;;GAGG;AACH,uCAAuC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,mBAAmB,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,gBAAgB,GAAG,UAAU,CAuClI;AAED;;GAEG;AACH,mCAAmC,GAAG,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,EAAE,cAAc,GAAE,mBAAwB,GAAG,YAAY,CAkFzH;AC51BD;IACE;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;IACE,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;IAEnB,gDAAgD;IAChD,cAAc,EAAE,OAAO,CAAC;IAExB,mEAAmE;IACnE,UAAU,EAAE,aAAa,CAAA;CAC1B;AAED;;;;GAIG;AACH,6BAA6B,KAAK,GAAE,kBAAuB,GAAG,aAAa,CAyC1E;AC5DD;IACE,6CAA6C;IAC7C,QAAQ,EAAE,YAAY,CAAC;IACvB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;GAIG;AACH,0BAA0B,KAAK,EAAE,cAAc,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAYvH;ACrCD;IACE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAOD;;;GAGG;AACH,oCAAoC,GAAG,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAmClH;AC/DD,iCAAiC,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAUzD;AAED,oCAAoC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAG3E;AAED,qCAAqC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAG5E;AAED,2CAA2C,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAQ7E;ACdD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAIjG,YAAY,EAAC,aAAa,EAAE,gBAAgB,EAAE,sBAAsB,EAAC,MAAM,0BAA0B,CAAC","sources":["packages/@react-aria/focus/src/packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/useHasTabbableChild.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/virtualFocus.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/index.ts","packages/@react-aria/focus/src/index.ts"],"sourcesContent":[null,null,null,null,null,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 {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager, isElementInChildOfActiveScope} from './FocusScope';\nexport {FocusRing} from './FocusRing';\nexport {useFocusRing} from './useFocusRing';\nexport {useHasTabbableChild} from './useHasTabbableChild';\nexport {moveVirtualFocus, dispatchVirtualBlur, dispatchVirtualFocus, getVirtuallyFocusedElement} from './virtualFocus';\n// For backward compatibility.\nexport {isFocusable} from '@react-aria/utils';\nexport {FocusableProvider, Focusable, useFocusable, focusSafely} from '@react-aria/interactions';\n\nexport type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';\nexport type {FocusRingProps} from './FocusRing';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from '@react-aria/interactions';\nexport type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
||||
50
node_modules/@react-aria/focus/dist/useFocusRing.main.js
generated
vendored
Normal file
50
node_modules/@react-aria/focus/dist/useFocusRing.main.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
var $7eRoM$reactariainteractions = require("@react-aria/interactions");
|
||||
var $7eRoM$react = require("react");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "useFocusRing", () => $581a96d6eb128c1b$export$4e328f61c538687f);
|
||||
|
||||
|
||||
function $581a96d6eb128c1b$export$4e328f61c538687f(props = {}) {
|
||||
let { autoFocus: autoFocus = false, isTextInput: isTextInput, within: within } = props;
|
||||
let state = (0, $7eRoM$react.useRef)({
|
||||
isFocused: false,
|
||||
isFocusVisible: autoFocus || (0, $7eRoM$reactariainteractions.isFocusVisible)()
|
||||
});
|
||||
let [isFocused, setFocused] = (0, $7eRoM$react.useState)(false);
|
||||
let [isFocusVisibleState, setFocusVisible] = (0, $7eRoM$react.useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
||||
let updateState = (0, $7eRoM$react.useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
||||
let onFocusChange = (0, $7eRoM$react.useCallback)((isFocused)=>{
|
||||
state.current.isFocused = isFocused;
|
||||
setFocused(isFocused);
|
||||
updateState();
|
||||
}, [
|
||||
updateState
|
||||
]);
|
||||
(0, $7eRoM$reactariainteractions.useFocusVisibleListener)((isFocusVisible)=>{
|
||||
state.current.isFocusVisible = isFocusVisible;
|
||||
updateState();
|
||||
}, [], {
|
||||
isTextInput: isTextInput
|
||||
});
|
||||
let { focusProps: focusProps } = (0, $7eRoM$reactariainteractions.useFocus)({
|
||||
isDisabled: within,
|
||||
onFocusChange: onFocusChange
|
||||
});
|
||||
let { focusWithinProps: focusWithinProps } = (0, $7eRoM$reactariainteractions.useFocusWithin)({
|
||||
isDisabled: !within,
|
||||
onFocusWithinChange: onFocusChange
|
||||
});
|
||||
return {
|
||||
isFocused: isFocused,
|
||||
isFocusVisible: isFocusVisibleState,
|
||||
focusProps: within ? focusWithinProps : focusProps
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=useFocusRing.main.js.map
|
||||
1
node_modules/@react-aria/focus/dist/useFocusRing.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/useFocusRing.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;AAoCO,SAAS,0CAAa,QAA4B,CAAC,CAAC;IACzD,IAAI,aACF,YAAY,oBACZ,WAAW,UACX,MAAM,EACP,GAAG;IACJ,IAAI,QAAQ,CAAA,GAAA,mBAAK,EAAE;QACjB,WAAW;QACX,gBAAgB,aAAa,CAAA,GAAA,2CAAa;IAC5C;IACA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,qBAAO,EAAE;IACvC,IAAI,CAAC,qBAAqB,gBAAgB,GAAG,CAAA,GAAA,qBAAO,EAAE,IAAM,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc;IAEnH,IAAI,cAAc,CAAA,GAAA,wBAAU,EAAE,IAAM,gBAAgB,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc,GAAG,EAAE;IAEhH,IAAI,gBAAgB,CAAA,GAAA,wBAAU,EAAE,CAAA;QAC9B,MAAM,OAAO,CAAC,SAAS,GAAG;QAC1B,WAAW;QACX;IACF,GAAG;QAAC;KAAY;IAEhB,CAAA,GAAA,oDAAsB,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,cAAc,GAAG;QAC/B;IACF,GAAG,EAAE,EAAE;qBAAC;IAAW;IAEnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,YAAY;uBACZ;IACF;IAEA,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB;IACvB;IAEA,OAAO;mBACL;QACA,gBAAgB;QAChB,YAAY,SAAS,mBAAmB;IAC1C;AACF","sources":["packages/@react-aria/focus/src/useFocusRing.ts"],"sourcesContent":["import {DOMAttributes} from '@react-types/shared';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useCallback, useRef, useState} from 'react';\n\nexport interface AriaFocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: DOMAttributes\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n"],"names":[],"version":3,"file":"useFocusRing.main.js.map"}
|
||||
45
node_modules/@react-aria/focus/dist/useFocusRing.mjs
generated
vendored
Normal file
45
node_modules/@react-aria/focus/dist/useFocusRing.mjs
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import {isFocusVisible as $isWE5$isFocusVisible, useFocusVisibleListener as $isWE5$useFocusVisibleListener, useFocus as $isWE5$useFocus, useFocusWithin as $isWE5$useFocusWithin} from "@react-aria/interactions";
|
||||
import {useRef as $isWE5$useRef, useState as $isWE5$useState, useCallback as $isWE5$useCallback} from "react";
|
||||
|
||||
|
||||
|
||||
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
|
||||
let { autoFocus: autoFocus = false, isTextInput: isTextInput, within: within } = props;
|
||||
let state = (0, $isWE5$useRef)({
|
||||
isFocused: false,
|
||||
isFocusVisible: autoFocus || (0, $isWE5$isFocusVisible)()
|
||||
});
|
||||
let [isFocused, setFocused] = (0, $isWE5$useState)(false);
|
||||
let [isFocusVisibleState, setFocusVisible] = (0, $isWE5$useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
||||
let updateState = (0, $isWE5$useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
||||
let onFocusChange = (0, $isWE5$useCallback)((isFocused)=>{
|
||||
state.current.isFocused = isFocused;
|
||||
setFocused(isFocused);
|
||||
updateState();
|
||||
}, [
|
||||
updateState
|
||||
]);
|
||||
(0, $isWE5$useFocusVisibleListener)((isFocusVisible)=>{
|
||||
state.current.isFocusVisible = isFocusVisible;
|
||||
updateState();
|
||||
}, [], {
|
||||
isTextInput: isTextInput
|
||||
});
|
||||
let { focusProps: focusProps } = (0, $isWE5$useFocus)({
|
||||
isDisabled: within,
|
||||
onFocusChange: onFocusChange
|
||||
});
|
||||
let { focusWithinProps: focusWithinProps } = (0, $isWE5$useFocusWithin)({
|
||||
isDisabled: !within,
|
||||
onFocusWithinChange: onFocusChange
|
||||
});
|
||||
return {
|
||||
isFocused: isFocused,
|
||||
isFocusVisible: isFocusVisibleState,
|
||||
focusProps: within ? focusWithinProps : focusProps
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$f7dceffc5ad7768b$export$4e328f61c538687f as useFocusRing};
|
||||
//# sourceMappingURL=useFocusRing.module.js.map
|
||||
45
node_modules/@react-aria/focus/dist/useFocusRing.module.js
generated
vendored
Normal file
45
node_modules/@react-aria/focus/dist/useFocusRing.module.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import {isFocusVisible as $isWE5$isFocusVisible, useFocusVisibleListener as $isWE5$useFocusVisibleListener, useFocus as $isWE5$useFocus, useFocusWithin as $isWE5$useFocusWithin} from "@react-aria/interactions";
|
||||
import {useRef as $isWE5$useRef, useState as $isWE5$useState, useCallback as $isWE5$useCallback} from "react";
|
||||
|
||||
|
||||
|
||||
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
|
||||
let { autoFocus: autoFocus = false, isTextInput: isTextInput, within: within } = props;
|
||||
let state = (0, $isWE5$useRef)({
|
||||
isFocused: false,
|
||||
isFocusVisible: autoFocus || (0, $isWE5$isFocusVisible)()
|
||||
});
|
||||
let [isFocused, setFocused] = (0, $isWE5$useState)(false);
|
||||
let [isFocusVisibleState, setFocusVisible] = (0, $isWE5$useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
||||
let updateState = (0, $isWE5$useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
||||
let onFocusChange = (0, $isWE5$useCallback)((isFocused)=>{
|
||||
state.current.isFocused = isFocused;
|
||||
setFocused(isFocused);
|
||||
updateState();
|
||||
}, [
|
||||
updateState
|
||||
]);
|
||||
(0, $isWE5$useFocusVisibleListener)((isFocusVisible)=>{
|
||||
state.current.isFocusVisible = isFocusVisible;
|
||||
updateState();
|
||||
}, [], {
|
||||
isTextInput: isTextInput
|
||||
});
|
||||
let { focusProps: focusProps } = (0, $isWE5$useFocus)({
|
||||
isDisabled: within,
|
||||
onFocusChange: onFocusChange
|
||||
});
|
||||
let { focusWithinProps: focusWithinProps } = (0, $isWE5$useFocusWithin)({
|
||||
isDisabled: !within,
|
||||
onFocusWithinChange: onFocusChange
|
||||
});
|
||||
return {
|
||||
isFocused: isFocused,
|
||||
isFocusVisible: isFocusVisibleState,
|
||||
focusProps: within ? focusWithinProps : focusProps
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$f7dceffc5ad7768b$export$4e328f61c538687f as useFocusRing};
|
||||
//# sourceMappingURL=useFocusRing.module.js.map
|
||||
1
node_modules/@react-aria/focus/dist/useFocusRing.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/useFocusRing.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;AAoCO,SAAS,0CAAa,QAA4B,CAAC,CAAC;IACzD,IAAI,aACF,YAAY,oBACZ,WAAW,UACX,MAAM,EACP,GAAG;IACJ,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;QACjB,WAAW;QACX,gBAAgB,aAAa,CAAA,GAAA,qBAAa;IAC5C;IACA,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,IAAI,CAAC,qBAAqB,gBAAgB,GAAG,CAAA,GAAA,eAAO,EAAE,IAAM,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc;IAEnH,IAAI,cAAc,CAAA,GAAA,kBAAU,EAAE,IAAM,gBAAgB,MAAM,OAAO,CAAC,SAAS,IAAI,MAAM,OAAO,CAAC,cAAc,GAAG,EAAE;IAEhH,IAAI,gBAAgB,CAAA,GAAA,kBAAU,EAAE,CAAA;QAC9B,MAAM,OAAO,CAAC,SAAS,GAAG;QAC1B,WAAW;QACX;IACF,GAAG;QAAC;KAAY;IAEhB,CAAA,GAAA,8BAAsB,EAAE,CAAC;QACvB,MAAM,OAAO,CAAC,cAAc,GAAG;QAC/B;IACF,GAAG,EAAE,EAAE;qBAAC;IAAW;IAEnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,YAAY;uBACZ;IACF;IAEA,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACtC,YAAY,CAAC;QACb,qBAAqB;IACvB;IAEA,OAAO;mBACL;QACA,gBAAgB;QAChB,YAAY,SAAS,mBAAmB;IAC1C;AACF","sources":["packages/@react-aria/focus/src/useFocusRing.ts"],"sourcesContent":["import {DOMAttributes} from '@react-types/shared';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useCallback, useRef, useState} from 'react';\n\nexport interface AriaFocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: DOMAttributes\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n"],"names":[],"version":3,"file":"useFocusRing.module.js.map"}
|
||||
62
node_modules/@react-aria/focus/dist/useHasTabbableChild.main.js
generated
vendored
Normal file
62
node_modules/@react-aria/focus/dist/useHasTabbableChild.main.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
var $a7a032acae3ddda9$exports = require("./FocusScope.main.js");
|
||||
var $6RLDH$reactariautils = require("@react-aria/utils");
|
||||
var $6RLDH$react = require("react");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "useHasTabbableChild", () => $259c6413a286f2e6$export$eac1895992b9f3d6);
|
||||
/*
|
||||
* Copyright 2022 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
function $259c6413a286f2e6$export$eac1895992b9f3d6(ref, options) {
|
||||
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
||||
let [hasTabbableChild, setHasTabbableChild] = (0, $6RLDH$react.useState)(false);
|
||||
(0, $6RLDH$reactariautils.useLayoutEffect)(()=>{
|
||||
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
|
||||
let update = ()=>{
|
||||
if (ref.current) {
|
||||
let walker = (0, $a7a032acae3ddda9$exports.getFocusableTreeWalker)(ref.current, {
|
||||
tabbable: true
|
||||
});
|
||||
setHasTabbableChild(!!walker.nextNode());
|
||||
}
|
||||
};
|
||||
update();
|
||||
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
||||
let observer = new MutationObserver(update);
|
||||
observer.observe(ref.current, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
attributes: true,
|
||||
attributeFilter: [
|
||||
'tabIndex',
|
||||
'disabled'
|
||||
]
|
||||
});
|
||||
return ()=>{
|
||||
// Disconnect mutation observer when a React update occurs on the top-level component
|
||||
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
||||
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
||||
// so we also update if a child component re-renders and adds/removes something tabbable.
|
||||
observer.disconnect();
|
||||
};
|
||||
}
|
||||
});
|
||||
return isDisabled ? false : hasTabbableChild;
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=useHasTabbableChild.main.js.map
|
||||
1
node_modules/@react-aria/focus/dist/useHasTabbableChild.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/useHasTabbableChild.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAoB,GAA8B,EAAE,OAAqC;IACvG,IAAI,aAAa,oBAAA,8BAAA,QAAS,UAAU;IACpC,IAAI,CAAC,kBAAkB,oBAAoB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAEvD,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,CAAA,gBAAA,0BAAA,IAAK,OAAO,KAAI,CAAC,YAAY;YAC/B,IAAI,SAAS;gBACX,IAAI,IAAI,OAAO,EAAE;oBACf,IAAI,SAAS,CAAA,GAAA,gDAAqB,EAAE,IAAI,OAAO,EAAE;wBAAC,UAAU;oBAAI;oBAChE,oBAAoB,CAAC,CAAC,OAAO,QAAQ;gBACvC;YACF;YAEA;YAEA,qFAAqF;YACrF,IAAI,WAAW,IAAI,iBAAiB;YACpC,SAAS,OAAO,CAAC,IAAI,OAAO,EAAE;gBAC5B,SAAS;gBACT,WAAW;gBACX,YAAY;gBACZ,iBAAiB;oBAAC;oBAAY;iBAAW;YAC3C;YAEA,OAAO;gBACL,qFAAqF;gBACrF,wFAAwF;gBACxF,4FAA4F;gBAC5F,yFAAyF;gBACzF,SAAS,UAAU;YACrB;QACF;IACF;IAEA,OAAO,aAAa,QAAQ;AAC9B","sources":["packages/@react-aria/focus/src/useHasTabbableChild.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {getFocusableTreeWalker} from './FocusScope';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\ninterface AriaHasTabbableChildOptions {\n isDisabled?: boolean\n}\n\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n\n/**\n * Returns whether an element has a tabbable child, and updates as children change.\n * @private\n */\nexport function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean {\n let isDisabled = options?.isDisabled;\n let [hasTabbableChild, setHasTabbableChild] = useState(false);\n\n useLayoutEffect(() => {\n if (ref?.current && !isDisabled) {\n let update = () => {\n if (ref.current) {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setHasTabbableChild(!!walker.nextNode());\n }\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n // Disconnect mutation observer when a React update occurs on the top-level component\n // so we update synchronously after re-rendering. Otherwise React will emit act warnings\n // in tests since mutation observers fire asynchronously. The mutation observer is necessary\n // so we also update if a child component re-renders and adds/removes something tabbable.\n observer.disconnect();\n };\n }\n });\n\n return isDisabled ? false : hasTabbableChild;\n}\n"],"names":[],"version":3,"file":"useHasTabbableChild.main.js.map"}
|
||||
57
node_modules/@react-aria/focus/dist/useHasTabbableChild.mjs
generated
vendored
Normal file
57
node_modules/@react-aria/focus/dist/useHasTabbableChild.mjs
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import {getFocusableTreeWalker as $9bf71ea28793e738$export$2d6ec8fc375ceafa} from "./FocusScope.mjs";
|
||||
import {useLayoutEffect as $hGAaG$useLayoutEffect} from "@react-aria/utils";
|
||||
import {useState as $hGAaG$useState} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2022 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
|
||||
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
||||
let [hasTabbableChild, setHasTabbableChild] = (0, $hGAaG$useState)(false);
|
||||
(0, $hGAaG$useLayoutEffect)(()=>{
|
||||
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
|
||||
let update = ()=>{
|
||||
if (ref.current) {
|
||||
let walker = (0, $9bf71ea28793e738$export$2d6ec8fc375ceafa)(ref.current, {
|
||||
tabbable: true
|
||||
});
|
||||
setHasTabbableChild(!!walker.nextNode());
|
||||
}
|
||||
};
|
||||
update();
|
||||
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
||||
let observer = new MutationObserver(update);
|
||||
observer.observe(ref.current, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
attributes: true,
|
||||
attributeFilter: [
|
||||
'tabIndex',
|
||||
'disabled'
|
||||
]
|
||||
});
|
||||
return ()=>{
|
||||
// Disconnect mutation observer when a React update occurs on the top-level component
|
||||
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
||||
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
||||
// so we also update if a child component re-renders and adds/removes something tabbable.
|
||||
observer.disconnect();
|
||||
};
|
||||
}
|
||||
});
|
||||
return isDisabled ? false : hasTabbableChild;
|
||||
}
|
||||
|
||||
|
||||
export {$83013635b024ae3d$export$eac1895992b9f3d6 as useHasTabbableChild};
|
||||
//# sourceMappingURL=useHasTabbableChild.module.js.map
|
||||
57
node_modules/@react-aria/focus/dist/useHasTabbableChild.module.js
generated
vendored
Normal file
57
node_modules/@react-aria/focus/dist/useHasTabbableChild.module.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import {getFocusableTreeWalker as $9bf71ea28793e738$export$2d6ec8fc375ceafa} from "./FocusScope.module.js";
|
||||
import {useLayoutEffect as $hGAaG$useLayoutEffect} from "@react-aria/utils";
|
||||
import {useState as $hGAaG$useState} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2022 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
|
||||
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
||||
let [hasTabbableChild, setHasTabbableChild] = (0, $hGAaG$useState)(false);
|
||||
(0, $hGAaG$useLayoutEffect)(()=>{
|
||||
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
|
||||
let update = ()=>{
|
||||
if (ref.current) {
|
||||
let walker = (0, $9bf71ea28793e738$export$2d6ec8fc375ceafa)(ref.current, {
|
||||
tabbable: true
|
||||
});
|
||||
setHasTabbableChild(!!walker.nextNode());
|
||||
}
|
||||
};
|
||||
update();
|
||||
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
||||
let observer = new MutationObserver(update);
|
||||
observer.observe(ref.current, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
attributes: true,
|
||||
attributeFilter: [
|
||||
'tabIndex',
|
||||
'disabled'
|
||||
]
|
||||
});
|
||||
return ()=>{
|
||||
// Disconnect mutation observer when a React update occurs on the top-level component
|
||||
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
||||
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
||||
// so we also update if a child component re-renders and adds/removes something tabbable.
|
||||
observer.disconnect();
|
||||
};
|
||||
}
|
||||
});
|
||||
return isDisabled ? false : hasTabbableChild;
|
||||
}
|
||||
|
||||
|
||||
export {$83013635b024ae3d$export$eac1895992b9f3d6 as useHasTabbableChild};
|
||||
//# sourceMappingURL=useHasTabbableChild.module.js.map
|
||||
1
node_modules/@react-aria/focus/dist/useHasTabbableChild.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/useHasTabbableChild.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAoB,GAA8B,EAAE,OAAqC;IACvG,IAAI,aAAa,oBAAA,8BAAA,QAAS,UAAU;IACpC,IAAI,CAAC,kBAAkB,oBAAoB,GAAG,CAAA,GAAA,eAAO,EAAE;IAEvD,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,CAAA,gBAAA,0BAAA,IAAK,OAAO,KAAI,CAAC,YAAY;YAC/B,IAAI,SAAS;gBACX,IAAI,IAAI,OAAO,EAAE;oBACf,IAAI,SAAS,CAAA,GAAA,yCAAqB,EAAE,IAAI,OAAO,EAAE;wBAAC,UAAU;oBAAI;oBAChE,oBAAoB,CAAC,CAAC,OAAO,QAAQ;gBACvC;YACF;YAEA;YAEA,qFAAqF;YACrF,IAAI,WAAW,IAAI,iBAAiB;YACpC,SAAS,OAAO,CAAC,IAAI,OAAO,EAAE;gBAC5B,SAAS;gBACT,WAAW;gBACX,YAAY;gBACZ,iBAAiB;oBAAC;oBAAY;iBAAW;YAC3C;YAEA,OAAO;gBACL,qFAAqF;gBACrF,wFAAwF;gBACxF,4FAA4F;gBAC5F,yFAAyF;gBACzF,SAAS,UAAU;YACrB;QACF;IACF;IAEA,OAAO,aAAa,QAAQ;AAC9B","sources":["packages/@react-aria/focus/src/useHasTabbableChild.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {getFocusableTreeWalker} from './FocusScope';\nimport {RefObject} from '@react-types/shared';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useState} from 'react';\n\ninterface AriaHasTabbableChildOptions {\n isDisabled?: boolean\n}\n\n// This was created for a special empty case of a component that can have child or\n// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components\n// are empty they can have a message with a tabbable element, which is like them\n// being not empty, when it comes to focus and tab order.\n\n/**\n * Returns whether an element has a tabbable child, and updates as children change.\n * @private\n */\nexport function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean {\n let isDisabled = options?.isDisabled;\n let [hasTabbableChild, setHasTabbableChild] = useState(false);\n\n useLayoutEffect(() => {\n if (ref?.current && !isDisabled) {\n let update = () => {\n if (ref.current) {\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setHasTabbableChild(!!walker.nextNode());\n }\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n // Disconnect mutation observer when a React update occurs on the top-level component\n // so we update synchronously after re-rendering. Otherwise React will emit act warnings\n // in tests since mutation observers fire asynchronously. The mutation observer is necessary\n // so we also update if a child component re-renders and adds/removes something tabbable.\n observer.disconnect();\n };\n }\n });\n\n return isDisabled ? false : hasTabbableChild;\n}\n"],"names":[],"version":3,"file":"useHasTabbableChild.module.js.map"}
|
||||
46
node_modules/@react-aria/focus/dist/virtualFocus.main.js
generated
vendored
Normal file
46
node_modules/@react-aria/focus/dist/virtualFocus.main.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
var $jMsK8$reactariautils = require("@react-aria/utils");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "moveVirtualFocus", () => $a756eb2d3b28d089$export$76e4e37e5339496d);
|
||||
$parcel$export(module.exports, "getVirtuallyFocusedElement", () => $a756eb2d3b28d089$export$759df0d867455a91);
|
||||
$parcel$export(module.exports, "dispatchVirtualBlur", () => $a756eb2d3b28d089$export$6c5dc7e81d2cc29a);
|
||||
$parcel$export(module.exports, "dispatchVirtualFocus", () => $a756eb2d3b28d089$export$2b35b76d2e30e129);
|
||||
|
||||
function $a756eb2d3b28d089$export$76e4e37e5339496d(to) {
|
||||
let from = $a756eb2d3b28d089$export$759df0d867455a91((0, $jMsK8$reactariautils.getOwnerDocument)(to));
|
||||
if (from !== to) {
|
||||
if (from) $a756eb2d3b28d089$export$6c5dc7e81d2cc29a(from, to);
|
||||
if (to) $a756eb2d3b28d089$export$2b35b76d2e30e129(to, from);
|
||||
}
|
||||
}
|
||||
function $a756eb2d3b28d089$export$6c5dc7e81d2cc29a(from, to) {
|
||||
from.dispatchEvent(new FocusEvent('blur', {
|
||||
relatedTarget: to
|
||||
}));
|
||||
from.dispatchEvent(new FocusEvent('focusout', {
|
||||
bubbles: true,
|
||||
relatedTarget: to
|
||||
}));
|
||||
}
|
||||
function $a756eb2d3b28d089$export$2b35b76d2e30e129(to, from) {
|
||||
to.dispatchEvent(new FocusEvent('focus', {
|
||||
relatedTarget: from
|
||||
}));
|
||||
to.dispatchEvent(new FocusEvent('focusin', {
|
||||
bubbles: true,
|
||||
relatedTarget: from
|
||||
}));
|
||||
}
|
||||
function $a756eb2d3b28d089$export$759df0d867455a91(document) {
|
||||
let activeElement = (0, $jMsK8$reactariautils.getActiveElement)(document);
|
||||
let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute('aria-activedescendant');
|
||||
if (activeDescendant) return document.getElementById(activeDescendant) || activeElement;
|
||||
return activeElement;
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=virtualFocus.main.js.map
|
||||
1
node_modules/@react-aria/focus/dist/virtualFocus.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/virtualFocus.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;AAEO,SAAS,0CAAiB,EAAkB;IACjD,IAAI,OAAO,0CAA2B,CAAA,GAAA,sCAAe,EAAE;IACvD,IAAI,SAAS,IAAI;QACf,IAAI,MACF,0CAAoB,MAAM;QAE5B,IAAI,IACF,0CAAqB,IAAI;IAE7B;AACF;AAEO,SAAS,0CAAoB,IAAa,EAAE,EAAkB;IACnE,KAAK,aAAa,CAAC,IAAI,WAAW,QAAQ;QAAC,eAAe;IAAE;IAC5D,KAAK,aAAa,CAAC,IAAI,WAAW,YAAY;QAAC,SAAS;QAAM,eAAe;IAAE;AACjF;AAEO,SAAS,0CAAqB,EAAW,EAAE,IAAoB;IACpE,GAAG,aAAa,CAAC,IAAI,WAAW,SAAS;QAAC,eAAe;IAAI;IAC7D,GAAG,aAAa,CAAC,IAAI,WAAW,WAAW;QAAC,SAAS;QAAM,eAAe;IAAI;AAChF;AAEO,SAAS,0CAA2B,QAAkB;IAC3D,IAAI,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACrC,IAAI,mBAAmB,0BAAA,oCAAA,cAAe,YAAY,CAAC;IACnD,IAAI,kBACF,OAAO,SAAS,cAAc,CAAC,qBAAqB;IAGtD,OAAO;AACT","sources":["packages/@react-aria/focus/src/virtualFocus.ts"],"sourcesContent":["import {getActiveElement, getOwnerDocument} from '@react-aria/utils';\n\nexport function moveVirtualFocus(to: Element | null): void {\n let from = getVirtuallyFocusedElement(getOwnerDocument(to));\n if (from !== to) {\n if (from) {\n dispatchVirtualBlur(from, to);\n }\n if (to) {\n dispatchVirtualFocus(to, from);\n }\n }\n}\n\nexport function dispatchVirtualBlur(from: Element, to: Element | null): void {\n from.dispatchEvent(new FocusEvent('blur', {relatedTarget: to}));\n from.dispatchEvent(new FocusEvent('focusout', {bubbles: true, relatedTarget: to}));\n}\n\nexport function dispatchVirtualFocus(to: Element, from: Element | null): void {\n to.dispatchEvent(new FocusEvent('focus', {relatedTarget: from}));\n to.dispatchEvent(new FocusEvent('focusin', {bubbles: true, relatedTarget: from}));\n}\n\nexport function getVirtuallyFocusedElement(document: Document): Element | null {\n let activeElement = getActiveElement(document);\n let activeDescendant = activeElement?.getAttribute('aria-activedescendant');\n if (activeDescendant) {\n return document.getElementById(activeDescendant) || activeElement;\n }\n\n return activeElement;\n}\n"],"names":[],"version":3,"file":"virtualFocus.main.js.map"}
|
||||
38
node_modules/@react-aria/focus/dist/virtualFocus.mjs
generated
vendored
Normal file
38
node_modules/@react-aria/focus/dist/virtualFocus.mjs
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import {getOwnerDocument as $hpDQO$getOwnerDocument, getActiveElement as $hpDQO$getActiveElement} from "@react-aria/utils";
|
||||
|
||||
|
||||
function $55f9b1ae81f22853$export$76e4e37e5339496d(to) {
|
||||
let from = $55f9b1ae81f22853$export$759df0d867455a91((0, $hpDQO$getOwnerDocument)(to));
|
||||
if (from !== to) {
|
||||
if (from) $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from, to);
|
||||
if (to) $55f9b1ae81f22853$export$2b35b76d2e30e129(to, from);
|
||||
}
|
||||
}
|
||||
function $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from, to) {
|
||||
from.dispatchEvent(new FocusEvent('blur', {
|
||||
relatedTarget: to
|
||||
}));
|
||||
from.dispatchEvent(new FocusEvent('focusout', {
|
||||
bubbles: true,
|
||||
relatedTarget: to
|
||||
}));
|
||||
}
|
||||
function $55f9b1ae81f22853$export$2b35b76d2e30e129(to, from) {
|
||||
to.dispatchEvent(new FocusEvent('focus', {
|
||||
relatedTarget: from
|
||||
}));
|
||||
to.dispatchEvent(new FocusEvent('focusin', {
|
||||
bubbles: true,
|
||||
relatedTarget: from
|
||||
}));
|
||||
}
|
||||
function $55f9b1ae81f22853$export$759df0d867455a91(document) {
|
||||
let activeElement = (0, $hpDQO$getActiveElement)(document);
|
||||
let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute('aria-activedescendant');
|
||||
if (activeDescendant) return document.getElementById(activeDescendant) || activeElement;
|
||||
return activeElement;
|
||||
}
|
||||
|
||||
|
||||
export {$55f9b1ae81f22853$export$76e4e37e5339496d as moveVirtualFocus, $55f9b1ae81f22853$export$759df0d867455a91 as getVirtuallyFocusedElement, $55f9b1ae81f22853$export$6c5dc7e81d2cc29a as dispatchVirtualBlur, $55f9b1ae81f22853$export$2b35b76d2e30e129 as dispatchVirtualFocus};
|
||||
//# sourceMappingURL=virtualFocus.module.js.map
|
||||
38
node_modules/@react-aria/focus/dist/virtualFocus.module.js
generated
vendored
Normal file
38
node_modules/@react-aria/focus/dist/virtualFocus.module.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import {getOwnerDocument as $hpDQO$getOwnerDocument, getActiveElement as $hpDQO$getActiveElement} from "@react-aria/utils";
|
||||
|
||||
|
||||
function $55f9b1ae81f22853$export$76e4e37e5339496d(to) {
|
||||
let from = $55f9b1ae81f22853$export$759df0d867455a91((0, $hpDQO$getOwnerDocument)(to));
|
||||
if (from !== to) {
|
||||
if (from) $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from, to);
|
||||
if (to) $55f9b1ae81f22853$export$2b35b76d2e30e129(to, from);
|
||||
}
|
||||
}
|
||||
function $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from, to) {
|
||||
from.dispatchEvent(new FocusEvent('blur', {
|
||||
relatedTarget: to
|
||||
}));
|
||||
from.dispatchEvent(new FocusEvent('focusout', {
|
||||
bubbles: true,
|
||||
relatedTarget: to
|
||||
}));
|
||||
}
|
||||
function $55f9b1ae81f22853$export$2b35b76d2e30e129(to, from) {
|
||||
to.dispatchEvent(new FocusEvent('focus', {
|
||||
relatedTarget: from
|
||||
}));
|
||||
to.dispatchEvent(new FocusEvent('focusin', {
|
||||
bubbles: true,
|
||||
relatedTarget: from
|
||||
}));
|
||||
}
|
||||
function $55f9b1ae81f22853$export$759df0d867455a91(document) {
|
||||
let activeElement = (0, $hpDQO$getActiveElement)(document);
|
||||
let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute('aria-activedescendant');
|
||||
if (activeDescendant) return document.getElementById(activeDescendant) || activeElement;
|
||||
return activeElement;
|
||||
}
|
||||
|
||||
|
||||
export {$55f9b1ae81f22853$export$76e4e37e5339496d as moveVirtualFocus, $55f9b1ae81f22853$export$759df0d867455a91 as getVirtuallyFocusedElement, $55f9b1ae81f22853$export$6c5dc7e81d2cc29a as dispatchVirtualBlur, $55f9b1ae81f22853$export$2b35b76d2e30e129 as dispatchVirtualFocus};
|
||||
//# sourceMappingURL=virtualFocus.module.js.map
|
||||
1
node_modules/@react-aria/focus/dist/virtualFocus.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/focus/dist/virtualFocus.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;AAEO,SAAS,0CAAiB,EAAkB;IACjD,IAAI,OAAO,0CAA2B,CAAA,GAAA,uBAAe,EAAE;IACvD,IAAI,SAAS,IAAI;QACf,IAAI,MACF,0CAAoB,MAAM;QAE5B,IAAI,IACF,0CAAqB,IAAI;IAE7B;AACF;AAEO,SAAS,0CAAoB,IAAa,EAAE,EAAkB;IACnE,KAAK,aAAa,CAAC,IAAI,WAAW,QAAQ;QAAC,eAAe;IAAE;IAC5D,KAAK,aAAa,CAAC,IAAI,WAAW,YAAY;QAAC,SAAS;QAAM,eAAe;IAAE;AACjF;AAEO,SAAS,0CAAqB,EAAW,EAAE,IAAoB;IACpE,GAAG,aAAa,CAAC,IAAI,WAAW,SAAS;QAAC,eAAe;IAAI;IAC7D,GAAG,aAAa,CAAC,IAAI,WAAW,WAAW;QAAC,SAAS;QAAM,eAAe;IAAI;AAChF;AAEO,SAAS,0CAA2B,QAAkB;IAC3D,IAAI,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACrC,IAAI,mBAAmB,0BAAA,oCAAA,cAAe,YAAY,CAAC;IACnD,IAAI,kBACF,OAAO,SAAS,cAAc,CAAC,qBAAqB;IAGtD,OAAO;AACT","sources":["packages/@react-aria/focus/src/virtualFocus.ts"],"sourcesContent":["import {getActiveElement, getOwnerDocument} from '@react-aria/utils';\n\nexport function moveVirtualFocus(to: Element | null): void {\n let from = getVirtuallyFocusedElement(getOwnerDocument(to));\n if (from !== to) {\n if (from) {\n dispatchVirtualBlur(from, to);\n }\n if (to) {\n dispatchVirtualFocus(to, from);\n }\n }\n}\n\nexport function dispatchVirtualBlur(from: Element, to: Element | null): void {\n from.dispatchEvent(new FocusEvent('blur', {relatedTarget: to}));\n from.dispatchEvent(new FocusEvent('focusout', {bubbles: true, relatedTarget: to}));\n}\n\nexport function dispatchVirtualFocus(to: Element, from: Element | null): void {\n to.dispatchEvent(new FocusEvent('focus', {relatedTarget: from}));\n to.dispatchEvent(new FocusEvent('focusin', {bubbles: true, relatedTarget: from}));\n}\n\nexport function getVirtuallyFocusedElement(document: Document): Element | null {\n let activeElement = getActiveElement(document);\n let activeDescendant = activeElement?.getAttribute('aria-activedescendant');\n if (activeDescendant) {\n return document.getElementById(activeDescendant) || activeElement;\n }\n\n return activeElement;\n}\n"],"names":[],"version":3,"file":"virtualFocus.module.js.map"}
|
||||
39
node_modules/@react-aria/focus/package.json
generated
vendored
Normal file
39
node_modules/@react-aria/focus/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@react-aria/focus",
|
||||
"version": "3.20.3",
|
||||
"description": "Spectrum UI components in React",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/main.js",
|
||||
"module": "dist/module.js",
|
||||
"exports": {
|
||||
"types": "./dist/types.d.ts",
|
||||
"import": "./dist/import.mjs",
|
||||
"require": "./dist/main.js"
|
||||
},
|
||||
"types": "dist/types.d.ts",
|
||||
"source": "src/index.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/adobe/react-spectrum"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-aria/interactions": "^3.25.1",
|
||||
"@react-aria/utils": "^3.29.0",
|
||||
"@react-types/shared": "^3.29.1",
|
||||
"@swc/helpers": "^0.5.0",
|
||||
"clsx": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
||||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "9c77d4e8267ed39469c65f65da94ece7be509874"
|
||||
}
|
||||
55
node_modules/@react-aria/focus/src/FocusRing.tsx
generated
vendored
Normal file
55
node_modules/@react-aria/focus/src/FocusRing.tsx
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import clsx from 'clsx';
|
||||
import {mergeProps} from '@react-aria/utils';
|
||||
import React, {ReactElement} from 'react';
|
||||
import {useFocusRing} from './useFocusRing';
|
||||
|
||||
export interface FocusRingProps {
|
||||
/** Child element to apply CSS classes to. */
|
||||
children: ReactElement,
|
||||
/** CSS class to apply when the element is focused. */
|
||||
focusClass?: string,
|
||||
/** CSS class to apply when the element has keyboard focus. */
|
||||
focusRingClass?: string,
|
||||
/**
|
||||
* Whether to show the focus ring when something
|
||||
* inside the container element has focus (true), or
|
||||
* only if the container itself has focus (false).
|
||||
* @default false
|
||||
*/
|
||||
within?: boolean,
|
||||
/** Whether the element is a text input. */
|
||||
isTextInput?: boolean,
|
||||
/** Whether the element will be auto focused. */
|
||||
autoFocus?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility component that applies a CSS class when an element has keyboard focus.
|
||||
* Focus rings are visible only when the user is interacting with a keyboard,
|
||||
* not with a mouse, touch, or other input methods.
|
||||
*/
|
||||
export function FocusRing(props: FocusRingProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> {
|
||||
let {children, focusClass, focusRingClass} = props;
|
||||
let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);
|
||||
let child = React.Children.only(children);
|
||||
|
||||
return React.cloneElement(child, mergeProps(child.props as any, {
|
||||
...focusProps,
|
||||
className: clsx({
|
||||
[focusClass || '']: isFocused,
|
||||
[focusRingClass || '']: isFocusVisible
|
||||
})
|
||||
}));
|
||||
}
|
||||
991
node_modules/@react-aria/focus/src/FocusScope.tsx
generated
vendored
Normal file
991
node_modules/@react-aria/focus/src/FocusScope.tsx
generated
vendored
Normal file
@@ -0,0 +1,991 @@
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
createShadowTreeWalker,
|
||||
getActiveElement,
|
||||
getEventTarget,
|
||||
getOwnerDocument,
|
||||
isAndroid,
|
||||
isChrome,
|
||||
isFocusable,
|
||||
isTabbable,
|
||||
ShadowTreeWalker,
|
||||
useLayoutEffect
|
||||
} from '@react-aria/utils';
|
||||
import {FocusableElement, RefObject} from '@react-types/shared';
|
||||
import {focusSafely, getInteractionModality} from '@react-aria/interactions';
|
||||
import {isElementVisible} from './isElementVisible';
|
||||
import React, {JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';
|
||||
|
||||
export interface FocusScopeProps {
|
||||
/** The contents of the focus scope. */
|
||||
children: ReactNode,
|
||||
|
||||
/**
|
||||
* Whether to contain focus inside the scope, so users cannot
|
||||
* move focus outside, for example in a modal dialog.
|
||||
*/
|
||||
contain?: boolean,
|
||||
|
||||
/**
|
||||
* Whether to restore focus back to the element that was focused
|
||||
* when the focus scope mounted, after the focus scope unmounts.
|
||||
*/
|
||||
restoreFocus?: boolean,
|
||||
|
||||
/** Whether to auto focus the first focusable element in the focus scope on mount. */
|
||||
autoFocus?: boolean
|
||||
}
|
||||
|
||||
export interface FocusManagerOptions {
|
||||
/** The element to start searching from. The currently focused element by default. */
|
||||
from?: Element,
|
||||
/** Whether to only include tabbable elements, or all focusable elements. */
|
||||
tabbable?: boolean,
|
||||
/** Whether focus should wrap around when it reaches the end of the scope. */
|
||||
wrap?: boolean,
|
||||
/** A callback that determines whether the given element is focused. */
|
||||
accept?: (node: Element) => boolean
|
||||
}
|
||||
|
||||
export interface FocusManager {
|
||||
/** Moves focus to the next focusable or tabbable element in the focus scope. */
|
||||
focusNext(opts?: FocusManagerOptions): FocusableElement | null,
|
||||
/** Moves focus to the previous focusable or tabbable element in the focus scope. */
|
||||
focusPrevious(opts?: FocusManagerOptions): FocusableElement | null,
|
||||
/** Moves focus to the first focusable or tabbable element in the focus scope. */
|
||||
focusFirst(opts?: FocusManagerOptions): FocusableElement | null,
|
||||
/** Moves focus to the last focusable or tabbable element in the focus scope. */
|
||||
focusLast(opts?: FocusManagerOptions): FocusableElement | null
|
||||
}
|
||||
|
||||
type ScopeRef = RefObject<Element[] | null> | null;
|
||||
interface IFocusContext {
|
||||
focusManager: FocusManager,
|
||||
parentNode: TreeNode | null
|
||||
}
|
||||
|
||||
const FocusContext = React.createContext<IFocusContext | null>(null);
|
||||
const RESTORE_FOCUS_EVENT = 'react-aria-focus-scope-restore';
|
||||
|
||||
let activeScope: ScopeRef = null;
|
||||
|
||||
// This is a hacky DOM-based implementation of a FocusScope until this RFC lands in React:
|
||||
// https://github.com/reactjs/rfcs/pull/109
|
||||
|
||||
/**
|
||||
* A FocusScope manages focus for its descendants. It supports containing focus inside
|
||||
* the scope, restoring focus to the previously focused element on unmount, and auto
|
||||
* focusing children on mount. It also acts as a container for a programmatic focus
|
||||
* management interface that can be used to move focus forward and back in response
|
||||
* to user events.
|
||||
*/
|
||||
export function FocusScope(props: FocusScopeProps): JSX.Element {
|
||||
let {children, contain, restoreFocus, autoFocus} = props;
|
||||
let startRef = useRef<HTMLSpanElement>(null);
|
||||
let endRef = useRef<HTMLSpanElement>(null);
|
||||
let scopeRef = useRef<Element[]>([]);
|
||||
let {parentNode} = useContext(FocusContext) || {};
|
||||
|
||||
// Create a tree node here so we can add children to it even before it is added to the tree.
|
||||
let node = useMemo(() => new TreeNode({scopeRef}), [scopeRef]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
// If a new scope mounts outside the active scope, (e.g. DialogContainer launched from a menu),
|
||||
// use the active scope as the parent instead of the parent from context. Layout effects run bottom
|
||||
// up, so if the parent is not yet added to the tree, don't do this. Only the outer-most FocusScope
|
||||
// that is being added should get the activeScope as its parent.
|
||||
let parent = parentNode || focusScopeTree.root;
|
||||
if (focusScopeTree.getTreeNode(parent.scopeRef) && activeScope && !isAncestorScope(activeScope, parent.scopeRef)) {
|
||||
let activeNode = focusScopeTree.getTreeNode(activeScope);
|
||||
if (activeNode) {
|
||||
parent = activeNode;
|
||||
}
|
||||
}
|
||||
|
||||
// Add the node to the parent, and to the tree.
|
||||
parent.addChild(node);
|
||||
focusScopeTree.addNode(node);
|
||||
}, [node, parentNode]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
let node = focusScopeTree.getTreeNode(scopeRef);
|
||||
if (node) {
|
||||
node.contain = !!contain;
|
||||
}
|
||||
}, [contain]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
// Find all rendered nodes between the sentinels and add them to the scope.
|
||||
let node = startRef.current?.nextSibling!;
|
||||
let nodes: Element[] = [];
|
||||
let stopPropagation = e => e.stopPropagation();
|
||||
while (node && node !== endRef.current) {
|
||||
nodes.push(node as Element);
|
||||
// Stop custom restore focus event from propagating to parent focus scopes.
|
||||
node.addEventListener(RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
node = node.nextSibling as Element;
|
||||
}
|
||||
|
||||
scopeRef.current = nodes;
|
||||
|
||||
return () => {
|
||||
for (let node of nodes) {
|
||||
node.removeEventListener(RESTORE_FOCUS_EVENT, stopPropagation);
|
||||
}
|
||||
};
|
||||
}, [children]);
|
||||
|
||||
useActiveScopeTracker(scopeRef, restoreFocus, contain);
|
||||
useFocusContainment(scopeRef, contain);
|
||||
useRestoreFocus(scopeRef, restoreFocus, contain);
|
||||
useAutoFocus(scopeRef, autoFocus);
|
||||
|
||||
// This needs to be an effect so that activeScope is updated after the FocusScope tree is complete.
|
||||
// It cannot be a useLayoutEffect because the parent of this node hasn't been attached in the tree yet.
|
||||
useEffect(() => {
|
||||
const activeElement = getActiveElement(getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined));
|
||||
let scope: TreeNode | null = null;
|
||||
|
||||
if (isElementInScope(activeElement, scopeRef.current)) {
|
||||
// We need to traverse the focusScope tree and find the bottom most scope that
|
||||
// contains the active element and set that as the activeScope.
|
||||
for (let node of focusScopeTree.traverse()) {
|
||||
if (node.scopeRef && isElementInScope(activeElement, node.scopeRef.current)) {
|
||||
scope = node;
|
||||
}
|
||||
}
|
||||
|
||||
if (scope === focusScopeTree.getTreeNode(scopeRef)) {
|
||||
activeScope = scope.scopeRef;
|
||||
}
|
||||
}
|
||||
}, [scopeRef]);
|
||||
|
||||
// This layout effect cleanup is so that the tree node is removed synchronously with react before the RAF
|
||||
// in useRestoreFocus cleanup runs.
|
||||
useLayoutEffect(() => {
|
||||
return () => {
|
||||
// Scope may have been re-parented.
|
||||
let parentScope = focusScopeTree.getTreeNode(scopeRef)?.parent?.scopeRef ?? null;
|
||||
|
||||
if (
|
||||
(scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) &&
|
||||
(!parentScope || focusScopeTree.getTreeNode(parentScope))
|
||||
) {
|
||||
activeScope = parentScope;
|
||||
}
|
||||
focusScopeTree.removeTreeNode(scopeRef);
|
||||
};
|
||||
}, [scopeRef]);
|
||||
|
||||
let focusManager = useMemo(() => createFocusManagerForScope(scopeRef), []);
|
||||
let value = useMemo(() => ({
|
||||
focusManager,
|
||||
parentNode: node
|
||||
}), [node, focusManager]);
|
||||
|
||||
return (
|
||||
<FocusContext.Provider value={value}>
|
||||
<span data-focus-scope-start hidden ref={startRef} />
|
||||
{children}
|
||||
<span data-focus-scope-end hidden ref={endRef} />
|
||||
</FocusContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a FocusManager interface for the parent FocusScope.
|
||||
* A FocusManager can be used to programmatically move focus within
|
||||
* a FocusScope, e.g. in response to user events like keyboard navigation.
|
||||
*/
|
||||
export function useFocusManager(): FocusManager | undefined {
|
||||
return useContext(FocusContext)?.focusManager;
|
||||
}
|
||||
|
||||
function createFocusManagerForScope(scopeRef: React.RefObject<Element[] | null>): FocusManager {
|
||||
return {
|
||||
focusNext(opts: FocusManagerOptions = {}) {
|
||||
let scope = scopeRef.current!;
|
||||
let {from, tabbable, wrap, accept} = opts;
|
||||
let node = from || getActiveElement(getOwnerDocument(scope[0] ?? undefined))!;
|
||||
let sentinel = scope[0].previousElementSibling!;
|
||||
let scopeRoot = getScopeRoot(scope);
|
||||
let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);
|
||||
walker.currentNode = isElementInScope(node, scope) ? node : sentinel;
|
||||
let nextNode = walker.nextNode() as FocusableElement;
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode() as FocusableElement;
|
||||
}
|
||||
if (nextNode) {
|
||||
focusElement(nextNode, true);
|
||||
}
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious(opts: FocusManagerOptions = {}) {
|
||||
let scope = scopeRef.current!;
|
||||
let {from, tabbable, wrap, accept} = opts;
|
||||
let node = from || getActiveElement(getOwnerDocument(scope[0] ?? undefined))!;
|
||||
let sentinel = scope[scope.length - 1].nextElementSibling!;
|
||||
let scopeRoot = getScopeRoot(scope);
|
||||
let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);
|
||||
walker.currentNode = isElementInScope(node, scope) ? node : sentinel;
|
||||
let previousNode = walker.previousNode() as FocusableElement;
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = sentinel;
|
||||
previousNode = walker.previousNode() as FocusableElement;
|
||||
}
|
||||
if (previousNode) {
|
||||
focusElement(previousNode, true);
|
||||
}
|
||||
return previousNode;
|
||||
},
|
||||
focusFirst(opts = {}) {
|
||||
let scope = scopeRef.current!;
|
||||
let {tabbable, accept} = opts;
|
||||
let scopeRoot = getScopeRoot(scope);
|
||||
let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);
|
||||
walker.currentNode = scope[0].previousElementSibling!;
|
||||
let nextNode = walker.nextNode() as FocusableElement;
|
||||
if (nextNode) {
|
||||
focusElement(nextNode, true);
|
||||
}
|
||||
return nextNode;
|
||||
},
|
||||
focusLast(opts = {}) {
|
||||
let scope = scopeRef.current!;
|
||||
let {tabbable, accept} = opts;
|
||||
let scopeRoot = getScopeRoot(scope);
|
||||
let walker = getFocusableTreeWalker(scopeRoot, {tabbable, accept}, scope);
|
||||
walker.currentNode = scope[scope.length - 1].nextElementSibling!;
|
||||
let previousNode = walker.previousNode() as FocusableElement;
|
||||
if (previousNode) {
|
||||
focusElement(previousNode, true);
|
||||
}
|
||||
return previousNode;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getScopeRoot(scope: Element[]) {
|
||||
return scope[0].parentElement!;
|
||||
}
|
||||
|
||||
function shouldContainFocus(scopeRef: ScopeRef) {
|
||||
let scope = focusScopeTree.getTreeNode(activeScope);
|
||||
while (scope && scope.scopeRef !== scopeRef) {
|
||||
if (scope.contain) {
|
||||
return false;
|
||||
}
|
||||
|
||||
scope = scope.parent;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function useFocusContainment(scopeRef: RefObject<Element[] | null>, contain?: boolean) {
|
||||
let focusedNode = useRef<FocusableElement>(undefined);
|
||||
|
||||
let raf = useRef<ReturnType<typeof requestAnimationFrame>>(undefined);
|
||||
useLayoutEffect(() => {
|
||||
let scope = scopeRef.current;
|
||||
if (!contain) {
|
||||
// if contain was changed, then we should cancel any ongoing waits to pull focus back into containment
|
||||
if (raf.current) {
|
||||
cancelAnimationFrame(raf.current);
|
||||
raf.current = undefined;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const ownerDocument = getOwnerDocument(scope ? scope[0] : undefined);
|
||||
|
||||
// Handle the Tab key to contain focus within the scope
|
||||
let onKeyDown = (e) => {
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !shouldContainFocus(scopeRef) || e.isComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
let focusedElement = getActiveElement(ownerDocument);
|
||||
let scope = scopeRef.current;
|
||||
if (!scope || !isElementInScope(focusedElement, scope)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let scopeRoot = getScopeRoot(scope);
|
||||
let walker = getFocusableTreeWalker(scopeRoot, {tabbable: true}, scope);
|
||||
if (!focusedElement) {
|
||||
return;
|
||||
}
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as FocusableElement;
|
||||
if (!nextElement) {
|
||||
walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling! : scope[0].previousElementSibling!;
|
||||
nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as FocusableElement;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
if (nextElement) {
|
||||
focusElement(nextElement, true);
|
||||
}
|
||||
};
|
||||
|
||||
let onFocus: EventListener = (e) => {
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!activeScope || isAncestorScope(activeScope, scopeRef)) && isElementInScope(getEventTarget(e) as Element, scopeRef.current)) {
|
||||
activeScope = scopeRef;
|
||||
focusedNode.current = getEventTarget(e) as FocusableElement;
|
||||
} else if (shouldContainFocus(scopeRef) && !isElementInChildScope(getEventTarget(e) as Element, scopeRef)) {
|
||||
// If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),
|
||||
// restore focus to the previously focused node or the first tabbable element in the active scope.
|
||||
if (focusedNode.current) {
|
||||
focusedNode.current.focus();
|
||||
} else if (activeScope && activeScope.current) {
|
||||
focusFirstInScope(activeScope.current);
|
||||
}
|
||||
} else if (shouldContainFocus(scopeRef)) {
|
||||
focusedNode.current = getEventTarget(e) as FocusableElement;
|
||||
}
|
||||
};
|
||||
|
||||
let onBlur: EventListener = (e) => {
|
||||
// Firefox doesn't shift focus back to the Dialog properly without this
|
||||
if (raf.current) {
|
||||
cancelAnimationFrame(raf.current);
|
||||
}
|
||||
raf.current = requestAnimationFrame(() => {
|
||||
// Patches infinite focus coersion loop for Android Talkback where the user isn't able to move the virtual cursor
|
||||
// if within a containing focus scope. Bug filed against Chrome: https://issuetracker.google.com/issues/384844019.
|
||||
// Note that this means focus can leave focus containing modals due to this, but it is isolated to Chrome Talkback.
|
||||
let modality = getInteractionModality();
|
||||
let shouldSkipFocusRestore = (modality === 'virtual' || modality === null) && isAndroid() && isChrome();
|
||||
|
||||
// Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe
|
||||
let activeElement = getActiveElement(ownerDocument);
|
||||
if (!shouldSkipFocusRestore && activeElement && shouldContainFocus(scopeRef) && !isElementInChildScope(activeElement, scopeRef)) {
|
||||
activeScope = scopeRef;
|
||||
let target = getEventTarget(e) as FocusableElement;
|
||||
if (target && target.isConnected) {
|
||||
focusedNode.current = target;
|
||||
focusedNode.current?.focus();
|
||||
} else if (activeScope.current) {
|
||||
focusFirstInScope(activeScope.current);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ownerDocument.addEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope?.forEach(element => element.addEventListener('focusin', onFocus, false));
|
||||
scope?.forEach(element => element.addEventListener('focusout', onBlur, false));
|
||||
return () => {
|
||||
ownerDocument.removeEventListener('keydown', onKeyDown, false);
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope?.forEach(element => element.removeEventListener('focusin', onFocus, false));
|
||||
scope?.forEach(element => element.removeEventListener('focusout', onBlur, false));
|
||||
};
|
||||
}, [scopeRef, contain]);
|
||||
|
||||
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur
|
||||
|
||||
useLayoutEffect(() => {
|
||||
return () => {
|
||||
if (raf.current) {
|
||||
cancelAnimationFrame(raf.current);
|
||||
}
|
||||
};
|
||||
}, [raf]);
|
||||
}
|
||||
|
||||
function isElementInAnyScope(element: Element) {
|
||||
return isElementInChildScope(element);
|
||||
}
|
||||
|
||||
function isElementInScope(element?: Element | null, scope?: Element[] | null) {
|
||||
if (!element) {
|
||||
return false;
|
||||
}
|
||||
if (!scope) {
|
||||
return false;
|
||||
}
|
||||
return scope.some(node => node.contains(element));
|
||||
}
|
||||
|
||||
function isElementInChildScope(element: Element, scope: ScopeRef = null) {
|
||||
// If the element is within a top layer element (e.g. toasts), always allow moving focus there.
|
||||
if (element instanceof Element && element.closest('[data-react-aria-top-layer]')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// node.contains in isElementInScope covers child scopes that are also DOM children,
|
||||
// but does not cover child scopes in portals.
|
||||
for (let {scopeRef: s} of focusScopeTree.traverse(focusScopeTree.getTreeNode(scope))) {
|
||||
if (s && isElementInScope(element, s.current)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
export function isElementInChildOfActiveScope(element: Element): boolean {
|
||||
return isElementInChildScope(element, activeScope);
|
||||
}
|
||||
|
||||
function isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {
|
||||
let parent = focusScopeTree.getTreeNode(scope)?.parent;
|
||||
while (parent) {
|
||||
if (parent.scopeRef === ancestor) {
|
||||
return true;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function focusElement(element: FocusableElement | null, scroll = false) {
|
||||
if (element != null && !scroll) {
|
||||
try {
|
||||
focusSafely(element);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
} else if (element != null) {
|
||||
try {
|
||||
element.focus();
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getFirstInScope(scope: Element[], tabbable = true) {
|
||||
let sentinel = scope[0].previousElementSibling!;
|
||||
let scopeRoot = getScopeRoot(scope);
|
||||
let walker = getFocusableTreeWalker(scopeRoot, {tabbable}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
let nextNode = walker.nextNode();
|
||||
|
||||
// If the scope does not contain a tabbable element, use the first focusable element.
|
||||
if (tabbable && !nextNode) {
|
||||
scopeRoot = getScopeRoot(scope);
|
||||
walker = getFocusableTreeWalker(scopeRoot, {tabbable: false}, scope);
|
||||
walker.currentNode = sentinel;
|
||||
nextNode = walker.nextNode();
|
||||
}
|
||||
|
||||
return nextNode as FocusableElement;
|
||||
}
|
||||
|
||||
function focusFirstInScope(scope: Element[], tabbable:boolean = true) {
|
||||
focusElement(getFirstInScope(scope, tabbable));
|
||||
}
|
||||
|
||||
function useAutoFocus(scopeRef: RefObject<Element[] | null>, autoFocus?: boolean) {
|
||||
const autoFocusRef = React.useRef(autoFocus);
|
||||
useEffect(() => {
|
||||
if (autoFocusRef.current) {
|
||||
activeScope = scopeRef;
|
||||
const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
if (!isElementInScope(getActiveElement(ownerDocument), activeScope.current) && scopeRef.current) {
|
||||
focusFirstInScope(scopeRef.current);
|
||||
}
|
||||
}
|
||||
autoFocusRef.current = false;
|
||||
}, [scopeRef]);
|
||||
}
|
||||
|
||||
function useActiveScopeTracker(scopeRef: RefObject<Element[] | null>, restore?: boolean, contain?: boolean) {
|
||||
// tracks the active scope, in case restore and contain are both false.
|
||||
// if either are true, this is tracked in useRestoreFocus or useFocusContainment.
|
||||
useLayoutEffect(() => {
|
||||
if (restore || contain) {
|
||||
return;
|
||||
}
|
||||
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = getOwnerDocument(scope ? scope[0] : undefined);
|
||||
|
||||
let onFocus = (e) => {
|
||||
let target = getEventTarget(e) as Element;
|
||||
if (isElementInScope(target, scopeRef.current)) {
|
||||
activeScope = scopeRef;
|
||||
} else if (!isElementInAnyScope(target)) {
|
||||
activeScope = null;
|
||||
}
|
||||
};
|
||||
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope?.forEach(element => element.addEventListener('focusin', onFocus, false));
|
||||
return () => {
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope?.forEach(element => element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
}, [scopeRef, restore, contain]);
|
||||
}
|
||||
|
||||
function shouldRestoreFocus(scopeRef: ScopeRef) {
|
||||
let scope = focusScopeTree.getTreeNode(activeScope);
|
||||
while (scope && scope.scopeRef !== scopeRef) {
|
||||
if (scope.nodeToRestore) {
|
||||
return false;
|
||||
}
|
||||
|
||||
scope = scope.parent;
|
||||
}
|
||||
|
||||
return scope?.scopeRef === scopeRef;
|
||||
}
|
||||
|
||||
function useRestoreFocus(scopeRef: RefObject<Element[] | null>, restoreFocus?: boolean, contain?: boolean) {
|
||||
// create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
const nodeToRestoreRef = useRef(typeof document !== 'undefined' ? getActiveElement(getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined)) as FocusableElement : null);
|
||||
|
||||
// restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus
|
||||
// restoring-non-containing scopes should only care if they become active so they can perform the restore
|
||||
useLayoutEffect(() => {
|
||||
let scope = scopeRef.current;
|
||||
const ownerDocument = getOwnerDocument(scope ? scope[0] : undefined);
|
||||
if (!restoreFocus || contain) {
|
||||
return;
|
||||
}
|
||||
|
||||
let onFocus = () => {
|
||||
// If focusing an element in a child scope of the currently active scope, the child becomes active.
|
||||
// Moving out of the active scope to an ancestor is not allowed.
|
||||
if ((!activeScope || isAncestorScope(activeScope, scopeRef)) &&
|
||||
isElementInScope(getActiveElement(ownerDocument), scopeRef.current)
|
||||
) {
|
||||
activeScope = scopeRef;
|
||||
}
|
||||
};
|
||||
|
||||
ownerDocument.addEventListener('focusin', onFocus, false);
|
||||
scope?.forEach(element => element.addEventListener('focusin', onFocus, false));
|
||||
return () => {
|
||||
ownerDocument.removeEventListener('focusin', onFocus, false);
|
||||
scope?.forEach(element => element.removeEventListener('focusin', onFocus, false));
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [scopeRef, contain]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
|
||||
if (!restoreFocus) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the Tab key so that tabbing out of the scope goes to the next element
|
||||
// after the node that had focus when the scope mounted. This is important when
|
||||
// using portals for overlays, so that focus goes to the expected element when
|
||||
// tabbing out of the overlay.
|
||||
let onKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || !shouldContainFocus(scopeRef) || e.isComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
let focusedElement = ownerDocument.activeElement as FocusableElement;
|
||||
if (!isElementInChildScope(focusedElement, scopeRef) || !shouldRestoreFocus(scopeRef)) {
|
||||
return;
|
||||
}
|
||||
let treeNode = focusScopeTree.getTreeNode(scopeRef);
|
||||
if (!treeNode) {
|
||||
return;
|
||||
}
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
|
||||
// Create a DOM tree walker that matches all tabbable elements
|
||||
let walker = getFocusableTreeWalker(ownerDocument.body, {tabbable: true});
|
||||
|
||||
// Find the next tabbable element after the currently focused element
|
||||
walker.currentNode = focusedElement;
|
||||
let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as FocusableElement;
|
||||
|
||||
if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
|
||||
nodeToRestore = undefined;
|
||||
treeNode.nodeToRestore = undefined;
|
||||
}
|
||||
|
||||
// If there is no next element, or it is outside the current scope, move focus to the
|
||||
// next element after the node to restore to instead.
|
||||
if ((!nextElement || !isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
|
||||
walker.currentNode = nodeToRestore;
|
||||
|
||||
// Skip over elements within the scope, in case the scope immediately follows the node to restore.
|
||||
do {
|
||||
nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as FocusableElement;
|
||||
} while (isElementInChildScope(nextElement, scopeRef));
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (nextElement) {
|
||||
focusElement(nextElement, true);
|
||||
} else {
|
||||
// If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)
|
||||
// then move focus to the body.
|
||||
// Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)
|
||||
if (!isElementInAnyScope(nodeToRestore)) {
|
||||
focusedElement.blur();
|
||||
} else {
|
||||
focusElement(nodeToRestore, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (!contain) {
|
||||
ownerDocument.addEventListener('keydown', onKeyDown as EventListener, true);
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (!contain) {
|
||||
ownerDocument.removeEventListener('keydown', onKeyDown as EventListener, true);
|
||||
}
|
||||
};
|
||||
}, [scopeRef, restoreFocus, contain]);
|
||||
|
||||
// useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.
|
||||
useLayoutEffect(() => {
|
||||
const ownerDocument = getOwnerDocument(scopeRef.current ? scopeRef.current[0] : undefined);
|
||||
|
||||
if (!restoreFocus) {
|
||||
return;
|
||||
}
|
||||
|
||||
let treeNode = focusScopeTree.getTreeNode(scopeRef);
|
||||
if (!treeNode) {
|
||||
return;
|
||||
}
|
||||
treeNode.nodeToRestore = nodeToRestoreRef.current ?? undefined;
|
||||
return () => {
|
||||
let treeNode = focusScopeTree.getTreeNode(scopeRef);
|
||||
if (!treeNode) {
|
||||
return;
|
||||
}
|
||||
let nodeToRestore = treeNode.nodeToRestore;
|
||||
|
||||
// if we already lost focus to the body and this was the active scope, then we should attempt to restore
|
||||
let activeElement = getActiveElement(ownerDocument);
|
||||
if (
|
||||
restoreFocus
|
||||
&& nodeToRestore
|
||||
&& (
|
||||
((activeElement && isElementInChildScope(activeElement, scopeRef)) || (activeElement === ownerDocument.body && shouldRestoreFocus(scopeRef)))
|
||||
)
|
||||
) {
|
||||
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it
|
||||
let clonedTree = focusScopeTree.clone();
|
||||
requestAnimationFrame(() => {
|
||||
// Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere
|
||||
if (ownerDocument.activeElement === ownerDocument.body) {
|
||||
// look up the tree starting with our scope to find a nodeToRestore still in the DOM
|
||||
let treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while (treeNode) {
|
||||
if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {
|
||||
restoreFocusToElement(treeNode.nodeToRestore);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
|
||||
// If no nodeToRestore was found, focus the first element in the nearest
|
||||
// ancestor scope that is still in the tree.
|
||||
treeNode = clonedTree.getTreeNode(scopeRef);
|
||||
while (treeNode) {
|
||||
if (treeNode.scopeRef && treeNode.scopeRef.current && focusScopeTree.getTreeNode(treeNode.scopeRef)) {
|
||||
let node = getFirstInScope(treeNode.scopeRef.current, true);
|
||||
restoreFocusToElement(node);
|
||||
return;
|
||||
}
|
||||
treeNode = treeNode.parent;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [scopeRef, restoreFocus]);
|
||||
}
|
||||
|
||||
function restoreFocusToElement(node: FocusableElement) {
|
||||
// Dispatch a custom event that parent elements can intercept to customize focus restoration.
|
||||
// For example, virtualized collection components reuse DOM elements, so the original element
|
||||
// might still exist in the DOM but representing a different item.
|
||||
if (node.dispatchEvent(new CustomEvent(RESTORE_FOCUS_EVENT, {bubbles: true, cancelable: true}))) {
|
||||
focusElement(node);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}
|
||||
* that matches all focusable/tabbable elements.
|
||||
*/
|
||||
export function getFocusableTreeWalker(root: Element, opts?: FocusManagerOptions, scope?: Element[]): ShadowTreeWalker | TreeWalker {
|
||||
let filter = opts?.tabbable ? isTabbable : isFocusable;
|
||||
|
||||
// Ensure that root is an Element or fall back appropriately
|
||||
let rootElement = root?.nodeType === Node.ELEMENT_NODE ? (root as Element) : null;
|
||||
|
||||
// Determine the document to use
|
||||
let doc = getOwnerDocument(rootElement);
|
||||
|
||||
// Create a TreeWalker, ensuring the root is an Element or Document
|
||||
let walker = createShadowTreeWalker(
|
||||
doc,
|
||||
root || doc,
|
||||
NodeFilter.SHOW_ELEMENT,
|
||||
{
|
||||
acceptNode(node) {
|
||||
// Skip nodes inside the starting node.
|
||||
if (opts?.from?.contains(node)) {
|
||||
return NodeFilter.FILTER_REJECT;
|
||||
}
|
||||
|
||||
if (filter(node as Element)
|
||||
&& isElementVisible(node as Element)
|
||||
&& (!scope || isElementInScope(node as Element, scope))
|
||||
&& (!opts?.accept || opts.accept(node as Element))
|
||||
) {
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
}
|
||||
|
||||
return NodeFilter.FILTER_SKIP;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (opts?.from) {
|
||||
walker.currentNode = opts.from;
|
||||
}
|
||||
|
||||
return walker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a FocusManager object that can be used to move focus within an element.
|
||||
*/
|
||||
export function createFocusManager(ref: RefObject<Element | null>, defaultOptions: FocusManagerOptions = {}): FocusManager {
|
||||
return {
|
||||
focusNext(opts: FocusManagerOptions = {}) {
|
||||
let root = ref.current;
|
||||
if (!root) {
|
||||
return null;
|
||||
}
|
||||
let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;
|
||||
let node = from || getActiveElement(getOwnerDocument(root));
|
||||
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
||||
if (root.contains(node)) {
|
||||
walker.currentNode = node!;
|
||||
}
|
||||
let nextNode = walker.nextNode() as FocusableElement;
|
||||
if (!nextNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
nextNode = walker.nextNode() as FocusableElement;
|
||||
}
|
||||
if (nextNode) {
|
||||
focusElement(nextNode, true);
|
||||
}
|
||||
return nextNode;
|
||||
},
|
||||
focusPrevious(opts: FocusManagerOptions = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) {
|
||||
return null;
|
||||
}
|
||||
let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;
|
||||
let node = from || getActiveElement(getOwnerDocument(root));
|
||||
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
||||
if (root.contains(node)) {
|
||||
walker.currentNode = node!;
|
||||
} else {
|
||||
let next = last(walker);
|
||||
if (next) {
|
||||
focusElement(next, true);
|
||||
}
|
||||
return next ?? null;
|
||||
}
|
||||
let previousNode = walker.previousNode() as FocusableElement;
|
||||
if (!previousNode && wrap) {
|
||||
walker.currentNode = root;
|
||||
let lastNode = last(walker);
|
||||
if (!lastNode) {
|
||||
// couldn't wrap
|
||||
return null;
|
||||
}
|
||||
previousNode = lastNode;
|
||||
}
|
||||
if (previousNode) {
|
||||
focusElement(previousNode, true);
|
||||
}
|
||||
return previousNode ?? null;
|
||||
},
|
||||
focusFirst(opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) {
|
||||
return null;
|
||||
}
|
||||
let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;
|
||||
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
||||
let nextNode = walker.nextNode() as FocusableElement;
|
||||
if (nextNode) {
|
||||
focusElement(nextNode, true);
|
||||
}
|
||||
return nextNode;
|
||||
},
|
||||
focusLast(opts = defaultOptions) {
|
||||
let root = ref.current;
|
||||
if (!root) {
|
||||
return null;
|
||||
}
|
||||
let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;
|
||||
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
||||
let next = last(walker);
|
||||
if (next) {
|
||||
focusElement(next, true);
|
||||
}
|
||||
return next ?? null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function last(walker: ShadowTreeWalker | TreeWalker) {
|
||||
let next: FocusableElement | undefined = undefined;
|
||||
let last: FocusableElement;
|
||||
do {
|
||||
last = walker.lastChild() as FocusableElement;
|
||||
if (last) {
|
||||
next = last;
|
||||
}
|
||||
} while (last);
|
||||
return next;
|
||||
}
|
||||
|
||||
|
||||
class Tree {
|
||||
root: TreeNode;
|
||||
private fastMap = new Map<ScopeRef, TreeNode>();
|
||||
|
||||
constructor() {
|
||||
this.root = new TreeNode({scopeRef: null});
|
||||
this.fastMap.set(null, this.root);
|
||||
}
|
||||
|
||||
get size() {
|
||||
return this.fastMap.size;
|
||||
}
|
||||
|
||||
getTreeNode(data: ScopeRef) {
|
||||
return this.fastMap.get(data);
|
||||
}
|
||||
|
||||
addTreeNode(scopeRef: ScopeRef, parent: ScopeRef, nodeToRestore?: FocusableElement) {
|
||||
let parentNode = this.fastMap.get(parent ?? null);
|
||||
if (!parentNode) {
|
||||
return;
|
||||
}
|
||||
let node = new TreeNode({scopeRef});
|
||||
parentNode.addChild(node);
|
||||
node.parent = parentNode;
|
||||
this.fastMap.set(scopeRef, node);
|
||||
if (nodeToRestore) {
|
||||
node.nodeToRestore = nodeToRestore;
|
||||
}
|
||||
}
|
||||
|
||||
addNode(node: TreeNode) {
|
||||
this.fastMap.set(node.scopeRef, node);
|
||||
}
|
||||
|
||||
removeTreeNode(scopeRef: ScopeRef) {
|
||||
// never remove the root
|
||||
if (scopeRef === null) {
|
||||
return;
|
||||
}
|
||||
let node = this.fastMap.get(scopeRef);
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
let parentNode = node.parent;
|
||||
// when we remove a scope, check if any sibling scopes are trying to restore focus to something inside the scope we're removing
|
||||
// if we are, then replace the siblings restore with the restore from the scope we're removing
|
||||
for (let current of this.traverse()) {
|
||||
if (
|
||||
current !== node &&
|
||||
node.nodeToRestore &&
|
||||
current.nodeToRestore &&
|
||||
node.scopeRef &&
|
||||
node.scopeRef.current &&
|
||||
isElementInScope(current.nodeToRestore, node.scopeRef.current)
|
||||
) {
|
||||
current.nodeToRestore = node.nodeToRestore;
|
||||
}
|
||||
}
|
||||
let children = node.children;
|
||||
if (parentNode) {
|
||||
parentNode.removeChild(node);
|
||||
if (children.size > 0) {
|
||||
children.forEach(child => parentNode && parentNode.addChild(child));
|
||||
}
|
||||
}
|
||||
|
||||
this.fastMap.delete(node.scopeRef);
|
||||
}
|
||||
|
||||
// Pre Order Depth First
|
||||
*traverse(node: TreeNode = this.root): Generator<TreeNode> {
|
||||
if (node.scopeRef != null) {
|
||||
yield node;
|
||||
}
|
||||
if (node.children.size > 0) {
|
||||
for (let child of node.children) {
|
||||
yield* this.traverse(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clone(): Tree {
|
||||
let newTree = new Tree();
|
||||
for (let node of this.traverse()) {
|
||||
newTree.addTreeNode(node.scopeRef, node.parent?.scopeRef ?? null, node.nodeToRestore);
|
||||
}
|
||||
return newTree;
|
||||
}
|
||||
}
|
||||
|
||||
class TreeNode {
|
||||
public scopeRef: ScopeRef;
|
||||
public nodeToRestore?: FocusableElement;
|
||||
public parent?: TreeNode;
|
||||
public children: Set<TreeNode> = new Set();
|
||||
public contain = false;
|
||||
|
||||
constructor(props: {scopeRef: ScopeRef}) {
|
||||
this.scopeRef = props.scopeRef;
|
||||
}
|
||||
addChild(node: TreeNode) {
|
||||
this.children.add(node);
|
||||
node.parent = this;
|
||||
}
|
||||
removeChild(node: TreeNode) {
|
||||
this.children.delete(node);
|
||||
node.parent = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export let focusScopeTree = new Tree();
|
||||
25
node_modules/@react-aria/focus/src/index.ts
generated
vendored
Normal file
25
node_modules/@react-aria/focus/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
export {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager, isElementInChildOfActiveScope} from './FocusScope';
|
||||
export {FocusRing} from './FocusRing';
|
||||
export {useFocusRing} from './useFocusRing';
|
||||
export {useHasTabbableChild} from './useHasTabbableChild';
|
||||
export {moveVirtualFocus, dispatchVirtualBlur, dispatchVirtualFocus, getVirtuallyFocusedElement} from './virtualFocus';
|
||||
// For backward compatibility.
|
||||
export {isFocusable} from '@react-aria/utils';
|
||||
export {FocusableProvider, Focusable, useFocusable, focusSafely} from '@react-aria/interactions';
|
||||
|
||||
export type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';
|
||||
export type {FocusRingProps} from './FocusRing';
|
||||
export type {FocusableAria, FocusableOptions, FocusableProviderProps} from '@react-aria/interactions';
|
||||
export type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';
|
||||
69
node_modules/@react-aria/focus/src/isElementVisible.ts
generated
vendored
Normal file
69
node_modules/@react-aria/focus/src/isElementVisible.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2021 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import {getOwnerWindow} from '@react-aria/utils';
|
||||
|
||||
function isStyleVisible(element: Element) {
|
||||
const windowObject = getOwnerWindow(element);
|
||||
if (!(element instanceof windowObject.HTMLElement) && !(element instanceof windowObject.SVGElement)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let {display, visibility} = element.style;
|
||||
|
||||
let isVisible = (
|
||||
display !== 'none' &&
|
||||
visibility !== 'hidden' &&
|
||||
visibility !== 'collapse'
|
||||
);
|
||||
|
||||
if (isVisible) {
|
||||
const {getComputedStyle} = element.ownerDocument.defaultView as unknown as Window;
|
||||
let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);
|
||||
|
||||
isVisible = (
|
||||
computedDisplay !== 'none' &&
|
||||
computedVisibility !== 'hidden' &&
|
||||
computedVisibility !== 'collapse'
|
||||
);
|
||||
}
|
||||
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
function isAttributeVisible(element: Element, childElement?: Element) {
|
||||
return (
|
||||
!element.hasAttribute('hidden') &&
|
||||
// Ignore HiddenSelect when tree walking.
|
||||
!element.hasAttribute('data-react-aria-prevent-focus') &&
|
||||
(element.nodeName === 'DETAILS' &&
|
||||
childElement &&
|
||||
childElement.nodeName !== 'SUMMARY'
|
||||
? element.hasAttribute('open')
|
||||
: true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapted from https://github.com/testing-library/jest-dom and
|
||||
* https://github.com/vuejs/vue-test-utils-next/.
|
||||
* Licensed under the MIT License.
|
||||
* @param element - Element to evaluate for display or visibility.
|
||||
*/
|
||||
export function isElementVisible(element: Element, childElement?: Element): boolean {
|
||||
return (
|
||||
element.nodeName !== '#comment' &&
|
||||
isStyleVisible(element) &&
|
||||
isAttributeVisible(element, childElement) &&
|
||||
(!element.parentElement || isElementVisible(element.parentElement, element))
|
||||
);
|
||||
}
|
||||
78
node_modules/@react-aria/focus/src/useFocusRing.ts
generated
vendored
Normal file
78
node_modules/@react-aria/focus/src/useFocusRing.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
import {DOMAttributes} from '@react-types/shared';
|
||||
import {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';
|
||||
import {useCallback, useRef, useState} from 'react';
|
||||
|
||||
export interface AriaFocusRingProps {
|
||||
/**
|
||||
* Whether to show the focus ring when something
|
||||
* inside the container element has focus (true), or
|
||||
* only if the container itself has focus (false).
|
||||
* @default 'false'
|
||||
*/
|
||||
within?: boolean,
|
||||
|
||||
/** Whether the element is a text input. */
|
||||
isTextInput?: boolean,
|
||||
|
||||
/** Whether the element will be auto focused. */
|
||||
autoFocus?: boolean
|
||||
}
|
||||
|
||||
export interface FocusRingAria {
|
||||
/** Whether the element is currently focused. */
|
||||
isFocused: boolean,
|
||||
|
||||
/** Whether keyboard focus should be visible. */
|
||||
isFocusVisible: boolean,
|
||||
|
||||
/** Props to apply to the container element with the focus ring. */
|
||||
focusProps: DOMAttributes
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a focus ring should be shown to indicate keyboard focus.
|
||||
* Focus rings are visible only when the user is interacting with a keyboard,
|
||||
* not with a mouse, touch, or other input methods.
|
||||
*/
|
||||
export function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {
|
||||
let {
|
||||
autoFocus = false,
|
||||
isTextInput,
|
||||
within
|
||||
} = props;
|
||||
let state = useRef({
|
||||
isFocused: false,
|
||||
isFocusVisible: autoFocus || isFocusVisible()
|
||||
});
|
||||
let [isFocused, setFocused] = useState(false);
|
||||
let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);
|
||||
|
||||
let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
||||
|
||||
let onFocusChange = useCallback(isFocused => {
|
||||
state.current.isFocused = isFocused;
|
||||
setFocused(isFocused);
|
||||
updateState();
|
||||
}, [updateState]);
|
||||
|
||||
useFocusVisibleListener((isFocusVisible) => {
|
||||
state.current.isFocusVisible = isFocusVisible;
|
||||
updateState();
|
||||
}, [], {isTextInput});
|
||||
|
||||
let {focusProps} = useFocus({
|
||||
isDisabled: within,
|
||||
onFocusChange
|
||||
});
|
||||
|
||||
let {focusWithinProps} = useFocusWithin({
|
||||
isDisabled: !within,
|
||||
onFocusWithinChange: onFocusChange
|
||||
});
|
||||
|
||||
return {
|
||||
isFocused,
|
||||
isFocusVisible: isFocusVisibleState,
|
||||
focusProps: within ? focusWithinProps : focusProps
|
||||
};
|
||||
}
|
||||
66
node_modules/@react-aria/focus/src/useHasTabbableChild.ts
generated
vendored
Normal file
66
node_modules/@react-aria/focus/src/useHasTabbableChild.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2022 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
import {getFocusableTreeWalker} from './FocusScope';
|
||||
import {RefObject} from '@react-types/shared';
|
||||
import {useLayoutEffect} from '@react-aria/utils';
|
||||
import {useState} from 'react';
|
||||
|
||||
interface AriaHasTabbableChildOptions {
|
||||
isDisabled?: boolean
|
||||
}
|
||||
|
||||
// This was created for a special empty case of a component that can have child or
|
||||
// be empty, like Collection/Virtualizer/Table/ListView/etc. When these components
|
||||
// are empty they can have a message with a tabbable element, which is like them
|
||||
// being not empty, when it comes to focus and tab order.
|
||||
|
||||
/**
|
||||
* Returns whether an element has a tabbable child, and updates as children change.
|
||||
* @private
|
||||
*/
|
||||
export function useHasTabbableChild(ref: RefObject<Element | null>, options?: AriaHasTabbableChildOptions): boolean {
|
||||
let isDisabled = options?.isDisabled;
|
||||
let [hasTabbableChild, setHasTabbableChild] = useState(false);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (ref?.current && !isDisabled) {
|
||||
let update = () => {
|
||||
if (ref.current) {
|
||||
let walker = getFocusableTreeWalker(ref.current, {tabbable: true});
|
||||
setHasTabbableChild(!!walker.nextNode());
|
||||
}
|
||||
};
|
||||
|
||||
update();
|
||||
|
||||
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
||||
let observer = new MutationObserver(update);
|
||||
observer.observe(ref.current, {
|
||||
subtree: true,
|
||||
childList: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['tabIndex', 'disabled']
|
||||
});
|
||||
|
||||
return () => {
|
||||
// Disconnect mutation observer when a React update occurs on the top-level component
|
||||
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
||||
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
||||
// so we also update if a child component re-renders and adds/removes something tabbable.
|
||||
observer.disconnect();
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return isDisabled ? false : hasTabbableChild;
|
||||
}
|
||||
33
node_modules/@react-aria/focus/src/virtualFocus.ts
generated
vendored
Normal file
33
node_modules/@react-aria/focus/src/virtualFocus.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import {getActiveElement, getOwnerDocument} from '@react-aria/utils';
|
||||
|
||||
export function moveVirtualFocus(to: Element | null): void {
|
||||
let from = getVirtuallyFocusedElement(getOwnerDocument(to));
|
||||
if (from !== to) {
|
||||
if (from) {
|
||||
dispatchVirtualBlur(from, to);
|
||||
}
|
||||
if (to) {
|
||||
dispatchVirtualFocus(to, from);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function dispatchVirtualBlur(from: Element, to: Element | null): void {
|
||||
from.dispatchEvent(new FocusEvent('blur', {relatedTarget: to}));
|
||||
from.dispatchEvent(new FocusEvent('focusout', {bubbles: true, relatedTarget: to}));
|
||||
}
|
||||
|
||||
export function dispatchVirtualFocus(to: Element, from: Element | null): void {
|
||||
to.dispatchEvent(new FocusEvent('focus', {relatedTarget: from}));
|
||||
to.dispatchEvent(new FocusEvent('focusin', {bubbles: true, relatedTarget: from}));
|
||||
}
|
||||
|
||||
export function getVirtuallyFocusedElement(document: Document): Element | null {
|
||||
let activeElement = getActiveElement(document);
|
||||
let activeDescendant = activeElement?.getAttribute('aria-activedescendant');
|
||||
if (activeDescendant) {
|
||||
return document.getElementById(activeDescendant) || activeElement;
|
||||
}
|
||||
|
||||
return activeElement;
|
||||
}
|
||||
201
node_modules/@react-aria/interactions/LICENSE
generated
vendored
Normal file
201
node_modules/@react-aria/interactions/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Adobe
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
3
node_modules/@react-aria/interactions/README.md
generated
vendored
Normal file
3
node_modules/@react-aria/interactions/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @react-aria/interactions
|
||||
|
||||
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
|
||||
62
node_modules/@react-aria/interactions/dist/PressResponder.main.js
generated
vendored
Normal file
62
node_modules/@react-aria/interactions/dist/PressResponder.main.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
var $01d3f539e91688c8$exports = require("./context.main.js");
|
||||
var $3maub$reactariautils = require("@react-aria/utils");
|
||||
var $3maub$react = require("react");
|
||||
|
||||
|
||||
function $parcel$interopDefault(a) {
|
||||
return a && a.__esModule ? a.default : a;
|
||||
}
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "PressResponder", () => $3596bae48579386f$export$3351871ee4b288b8);
|
||||
$parcel$export(module.exports, "ClearPressResponder", () => $3596bae48579386f$export$cf75428e0b9ed1ea);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
const $3596bae48579386f$export$3351871ee4b288b8 = /*#__PURE__*/ (0, ($parcel$interopDefault($3maub$react))).forwardRef(({ children: children, ...props }, ref)=>{
|
||||
let isRegistered = (0, $3maub$react.useRef)(false);
|
||||
let prevContext = (0, $3maub$react.useContext)((0, $01d3f539e91688c8$exports.PressResponderContext));
|
||||
ref = (0, $3maub$reactariautils.useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
||||
let context = (0, $3maub$reactariautils.mergeProps)(prevContext || {}, {
|
||||
...props,
|
||||
ref: ref,
|
||||
register () {
|
||||
isRegistered.current = true;
|
||||
if (prevContext) prevContext.register();
|
||||
}
|
||||
});
|
||||
(0, $3maub$reactariautils.useSyncRef)(prevContext, ref);
|
||||
(0, $3maub$react.useEffect)(()=>{
|
||||
if (!isRegistered.current) {
|
||||
if (process.env.NODE_ENV !== 'production') console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
||||
isRegistered.current = true; // only warn once in strict mode.
|
||||
}
|
||||
}, []);
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($3maub$react))).createElement((0, $01d3f539e91688c8$exports.PressResponderContext).Provider, {
|
||||
value: context
|
||||
}, children);
|
||||
});
|
||||
function $3596bae48579386f$export$cf75428e0b9ed1ea({ children: children }) {
|
||||
let context = (0, $3maub$react.useMemo)(()=>({
|
||||
register: ()=>{}
|
||||
}), []);
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($3maub$react))).createElement((0, $01d3f539e91688c8$exports.PressResponderContext).Provider, {
|
||||
value: context
|
||||
}, children);
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=PressResponder.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/PressResponder.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/PressResponder.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,mBAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,+CAAoB;IACjD,MAAM,CAAA,GAAA,kCAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,gCAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,gCAAS,EAAE,aAAa;IAExB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CACV;YAIJ,aAAa,OAAO,GAAG,MAAM,iCAAiC;QAChE;IACF,GAAG,EAAE;IAEL,qBACE,0DAAC,CAAA,GAAA,+CAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP;AAEO,SAAS,0CAAoB,YAAC,QAAQ,EAAwB;IACnE,IAAI,UAAU,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YAAC,UAAU,KAAO;QAAC,CAAA,GAAI,EAAE;IACtD,qBACE,0DAAC,CAAA,GAAA,+CAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP","sources":["packages/@react-aria/interactions/src/PressResponder.tsx"],"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 {FocusableElement} from '@react-types/shared';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport {PressProps} from './usePress';\nimport {PressResponderContext} from './context';\nimport React, {ForwardedRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'A PressResponder was rendered without a pressable child. ' +\n 'Either call the usePress hook, or wrap your DOM node with <Pressable> component.'\n );\n }\n isRegistered.current = true; // only warn once in strict mode.\n }\n }, []);\n\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n});\n\nexport function ClearPressResponder({children}: {children: ReactNode}): JSX.Element {\n let context = useMemo(() => ({register: () => {}}), []);\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"PressResponder.main.js.map"}
|
||||
52
node_modules/@react-aria/interactions/dist/PressResponder.mjs
generated
vendored
Normal file
52
node_modules/@react-aria/interactions/dist/PressResponder.mjs
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import {PressResponderContext as $ae1eeba8b9eafd08$export$5165eccb35aaadb5} from "./context.mjs";
|
||||
import {useObjectRef as $87RPk$useObjectRef, mergeProps as $87RPk$mergeProps, useSyncRef as $87RPk$useSyncRef} from "@react-aria/utils";
|
||||
import $87RPk$react, {useRef as $87RPk$useRef, useContext as $87RPk$useContext, useEffect as $87RPk$useEffect, useMemo as $87RPk$useMemo} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $87RPk$react).forwardRef(({ children: children, ...props }, ref)=>{
|
||||
let isRegistered = (0, $87RPk$useRef)(false);
|
||||
let prevContext = (0, $87RPk$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
||||
ref = (0, $87RPk$useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
||||
let context = (0, $87RPk$mergeProps)(prevContext || {}, {
|
||||
...props,
|
||||
ref: ref,
|
||||
register () {
|
||||
isRegistered.current = true;
|
||||
if (prevContext) prevContext.register();
|
||||
}
|
||||
});
|
||||
(0, $87RPk$useSyncRef)(prevContext, ref);
|
||||
(0, $87RPk$useEffect)(()=>{
|
||||
if (!isRegistered.current) {
|
||||
if (process.env.NODE_ENV !== 'production') console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
||||
isRegistered.current = true; // only warn once in strict mode.
|
||||
}
|
||||
}, []);
|
||||
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
||||
value: context
|
||||
}, children);
|
||||
});
|
||||
function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
|
||||
let context = (0, $87RPk$useMemo)(()=>({
|
||||
register: ()=>{}
|
||||
}), []);
|
||||
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
||||
value: context
|
||||
}, children);
|
||||
}
|
||||
|
||||
|
||||
export {$f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder};
|
||||
//# sourceMappingURL=PressResponder.module.js.map
|
||||
52
node_modules/@react-aria/interactions/dist/PressResponder.module.js
generated
vendored
Normal file
52
node_modules/@react-aria/interactions/dist/PressResponder.module.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import {PressResponderContext as $ae1eeba8b9eafd08$export$5165eccb35aaadb5} from "./context.module.js";
|
||||
import {useObjectRef as $87RPk$useObjectRef, mergeProps as $87RPk$mergeProps, useSyncRef as $87RPk$useSyncRef} from "@react-aria/utils";
|
||||
import $87RPk$react, {useRef as $87RPk$useRef, useContext as $87RPk$useContext, useEffect as $87RPk$useEffect, useMemo as $87RPk$useMemo} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
const $f1ab8c75478c6f73$export$3351871ee4b288b8 = /*#__PURE__*/ (0, $87RPk$react).forwardRef(({ children: children, ...props }, ref)=>{
|
||||
let isRegistered = (0, $87RPk$useRef)(false);
|
||||
let prevContext = (0, $87RPk$useContext)((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5));
|
||||
ref = (0, $87RPk$useObjectRef)(ref || (prevContext === null || prevContext === void 0 ? void 0 : prevContext.ref));
|
||||
let context = (0, $87RPk$mergeProps)(prevContext || {}, {
|
||||
...props,
|
||||
ref: ref,
|
||||
register () {
|
||||
isRegistered.current = true;
|
||||
if (prevContext) prevContext.register();
|
||||
}
|
||||
});
|
||||
(0, $87RPk$useSyncRef)(prevContext, ref);
|
||||
(0, $87RPk$useEffect)(()=>{
|
||||
if (!isRegistered.current) {
|
||||
if (process.env.NODE_ENV !== 'production') console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.");
|
||||
isRegistered.current = true; // only warn once in strict mode.
|
||||
}
|
||||
}, []);
|
||||
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
||||
value: context
|
||||
}, children);
|
||||
});
|
||||
function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children: children }) {
|
||||
let context = (0, $87RPk$useMemo)(()=>({
|
||||
register: ()=>{}
|
||||
}), []);
|
||||
return /*#__PURE__*/ (0, $87RPk$react).createElement((0, $ae1eeba8b9eafd08$export$5165eccb35aaadb5).Provider, {
|
||||
value: context
|
||||
}, children);
|
||||
}
|
||||
|
||||
|
||||
export {$f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder};
|
||||
//# sourceMappingURL=PressResponder.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/PressResponder.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/PressResponder.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAYM,MAAM,0DAAiB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAA2B,EAAE;IACzF,IAAI,eAAe,CAAA,GAAA,aAAK,EAAE;IAC1B,IAAI,cAAc,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAoB;IACjD,MAAM,CAAA,GAAA,mBAAW,EAAE,QAAO,wBAAA,kCAAA,YAAa,GAAG;IAC1C,IAAI,UAAU,CAAA,GAAA,iBAAS,EAAE,eAAe,CAAC,GAAG;QAC1C,GAAG,KAAK;aACR;QACA;YACE,aAAa,OAAO,GAAG;YACvB,IAAI,aACF,YAAY,QAAQ;QAExB;IACF;IAEA,CAAA,GAAA,iBAAS,EAAE,aAAa;IAExB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,aAAa,OAAO,EAAE;YACzB,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B,QAAQ,IAAI,CACV;YAIJ,aAAa,OAAO,GAAG,MAAM,iCAAiC;QAChE;IACF,GAAG,EAAE;IAEL,qBACE,gCAAC,CAAA,GAAA,yCAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP;AAEO,SAAS,0CAAoB,YAAC,QAAQ,EAAwB;IACnE,IAAI,UAAU,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAAC,UAAU,KAAO;QAAC,CAAA,GAAI,EAAE;IACtD,qBACE,gCAAC,CAAA,GAAA,yCAAoB,EAAE,QAAQ;QAAC,OAAO;OACpC;AAGP","sources":["packages/@react-aria/interactions/src/PressResponder.tsx"],"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 {FocusableElement} from '@react-types/shared';\nimport {mergeProps, useObjectRef, useSyncRef} from '@react-aria/utils';\nimport {PressProps} from './usePress';\nimport {PressResponderContext} from './context';\nimport React, {ForwardedRef, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\n\ninterface PressResponderProps extends PressProps {\n children: ReactNode\n}\n\nexport const PressResponder = React.forwardRef(({children, ...props}: PressResponderProps, ref: ForwardedRef<FocusableElement>) => {\n let isRegistered = useRef(false);\n let prevContext = useContext(PressResponderContext);\n ref = useObjectRef(ref || prevContext?.ref);\n let context = mergeProps(prevContext || {}, {\n ...props,\n ref,\n register() {\n isRegistered.current = true;\n if (prevContext) {\n prevContext.register();\n }\n }\n });\n\n useSyncRef(prevContext, ref);\n\n useEffect(() => {\n if (!isRegistered.current) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'A PressResponder was rendered without a pressable child. ' +\n 'Either call the usePress hook, or wrap your DOM node with <Pressable> component.'\n );\n }\n isRegistered.current = true; // only warn once in strict mode.\n }\n }, []);\n\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n});\n\nexport function ClearPressResponder({children}: {children: ReactNode}): JSX.Element {\n let context = useMemo(() => ({register: () => {}}), []);\n return (\n <PressResponderContext.Provider value={context}>\n {children}\n </PressResponderContext.Provider>\n );\n}\n"],"names":[],"version":3,"file":"PressResponder.module.js.map"}
|
||||
68
node_modules/@react-aria/interactions/dist/Pressable.main.js
generated
vendored
Normal file
68
node_modules/@react-aria/interactions/dist/Pressable.main.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
var $0294ea432cd92340$exports = require("./usePress.main.js");
|
||||
var $15f8fd80892557ff$exports = require("./useFocusable.main.js");
|
||||
var $ev4bP$reactariautils = require("@react-aria/utils");
|
||||
var $ev4bP$react = require("react");
|
||||
|
||||
|
||||
function $parcel$interopDefault(a) {
|
||||
return a && a.__esModule ? a.default : a;
|
||||
}
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "Pressable", () => $e1dbec26039c051d$export$27c701ed9e449e99);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const $e1dbec26039c051d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).forwardRef(({ children: children, ...props }, ref)=>{
|
||||
ref = (0, $ev4bP$reactariautils.useObjectRef)(ref);
|
||||
let { pressProps: pressProps } = (0, $0294ea432cd92340$exports.usePress)({
|
||||
...props,
|
||||
ref: ref
|
||||
});
|
||||
let { focusableProps: focusableProps } = (0, $15f8fd80892557ff$exports.useFocusable)(props, ref);
|
||||
let child = (0, ($parcel$interopDefault($ev4bP$react))).Children.only(children);
|
||||
(0, $ev4bP$react.useEffect)(()=>{
|
||||
if (process.env.NODE_ENV === 'production') return;
|
||||
let el = ref.current;
|
||||
if (!el || !(el instanceof (0, $ev4bP$reactariautils.getOwnerWindow)(el).Element)) {
|
||||
console.error('<Pressable> child must forward its ref to a DOM element.');
|
||||
return;
|
||||
}
|
||||
if (!(0, $ev4bP$reactariautils.isFocusable)(el)) {
|
||||
console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
|
||||
return;
|
||||
}
|
||||
if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
|
||||
let role = el.getAttribute('role');
|
||||
if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
|
||||
else if (// https://w3c.github.io/aria/#widget_roles
|
||||
role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
|
||||
}
|
||||
}, [
|
||||
ref
|
||||
]);
|
||||
// @ts-ignore
|
||||
let childRef = parseInt((0, ($parcel$interopDefault($ev4bP$react))).version, 10) < 19 ? child.ref : child.props.ref;
|
||||
return /*#__PURE__*/ (0, ($parcel$interopDefault($ev4bP$react))).cloneElement(child, {
|
||||
...(0, $ev4bP$reactariautils.mergeProps)(pressProps, focusableProps, child.props),
|
||||
// @ts-ignore
|
||||
ref: (0, $ev4bP$reactariautils.mergeRefs)(childRef, ref)
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//# sourceMappingURL=Pressable.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/Pressable.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/Pressable.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,MAAM,CAAA,GAAA,kCAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC3C,IAAI,QAAQ,CAAA,GAAA,sCAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B;QAGF,IAAI,KAAK,IAAI,OAAO;QACpB,IAAI,CAAC,MAAM,CAAE,CAAA,cAAc,CAAA,GAAA,oCAAa,EAAE,IAAI,OAAO,AAAD,GAAI;YACtD,QAAQ,KAAK,CAAC;YACd;QACF;QAEA,IAAI,CAAC,CAAA,GAAA,iCAAU,EAAE,KAAK;YACpB,QAAQ,IAAI,CAAC;YACb;QACF;QAEA,IACE,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,WACjB,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,cACjB,GAAG,SAAS,KAAK,OACjB,GAAG,SAAS,KAAK,UACjB,GAAG,SAAS,KAAK,WACjB;YACA,IAAI,OAAO,GAAG,YAAY,CAAC;YAC3B,IAAI,CAAC,MACH,QAAQ,IAAI,CAAC;iBACR,IACL,2CAA2C;YAC3C,SAAS,iBACT,SAAS,YACT,SAAS,cACT,SAAS,cACT,SAAS,cACT,SAAS,UACT,SAAS,cACT,SAAS,sBACT,SAAS,mBACT,SAAS,YACT,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,YACT,SAAS,gBACT,SAAS,YACT,SAAS,SACT,SAAS,aACT,SAAS,YAET,QAAQ,IAAI,CAAC,CAAC,2DAA2D,EAAE,KAAK,EAAE,CAAC;QAEvF;IACF,GAAG;QAAC;KAAI;IAER,aAAa;IACb,IAAI,WAAW,SAAS,CAAA,GAAA,sCAAI,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG;IAE7E,qBAAO,CAAA,GAAA,sCAAI,EAAE,YAAY,CACvB,OACA;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,YAAY,gBAAgB,MAAM,KAAK,CAAC;QACtD,aAAa;QACb,KAAK,CAAA,GAAA,+BAAQ,EAAE,UAAU;IAC3B;AAEJ","sources":["packages/@react-aria/interactions/src/Pressable.tsx"],"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 {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement, useEffect} from 'react';\nimport {useFocusable} from './useFocusable';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable = React.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<FocusableElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let {focusableProps} = useFocusable(props, ref);\n let child = React.Children.only(children);\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n \n let el = ref.current;\n if (!el || !(el instanceof getOwnerWindow(el).Element)) {\n console.error('<Pressable> child must forward its ref to a DOM element.');\n return;\n }\n\n if (!isFocusable(el)) {\n console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');\n return;\n }\n\n if (\n el.localName !== 'button' &&\n el.localName !== 'input' &&\n el.localName !== 'select' &&\n el.localName !== 'textarea' &&\n el.localName !== 'a' &&\n el.localName !== 'area' &&\n el.localName !== 'summary'\n ) {\n let role = el.getAttribute('role');\n if (!role) {\n console.warn('<Pressable> child must have an interactive ARIA role.');\n } else if (\n // https://w3c.github.io/aria/#widget_roles\n role !== 'application' &&\n role !== 'button' &&\n role !== 'checkbox' &&\n role !== 'combobox' &&\n role !== 'gridcell' &&\n role !== 'link' &&\n role !== 'menuitem' &&\n role !== 'menuitemcheckbox' &&\n role !== 'menuitemradio' &&\n role !== 'option' &&\n role !== 'radio' &&\n role !== 'searchbox' &&\n role !== 'separator' &&\n role !== 'slider' &&\n role !== 'spinbutton' &&\n role !== 'switch' &&\n role !== 'tab' &&\n role !== 'textbox' &&\n role !== 'treeitem'\n ) {\n console.warn(`<Pressable> child must have an interactive ARIA role. Got \"${role}\".`);\n }\n }\n }, [ref]);\n\n // @ts-ignore\n let childRef = parseInt(React.version, 10) < 19 ? child.ref : child.props.ref;\n\n return React.cloneElement(\n child,\n {\n ...mergeProps(pressProps, focusableProps, child.props),\n // @ts-ignore\n ref: mergeRefs(childRef, ref)\n }\n );\n});\n"],"names":[],"version":3,"file":"Pressable.main.js.map"}
|
||||
59
node_modules/@react-aria/interactions/dist/Pressable.mjs
generated
vendored
Normal file
59
node_modules/@react-aria/interactions/dist/Pressable.mjs
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.mjs";
|
||||
import {useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.mjs";
|
||||
import {useObjectRef as $hhDyF$useObjectRef, getOwnerWindow as $hhDyF$getOwnerWindow, isFocusable as $hhDyF$isFocusable, mergeProps as $hhDyF$mergeProps, mergeRefs as $hhDyF$mergeRefs} from "@react-aria/utils";
|
||||
import $hhDyF$react, {useEffect as $hhDyF$useEffect} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
|
||||
ref = (0, $hhDyF$useObjectRef)(ref);
|
||||
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
||||
...props,
|
||||
ref: ref
|
||||
});
|
||||
let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
|
||||
let child = (0, $hhDyF$react).Children.only(children);
|
||||
(0, $hhDyF$useEffect)(()=>{
|
||||
if (process.env.NODE_ENV === 'production') return;
|
||||
let el = ref.current;
|
||||
if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
|
||||
console.error('<Pressable> child must forward its ref to a DOM element.');
|
||||
return;
|
||||
}
|
||||
if (!(0, $hhDyF$isFocusable)(el)) {
|
||||
console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
|
||||
return;
|
||||
}
|
||||
if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
|
||||
let role = el.getAttribute('role');
|
||||
if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
|
||||
else if (// https://w3c.github.io/aria/#widget_roles
|
||||
role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
|
||||
}
|
||||
}, [
|
||||
ref
|
||||
]);
|
||||
// @ts-ignore
|
||||
let childRef = parseInt((0, $hhDyF$react).version, 10) < 19 ? child.ref : child.props.ref;
|
||||
return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, {
|
||||
...(0, $hhDyF$mergeProps)(pressProps, focusableProps, child.props),
|
||||
// @ts-ignore
|
||||
ref: (0, $hhDyF$mergeRefs)(childRef, ref)
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
|
||||
//# sourceMappingURL=Pressable.module.js.map
|
||||
59
node_modules/@react-aria/interactions/dist/Pressable.module.js
generated
vendored
Normal file
59
node_modules/@react-aria/interactions/dist/Pressable.module.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.module.js";
|
||||
import {useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.module.js";
|
||||
import {useObjectRef as $hhDyF$useObjectRef, getOwnerWindow as $hhDyF$getOwnerWindow, isFocusable as $hhDyF$isFocusable, mergeProps as $hhDyF$mergeProps, mergeRefs as $hhDyF$mergeRefs} from "@react-aria/utils";
|
||||
import $hhDyF$react, {useEffect as $hhDyF$useEffect} from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const $3b117e43dc0ca95d$export$27c701ed9e449e99 = /*#__PURE__*/ (0, $hhDyF$react).forwardRef(({ children: children, ...props }, ref)=>{
|
||||
ref = (0, $hhDyF$useObjectRef)(ref);
|
||||
let { pressProps: pressProps } = (0, $f6c31cce2adf654f$export$45712eceda6fad21)({
|
||||
...props,
|
||||
ref: ref
|
||||
});
|
||||
let { focusableProps: focusableProps } = (0, $f645667febf57a63$export$4c014de7c8940b4c)(props, ref);
|
||||
let child = (0, $hhDyF$react).Children.only(children);
|
||||
(0, $hhDyF$useEffect)(()=>{
|
||||
if (process.env.NODE_ENV === 'production') return;
|
||||
let el = ref.current;
|
||||
if (!el || !(el instanceof (0, $hhDyF$getOwnerWindow)(el).Element)) {
|
||||
console.error('<Pressable> child must forward its ref to a DOM element.');
|
||||
return;
|
||||
}
|
||||
if (!(0, $hhDyF$isFocusable)(el)) {
|
||||
console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');
|
||||
return;
|
||||
}
|
||||
if (el.localName !== 'button' && el.localName !== 'input' && el.localName !== 'select' && el.localName !== 'textarea' && el.localName !== 'a' && el.localName !== 'area' && el.localName !== 'summary') {
|
||||
let role = el.getAttribute('role');
|
||||
if (!role) console.warn('<Pressable> child must have an interactive ARIA role.');
|
||||
else if (// https://w3c.github.io/aria/#widget_roles
|
||||
role !== 'application' && role !== 'button' && role !== 'checkbox' && role !== 'combobox' && role !== 'gridcell' && role !== 'link' && role !== 'menuitem' && role !== 'menuitemcheckbox' && role !== 'menuitemradio' && role !== 'option' && role !== 'radio' && role !== 'searchbox' && role !== 'separator' && role !== 'slider' && role !== 'spinbutton' && role !== 'switch' && role !== 'tab' && role !== 'textbox' && role !== 'treeitem') console.warn(`<Pressable> child must have an interactive ARIA role. Got "${role}".`);
|
||||
}
|
||||
}, [
|
||||
ref
|
||||
]);
|
||||
// @ts-ignore
|
||||
let childRef = parseInt((0, $hhDyF$react).version, 10) < 19 ? child.ref : child.props.ref;
|
||||
return /*#__PURE__*/ (0, $hhDyF$react).cloneElement(child, {
|
||||
...(0, $hhDyF$mergeProps)(pressProps, focusableProps, child.props),
|
||||
// @ts-ignore
|
||||
ref: (0, $hhDyF$mergeRefs)(childRef, ref)
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable};
|
||||
//# sourceMappingURL=Pressable.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/Pressable.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/Pressable.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAYM,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,CAAC,YAAC,QAAQ,EAAE,GAAG,OAAsB,EAAE;IAC/E,MAAM,CAAA,GAAA,mBAAW,EAAE;IACnB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAO,EAAE;QAAC,GAAG,KAAK;aAAE;IAAG;IAC1C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,QAAQ,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEhC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC3B;QAGF,IAAI,KAAK,IAAI,OAAO;QACpB,IAAI,CAAC,MAAM,CAAE,CAAA,cAAc,CAAA,GAAA,qBAAa,EAAE,IAAI,OAAO,AAAD,GAAI;YACtD,QAAQ,KAAK,CAAC;YACd;QACF;QAEA,IAAI,CAAC,CAAA,GAAA,kBAAU,EAAE,KAAK;YACpB,QAAQ,IAAI,CAAC;YACb;QACF;QAEA,IACE,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,WACjB,GAAG,SAAS,KAAK,YACjB,GAAG,SAAS,KAAK,cACjB,GAAG,SAAS,KAAK,OACjB,GAAG,SAAS,KAAK,UACjB,GAAG,SAAS,KAAK,WACjB;YACA,IAAI,OAAO,GAAG,YAAY,CAAC;YAC3B,IAAI,CAAC,MACH,QAAQ,IAAI,CAAC;iBACR,IACL,2CAA2C;YAC3C,SAAS,iBACT,SAAS,YACT,SAAS,cACT,SAAS,cACT,SAAS,cACT,SAAS,UACT,SAAS,cACT,SAAS,sBACT,SAAS,mBACT,SAAS,YACT,SAAS,WACT,SAAS,eACT,SAAS,eACT,SAAS,YACT,SAAS,gBACT,SAAS,YACT,SAAS,SACT,SAAS,aACT,SAAS,YAET,QAAQ,IAAI,CAAC,CAAC,2DAA2D,EAAE,KAAK,EAAE,CAAC;QAEvF;IACF,GAAG;QAAC;KAAI;IAER,aAAa;IACb,IAAI,WAAW,SAAS,CAAA,GAAA,YAAI,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG;IAE7E,qBAAO,CAAA,GAAA,YAAI,EAAE,YAAY,CACvB,OACA;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY,gBAAgB,MAAM,KAAK,CAAC;QACtD,aAAa;QACb,KAAK,CAAA,GAAA,gBAAQ,EAAE,UAAU;IAC3B;AAEJ","sources":["packages/@react-aria/interactions/src/Pressable.tsx"],"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 {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {getOwnerWindow, isFocusable, mergeProps, mergeRefs, useObjectRef} from '@react-aria/utils';\nimport {PressProps, usePress} from './usePress';\nimport React, {ForwardedRef, ReactElement, useEffect} from 'react';\nimport {useFocusable} from './useFocusable';\n\ninterface PressableProps extends PressProps {\n children: ReactElement<DOMAttributes, string>\n}\n\nexport const Pressable = React.forwardRef(({children, ...props}: PressableProps, ref: ForwardedRef<FocusableElement>) => {\n ref = useObjectRef(ref);\n let {pressProps} = usePress({...props, ref});\n let {focusableProps} = useFocusable(props, ref);\n let child = React.Children.only(children);\n\n useEffect(() => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n \n let el = ref.current;\n if (!el || !(el instanceof getOwnerWindow(el).Element)) {\n console.error('<Pressable> child must forward its ref to a DOM element.');\n return;\n }\n\n if (!isFocusable(el)) {\n console.warn('<Pressable> child must be focusable. Please ensure the tabIndex prop is passed through.');\n return;\n }\n\n if (\n el.localName !== 'button' &&\n el.localName !== 'input' &&\n el.localName !== 'select' &&\n el.localName !== 'textarea' &&\n el.localName !== 'a' &&\n el.localName !== 'area' &&\n el.localName !== 'summary'\n ) {\n let role = el.getAttribute('role');\n if (!role) {\n console.warn('<Pressable> child must have an interactive ARIA role.');\n } else if (\n // https://w3c.github.io/aria/#widget_roles\n role !== 'application' &&\n role !== 'button' &&\n role !== 'checkbox' &&\n role !== 'combobox' &&\n role !== 'gridcell' &&\n role !== 'link' &&\n role !== 'menuitem' &&\n role !== 'menuitemcheckbox' &&\n role !== 'menuitemradio' &&\n role !== 'option' &&\n role !== 'radio' &&\n role !== 'searchbox' &&\n role !== 'separator' &&\n role !== 'slider' &&\n role !== 'spinbutton' &&\n role !== 'switch' &&\n role !== 'tab' &&\n role !== 'textbox' &&\n role !== 'treeitem'\n ) {\n console.warn(`<Pressable> child must have an interactive ARIA role. Got \"${role}\".`);\n }\n }\n }, [ref]);\n\n // @ts-ignore\n let childRef = parseInt(React.version, 10) < 19 ? child.ref : child.props.ref;\n\n return React.cloneElement(\n child,\n {\n ...mergeProps(pressProps, focusableProps, child.props),\n // @ts-ignore\n ref: mergeRefs(childRef, ref)\n }\n );\n});\n"],"names":[],"version":3,"file":"Pressable.module.js.map"}
|
||||
30
node_modules/@react-aria/interactions/dist/context.main.js
generated
vendored
Normal file
30
node_modules/@react-aria/interactions/dist/context.main.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var $bNpOp$react = require("react");
|
||||
|
||||
|
||||
function $parcel$interopDefault(a) {
|
||||
return a && a.__esModule ? a.default : a;
|
||||
}
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "PressResponderContext", () => $01d3f539e91688c8$export$5165eccb35aaadb5);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
const $01d3f539e91688c8$export$5165eccb35aaadb5 = (0, ($parcel$interopDefault($bNpOp$react))).createContext({
|
||||
register: ()=>{}
|
||||
});
|
||||
$01d3f539e91688c8$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
||||
|
||||
|
||||
//# sourceMappingURL=context.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/context.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/context.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAAwB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AACpG,0CAAsB,WAAW,GAAG","sources":["packages/@react-aria/interactions/src/context.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 {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.main.js.map"}
|
||||
21
node_modules/@react-aria/interactions/dist/context.mjs
generated
vendored
Normal file
21
node_modules/@react-aria/interactions/dist/context.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import $3aeG1$react from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
|
||||
register: ()=>{}
|
||||
});
|
||||
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
||||
|
||||
|
||||
export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
|
||||
//# sourceMappingURL=context.module.js.map
|
||||
21
node_modules/@react-aria/interactions/dist/context.module.js
generated
vendored
Normal file
21
node_modules/@react-aria/interactions/dist/context.module.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import $3aeG1$react from "react";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = (0, $3aeG1$react).createContext({
|
||||
register: ()=>{}
|
||||
});
|
||||
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = 'PressResponderContext';
|
||||
|
||||
|
||||
export {$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as PressResponderContext};
|
||||
//# sourceMappingURL=context.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/context.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/context.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAWM,MAAM,4CAAwB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAyB;IAAC,UAAU,KAAO;AAAC;AACpG,0CAAsB,WAAW,GAAG","sources":["packages/@react-aria/interactions/src/context.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 {FocusableElement} from '@react-types/shared';\nimport {PressProps} from './usePress';\nimport React, {MutableRefObject} from 'react';\n\ninterface IPressResponderContext extends PressProps {\n register(): void,\n ref?: MutableRefObject<FocusableElement>\n}\n\nexport const PressResponderContext = React.createContext<IPressResponderContext>({register: () => {}});\nPressResponderContext.displayName = 'PressResponderContext';\n"],"names":[],"version":3,"file":"context.module.js.map"}
|
||||
46
node_modules/@react-aria/interactions/dist/createEventHandler.main.js
generated
vendored
Normal file
46
node_modules/@react-aria/interactions/dist/createEventHandler.main.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "createEventHandler", () => $951fbcbbca8db6ce$export$48d1ea6320830260);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ function $951fbcbbca8db6ce$export$48d1ea6320830260(handler) {
|
||||
if (!handler) return undefined;
|
||||
let shouldStopPropagation = true;
|
||||
return (e)=>{
|
||||
let event = {
|
||||
...e,
|
||||
preventDefault () {
|
||||
e.preventDefault();
|
||||
},
|
||||
isDefaultPrevented () {
|
||||
return e.isDefaultPrevented();
|
||||
},
|
||||
stopPropagation () {
|
||||
if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
||||
else shouldStopPropagation = true;
|
||||
},
|
||||
continuePropagation () {
|
||||
shouldStopPropagation = false;
|
||||
},
|
||||
isPropagationStopped () {
|
||||
return shouldStopPropagation;
|
||||
}
|
||||
};
|
||||
handler(event);
|
||||
if (shouldStopPropagation) e.stopPropagation();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=createEventHandler.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/createEventHandler.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/createEventHandler.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAQM,SAAS,0CAA6C,OAAmC;IAC9F,IAAI,CAAC,SACH,OAAO;IAGT,IAAI,wBAAwB;IAC5B,OAAO,CAAC;QACN,IAAI,QAAsB;YACxB,GAAG,CAAC;YACJ;gBACE,EAAE,cAAc;YAClB;YACA;gBACE,OAAO,EAAE,kBAAkB;YAC7B;YACA;gBACE,IAAI,yBAAyB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACpD,QAAQ,KAAK,CAAC;qBAEd,wBAAwB;YAE5B;YACA;gBACE,wBAAwB;YAC1B;YACA;gBACE,OAAO;YACT;QACF;QAEA,QAAQ;QAER,IAAI,uBACF,EAAE,eAAe;IAErB;AACF","sources":["packages/@react-aria/interactions/src/createEventHandler.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 {BaseEvent} from '@react-types/shared';\nimport {SyntheticEvent} from 'react';\n\n/**\n * This function wraps a React event handler to make stopPropagation the default, and support continuePropagation instead.\n */\nexport function createEventHandler<T extends SyntheticEvent>(handler?: (e: BaseEvent<T>) => void): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n let shouldStopPropagation = true;\n return (e: T) => {\n let event: BaseEvent<T> = {\n ...e,\n preventDefault() {\n e.preventDefault();\n },\n isDefaultPrevented() {\n return e.isDefaultPrevented();\n },\n stopPropagation() {\n if (shouldStopPropagation && process.env.NODE_ENV !== 'production') {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n } else {\n shouldStopPropagation = true;\n }\n },\n continuePropagation() {\n shouldStopPropagation = false;\n },\n isPropagationStopped() {\n return shouldStopPropagation;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n"],"names":[],"version":3,"file":"createEventHandler.main.js.map"}
|
||||
41
node_modules/@react-aria/interactions/dist/createEventHandler.mjs
generated
vendored
Normal file
41
node_modules/@react-aria/interactions/dist/createEventHandler.mjs
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ function $93925083ecbb358c$export$48d1ea6320830260(handler) {
|
||||
if (!handler) return undefined;
|
||||
let shouldStopPropagation = true;
|
||||
return (e)=>{
|
||||
let event = {
|
||||
...e,
|
||||
preventDefault () {
|
||||
e.preventDefault();
|
||||
},
|
||||
isDefaultPrevented () {
|
||||
return e.isDefaultPrevented();
|
||||
},
|
||||
stopPropagation () {
|
||||
if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
||||
else shouldStopPropagation = true;
|
||||
},
|
||||
continuePropagation () {
|
||||
shouldStopPropagation = false;
|
||||
},
|
||||
isPropagationStopped () {
|
||||
return shouldStopPropagation;
|
||||
}
|
||||
};
|
||||
handler(event);
|
||||
if (shouldStopPropagation) e.stopPropagation();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
|
||||
//# sourceMappingURL=createEventHandler.module.js.map
|
||||
41
node_modules/@react-aria/interactions/dist/createEventHandler.module.js
generated
vendored
Normal file
41
node_modules/@react-aria/interactions/dist/createEventHandler.module.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ function $93925083ecbb358c$export$48d1ea6320830260(handler) {
|
||||
if (!handler) return undefined;
|
||||
let shouldStopPropagation = true;
|
||||
return (e)=>{
|
||||
let event = {
|
||||
...e,
|
||||
preventDefault () {
|
||||
e.preventDefault();
|
||||
},
|
||||
isDefaultPrevented () {
|
||||
return e.isDefaultPrevented();
|
||||
},
|
||||
stopPropagation () {
|
||||
if (shouldStopPropagation && process.env.NODE_ENV !== 'production') console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');
|
||||
else shouldStopPropagation = true;
|
||||
},
|
||||
continuePropagation () {
|
||||
shouldStopPropagation = false;
|
||||
},
|
||||
isPropagationStopped () {
|
||||
return shouldStopPropagation;
|
||||
}
|
||||
};
|
||||
handler(event);
|
||||
if (shouldStopPropagation) e.stopPropagation();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$93925083ecbb358c$export$48d1ea6320830260 as createEventHandler};
|
||||
//# sourceMappingURL=createEventHandler.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/createEventHandler.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/createEventHandler.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":"AAAA;;;;;;;;;;CAUC,GAQM,SAAS,0CAA6C,OAAmC;IAC9F,IAAI,CAAC,SACH,OAAO;IAGT,IAAI,wBAAwB;IAC5B,OAAO,CAAC;QACN,IAAI,QAAsB;YACxB,GAAG,CAAC;YACJ;gBACE,EAAE,cAAc;YAClB;YACA;gBACE,OAAO,EAAE,kBAAkB;YAC7B;YACA;gBACE,IAAI,yBAAyB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cACpD,QAAQ,KAAK,CAAC;qBAEd,wBAAwB;YAE5B;YACA;gBACE,wBAAwB;YAC1B;YACA;gBACE,OAAO;YACT;QACF;QAEA,QAAQ;QAER,IAAI,uBACF,EAAE,eAAe;IAErB;AACF","sources":["packages/@react-aria/interactions/src/createEventHandler.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 {BaseEvent} from '@react-types/shared';\nimport {SyntheticEvent} from 'react';\n\n/**\n * This function wraps a React event handler to make stopPropagation the default, and support continuePropagation instead.\n */\nexport function createEventHandler<T extends SyntheticEvent>(handler?: (e: BaseEvent<T>) => void): ((e: T) => void) | undefined {\n if (!handler) {\n return undefined;\n }\n\n let shouldStopPropagation = true;\n return (e: T) => {\n let event: BaseEvent<T> = {\n ...e,\n preventDefault() {\n e.preventDefault();\n },\n isDefaultPrevented() {\n return e.isDefaultPrevented();\n },\n stopPropagation() {\n if (shouldStopPropagation && process.env.NODE_ENV !== 'production') {\n console.error('stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.');\n } else {\n shouldStopPropagation = true;\n }\n },\n continuePropagation() {\n shouldStopPropagation = false;\n },\n isPropagationStopped() {\n return shouldStopPropagation;\n }\n };\n\n handler(event);\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n };\n}\n"],"names":[],"version":3,"file":"createEventHandler.module.js.map"}
|
||||
40
node_modules/@react-aria/interactions/dist/focusSafely.main.js
generated
vendored
Normal file
40
node_modules/@react-aria/interactions/dist/focusSafely.main.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
var $e77252a287ef94ab$exports = require("./useFocusVisible.main.js");
|
||||
var $fCG8z$reactariautils = require("@react-aria/utils");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "focusSafely", () => $2833058fcd3993f5$export$80f3e147d781571c);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
function $2833058fcd3993f5$export$80f3e147d781571c(element) {
|
||||
// If the user is interacting with a virtual cursor, e.g. screen reader, then
|
||||
// wait until after any animated transitions that are currently occurring on
|
||||
// the page before shifting focus. This avoids issues with VoiceOver on iOS
|
||||
// causing the page to scroll when moving focus if the element is transitioning
|
||||
// from off the screen.
|
||||
const ownerDocument = (0, $fCG8z$reactariautils.getOwnerDocument)(element);
|
||||
const activeElement = (0, $fCG8z$reactariautils.getActiveElement)(ownerDocument);
|
||||
if ((0, $e77252a287ef94ab$exports.getInteractionModality)() === 'virtual') {
|
||||
let lastFocusedElement = activeElement;
|
||||
(0, $fCG8z$reactariautils.runAfterTransition)(()=>{
|
||||
// If focus did not move and the element is still in the document, focus it.
|
||||
if ((0, $fCG8z$reactariautils.getActiveElement)(ownerDocument) === lastFocusedElement && element.isConnected) (0, $fCG8z$reactariautils.focusWithoutScrolling)(element);
|
||||
});
|
||||
} else (0, $fCG8z$reactariautils.focusWithoutScrolling)(element);
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=focusSafely.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/focusSafely.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/focusSafely.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACvC,IAAI,CAAA,GAAA,gDAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB;QACzB,CAAA,GAAA,wCAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,CAAA,GAAA,sCAAe,EAAE,mBAAmB,sBAAsB,QAAQ,WAAW,EAC/E,CAAA,GAAA,2CAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,2CAAoB,EAAE;AAE1B","sources":["packages/@react-aria/interactions/src/focusSafely.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 {FocusableElement} from '@react-types/shared';\nimport {\n focusWithoutScrolling,\n getActiveElement,\n getOwnerDocument,\n runAfterTransition\n} from '@react-aria/utils';\nimport {getInteractionModality} from './useFocusVisible';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement): void {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n const activeElement = getActiveElement(ownerDocument);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (getActiveElement(ownerDocument) === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.main.js.map"}
|
||||
35
node_modules/@react-aria/interactions/dist/focusSafely.mjs
generated
vendored
Normal file
35
node_modules/@react-aria/interactions/dist/focusSafely.mjs
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import {getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9} from "./useFocusVisible.mjs";
|
||||
import {getOwnerDocument as $k50bp$getOwnerDocument, getActiveElement as $k50bp$getActiveElement, runAfterTransition as $k50bp$runAfterTransition, focusWithoutScrolling as $k50bp$focusWithoutScrolling} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
function $3ad3f6e1647bc98d$export$80f3e147d781571c(element) {
|
||||
// If the user is interacting with a virtual cursor, e.g. screen reader, then
|
||||
// wait until after any animated transitions that are currently occurring on
|
||||
// the page before shifting focus. This avoids issues with VoiceOver on iOS
|
||||
// causing the page to scroll when moving focus if the element is transitioning
|
||||
// from off the screen.
|
||||
const ownerDocument = (0, $k50bp$getOwnerDocument)(element);
|
||||
const activeElement = (0, $k50bp$getActiveElement)(ownerDocument);
|
||||
if ((0, $507fabe10e71c6fb$export$630ff653c5ada6a9)() === 'virtual') {
|
||||
let lastFocusedElement = activeElement;
|
||||
(0, $k50bp$runAfterTransition)(()=>{
|
||||
// If focus did not move and the element is still in the document, focus it.
|
||||
if ((0, $k50bp$getActiveElement)(ownerDocument) === lastFocusedElement && element.isConnected) (0, $k50bp$focusWithoutScrolling)(element);
|
||||
});
|
||||
} else (0, $k50bp$focusWithoutScrolling)(element);
|
||||
}
|
||||
|
||||
|
||||
export {$3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
|
||||
//# sourceMappingURL=focusSafely.module.js.map
|
||||
35
node_modules/@react-aria/interactions/dist/focusSafely.module.js
generated
vendored
Normal file
35
node_modules/@react-aria/interactions/dist/focusSafely.module.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import {getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9} from "./useFocusVisible.module.js";
|
||||
import {getOwnerDocument as $k50bp$getOwnerDocument, getActiveElement as $k50bp$getActiveElement, runAfterTransition as $k50bp$runAfterTransition, focusWithoutScrolling as $k50bp$focusWithoutScrolling} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
function $3ad3f6e1647bc98d$export$80f3e147d781571c(element) {
|
||||
// If the user is interacting with a virtual cursor, e.g. screen reader, then
|
||||
// wait until after any animated transitions that are currently occurring on
|
||||
// the page before shifting focus. This avoids issues with VoiceOver on iOS
|
||||
// causing the page to scroll when moving focus if the element is transitioning
|
||||
// from off the screen.
|
||||
const ownerDocument = (0, $k50bp$getOwnerDocument)(element);
|
||||
const activeElement = (0, $k50bp$getActiveElement)(ownerDocument);
|
||||
if ((0, $507fabe10e71c6fb$export$630ff653c5ada6a9)() === 'virtual') {
|
||||
let lastFocusedElement = activeElement;
|
||||
(0, $k50bp$runAfterTransition)(()=>{
|
||||
// If focus did not move and the element is still in the document, focus it.
|
||||
if ((0, $k50bp$getActiveElement)(ownerDocument) === lastFocusedElement && element.isConnected) (0, $k50bp$focusWithoutScrolling)(element);
|
||||
});
|
||||
} else (0, $k50bp$focusWithoutScrolling)(element);
|
||||
}
|
||||
|
||||
|
||||
export {$3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
|
||||
//# sourceMappingURL=focusSafely.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/focusSafely.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/focusSafely.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAeM,SAAS,0CAAY,OAAyB;IACnD,6EAA6E;IAC7E,4EAA4E;IAC5E,2EAA2E;IAC3E,+EAA+E;IAC/E,uBAAuB;IACvB,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE;IACvC,IAAI,CAAA,GAAA,yCAAqB,QAAQ,WAAW;QAC1C,IAAI,qBAAqB;QACzB,CAAA,GAAA,yBAAiB,EAAE;YACjB,4EAA4E;YAC5E,IAAI,CAAA,GAAA,uBAAe,EAAE,mBAAmB,sBAAsB,QAAQ,WAAW,EAC/E,CAAA,GAAA,4BAAoB,EAAE;QAE1B;IACF,OACE,CAAA,GAAA,4BAAoB,EAAE;AAE1B","sources":["packages/@react-aria/interactions/src/focusSafely.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 {FocusableElement} from '@react-types/shared';\nimport {\n focusWithoutScrolling,\n getActiveElement,\n getOwnerDocument,\n runAfterTransition\n} from '@react-aria/utils';\nimport {getInteractionModality} from './useFocusVisible';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: FocusableElement): void {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n const ownerDocument = getOwnerDocument(element);\n const activeElement = getActiveElement(ownerDocument);\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (getActiveElement(ownerDocument) === lastFocusedElement && element.isConnected) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n"],"names":[],"version":3,"file":"focusSafely.module.js.map"}
|
||||
43
node_modules/@react-aria/interactions/dist/import.mjs
generated
vendored
Normal file
43
node_modules/@react-aria/interactions/dist/import.mjs
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import {Pressable as $3b117e43dc0ca95d$export$27c701ed9e449e99} from "./Pressable.mjs";
|
||||
import {ClearPressResponder as $f1ab8c75478c6f73$export$cf75428e0b9ed1ea, PressResponder as $f1ab8c75478c6f73$export$3351871ee4b288b8} from "./PressResponder.mjs";
|
||||
import {useFocus as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6} from "./useFocus.mjs";
|
||||
import {addWindowFocusTracking as $507fabe10e71c6fb$export$2f1888112f558a7d, getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9, isFocusVisible as $507fabe10e71c6fb$export$b9b3dfddab17db27, setInteractionModality as $507fabe10e71c6fb$export$8397ddfc504fdb9a, useFocusVisible as $507fabe10e71c6fb$export$ffd9e5021c1fb2d6, useFocusVisibleListener as $507fabe10e71c6fb$export$ec71b4b83ac08ec3, useInteractionModality as $507fabe10e71c6fb$export$98e20ec92f614cfe} from "./useFocusVisible.mjs";
|
||||
import {useFocusWithin as $9ab94262bd0047c7$export$420e68273165f4ec} from "./useFocusWithin.mjs";
|
||||
import {useHover as $6179b936705e76d3$export$ae780daf29e6d456} from "./useHover.mjs";
|
||||
import {useInteractOutside as $e0b6e0b68ec7f50f$export$872b660ac5a1ff98} from "./useInteractOutside.mjs";
|
||||
import {useKeyboard as $46d819fcbaf35654$export$8f71654801c2f7cd} from "./useKeyboard.mjs";
|
||||
import {useMove as $e8a7022cf87cba2a$export$36da96379f79f245} from "./useMove.mjs";
|
||||
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.mjs";
|
||||
import {useScrollWheel as $7d0a636d7a4dcefd$export$2123ff2b87c81ca} from "./useScrollWheel.mjs";
|
||||
import {useLongPress as $8a26561d2877236e$export$c24ed0104d07eab9} from "./useLongPress.mjs";
|
||||
import {Focusable as $f645667febf57a63$export$35a3bebf7ef2d934, FocusableContext as $f645667febf57a63$export$f9762fab77588ecb, FocusableProvider as $f645667febf57a63$export$13f3202a3e5ddd5, useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.mjs";
|
||||
import {focusSafely as $3ad3f6e1647bc98d$export$80f3e147d781571c} from "./focusSafely.mjs";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable, $f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder, $a1ea59d68270f0dd$export$f8168d8dd8fd66e6 as useFocus, $507fabe10e71c6fb$export$b9b3dfddab17db27 as isFocusVisible, $507fabe10e71c6fb$export$630ff653c5ada6a9 as getInteractionModality, $507fabe10e71c6fb$export$8397ddfc504fdb9a as setInteractionModality, $507fabe10e71c6fb$export$2f1888112f558a7d as addWindowFocusTracking, $507fabe10e71c6fb$export$98e20ec92f614cfe as useInteractionModality, $507fabe10e71c6fb$export$ffd9e5021c1fb2d6 as useFocusVisible, $507fabe10e71c6fb$export$ec71b4b83ac08ec3 as useFocusVisibleListener, $9ab94262bd0047c7$export$420e68273165f4ec as useFocusWithin, $6179b936705e76d3$export$ae780daf29e6d456 as useHover, $e0b6e0b68ec7f50f$export$872b660ac5a1ff98 as useInteractOutside, $46d819fcbaf35654$export$8f71654801c2f7cd as useKeyboard, $e8a7022cf87cba2a$export$36da96379f79f245 as useMove, $f6c31cce2adf654f$export$45712eceda6fad21 as usePress, $7d0a636d7a4dcefd$export$2123ff2b87c81ca as useScrollWheel, $8a26561d2877236e$export$c24ed0104d07eab9 as useLongPress, $f645667febf57a63$export$4c014de7c8940b4c as useFocusable, $f645667febf57a63$export$13f3202a3e5ddd5 as FocusableProvider, $f645667febf57a63$export$35a3bebf7ef2d934 as Focusable, $f645667febf57a63$export$f9762fab77588ecb as FocusableContext, $3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
|
||||
//# sourceMappingURL=module.js.map
|
||||
71
node_modules/@react-aria/interactions/dist/main.js
generated
vendored
Normal file
71
node_modules/@react-aria/interactions/dist/main.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
var $e1dbec26039c051d$exports = require("./Pressable.main.js");
|
||||
var $3596bae48579386f$exports = require("./PressResponder.main.js");
|
||||
var $5cb73d0ce355b0dc$exports = require("./useFocus.main.js");
|
||||
var $e77252a287ef94ab$exports = require("./useFocusVisible.main.js");
|
||||
var $d16842bbd0359d1b$exports = require("./useFocusWithin.main.js");
|
||||
var $ffbc150311c75f01$exports = require("./useHover.main.js");
|
||||
var $edcfa848c42f94f4$exports = require("./useInteractOutside.main.js");
|
||||
var $892d64db2a3c53b0$exports = require("./useKeyboard.main.js");
|
||||
var $c09386fc48fa427d$exports = require("./useMove.main.js");
|
||||
var $0294ea432cd92340$exports = require("./usePress.main.js");
|
||||
var $a3dbce0aed7087e2$exports = require("./useScrollWheel.main.js");
|
||||
var $3cd7b5d0eebf0ca9$exports = require("./useLongPress.main.js");
|
||||
var $15f8fd80892557ff$exports = require("./useFocusable.main.js");
|
||||
var $2833058fcd3993f5$exports = require("./focusSafely.main.js");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "Pressable", () => $e1dbec26039c051d$exports.Pressable);
|
||||
$parcel$export(module.exports, "PressResponder", () => $3596bae48579386f$exports.PressResponder);
|
||||
$parcel$export(module.exports, "ClearPressResponder", () => $3596bae48579386f$exports.ClearPressResponder);
|
||||
$parcel$export(module.exports, "useFocus", () => $5cb73d0ce355b0dc$exports.useFocus);
|
||||
$parcel$export(module.exports, "isFocusVisible", () => $e77252a287ef94ab$exports.isFocusVisible);
|
||||
$parcel$export(module.exports, "getInteractionModality", () => $e77252a287ef94ab$exports.getInteractionModality);
|
||||
$parcel$export(module.exports, "setInteractionModality", () => $e77252a287ef94ab$exports.setInteractionModality);
|
||||
$parcel$export(module.exports, "addWindowFocusTracking", () => $e77252a287ef94ab$exports.addWindowFocusTracking);
|
||||
$parcel$export(module.exports, "useInteractionModality", () => $e77252a287ef94ab$exports.useInteractionModality);
|
||||
$parcel$export(module.exports, "useFocusVisible", () => $e77252a287ef94ab$exports.useFocusVisible);
|
||||
$parcel$export(module.exports, "useFocusVisibleListener", () => $e77252a287ef94ab$exports.useFocusVisibleListener);
|
||||
$parcel$export(module.exports, "useFocusWithin", () => $d16842bbd0359d1b$exports.useFocusWithin);
|
||||
$parcel$export(module.exports, "useHover", () => $ffbc150311c75f01$exports.useHover);
|
||||
$parcel$export(module.exports, "useInteractOutside", () => $edcfa848c42f94f4$exports.useInteractOutside);
|
||||
$parcel$export(module.exports, "useKeyboard", () => $892d64db2a3c53b0$exports.useKeyboard);
|
||||
$parcel$export(module.exports, "useMove", () => $c09386fc48fa427d$exports.useMove);
|
||||
$parcel$export(module.exports, "usePress", () => $0294ea432cd92340$exports.usePress);
|
||||
$parcel$export(module.exports, "useScrollWheel", () => $a3dbce0aed7087e2$exports.useScrollWheel);
|
||||
$parcel$export(module.exports, "useLongPress", () => $3cd7b5d0eebf0ca9$exports.useLongPress);
|
||||
$parcel$export(module.exports, "useFocusable", () => $15f8fd80892557ff$exports.useFocusable);
|
||||
$parcel$export(module.exports, "FocusableProvider", () => $15f8fd80892557ff$exports.FocusableProvider);
|
||||
$parcel$export(module.exports, "Focusable", () => $15f8fd80892557ff$exports.Focusable);
|
||||
$parcel$export(module.exports, "FocusableContext", () => $15f8fd80892557ff$exports.FocusableContext);
|
||||
$parcel$export(module.exports, "focusSafely", () => $2833058fcd3993f5$exports.focusSafely);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/interactions/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\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\nexport {useFocusable, FocusableProvider, Focusable, FocusableContext} from './useFocusable';\nexport {focusSafely} from './focusSafely';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from './useFocusable';\n"],"names":[],"version":3,"file":"main.js.map"}
|
||||
43
node_modules/@react-aria/interactions/dist/module.js
generated
vendored
Normal file
43
node_modules/@react-aria/interactions/dist/module.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import {Pressable as $3b117e43dc0ca95d$export$27c701ed9e449e99} from "./Pressable.module.js";
|
||||
import {ClearPressResponder as $f1ab8c75478c6f73$export$cf75428e0b9ed1ea, PressResponder as $f1ab8c75478c6f73$export$3351871ee4b288b8} from "./PressResponder.module.js";
|
||||
import {useFocus as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6} from "./useFocus.module.js";
|
||||
import {addWindowFocusTracking as $507fabe10e71c6fb$export$2f1888112f558a7d, getInteractionModality as $507fabe10e71c6fb$export$630ff653c5ada6a9, isFocusVisible as $507fabe10e71c6fb$export$b9b3dfddab17db27, setInteractionModality as $507fabe10e71c6fb$export$8397ddfc504fdb9a, useFocusVisible as $507fabe10e71c6fb$export$ffd9e5021c1fb2d6, useFocusVisibleListener as $507fabe10e71c6fb$export$ec71b4b83ac08ec3, useInteractionModality as $507fabe10e71c6fb$export$98e20ec92f614cfe} from "./useFocusVisible.module.js";
|
||||
import {useFocusWithin as $9ab94262bd0047c7$export$420e68273165f4ec} from "./useFocusWithin.module.js";
|
||||
import {useHover as $6179b936705e76d3$export$ae780daf29e6d456} from "./useHover.module.js";
|
||||
import {useInteractOutside as $e0b6e0b68ec7f50f$export$872b660ac5a1ff98} from "./useInteractOutside.module.js";
|
||||
import {useKeyboard as $46d819fcbaf35654$export$8f71654801c2f7cd} from "./useKeyboard.module.js";
|
||||
import {useMove as $e8a7022cf87cba2a$export$36da96379f79f245} from "./useMove.module.js";
|
||||
import {usePress as $f6c31cce2adf654f$export$45712eceda6fad21} from "./usePress.module.js";
|
||||
import {useScrollWheel as $7d0a636d7a4dcefd$export$2123ff2b87c81ca} from "./useScrollWheel.module.js";
|
||||
import {useLongPress as $8a26561d2877236e$export$c24ed0104d07eab9} from "./useLongPress.module.js";
|
||||
import {Focusable as $f645667febf57a63$export$35a3bebf7ef2d934, FocusableContext as $f645667febf57a63$export$f9762fab77588ecb, FocusableProvider as $f645667febf57a63$export$13f3202a3e5ddd5, useFocusable as $f645667febf57a63$export$4c014de7c8940b4c} from "./useFocusable.module.js";
|
||||
import {focusSafely as $3ad3f6e1647bc98d$export$80f3e147d781571c} from "./focusSafely.module.js";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export {$3b117e43dc0ca95d$export$27c701ed9e449e99 as Pressable, $f1ab8c75478c6f73$export$3351871ee4b288b8 as PressResponder, $f1ab8c75478c6f73$export$cf75428e0b9ed1ea as ClearPressResponder, $a1ea59d68270f0dd$export$f8168d8dd8fd66e6 as useFocus, $507fabe10e71c6fb$export$b9b3dfddab17db27 as isFocusVisible, $507fabe10e71c6fb$export$630ff653c5ada6a9 as getInteractionModality, $507fabe10e71c6fb$export$8397ddfc504fdb9a as setInteractionModality, $507fabe10e71c6fb$export$2f1888112f558a7d as addWindowFocusTracking, $507fabe10e71c6fb$export$98e20ec92f614cfe as useInteractionModality, $507fabe10e71c6fb$export$ffd9e5021c1fb2d6 as useFocusVisible, $507fabe10e71c6fb$export$ec71b4b83ac08ec3 as useFocusVisibleListener, $9ab94262bd0047c7$export$420e68273165f4ec as useFocusWithin, $6179b936705e76d3$export$ae780daf29e6d456 as useHover, $e0b6e0b68ec7f50f$export$872b660ac5a1ff98 as useInteractOutside, $46d819fcbaf35654$export$8f71654801c2f7cd as useKeyboard, $e8a7022cf87cba2a$export$36da96379f79f245 as useMove, $f6c31cce2adf654f$export$45712eceda6fad21 as usePress, $7d0a636d7a4dcefd$export$2123ff2b87c81ca as useScrollWheel, $8a26561d2877236e$export$c24ed0104d07eab9 as useLongPress, $f645667febf57a63$export$4c014de7c8940b4c as useFocusable, $f645667febf57a63$export$13f3202a3e5ddd5 as FocusableProvider, $f645667febf57a63$export$35a3bebf7ef2d934 as Focusable, $f645667febf57a63$export$f9762fab77588ecb as FocusableContext, $3ad3f6e1647bc98d$export$80f3e147d781571c as focusSafely};
|
||||
//# sourceMappingURL=module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/interactions/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\nexport {Pressable} from './Pressable';\nexport {PressResponder, ClearPressResponder} from './PressResponder';\nexport {useFocus} from './useFocus';\nexport {\n isFocusVisible,\n getInteractionModality,\n setInteractionModality,\n addWindowFocusTracking,\n useInteractionModality,\n useFocusVisible,\n useFocusVisibleListener\n} from './useFocusVisible';\nexport {useFocusWithin} from './useFocusWithin';\nexport {useHover} from './useHover';\nexport {useInteractOutside} from './useInteractOutside';\nexport {useKeyboard} from './useKeyboard';\nexport {useMove} from './useMove';\nexport {usePress} from './usePress';\nexport {useScrollWheel} from './useScrollWheel';\nexport {useLongPress} from './useLongPress';\nexport {useFocusable, FocusableProvider, Focusable, FocusableContext} from './useFocusable';\nexport {focusSafely} from './focusSafely';\n\nexport type {FocusProps, FocusResult} from './useFocus';\nexport type {FocusVisibleHandler, FocusVisibleProps, FocusVisibleResult, Modality} from './useFocusVisible';\nexport type {FocusWithinProps, FocusWithinResult} from './useFocusWithin';\nexport type {HoverProps, HoverResult} from './useHover';\nexport type {InteractOutsideProps} from './useInteractOutside';\nexport type {KeyboardProps, KeyboardResult} from './useKeyboard';\nexport type {PressProps, PressHookProps, PressResult} from './usePress';\nexport type {PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents} from '@react-types/shared';\nexport type {MoveResult} from './useMove';\nexport type {LongPressProps, LongPressResult} from './useLongPress';\nexport type {ScrollWheelProps} from './useScrollWheel';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from './useFocusable';\n"],"names":[],"version":3,"file":"module.js.map"}
|
||||
77
node_modules/@react-aria/interactions/dist/textSelection.main.js
generated
vendored
Normal file
77
node_modules/@react-aria/interactions/dist/textSelection.main.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
var $20aJV$reactariautils = require("@react-aria/utils");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "disableTextSelection", () => $f7e14e656343df57$export$16a4697467175487);
|
||||
$parcel$export(module.exports, "restoreTextSelection", () => $f7e14e656343df57$export$b0d6fa1ab32e3295);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
||||
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
||||
let $f7e14e656343df57$var$state = 'default';
|
||||
let $f7e14e656343df57$var$savedUserSelect = '';
|
||||
let $f7e14e656343df57$var$modifiedElementMap = new WeakMap();
|
||||
function $f7e14e656343df57$export$16a4697467175487(target) {
|
||||
if ((0, $20aJV$reactariautils.isIOS)()) {
|
||||
if ($f7e14e656343df57$var$state === 'default') {
|
||||
const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
|
||||
$f7e14e656343df57$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
||||
documentObject.documentElement.style.webkitUserSelect = 'none';
|
||||
}
|
||||
$f7e14e656343df57$var$state = 'disabled';
|
||||
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
||||
// If not iOS, store the target's original user-select and change to user-select: none
|
||||
// Ignore state since it doesn't apply for non iOS
|
||||
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
||||
$f7e14e656343df57$var$modifiedElementMap.set(target, target.style[property]);
|
||||
target.style[property] = 'none';
|
||||
}
|
||||
}
|
||||
function $f7e14e656343df57$export$b0d6fa1ab32e3295(target) {
|
||||
if ((0, $20aJV$reactariautils.isIOS)()) {
|
||||
// If the state is already default, there's nothing to do.
|
||||
// If it is restoring, then there's no need to queue a second restore.
|
||||
if ($f7e14e656343df57$var$state !== 'disabled') return;
|
||||
$f7e14e656343df57$var$state = 'restoring';
|
||||
// There appears to be a delay on iOS where selection still might occur
|
||||
// after pointer up, so wait a bit before removing user-select.
|
||||
setTimeout(()=>{
|
||||
// Wait for any CSS transitions to complete so we don't recompute style
|
||||
// for the whole page in the middle of the animation and cause jank.
|
||||
(0, $20aJV$reactariautils.runAfterTransition)(()=>{
|
||||
// Avoid race conditions
|
||||
if ($f7e14e656343df57$var$state === 'restoring') {
|
||||
const documentObject = (0, $20aJV$reactariautils.getOwnerDocument)(target);
|
||||
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $f7e14e656343df57$var$savedUserSelect || '';
|
||||
$f7e14e656343df57$var$savedUserSelect = '';
|
||||
$f7e14e656343df57$var$state = 'default';
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
} else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
|
||||
// Ignore state since it doesn't apply for non iOS
|
||||
{
|
||||
if (target && $f7e14e656343df57$var$modifiedElementMap.has(target)) {
|
||||
let targetOldUserSelect = $f7e14e656343df57$var$modifiedElementMap.get(target);
|
||||
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
||||
if (target.style[property] === 'none') target.style[property] = targetOldUserSelect;
|
||||
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
||||
$f7e14e656343df57$var$modifiedElementMap.delete(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=textSelection.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/textSelection.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/textSelection.main.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
71
node_modules/@react-aria/interactions/dist/textSelection.mjs
generated
vendored
Normal file
71
node_modules/@react-aria/interactions/dist/textSelection.mjs
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runAfterTransition as $7R18e$runAfterTransition} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
||||
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
||||
let $14c0b72509d70225$var$state = 'default';
|
||||
let $14c0b72509d70225$var$savedUserSelect = '';
|
||||
let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
|
||||
function $14c0b72509d70225$export$16a4697467175487(target) {
|
||||
if ((0, $7R18e$isIOS)()) {
|
||||
if ($14c0b72509d70225$var$state === 'default') {
|
||||
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
||||
$14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
||||
documentObject.documentElement.style.webkitUserSelect = 'none';
|
||||
}
|
||||
$14c0b72509d70225$var$state = 'disabled';
|
||||
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
||||
// If not iOS, store the target's original user-select and change to user-select: none
|
||||
// Ignore state since it doesn't apply for non iOS
|
||||
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
||||
$14c0b72509d70225$var$modifiedElementMap.set(target, target.style[property]);
|
||||
target.style[property] = 'none';
|
||||
}
|
||||
}
|
||||
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
||||
if ((0, $7R18e$isIOS)()) {
|
||||
// If the state is already default, there's nothing to do.
|
||||
// If it is restoring, then there's no need to queue a second restore.
|
||||
if ($14c0b72509d70225$var$state !== 'disabled') return;
|
||||
$14c0b72509d70225$var$state = 'restoring';
|
||||
// There appears to be a delay on iOS where selection still might occur
|
||||
// after pointer up, so wait a bit before removing user-select.
|
||||
setTimeout(()=>{
|
||||
// Wait for any CSS transitions to complete so we don't recompute style
|
||||
// for the whole page in the middle of the animation and cause jank.
|
||||
(0, $7R18e$runAfterTransition)(()=>{
|
||||
// Avoid race conditions
|
||||
if ($14c0b72509d70225$var$state === 'restoring') {
|
||||
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
||||
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
|
||||
$14c0b72509d70225$var$savedUserSelect = '';
|
||||
$14c0b72509d70225$var$state = 'default';
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
} else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
|
||||
// Ignore state since it doesn't apply for non iOS
|
||||
{
|
||||
if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
||||
let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
||||
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
||||
if (target.style[property] === 'none') target.style[property] = targetOldUserSelect;
|
||||
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
||||
$14c0b72509d70225$var$modifiedElementMap.delete(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export {$14c0b72509d70225$export$16a4697467175487 as disableTextSelection, $14c0b72509d70225$export$b0d6fa1ab32e3295 as restoreTextSelection};
|
||||
//# sourceMappingURL=textSelection.module.js.map
|
||||
71
node_modules/@react-aria/interactions/dist/textSelection.module.js
generated
vendored
Normal file
71
node_modules/@react-aria/interactions/dist/textSelection.module.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import {isIOS as $7R18e$isIOS, getOwnerDocument as $7R18e$getOwnerDocument, runAfterTransition as $7R18e$runAfterTransition} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
// Note that state only matters here for iOS. Non-iOS gets user-select: none applied to the target element
|
||||
// rather than at the document level so we just need to apply/remove user-select: none for each pressed element individually
|
||||
let $14c0b72509d70225$var$state = 'default';
|
||||
let $14c0b72509d70225$var$savedUserSelect = '';
|
||||
let $14c0b72509d70225$var$modifiedElementMap = new WeakMap();
|
||||
function $14c0b72509d70225$export$16a4697467175487(target) {
|
||||
if ((0, $7R18e$isIOS)()) {
|
||||
if ($14c0b72509d70225$var$state === 'default') {
|
||||
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
||||
$14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
||||
documentObject.documentElement.style.webkitUserSelect = 'none';
|
||||
}
|
||||
$14c0b72509d70225$var$state = 'disabled';
|
||||
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
||||
// If not iOS, store the target's original user-select and change to user-select: none
|
||||
// Ignore state since it doesn't apply for non iOS
|
||||
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
||||
$14c0b72509d70225$var$modifiedElementMap.set(target, target.style[property]);
|
||||
target.style[property] = 'none';
|
||||
}
|
||||
}
|
||||
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
||||
if ((0, $7R18e$isIOS)()) {
|
||||
// If the state is already default, there's nothing to do.
|
||||
// If it is restoring, then there's no need to queue a second restore.
|
||||
if ($14c0b72509d70225$var$state !== 'disabled') return;
|
||||
$14c0b72509d70225$var$state = 'restoring';
|
||||
// There appears to be a delay on iOS where selection still might occur
|
||||
// after pointer up, so wait a bit before removing user-select.
|
||||
setTimeout(()=>{
|
||||
// Wait for any CSS transitions to complete so we don't recompute style
|
||||
// for the whole page in the middle of the animation and cause jank.
|
||||
(0, $7R18e$runAfterTransition)(()=>{
|
||||
// Avoid race conditions
|
||||
if ($14c0b72509d70225$var$state === 'restoring') {
|
||||
const documentObject = (0, $7R18e$getOwnerDocument)(target);
|
||||
if (documentObject.documentElement.style.webkitUserSelect === 'none') documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || '';
|
||||
$14c0b72509d70225$var$savedUserSelect = '';
|
||||
$14c0b72509d70225$var$state = 'default';
|
||||
}
|
||||
});
|
||||
}, 300);
|
||||
} else if (target instanceof HTMLElement || target instanceof SVGElement) // If not iOS, restore the target's original user-select if any
|
||||
// Ignore state since it doesn't apply for non iOS
|
||||
{
|
||||
if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
||||
let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
||||
let property = 'userSelect' in target.style ? 'userSelect' : 'webkitUserSelect';
|
||||
if (target.style[property] === 'none') target.style[property] = targetOldUserSelect;
|
||||
if (target.getAttribute('style') === '') target.removeAttribute('style');
|
||||
$14c0b72509d70225$var$modifiedElementMap.delete(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export {$14c0b72509d70225$export$16a4697467175487 as disableTextSelection, $14c0b72509d70225$export$b0d6fa1ab32e3295 as restoreTextSelection};
|
||||
//# sourceMappingURL=textSelection.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/textSelection.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/textSelection.module.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
252
node_modules/@react-aria/interactions/dist/types.d.ts
generated
vendored
Normal file
252
node_modules/@react-aria/interactions/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
import { DOMAttributes, PressEvents, RefObject, FocusableElement, FocusEvents, KeyboardEvents, FocusableDOMProps, FocusableProps, HoverEvents, MoveEvents, ScrollEvents, LongPressEvent } from "@react-types/shared";
|
||||
import React, { MutableRefObject, ReactElement, ReactNode, JSX, FocusEvent } from "react";
|
||||
export interface PressProps extends PressEvents {
|
||||
/** Whether the target is in a controlled press state (e.g. an overlay it triggers is open). */
|
||||
isPressed?: boolean;
|
||||
/** Whether the press events should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
/** Whether the target should not receive focus on press. */
|
||||
preventFocusOnPress?: boolean;
|
||||
/**
|
||||
* Whether press events should be canceled when the pointer leaves the target while pressed.
|
||||
* By default, this is `false`, which means if the pointer returns back over the target while
|
||||
* still pressed, onPressStart will be fired again. If set to `true`, the press is canceled
|
||||
* when the pointer leaves the target and onPressStart will not be fired if the pointer returns.
|
||||
*/
|
||||
shouldCancelOnPointerExit?: boolean;
|
||||
/** Whether text selection should be enabled on the pressable element. */
|
||||
allowTextSelectionOnPress?: boolean;
|
||||
}
|
||||
export interface PressHookProps extends PressProps {
|
||||
/** A ref to the target element. */
|
||||
ref?: RefObject<Element | null>;
|
||||
}
|
||||
export interface PressResult {
|
||||
/** Whether the target is currently pressed. */
|
||||
isPressed: boolean;
|
||||
/** Props to spread on the target element. */
|
||||
pressProps: DOMAttributes;
|
||||
}
|
||||
/**
|
||||
* Handles press interactions across mouse, touch, keyboard, and screen readers.
|
||||
* It normalizes behavior across browsers and platforms, and handles many nuances
|
||||
* of dealing with pointer and keyboard events.
|
||||
*/
|
||||
export function usePress(props: PressHookProps): PressResult;
|
||||
export interface FocusProps<Target = FocusableElement> extends FocusEvents<Target> {
|
||||
/** Whether the focus events should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
export interface FocusResult<Target = FocusableElement> {
|
||||
/** Props to spread onto the target element. */
|
||||
focusProps: DOMAttributes<Target>;
|
||||
}
|
||||
/**
|
||||
* Handles focus events for the immediate target.
|
||||
* Focus events on child elements will be ignored.
|
||||
*/
|
||||
export function useFocus<Target extends FocusableElement = FocusableElement>(props: FocusProps<Target>): FocusResult<Target>;
|
||||
export interface KeyboardProps extends KeyboardEvents {
|
||||
/** Whether the keyboard events should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
export interface KeyboardResult {
|
||||
/** Props to spread onto the target element. */
|
||||
keyboardProps: DOMAttributes;
|
||||
}
|
||||
/**
|
||||
* Handles keyboard interactions for a focusable element.
|
||||
*/
|
||||
export function useKeyboard(props: KeyboardProps): KeyboardResult;
|
||||
export interface FocusableOptions<T = FocusableElement> extends FocusableProps<T>, FocusableDOMProps {
|
||||
/** Whether focus should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
export interface FocusableProviderProps extends DOMAttributes {
|
||||
/** The child element to provide DOM props to. */
|
||||
children?: ReactNode;
|
||||
}
|
||||
interface FocusableContextValue extends FocusableProviderProps {
|
||||
ref?: MutableRefObject<FocusableElement | null>;
|
||||
}
|
||||
/** @private */
|
||||
export let FocusableContext: React.Context<FocusableContextValue | null>;
|
||||
/**
|
||||
* Provides DOM props to the nearest focusable child.
|
||||
*/
|
||||
export const FocusableProvider: React.ForwardRefExoticComponent<FocusableProviderProps & React.RefAttributes<FocusableElement>>;
|
||||
export interface FocusableAria {
|
||||
/** Props for the focusable element. */
|
||||
focusableProps: DOMAttributes;
|
||||
}
|
||||
/**
|
||||
* Used to make an element focusable and capable of auto focus.
|
||||
*/
|
||||
export function useFocusable<T extends FocusableElement = FocusableElement>(props: FocusableOptions<T>, domRef: RefObject<FocusableElement | null>): FocusableAria;
|
||||
interface FocusableComponentProps extends FocusableOptions {
|
||||
children: ReactElement<DOMAttributes, string>;
|
||||
}
|
||||
export const Focusable: React.ForwardRefExoticComponent<FocusableComponentProps & React.RefAttributes<FocusableElement>>;
|
||||
interface PressableProps extends PressProps {
|
||||
children: ReactElement<DOMAttributes, string>;
|
||||
}
|
||||
export const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<FocusableElement>>;
|
||||
interface PressResponderProps extends PressProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
export const PressResponder: React.ForwardRefExoticComponent<PressResponderProps & React.RefAttributes<FocusableElement>>;
|
||||
export function ClearPressResponder({ children }: {
|
||||
children: ReactNode;
|
||||
}): JSX.Element;
|
||||
export type Modality = 'keyboard' | 'pointer' | 'virtual';
|
||||
export type FocusVisibleHandler = (isFocusVisible: boolean) => void;
|
||||
export interface FocusVisibleProps {
|
||||
/** Whether the element is a text input. */
|
||||
isTextInput?: boolean;
|
||||
/** Whether the element will be auto focused. */
|
||||
autoFocus?: boolean;
|
||||
}
|
||||
export interface FocusVisibleResult {
|
||||
/** Whether keyboard focus is visible globally. */
|
||||
isFocusVisible: boolean;
|
||||
}
|
||||
/**
|
||||
* EXPERIMENTAL
|
||||
* Adds a window (i.e. iframe) to the list of windows that are being tracked for focus visible.
|
||||
*
|
||||
* Sometimes apps render portions of their tree into an iframe. In this case, we cannot accurately track if the focus
|
||||
* is visible because we cannot see interactions inside the iframe. If you have this in your application's architecture,
|
||||
* then this function will attach event listeners inside the iframe. You should call `addWindowFocusTracking` with an
|
||||
* element from inside the window you wish to add. We'll retrieve the relevant elements based on that.
|
||||
* Note, you do not need to call this for the default window, as we call it for you.
|
||||
*
|
||||
* When you are ready to stop listening, but you do not wish to unmount the iframe, you may call the cleanup function
|
||||
* returned by `addWindowFocusTracking`. Otherwise, when you unmount the iframe, all listeners and state will be cleaned
|
||||
* up automatically for you.
|
||||
*
|
||||
* @param element @default document.body - The element provided will be used to get the window to add.
|
||||
* @returns A function to remove the event listeners and cleanup the state.
|
||||
*/
|
||||
export function addWindowFocusTracking(element?: HTMLElement | null): () => void;
|
||||
/**
|
||||
* If true, keyboard focus is visible.
|
||||
*/
|
||||
export function isFocusVisible(): boolean;
|
||||
export function getInteractionModality(): Modality | null;
|
||||
export function setInteractionModality(modality: Modality): void;
|
||||
/**
|
||||
* Keeps state of the current modality.
|
||||
*/
|
||||
export function useInteractionModality(): Modality | null;
|
||||
/**
|
||||
* Manages focus visible state for the page, and subscribes individual components for updates.
|
||||
*/
|
||||
export function useFocusVisible(props?: FocusVisibleProps): FocusVisibleResult;
|
||||
/**
|
||||
* Listens for trigger change and reports if focus is visible (i.e., modality is not pointer).
|
||||
*/
|
||||
export function useFocusVisibleListener(fn: FocusVisibleHandler, deps: ReadonlyArray<any>, opts?: {
|
||||
isTextInput?: boolean;
|
||||
}): void;
|
||||
export interface FocusWithinProps {
|
||||
/** Whether the focus within events should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
/** Handler that is called when the target element or a descendant receives focus. */
|
||||
onFocusWithin?: (e: FocusEvent) => void;
|
||||
/** Handler that is called when the target element and all descendants lose focus. */
|
||||
onBlurWithin?: (e: FocusEvent) => void;
|
||||
/** Handler that is called when the the focus within state changes. */
|
||||
onFocusWithinChange?: (isFocusWithin: boolean) => void;
|
||||
}
|
||||
export interface FocusWithinResult {
|
||||
/** Props to spread onto the target element. */
|
||||
focusWithinProps: DOMAttributes;
|
||||
}
|
||||
/**
|
||||
* Handles focus events for the target and its descendants.
|
||||
*/
|
||||
export function useFocusWithin(props: FocusWithinProps): FocusWithinResult;
|
||||
export interface HoverProps extends HoverEvents {
|
||||
/** Whether the hover events should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
export interface HoverResult {
|
||||
/** Props to spread on the target element. */
|
||||
hoverProps: DOMAttributes;
|
||||
isHovered: boolean;
|
||||
}
|
||||
/**
|
||||
* Handles pointer hover interactions for an element. Normalizes behavior
|
||||
* across browsers and platforms, and ignores emulated mouse events on touch devices.
|
||||
*/
|
||||
export function useHover(props: HoverProps): HoverResult;
|
||||
export interface InteractOutsideProps {
|
||||
ref: RefObject<Element | null>;
|
||||
onInteractOutside?: (e: PointerEvent) => void;
|
||||
onInteractOutsideStart?: (e: PointerEvent) => void;
|
||||
/** Whether the interact outside events should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
/**
|
||||
* Example, used in components like Dialogs and Popovers so they can close
|
||||
* when a user clicks outside them.
|
||||
*/
|
||||
export function useInteractOutside(props: InteractOutsideProps): void;
|
||||
export interface MoveResult {
|
||||
/** Props to spread on the target element. */
|
||||
moveProps: DOMAttributes;
|
||||
}
|
||||
/**
|
||||
* Handles move interactions across mouse, touch, and keyboard, including dragging with
|
||||
* the mouse or touch, and using the arrow keys. Normalizes behavior across browsers and
|
||||
* platforms, and ignores emulated mouse events on touch devices.
|
||||
*/
|
||||
export function useMove(props: MoveEvents): MoveResult;
|
||||
export interface ScrollWheelProps extends ScrollEvents {
|
||||
/** Whether the scroll listener should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
export function useScrollWheel(props: ScrollWheelProps, ref: RefObject<HTMLElement | null>): void;
|
||||
export interface LongPressProps {
|
||||
/** Whether long press events should be disabled. */
|
||||
isDisabled?: boolean;
|
||||
/** Handler that is called when a long press interaction starts. */
|
||||
onLongPressStart?: (e: LongPressEvent) => void;
|
||||
/**
|
||||
* Handler that is called when a long press interaction ends, either
|
||||
* over the target or when the pointer leaves the target.
|
||||
*/
|
||||
onLongPressEnd?: (e: LongPressEvent) => void;
|
||||
/**
|
||||
* Handler that is called when the threshold time is met while
|
||||
* the press is over the target.
|
||||
*/
|
||||
onLongPress?: (e: LongPressEvent) => void;
|
||||
/**
|
||||
* The amount of time in milliseconds to wait before triggering a long press.
|
||||
* @default 500ms
|
||||
*/
|
||||
threshold?: number;
|
||||
/**
|
||||
* A description for assistive techology users indicating that a long press
|
||||
* action is available, e.g. "Long press to open menu".
|
||||
*/
|
||||
accessibilityDescription?: string;
|
||||
}
|
||||
export interface LongPressResult {
|
||||
/** Props to spread on the target element. */
|
||||
longPressProps: DOMAttributes;
|
||||
}
|
||||
/**
|
||||
* Handles long press interactions across mouse and touch devices. Supports a customizable time threshold,
|
||||
* accessibility description, and normalizes behavior across browsers and devices.
|
||||
*/
|
||||
export function useLongPress(props: LongPressProps): LongPressResult;
|
||||
/**
|
||||
* A utility function that focuses an element while avoiding undesired side effects such
|
||||
* as page scrolling and screen reader issues with CSS transitions.
|
||||
*/
|
||||
export function focusSafely(element: FocusableElement): void;
|
||||
export type { PressEvent, PressEvents, MoveStartEvent, MoveMoveEvent, MoveEndEvent, MoveEvents, HoverEvent, HoverEvents, FocusEvents, KeyboardEvents } from '@react-types/shared';
|
||||
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/@react-aria/interactions/dist/types.d.ts.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/types.d.ts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
65
node_modules/@react-aria/interactions/dist/useFocus.main.js
generated
vendored
Normal file
65
node_modules/@react-aria/interactions/dist/useFocus.main.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
var $625cf83917e112ad$exports = require("./utils.main.js");
|
||||
var $hrHul$react = require("react");
|
||||
var $hrHul$reactariautils = require("@react-aria/utils");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "useFocus", () => $5cb73d0ce355b0dc$export$f8168d8dd8fd66e6);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
function $5cb73d0ce355b0dc$export$f8168d8dd8fd66e6(props) {
|
||||
let { isDisabled: isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange: onFocusChange } = props;
|
||||
const onBlur = (0, $hrHul$react.useCallback)((e)=>{
|
||||
if (e.target === e.currentTarget) {
|
||||
if (onBlurProp) onBlurProp(e);
|
||||
if (onFocusChange) onFocusChange(false);
|
||||
return true;
|
||||
}
|
||||
}, [
|
||||
onBlurProp,
|
||||
onFocusChange
|
||||
]);
|
||||
const onSyntheticFocus = (0, $625cf83917e112ad$exports.useSyntheticBlurEvent)(onBlur);
|
||||
const onFocus = (0, $hrHul$react.useCallback)((e)=>{
|
||||
// Double check that document.activeElement actually matches e.target in case a previously chained
|
||||
// focus handler already moved focus somewhere else.
|
||||
const ownerDocument = (0, $hrHul$reactariautils.getOwnerDocument)(e.target);
|
||||
const activeElement = ownerDocument ? (0, $hrHul$reactariautils.getActiveElement)(ownerDocument) : (0, $hrHul$reactariautils.getActiveElement)();
|
||||
if (e.target === e.currentTarget && activeElement === (0, $hrHul$reactariautils.getEventTarget)(e.nativeEvent)) {
|
||||
if (onFocusProp) onFocusProp(e);
|
||||
if (onFocusChange) onFocusChange(true);
|
||||
onSyntheticFocus(e);
|
||||
}
|
||||
}, [
|
||||
onFocusChange,
|
||||
onFocusProp,
|
||||
onSyntheticFocus
|
||||
]);
|
||||
return {
|
||||
focusProps: {
|
||||
onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : undefined,
|
||||
onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=useFocus.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/useFocus.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/useFocus.main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;;;AAqB3G,SAAS,0CAA6D,KAAyB;IACpG,IAAI,cACF,UAAU,EACV,SAAS,WAAW,EACpB,QAAQ,UAAU,iBAClB,aAAa,EACd,GAAG;IAEJ,MAAM,SAAuC,CAAA,GAAA,wBAAU,EAAE,CAAC;QACxD,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,EAAE;YAChC,IAAI,YACF,WAAW;YAGb,IAAI,eACF,cAAc;YAGhB,OAAO;QACT;IACF,GAAG;QAAC;QAAY;KAAc;IAG9B,MAAM,mBAAmB,CAAA,GAAA,+CAAoB,EAAU;IAEvD,MAAM,UAAyC,CAAA,GAAA,wBAAU,EAAE,CAAC;QAC1D,kGAAkG;QAClG,oDAAoD;QAEpD,MAAM,gBAAgB,CAAA,GAAA,sCAAe,EAAE,EAAE,MAAM;QAC/C,MAAM,gBAAgB,gBAAgB,CAAA,GAAA,sCAAe,EAAE,iBAAiB,CAAA,GAAA,sCAAe;QACvF,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,IAAI,kBAAkB,CAAA,GAAA,oCAAa,EAAE,EAAE,WAAW,GAAG;YACnF,IAAI,aACF,YAAY;YAGd,IAAI,eACF,cAAc;YAGhB,iBAAiB;QACnB;IACF,GAAG;QAAC;QAAe;QAAa;KAAiB;IAEjD,OAAO;QACL,YAAY;YACV,SAAS,AAAC,CAAC,cAAe,CAAA,eAAe,iBAAiB,UAAS,IAAM,UAAU;YACnF,QAAQ,AAAC,CAAC,cAAe,CAAA,cAAc,aAAY,IAAM,SAAS;QACpE;IACF;AACF","sources":["packages/@react-aria/interactions/src/useFocus.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {DOMAttributes, FocusableElement, FocusEvents} from '@react-types/shared';\nimport {FocusEvent, useCallback} from 'react';\nimport {getActiveElement, getEventTarget, getOwnerDocument} from '@react-aria/utils';\nimport {useSyntheticBlurEvent} from './utils';\n\nexport interface FocusProps<Target = FocusableElement> extends FocusEvents<Target> {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusResult<Target = FocusableElement> {\n /** Props to spread onto the target element. */\n focusProps: DOMAttributes<Target>\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n */\nexport function useFocus<Target extends FocusableElement = FocusableElement>(props: FocusProps<Target>): FocusResult<Target> {\n let {\n isDisabled,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n onFocusChange\n } = props;\n\n const onBlur: FocusProps<Target>['onBlur'] = useCallback((e: FocusEvent<Target>) => {\n if (e.target === e.currentTarget) {\n if (onBlurProp) {\n onBlurProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(false);\n }\n\n return true;\n }\n }, [onBlurProp, onFocusChange]);\n\n\n const onSyntheticFocus = useSyntheticBlurEvent<Target>(onBlur);\n\n const onFocus: FocusProps<Target>['onFocus'] = useCallback((e: FocusEvent<Target>) => {\n // Double check that document.activeElement actually matches e.target in case a previously chained\n // focus handler already moved focus somewhere else.\n\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : getActiveElement();\n if (e.target === e.currentTarget && activeElement === getEventTarget(e.nativeEvent)) {\n if (onFocusProp) {\n onFocusProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(true);\n }\n\n onSyntheticFocus(e);\n }\n }, [onFocusChange, onFocusProp, onSyntheticFocus]);\n\n return {\n focusProps: {\n onFocus: (!isDisabled && (onFocusProp || onFocusChange || onBlurProp)) ? onFocus : undefined,\n onBlur: (!isDisabled && (onBlurProp || onFocusChange)) ? onBlur : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"useFocus.main.js.map"}
|
||||
60
node_modules/@react-aria/interactions/dist/useFocus.mjs
generated
vendored
Normal file
60
node_modules/@react-aria/interactions/dist/useFocus.mjs
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import {useSyntheticBlurEvent as $8a9cb279dc87e130$export$715c682d09d639cc} from "./utils.mjs";
|
||||
import {useCallback as $hf0lj$useCallback} from "react";
|
||||
import {getOwnerDocument as $hf0lj$getOwnerDocument, getActiveElement as $hf0lj$getActiveElement, getEventTarget as $hf0lj$getEventTarget} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
||||
let { isDisabled: isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange: onFocusChange } = props;
|
||||
const onBlur = (0, $hf0lj$useCallback)((e)=>{
|
||||
if (e.target === e.currentTarget) {
|
||||
if (onBlurProp) onBlurProp(e);
|
||||
if (onFocusChange) onFocusChange(false);
|
||||
return true;
|
||||
}
|
||||
}, [
|
||||
onBlurProp,
|
||||
onFocusChange
|
||||
]);
|
||||
const onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
||||
const onFocus = (0, $hf0lj$useCallback)((e)=>{
|
||||
// Double check that document.activeElement actually matches e.target in case a previously chained
|
||||
// focus handler already moved focus somewhere else.
|
||||
const ownerDocument = (0, $hf0lj$getOwnerDocument)(e.target);
|
||||
const activeElement = ownerDocument ? (0, $hf0lj$getActiveElement)(ownerDocument) : (0, $hf0lj$getActiveElement)();
|
||||
if (e.target === e.currentTarget && activeElement === (0, $hf0lj$getEventTarget)(e.nativeEvent)) {
|
||||
if (onFocusProp) onFocusProp(e);
|
||||
if (onFocusChange) onFocusChange(true);
|
||||
onSyntheticFocus(e);
|
||||
}
|
||||
}, [
|
||||
onFocusChange,
|
||||
onFocusProp,
|
||||
onSyntheticFocus
|
||||
]);
|
||||
return {
|
||||
focusProps: {
|
||||
onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : undefined,
|
||||
onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$a1ea59d68270f0dd$export$f8168d8dd8fd66e6 as useFocus};
|
||||
//# sourceMappingURL=useFocus.module.js.map
|
||||
60
node_modules/@react-aria/interactions/dist/useFocus.module.js
generated
vendored
Normal file
60
node_modules/@react-aria/interactions/dist/useFocus.module.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import {useSyntheticBlurEvent as $8a9cb279dc87e130$export$715c682d09d639cc} from "./utils.module.js";
|
||||
import {useCallback as $hf0lj$useCallback} from "react";
|
||||
import {getOwnerDocument as $hf0lj$getOwnerDocument, getActiveElement as $hf0lj$getActiveElement, getEventTarget as $hf0lj$getEventTarget} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
|
||||
let { isDisabled: isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange: onFocusChange } = props;
|
||||
const onBlur = (0, $hf0lj$useCallback)((e)=>{
|
||||
if (e.target === e.currentTarget) {
|
||||
if (onBlurProp) onBlurProp(e);
|
||||
if (onFocusChange) onFocusChange(false);
|
||||
return true;
|
||||
}
|
||||
}, [
|
||||
onBlurProp,
|
||||
onFocusChange
|
||||
]);
|
||||
const onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
||||
const onFocus = (0, $hf0lj$useCallback)((e)=>{
|
||||
// Double check that document.activeElement actually matches e.target in case a previously chained
|
||||
// focus handler already moved focus somewhere else.
|
||||
const ownerDocument = (0, $hf0lj$getOwnerDocument)(e.target);
|
||||
const activeElement = ownerDocument ? (0, $hf0lj$getActiveElement)(ownerDocument) : (0, $hf0lj$getActiveElement)();
|
||||
if (e.target === e.currentTarget && activeElement === (0, $hf0lj$getEventTarget)(e.nativeEvent)) {
|
||||
if (onFocusProp) onFocusProp(e);
|
||||
if (onFocusChange) onFocusChange(true);
|
||||
onSyntheticFocus(e);
|
||||
}
|
||||
}, [
|
||||
onFocusChange,
|
||||
onFocusProp,
|
||||
onSyntheticFocus
|
||||
]);
|
||||
return {
|
||||
focusProps: {
|
||||
onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : undefined,
|
||||
onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$a1ea59d68270f0dd$export$f8168d8dd8fd66e6 as useFocus};
|
||||
//# sourceMappingURL=useFocus.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/useFocus.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/useFocus.module.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;AAAA;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;;;AAqB3G,SAAS,0CAA6D,KAAyB;IACpG,IAAI,cACF,UAAU,EACV,SAAS,WAAW,EACpB,QAAQ,UAAU,iBAClB,aAAa,EACd,GAAG;IAEJ,MAAM,SAAuC,CAAA,GAAA,kBAAU,EAAE,CAAC;QACxD,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,EAAE;YAChC,IAAI,YACF,WAAW;YAGb,IAAI,eACF,cAAc;YAGhB,OAAO;QACT;IACF,GAAG;QAAC;QAAY;KAAc;IAG9B,MAAM,mBAAmB,CAAA,GAAA,yCAAoB,EAAU;IAEvD,MAAM,UAAyC,CAAA,GAAA,kBAAU,EAAE,CAAC;QAC1D,kGAAkG;QAClG,oDAAoD;QAEpD,MAAM,gBAAgB,CAAA,GAAA,uBAAe,EAAE,EAAE,MAAM;QAC/C,MAAM,gBAAgB,gBAAgB,CAAA,GAAA,uBAAe,EAAE,iBAAiB,CAAA,GAAA,uBAAe;QACvF,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,IAAI,kBAAkB,CAAA,GAAA,qBAAa,EAAE,EAAE,WAAW,GAAG;YACnF,IAAI,aACF,YAAY;YAGd,IAAI,eACF,cAAc;YAGhB,iBAAiB;QACnB;IACF,GAAG;QAAC;QAAe;QAAa;KAAiB;IAEjD,OAAO;QACL,YAAY;YACV,SAAS,AAAC,CAAC,cAAe,CAAA,eAAe,iBAAiB,UAAS,IAAM,UAAU;YACnF,QAAQ,AAAC,CAAC,cAAe,CAAA,cAAc,aAAY,IAAM,SAAS;QACpE;IACF;AACF","sources":["packages/@react-aria/interactions/src/useFocus.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {DOMAttributes, FocusableElement, FocusEvents} from '@react-types/shared';\nimport {FocusEvent, useCallback} from 'react';\nimport {getActiveElement, getEventTarget, getOwnerDocument} from '@react-aria/utils';\nimport {useSyntheticBlurEvent} from './utils';\n\nexport interface FocusProps<Target = FocusableElement> extends FocusEvents<Target> {\n /** Whether the focus events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusResult<Target = FocusableElement> {\n /** Props to spread onto the target element. */\n focusProps: DOMAttributes<Target>\n}\n\n/**\n * Handles focus events for the immediate target.\n * Focus events on child elements will be ignored.\n */\nexport function useFocus<Target extends FocusableElement = FocusableElement>(props: FocusProps<Target>): FocusResult<Target> {\n let {\n isDisabled,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n onFocusChange\n } = props;\n\n const onBlur: FocusProps<Target>['onBlur'] = useCallback((e: FocusEvent<Target>) => {\n if (e.target === e.currentTarget) {\n if (onBlurProp) {\n onBlurProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(false);\n }\n\n return true;\n }\n }, [onBlurProp, onFocusChange]);\n\n\n const onSyntheticFocus = useSyntheticBlurEvent<Target>(onBlur);\n\n const onFocus: FocusProps<Target>['onFocus'] = useCallback((e: FocusEvent<Target>) => {\n // Double check that document.activeElement actually matches e.target in case a previously chained\n // focus handler already moved focus somewhere else.\n\n const ownerDocument = getOwnerDocument(e.target);\n const activeElement = ownerDocument ? getActiveElement(ownerDocument) : getActiveElement();\n if (e.target === e.currentTarget && activeElement === getEventTarget(e.nativeEvent)) {\n if (onFocusProp) {\n onFocusProp(e);\n }\n\n if (onFocusChange) {\n onFocusChange(true);\n }\n\n onSyntheticFocus(e);\n }\n }, [onFocusChange, onFocusProp, onSyntheticFocus]);\n\n return {\n focusProps: {\n onFocus: (!isDisabled && (onFocusProp || onFocusChange || onBlurProp)) ? onFocus : undefined,\n onBlur: (!isDisabled && (onBlurProp || onFocusChange)) ? onBlur : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"useFocus.module.js.map"}
|
||||
254
node_modules/@react-aria/interactions/dist/useFocusVisible.main.js
generated
vendored
Normal file
254
node_modules/@react-aria/interactions/dist/useFocusVisible.main.js
generated
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
var $625cf83917e112ad$exports = require("./utils.main.js");
|
||||
var $cR3F8$reactariautils = require("@react-aria/utils");
|
||||
var $cR3F8$react = require("react");
|
||||
var $cR3F8$reactariassr = require("@react-aria/ssr");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "addWindowFocusTracking", () => $e77252a287ef94ab$export$2f1888112f558a7d);
|
||||
$parcel$export(module.exports, "isFocusVisible", () => $e77252a287ef94ab$export$b9b3dfddab17db27);
|
||||
$parcel$export(module.exports, "getInteractionModality", () => $e77252a287ef94ab$export$630ff653c5ada6a9);
|
||||
$parcel$export(module.exports, "setInteractionModality", () => $e77252a287ef94ab$export$8397ddfc504fdb9a);
|
||||
$parcel$export(module.exports, "useInteractionModality", () => $e77252a287ef94ab$export$98e20ec92f614cfe);
|
||||
$parcel$export(module.exports, "useFocusVisible", () => $e77252a287ef94ab$export$ffd9e5021c1fb2d6);
|
||||
$parcel$export(module.exports, "useFocusVisibleListener", () => $e77252a287ef94ab$export$ec71b4b83ac08ec3);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
|
||||
let $e77252a287ef94ab$var$currentModality = null;
|
||||
let $e77252a287ef94ab$var$changeHandlers = new Set();
|
||||
let $e77252a287ef94ab$export$d90243b58daecda7 = new Map(); // We use a map here to support setting event listeners across multiple document objects.
|
||||
let $e77252a287ef94ab$var$hasEventBeforeFocus = false;
|
||||
let $e77252a287ef94ab$var$hasBlurredWindowRecently = false;
|
||||
// Only Tab or Esc keys will make focus visible on text input elements
|
||||
const $e77252a287ef94ab$var$FOCUS_VISIBLE_INPUT_KEYS = {
|
||||
Tab: true,
|
||||
Escape: true
|
||||
};
|
||||
function $e77252a287ef94ab$var$triggerChangeHandlers(modality, e) {
|
||||
for (let handler of $e77252a287ef94ab$var$changeHandlers)handler(modality, e);
|
||||
}
|
||||
/**
|
||||
* Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
|
||||
*/ function $e77252a287ef94ab$var$isValidKey(e) {
|
||||
// Control and Shift keys trigger when navigating back to the tab with keyboard.
|
||||
return !(e.metaKey || !(0, $cR3F8$reactariautils.isMac)() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
|
||||
}
|
||||
function $e77252a287ef94ab$var$handleKeyboardEvent(e) {
|
||||
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
||||
if ($e77252a287ef94ab$var$isValidKey(e)) {
|
||||
$e77252a287ef94ab$var$currentModality = 'keyboard';
|
||||
$e77252a287ef94ab$var$triggerChangeHandlers('keyboard', e);
|
||||
}
|
||||
}
|
||||
function $e77252a287ef94ab$var$handlePointerEvent(e) {
|
||||
$e77252a287ef94ab$var$currentModality = 'pointer';
|
||||
if (e.type === 'mousedown' || e.type === 'pointerdown') {
|
||||
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
||||
$e77252a287ef94ab$var$triggerChangeHandlers('pointer', e);
|
||||
}
|
||||
}
|
||||
function $e77252a287ef94ab$var$handleClickEvent(e) {
|
||||
if ((0, $cR3F8$reactariautils.isVirtualClick)(e)) {
|
||||
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
||||
$e77252a287ef94ab$var$currentModality = 'virtual';
|
||||
}
|
||||
}
|
||||
function $e77252a287ef94ab$var$handleFocusEvent(e) {
|
||||
// Firefox fires two extra focus events when the user first clicks into an iframe:
|
||||
// first on the window, then on the document. We ignore these events so they don't
|
||||
// cause keyboard focus rings to appear.
|
||||
if (e.target === window || e.target === document || (0, $625cf83917e112ad$exports.ignoreFocusEvent) || !e.isTrusted) return;
|
||||
// If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
|
||||
// This occurs, for example, when navigating a form with the next/previous buttons on iOS.
|
||||
if (!$e77252a287ef94ab$var$hasEventBeforeFocus && !$e77252a287ef94ab$var$hasBlurredWindowRecently) {
|
||||
$e77252a287ef94ab$var$currentModality = 'virtual';
|
||||
$e77252a287ef94ab$var$triggerChangeHandlers('virtual', e);
|
||||
}
|
||||
$e77252a287ef94ab$var$hasEventBeforeFocus = false;
|
||||
$e77252a287ef94ab$var$hasBlurredWindowRecently = false;
|
||||
}
|
||||
function $e77252a287ef94ab$var$handleWindowBlur() {
|
||||
if (0, $625cf83917e112ad$exports.ignoreFocusEvent) return;
|
||||
// When the window is blurred, reset state. This is necessary when tabbing out of the window,
|
||||
// for example, since a subsequent focus event won't be fired.
|
||||
$e77252a287ef94ab$var$hasEventBeforeFocus = false;
|
||||
$e77252a287ef94ab$var$hasBlurredWindowRecently = true;
|
||||
}
|
||||
/**
|
||||
* Setup global event listeners to control when keyboard focus style should be visible.
|
||||
*/ function $e77252a287ef94ab$var$setupGlobalFocusEvents(element) {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined' || $e77252a287ef94ab$export$d90243b58daecda7.get((0, $cR3F8$reactariautils.getOwnerWindow)(element))) return;
|
||||
const windowObject = (0, $cR3F8$reactariautils.getOwnerWindow)(element);
|
||||
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
|
||||
// Programmatic focus() calls shouldn't affect the current input modality.
|
||||
// However, we need to detect other cases when a focus event occurs without
|
||||
// a preceding user event (e.g. screen reader focus). Overriding the focus
|
||||
// method on HTMLElement.prototype is a bit hacky, but works.
|
||||
let focus = windowObject.HTMLElement.prototype.focus;
|
||||
windowObject.HTMLElement.prototype.focus = function() {
|
||||
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
|
||||
focus.apply(this, arguments);
|
||||
};
|
||||
documentObject.addEventListener('keydown', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
||||
documentObject.addEventListener('keyup', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
||||
documentObject.addEventListener('click', $e77252a287ef94ab$var$handleClickEvent, true);
|
||||
// Register focus events on the window so they are sure to happen
|
||||
// before React's event listeners (registered on the document).
|
||||
windowObject.addEventListener('focus', $e77252a287ef94ab$var$handleFocusEvent, true);
|
||||
windowObject.addEventListener('blur', $e77252a287ef94ab$var$handleWindowBlur, false);
|
||||
if (typeof PointerEvent !== 'undefined') {
|
||||
documentObject.addEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
documentObject.addEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
}
|
||||
// Add unmount handler
|
||||
windowObject.addEventListener('beforeunload', ()=>{
|
||||
$e77252a287ef94ab$var$tearDownWindowFocusTracking(element);
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
$e77252a287ef94ab$export$d90243b58daecda7.set(windowObject, {
|
||||
focus: focus
|
||||
});
|
||||
}
|
||||
const $e77252a287ef94ab$var$tearDownWindowFocusTracking = (element, loadListener)=>{
|
||||
const windowObject = (0, $cR3F8$reactariautils.getOwnerWindow)(element);
|
||||
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
|
||||
if (loadListener) documentObject.removeEventListener('DOMContentLoaded', loadListener);
|
||||
if (!$e77252a287ef94ab$export$d90243b58daecda7.has(windowObject)) return;
|
||||
windowObject.HTMLElement.prototype.focus = $e77252a287ef94ab$export$d90243b58daecda7.get(windowObject).focus;
|
||||
documentObject.removeEventListener('keydown', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
||||
documentObject.removeEventListener('keyup', $e77252a287ef94ab$var$handleKeyboardEvent, true);
|
||||
documentObject.removeEventListener('click', $e77252a287ef94ab$var$handleClickEvent, true);
|
||||
windowObject.removeEventListener('focus', $e77252a287ef94ab$var$handleFocusEvent, true);
|
||||
windowObject.removeEventListener('blur', $e77252a287ef94ab$var$handleWindowBlur, false);
|
||||
if (typeof PointerEvent !== 'undefined') {
|
||||
documentObject.removeEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
documentObject.removeEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
|
||||
}
|
||||
$e77252a287ef94ab$export$d90243b58daecda7.delete(windowObject);
|
||||
};
|
||||
function $e77252a287ef94ab$export$2f1888112f558a7d(element) {
|
||||
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
|
||||
let loadListener;
|
||||
if (documentObject.readyState !== 'loading') $e77252a287ef94ab$var$setupGlobalFocusEvents(element);
|
||||
else {
|
||||
loadListener = ()=>{
|
||||
$e77252a287ef94ab$var$setupGlobalFocusEvents(element);
|
||||
};
|
||||
documentObject.addEventListener('DOMContentLoaded', loadListener);
|
||||
}
|
||||
return ()=>$e77252a287ef94ab$var$tearDownWindowFocusTracking(element, loadListener);
|
||||
}
|
||||
// Server-side rendering does not have the document object defined
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (typeof document !== 'undefined') $e77252a287ef94ab$export$2f1888112f558a7d();
|
||||
function $e77252a287ef94ab$export$b9b3dfddab17db27() {
|
||||
return $e77252a287ef94ab$var$currentModality !== 'pointer';
|
||||
}
|
||||
function $e77252a287ef94ab$export$630ff653c5ada6a9() {
|
||||
return $e77252a287ef94ab$var$currentModality;
|
||||
}
|
||||
function $e77252a287ef94ab$export$8397ddfc504fdb9a(modality) {
|
||||
$e77252a287ef94ab$var$currentModality = modality;
|
||||
$e77252a287ef94ab$var$triggerChangeHandlers(modality, null);
|
||||
}
|
||||
function $e77252a287ef94ab$export$98e20ec92f614cfe() {
|
||||
$e77252a287ef94ab$var$setupGlobalFocusEvents();
|
||||
let [modality, setModality] = (0, $cR3F8$react.useState)($e77252a287ef94ab$var$currentModality);
|
||||
(0, $cR3F8$react.useEffect)(()=>{
|
||||
let handler = ()=>{
|
||||
setModality($e77252a287ef94ab$var$currentModality);
|
||||
};
|
||||
$e77252a287ef94ab$var$changeHandlers.add(handler);
|
||||
return ()=>{
|
||||
$e77252a287ef94ab$var$changeHandlers.delete(handler);
|
||||
};
|
||||
}, []);
|
||||
return (0, $cR3F8$reactariassr.useIsSSR)() ? null : modality;
|
||||
}
|
||||
const $e77252a287ef94ab$var$nonTextInputTypes = new Set([
|
||||
'checkbox',
|
||||
'radio',
|
||||
'range',
|
||||
'color',
|
||||
'file',
|
||||
'image',
|
||||
'button',
|
||||
'submit',
|
||||
'reset'
|
||||
]);
|
||||
/**
|
||||
* If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
|
||||
* focus visible style can be properly set.
|
||||
*/ function $e77252a287ef94ab$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
||||
let document1 = (0, $cR3F8$reactariautils.getOwnerDocument)(e === null || e === void 0 ? void 0 : e.target);
|
||||
const IHTMLInputElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
|
||||
const IHTMLTextAreaElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
|
||||
const IHTMLElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
|
||||
const IKeyboardEvent = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
|
||||
// For keyboard events that occur on a non-input element that will move focus into input element (aka ArrowLeft going from Datepicker button to the main input group)
|
||||
// we need to rely on the user passing isTextInput into here. This way we can skip toggling focus visiblity for said input element
|
||||
isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$e77252a287ef94ab$var$nonTextInputTypes.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
|
||||
return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !$e77252a287ef94ab$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
||||
}
|
||||
function $e77252a287ef94ab$export$ffd9e5021c1fb2d6(props = {}) {
|
||||
let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
|
||||
let [isFocusVisibleState, setFocusVisible] = (0, $cR3F8$react.useState)(autoFocus || $e77252a287ef94ab$export$b9b3dfddab17db27());
|
||||
$e77252a287ef94ab$export$ec71b4b83ac08ec3((isFocusVisible)=>{
|
||||
setFocusVisible(isFocusVisible);
|
||||
}, [
|
||||
isTextInput
|
||||
], {
|
||||
isTextInput: isTextInput
|
||||
});
|
||||
return {
|
||||
isFocusVisible: isFocusVisibleState
|
||||
};
|
||||
}
|
||||
function $e77252a287ef94ab$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
||||
$e77252a287ef94ab$var$setupGlobalFocusEvents();
|
||||
(0, $cR3F8$react.useEffect)(()=>{
|
||||
let handler = (modality, e)=>{
|
||||
// We want to early return for any keyboard events that occur inside text inputs EXCEPT for Tab and Escape
|
||||
if (!$e77252a287ef94ab$var$isKeyboardFocusEvent(!!(opts === null || opts === void 0 ? void 0 : opts.isTextInput), modality, e)) return;
|
||||
fn($e77252a287ef94ab$export$b9b3dfddab17db27());
|
||||
};
|
||||
$e77252a287ef94ab$var$changeHandlers.add(handler);
|
||||
return ()=>{
|
||||
$e77252a287ef94ab$var$changeHandlers.delete(handler);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, deps);
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=useFocusVisible.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/useFocusVisible.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/useFocusVisible.main.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
243
node_modules/@react-aria/interactions/dist/useFocusVisible.mjs
generated
vendored
Normal file
243
node_modules/@react-aria/interactions/dist/useFocusVisible.mjs
generated
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
import {ignoreFocusEvent as $8a9cb279dc87e130$export$fda7da73ab5d4c48} from "./utils.mjs";
|
||||
import {isMac as $28AnR$isMac, isVirtualClick as $28AnR$isVirtualClick, getOwnerWindow as $28AnR$getOwnerWindow, getOwnerDocument as $28AnR$getOwnerDocument} from "@react-aria/utils";
|
||||
import {useState as $28AnR$useState, useEffect as $28AnR$useEffect} from "react";
|
||||
import {useIsSSR as $28AnR$useIsSSR} from "@react-aria/ssr";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
|
||||
let $507fabe10e71c6fb$var$currentModality = null;
|
||||
let $507fabe10e71c6fb$var$changeHandlers = new Set();
|
||||
let $507fabe10e71c6fb$export$d90243b58daecda7 = new Map(); // We use a map here to support setting event listeners across multiple document objects.
|
||||
let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
||||
let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
||||
// Only Tab or Esc keys will make focus visible on text input elements
|
||||
const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
|
||||
Tab: true,
|
||||
Escape: true
|
||||
};
|
||||
function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
|
||||
for (let handler of $507fabe10e71c6fb$var$changeHandlers)handler(modality, e);
|
||||
}
|
||||
/**
|
||||
* Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
|
||||
*/ function $507fabe10e71c6fb$var$isValidKey(e) {
|
||||
// Control and Shift keys trigger when navigating back to the tab with keyboard.
|
||||
return !(e.metaKey || !(0, $28AnR$isMac)() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
if ($507fabe10e71c6fb$var$isValidKey(e)) {
|
||||
$507fabe10e71c6fb$var$currentModality = 'keyboard';
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers('keyboard', e);
|
||||
}
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handlePointerEvent(e) {
|
||||
$507fabe10e71c6fb$var$currentModality = 'pointer';
|
||||
if (e.type === 'mousedown' || e.type === 'pointerdown') {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers('pointer', e);
|
||||
}
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleClickEvent(e) {
|
||||
if ((0, $28AnR$isVirtualClick)(e)) {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
$507fabe10e71c6fb$var$currentModality = 'virtual';
|
||||
}
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleFocusEvent(e) {
|
||||
// Firefox fires two extra focus events when the user first clicks into an iframe:
|
||||
// first on the window, then on the document. We ignore these events so they don't
|
||||
// cause keyboard focus rings to appear.
|
||||
if (e.target === window || e.target === document || (0, $8a9cb279dc87e130$export$fda7da73ab5d4c48) || !e.isTrusted) return;
|
||||
// If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
|
||||
// This occurs, for example, when navigating a form with the next/previous buttons on iOS.
|
||||
if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
|
||||
$507fabe10e71c6fb$var$currentModality = 'virtual';
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers('virtual', e);
|
||||
}
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
||||
$507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleWindowBlur() {
|
||||
if (0, $8a9cb279dc87e130$export$fda7da73ab5d4c48) return;
|
||||
// When the window is blurred, reset state. This is necessary when tabbing out of the window,
|
||||
// for example, since a subsequent focus event won't be fired.
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
||||
$507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
|
||||
}
|
||||
/**
|
||||
* Setup global event listeners to control when keyboard focus style should be visible.
|
||||
*/ function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined' || $507fabe10e71c6fb$export$d90243b58daecda7.get((0, $28AnR$getOwnerWindow)(element))) return;
|
||||
const windowObject = (0, $28AnR$getOwnerWindow)(element);
|
||||
const documentObject = (0, $28AnR$getOwnerDocument)(element);
|
||||
// Programmatic focus() calls shouldn't affect the current input modality.
|
||||
// However, we need to detect other cases when a focus event occurs without
|
||||
// a preceding user event (e.g. screen reader focus). Overriding the focus
|
||||
// method on HTMLElement.prototype is a bit hacky, but works.
|
||||
let focus = windowObject.HTMLElement.prototype.focus;
|
||||
windowObject.HTMLElement.prototype.focus = function() {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
focus.apply(this, arguments);
|
||||
};
|
||||
documentObject.addEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.addEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.addEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
|
||||
// Register focus events on the window so they are sure to happen
|
||||
// before React's event listeners (registered on the document).
|
||||
windowObject.addEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
|
||||
windowObject.addEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
|
||||
if (typeof PointerEvent !== 'undefined') {
|
||||
documentObject.addEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
documentObject.addEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
}
|
||||
// Add unmount handler
|
||||
windowObject.addEventListener('beforeunload', ()=>{
|
||||
$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element);
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
$507fabe10e71c6fb$export$d90243b58daecda7.set(windowObject, {
|
||||
focus: focus
|
||||
});
|
||||
}
|
||||
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener)=>{
|
||||
const windowObject = (0, $28AnR$getOwnerWindow)(element);
|
||||
const documentObject = (0, $28AnR$getOwnerDocument)(element);
|
||||
if (loadListener) documentObject.removeEventListener('DOMContentLoaded', loadListener);
|
||||
if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject)) return;
|
||||
windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
|
||||
documentObject.removeEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.removeEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.removeEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
|
||||
windowObject.removeEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
|
||||
windowObject.removeEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
|
||||
if (typeof PointerEvent !== 'undefined') {
|
||||
documentObject.removeEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
documentObject.removeEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
}
|
||||
$507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
|
||||
};
|
||||
function $507fabe10e71c6fb$export$2f1888112f558a7d(element) {
|
||||
const documentObject = (0, $28AnR$getOwnerDocument)(element);
|
||||
let loadListener;
|
||||
if (documentObject.readyState !== 'loading') $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
||||
else {
|
||||
loadListener = ()=>{
|
||||
$507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
||||
};
|
||||
documentObject.addEventListener('DOMContentLoaded', loadListener);
|
||||
}
|
||||
return ()=>$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element, loadListener);
|
||||
}
|
||||
// Server-side rendering does not have the document object defined
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (typeof document !== 'undefined') $507fabe10e71c6fb$export$2f1888112f558a7d();
|
||||
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
|
||||
return $507fabe10e71c6fb$var$currentModality !== 'pointer';
|
||||
}
|
||||
function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
|
||||
return $507fabe10e71c6fb$var$currentModality;
|
||||
}
|
||||
function $507fabe10e71c6fb$export$8397ddfc504fdb9a(modality) {
|
||||
$507fabe10e71c6fb$var$currentModality = modality;
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers(modality, null);
|
||||
}
|
||||
function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
|
||||
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
||||
let [modality, setModality] = (0, $28AnR$useState)($507fabe10e71c6fb$var$currentModality);
|
||||
(0, $28AnR$useEffect)(()=>{
|
||||
let handler = ()=>{
|
||||
setModality($507fabe10e71c6fb$var$currentModality);
|
||||
};
|
||||
$507fabe10e71c6fb$var$changeHandlers.add(handler);
|
||||
return ()=>{
|
||||
$507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
||||
};
|
||||
}, []);
|
||||
return (0, $28AnR$useIsSSR)() ? null : modality;
|
||||
}
|
||||
const $507fabe10e71c6fb$var$nonTextInputTypes = new Set([
|
||||
'checkbox',
|
||||
'radio',
|
||||
'range',
|
||||
'color',
|
||||
'file',
|
||||
'image',
|
||||
'button',
|
||||
'submit',
|
||||
'reset'
|
||||
]);
|
||||
/**
|
||||
* If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
|
||||
* focus visible style can be properly set.
|
||||
*/ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
||||
let document1 = (0, $28AnR$getOwnerDocument)(e === null || e === void 0 ? void 0 : e.target);
|
||||
const IHTMLInputElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
|
||||
const IHTMLTextAreaElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
|
||||
const IHTMLElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
|
||||
const IKeyboardEvent = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
|
||||
// For keyboard events that occur on a non-input element that will move focus into input element (aka ArrowLeft going from Datepicker button to the main input group)
|
||||
// we need to rely on the user passing isTextInput into here. This way we can skip toggling focus visiblity for said input element
|
||||
isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
|
||||
return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
||||
}
|
||||
function $507fabe10e71c6fb$export$ffd9e5021c1fb2d6(props = {}) {
|
||||
let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
|
||||
let [isFocusVisibleState, setFocusVisible] = (0, $28AnR$useState)(autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27());
|
||||
$507fabe10e71c6fb$export$ec71b4b83ac08ec3((isFocusVisible)=>{
|
||||
setFocusVisible(isFocusVisible);
|
||||
}, [
|
||||
isTextInput
|
||||
], {
|
||||
isTextInput: isTextInput
|
||||
});
|
||||
return {
|
||||
isFocusVisible: isFocusVisibleState
|
||||
};
|
||||
}
|
||||
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
||||
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
||||
(0, $28AnR$useEffect)(()=>{
|
||||
let handler = (modality, e)=>{
|
||||
// We want to early return for any keyboard events that occur inside text inputs EXCEPT for Tab and Escape
|
||||
if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(!!(opts === null || opts === void 0 ? void 0 : opts.isTextInput), modality, e)) return;
|
||||
fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
|
||||
};
|
||||
$507fabe10e71c6fb$var$changeHandlers.add(handler);
|
||||
return ()=>{
|
||||
$507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, deps);
|
||||
}
|
||||
|
||||
|
||||
export {$507fabe10e71c6fb$export$d90243b58daecda7 as hasSetupGlobalListeners, $507fabe10e71c6fb$export$2f1888112f558a7d as addWindowFocusTracking, $507fabe10e71c6fb$export$b9b3dfddab17db27 as isFocusVisible, $507fabe10e71c6fb$export$630ff653c5ada6a9 as getInteractionModality, $507fabe10e71c6fb$export$8397ddfc504fdb9a as setInteractionModality, $507fabe10e71c6fb$export$98e20ec92f614cfe as useInteractionModality, $507fabe10e71c6fb$export$ffd9e5021c1fb2d6 as useFocusVisible, $507fabe10e71c6fb$export$ec71b4b83ac08ec3 as useFocusVisibleListener};
|
||||
//# sourceMappingURL=useFocusVisible.module.js.map
|
||||
243
node_modules/@react-aria/interactions/dist/useFocusVisible.module.js
generated
vendored
Normal file
243
node_modules/@react-aria/interactions/dist/useFocusVisible.module.js
generated
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
import {ignoreFocusEvent as $8a9cb279dc87e130$export$fda7da73ab5d4c48} from "./utils.module.js";
|
||||
import {isMac as $28AnR$isMac, isVirtualClick as $28AnR$isVirtualClick, getOwnerWindow as $28AnR$getOwnerWindow, getOwnerDocument as $28AnR$getOwnerDocument} from "@react-aria/utils";
|
||||
import {useState as $28AnR$useState, useEffect as $28AnR$useEffect} from "react";
|
||||
import {useIsSSR as $28AnR$useIsSSR} from "@react-aria/ssr";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
|
||||
let $507fabe10e71c6fb$var$currentModality = null;
|
||||
let $507fabe10e71c6fb$var$changeHandlers = new Set();
|
||||
let $507fabe10e71c6fb$export$d90243b58daecda7 = new Map(); // We use a map here to support setting event listeners across multiple document objects.
|
||||
let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
||||
let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
||||
// Only Tab or Esc keys will make focus visible on text input elements
|
||||
const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
|
||||
Tab: true,
|
||||
Escape: true
|
||||
};
|
||||
function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
|
||||
for (let handler of $507fabe10e71c6fb$var$changeHandlers)handler(modality, e);
|
||||
}
|
||||
/**
|
||||
* Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
|
||||
*/ function $507fabe10e71c6fb$var$isValidKey(e) {
|
||||
// Control and Shift keys trigger when navigating back to the tab with keyboard.
|
||||
return !(e.metaKey || !(0, $28AnR$isMac)() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
if ($507fabe10e71c6fb$var$isValidKey(e)) {
|
||||
$507fabe10e71c6fb$var$currentModality = 'keyboard';
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers('keyboard', e);
|
||||
}
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handlePointerEvent(e) {
|
||||
$507fabe10e71c6fb$var$currentModality = 'pointer';
|
||||
if (e.type === 'mousedown' || e.type === 'pointerdown') {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers('pointer', e);
|
||||
}
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleClickEvent(e) {
|
||||
if ((0, $28AnR$isVirtualClick)(e)) {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
$507fabe10e71c6fb$var$currentModality = 'virtual';
|
||||
}
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleFocusEvent(e) {
|
||||
// Firefox fires two extra focus events when the user first clicks into an iframe:
|
||||
// first on the window, then on the document. We ignore these events so they don't
|
||||
// cause keyboard focus rings to appear.
|
||||
if (e.target === window || e.target === document || (0, $8a9cb279dc87e130$export$fda7da73ab5d4c48) || !e.isTrusted) return;
|
||||
// If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
|
||||
// This occurs, for example, when navigating a form with the next/previous buttons on iOS.
|
||||
if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
|
||||
$507fabe10e71c6fb$var$currentModality = 'virtual';
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers('virtual', e);
|
||||
}
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
||||
$507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
||||
}
|
||||
function $507fabe10e71c6fb$var$handleWindowBlur() {
|
||||
if (0, $8a9cb279dc87e130$export$fda7da73ab5d4c48) return;
|
||||
// When the window is blurred, reset state. This is necessary when tabbing out of the window,
|
||||
// for example, since a subsequent focus event won't be fired.
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
||||
$507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
|
||||
}
|
||||
/**
|
||||
* Setup global event listeners to control when keyboard focus style should be visible.
|
||||
*/ function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element) {
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined' || $507fabe10e71c6fb$export$d90243b58daecda7.get((0, $28AnR$getOwnerWindow)(element))) return;
|
||||
const windowObject = (0, $28AnR$getOwnerWindow)(element);
|
||||
const documentObject = (0, $28AnR$getOwnerDocument)(element);
|
||||
// Programmatic focus() calls shouldn't affect the current input modality.
|
||||
// However, we need to detect other cases when a focus event occurs without
|
||||
// a preceding user event (e.g. screen reader focus). Overriding the focus
|
||||
// method on HTMLElement.prototype is a bit hacky, but works.
|
||||
let focus = windowObject.HTMLElement.prototype.focus;
|
||||
windowObject.HTMLElement.prototype.focus = function() {
|
||||
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
||||
focus.apply(this, arguments);
|
||||
};
|
||||
documentObject.addEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.addEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.addEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
|
||||
// Register focus events on the window so they are sure to happen
|
||||
// before React's event listeners (registered on the document).
|
||||
windowObject.addEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
|
||||
windowObject.addEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
|
||||
if (typeof PointerEvent !== 'undefined') {
|
||||
documentObject.addEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
documentObject.addEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.addEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
}
|
||||
// Add unmount handler
|
||||
windowObject.addEventListener('beforeunload', ()=>{
|
||||
$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element);
|
||||
}, {
|
||||
once: true
|
||||
});
|
||||
$507fabe10e71c6fb$export$d90243b58daecda7.set(windowObject, {
|
||||
focus: focus
|
||||
});
|
||||
}
|
||||
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element, loadListener)=>{
|
||||
const windowObject = (0, $28AnR$getOwnerWindow)(element);
|
||||
const documentObject = (0, $28AnR$getOwnerDocument)(element);
|
||||
if (loadListener) documentObject.removeEventListener('DOMContentLoaded', loadListener);
|
||||
if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject)) return;
|
||||
windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
|
||||
documentObject.removeEventListener('keydown', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.removeEventListener('keyup', $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
||||
documentObject.removeEventListener('click', $507fabe10e71c6fb$var$handleClickEvent, true);
|
||||
windowObject.removeEventListener('focus', $507fabe10e71c6fb$var$handleFocusEvent, true);
|
||||
windowObject.removeEventListener('blur', $507fabe10e71c6fb$var$handleWindowBlur, false);
|
||||
if (typeof PointerEvent !== 'undefined') {
|
||||
documentObject.removeEventListener('pointerdown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('pointermove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('pointerup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
} else if (process.env.NODE_ENV === 'test') {
|
||||
documentObject.removeEventListener('mousedown', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('mousemove', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
documentObject.removeEventListener('mouseup', $507fabe10e71c6fb$var$handlePointerEvent, true);
|
||||
}
|
||||
$507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
|
||||
};
|
||||
function $507fabe10e71c6fb$export$2f1888112f558a7d(element) {
|
||||
const documentObject = (0, $28AnR$getOwnerDocument)(element);
|
||||
let loadListener;
|
||||
if (documentObject.readyState !== 'loading') $507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
||||
else {
|
||||
loadListener = ()=>{
|
||||
$507fabe10e71c6fb$var$setupGlobalFocusEvents(element);
|
||||
};
|
||||
documentObject.addEventListener('DOMContentLoaded', loadListener);
|
||||
}
|
||||
return ()=>$507fabe10e71c6fb$var$tearDownWindowFocusTracking(element, loadListener);
|
||||
}
|
||||
// Server-side rendering does not have the document object defined
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
if (typeof document !== 'undefined') $507fabe10e71c6fb$export$2f1888112f558a7d();
|
||||
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
|
||||
return $507fabe10e71c6fb$var$currentModality !== 'pointer';
|
||||
}
|
||||
function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
|
||||
return $507fabe10e71c6fb$var$currentModality;
|
||||
}
|
||||
function $507fabe10e71c6fb$export$8397ddfc504fdb9a(modality) {
|
||||
$507fabe10e71c6fb$var$currentModality = modality;
|
||||
$507fabe10e71c6fb$var$triggerChangeHandlers(modality, null);
|
||||
}
|
||||
function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
|
||||
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
||||
let [modality, setModality] = (0, $28AnR$useState)($507fabe10e71c6fb$var$currentModality);
|
||||
(0, $28AnR$useEffect)(()=>{
|
||||
let handler = ()=>{
|
||||
setModality($507fabe10e71c6fb$var$currentModality);
|
||||
};
|
||||
$507fabe10e71c6fb$var$changeHandlers.add(handler);
|
||||
return ()=>{
|
||||
$507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
||||
};
|
||||
}, []);
|
||||
return (0, $28AnR$useIsSSR)() ? null : modality;
|
||||
}
|
||||
const $507fabe10e71c6fb$var$nonTextInputTypes = new Set([
|
||||
'checkbox',
|
||||
'radio',
|
||||
'range',
|
||||
'color',
|
||||
'file',
|
||||
'image',
|
||||
'button',
|
||||
'submit',
|
||||
'reset'
|
||||
]);
|
||||
/**
|
||||
* If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
|
||||
* focus visible style can be properly set.
|
||||
*/ function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e) {
|
||||
let document1 = (0, $28AnR$getOwnerDocument)(e === null || e === void 0 ? void 0 : e.target);
|
||||
const IHTMLInputElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
|
||||
const IHTMLTextAreaElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
|
||||
const IHTMLElement = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
|
||||
const IKeyboardEvent = typeof window !== 'undefined' ? (0, $28AnR$getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
|
||||
// For keyboard events that occur on a non-input element that will move focus into input element (aka ArrowLeft going from Datepicker button to the main input group)
|
||||
// we need to rely on the user passing isTextInput into here. This way we can skip toggling focus visiblity for said input element
|
||||
isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
|
||||
return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
|
||||
}
|
||||
function $507fabe10e71c6fb$export$ffd9e5021c1fb2d6(props = {}) {
|
||||
let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
|
||||
let [isFocusVisibleState, setFocusVisible] = (0, $28AnR$useState)(autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27());
|
||||
$507fabe10e71c6fb$export$ec71b4b83ac08ec3((isFocusVisible)=>{
|
||||
setFocusVisible(isFocusVisible);
|
||||
}, [
|
||||
isTextInput
|
||||
], {
|
||||
isTextInput: isTextInput
|
||||
});
|
||||
return {
|
||||
isFocusVisible: isFocusVisibleState
|
||||
};
|
||||
}
|
||||
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts) {
|
||||
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
||||
(0, $28AnR$useEffect)(()=>{
|
||||
let handler = (modality, e)=>{
|
||||
// We want to early return for any keyboard events that occur inside text inputs EXCEPT for Tab and Escape
|
||||
if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(!!(opts === null || opts === void 0 ? void 0 : opts.isTextInput), modality, e)) return;
|
||||
fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
|
||||
};
|
||||
$507fabe10e71c6fb$var$changeHandlers.add(handler);
|
||||
return ()=>{
|
||||
$507fabe10e71c6fb$var$changeHandlers.delete(handler);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, deps);
|
||||
}
|
||||
|
||||
|
||||
export {$507fabe10e71c6fb$export$d90243b58daecda7 as hasSetupGlobalListeners, $507fabe10e71c6fb$export$2f1888112f558a7d as addWindowFocusTracking, $507fabe10e71c6fb$export$b9b3dfddab17db27 as isFocusVisible, $507fabe10e71c6fb$export$630ff653c5ada6a9 as getInteractionModality, $507fabe10e71c6fb$export$8397ddfc504fdb9a as setInteractionModality, $507fabe10e71c6fb$export$98e20ec92f614cfe as useInteractionModality, $507fabe10e71c6fb$export$ffd9e5021c1fb2d6 as useFocusVisible, $507fabe10e71c6fb$export$ec71b4b83ac08ec3 as useFocusVisibleListener};
|
||||
//# sourceMappingURL=useFocusVisible.module.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/useFocusVisible.module.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/useFocusVisible.module.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
105
node_modules/@react-aria/interactions/dist/useFocusWithin.main.js
generated
vendored
Normal file
105
node_modules/@react-aria/interactions/dist/useFocusWithin.main.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
var $625cf83917e112ad$exports = require("./utils.main.js");
|
||||
var $kDAhS$react = require("react");
|
||||
var $kDAhS$reactariautils = require("@react-aria/utils");
|
||||
|
||||
|
||||
function $parcel$export(e, n, v, s) {
|
||||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
||||
}
|
||||
|
||||
$parcel$export(module.exports, "useFocusWithin", () => $d16842bbd0359d1b$export$420e68273165f4ec);
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
function $d16842bbd0359d1b$export$420e68273165f4ec(props) {
|
||||
let { isDisabled: isDisabled, onBlurWithin: onBlurWithin, onFocusWithin: onFocusWithin, onFocusWithinChange: onFocusWithinChange } = props;
|
||||
let state = (0, $kDAhS$react.useRef)({
|
||||
isFocusWithin: false
|
||||
});
|
||||
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $kDAhS$reactariautils.useGlobalListeners)();
|
||||
let onBlur = (0, $kDAhS$react.useCallback)((e)=>{
|
||||
// Ignore events bubbling through portals.
|
||||
if (!e.currentTarget.contains(e.target)) return;
|
||||
// We don't want to trigger onBlurWithin and then immediately onFocusWithin again
|
||||
// when moving focus inside the element. Only trigger if the currentTarget doesn't
|
||||
// include the relatedTarget (where focus is moving).
|
||||
if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
||||
state.current.isFocusWithin = false;
|
||||
removeAllGlobalListeners();
|
||||
if (onBlurWithin) onBlurWithin(e);
|
||||
if (onFocusWithinChange) onFocusWithinChange(false);
|
||||
}
|
||||
}, [
|
||||
onBlurWithin,
|
||||
onFocusWithinChange,
|
||||
state,
|
||||
removeAllGlobalListeners
|
||||
]);
|
||||
let onSyntheticFocus = (0, $625cf83917e112ad$exports.useSyntheticBlurEvent)(onBlur);
|
||||
let onFocus = (0, $kDAhS$react.useCallback)((e)=>{
|
||||
// Ignore events bubbling through portals.
|
||||
if (!e.currentTarget.contains(e.target)) return;
|
||||
// Double check that document.activeElement actually matches e.target in case a previously chained
|
||||
// focus handler already moved focus somewhere else.
|
||||
const ownerDocument = (0, $kDAhS$reactariautils.getOwnerDocument)(e.target);
|
||||
const activeElement = (0, $kDAhS$reactariautils.getActiveElement)(ownerDocument);
|
||||
if (!state.current.isFocusWithin && activeElement === (0, $kDAhS$reactariautils.getEventTarget)(e.nativeEvent)) {
|
||||
if (onFocusWithin) onFocusWithin(e);
|
||||
if (onFocusWithinChange) onFocusWithinChange(true);
|
||||
state.current.isFocusWithin = true;
|
||||
onSyntheticFocus(e);
|
||||
// Browsers don't fire blur events when elements are removed from the DOM.
|
||||
// However, if a focus event occurs outside the element we're tracking, we
|
||||
// can manually fire onBlur.
|
||||
let currentTarget = e.currentTarget;
|
||||
addGlobalListener(ownerDocument, 'focus', (e)=>{
|
||||
if (state.current.isFocusWithin && !(0, $kDAhS$reactariautils.nodeContains)(currentTarget, e.target)) {
|
||||
let nativeEvent = new ownerDocument.defaultView.FocusEvent('blur', {
|
||||
relatedTarget: e.target
|
||||
});
|
||||
(0, $625cf83917e112ad$exports.setEventTarget)(nativeEvent, currentTarget);
|
||||
let event = (0, $625cf83917e112ad$exports.createSyntheticEvent)(nativeEvent);
|
||||
onBlur(event);
|
||||
}
|
||||
}, {
|
||||
capture: true
|
||||
});
|
||||
}
|
||||
}, [
|
||||
onFocusWithin,
|
||||
onFocusWithinChange,
|
||||
onSyntheticFocus,
|
||||
addGlobalListener,
|
||||
onBlur
|
||||
]);
|
||||
if (isDisabled) return {
|
||||
focusWithinProps: {
|
||||
// These cannot be null, that would conflict in mergeProps
|
||||
onFocus: undefined,
|
||||
onBlur: undefined
|
||||
}
|
||||
};
|
||||
return {
|
||||
focusWithinProps: {
|
||||
onFocus: onFocus,
|
||||
onBlur: onBlur
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//# sourceMappingURL=useFocusWithin.main.js.map
|
||||
1
node_modules/@react-aria/interactions/dist/useFocusWithin.main.js.map
generated
vendored
Normal file
1
node_modules/@react-aria/interactions/dist/useFocusWithin.main.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
100
node_modules/@react-aria/interactions/dist/useFocusWithin.mjs
generated
vendored
Normal file
100
node_modules/@react-aria/interactions/dist/useFocusWithin.mjs
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
import {createSyntheticEvent as $8a9cb279dc87e130$export$525bc4921d56d4a, setEventTarget as $8a9cb279dc87e130$export$c2b7abe5d61ec696, useSyntheticBlurEvent as $8a9cb279dc87e130$export$715c682d09d639cc} from "./utils.mjs";
|
||||
import {useRef as $3b9Q0$useRef, useCallback as $3b9Q0$useCallback} from "react";
|
||||
import {useGlobalListeners as $3b9Q0$useGlobalListeners, getOwnerDocument as $3b9Q0$getOwnerDocument, getActiveElement as $3b9Q0$getActiveElement, getEventTarget as $3b9Q0$getEventTarget, nodeContains as $3b9Q0$nodeContains} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
||||
let { isDisabled: isDisabled, onBlurWithin: onBlurWithin, onFocusWithin: onFocusWithin, onFocusWithinChange: onFocusWithinChange } = props;
|
||||
let state = (0, $3b9Q0$useRef)({
|
||||
isFocusWithin: false
|
||||
});
|
||||
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $3b9Q0$useGlobalListeners)();
|
||||
let onBlur = (0, $3b9Q0$useCallback)((e)=>{
|
||||
// Ignore events bubbling through portals.
|
||||
if (!e.currentTarget.contains(e.target)) return;
|
||||
// We don't want to trigger onBlurWithin and then immediately onFocusWithin again
|
||||
// when moving focus inside the element. Only trigger if the currentTarget doesn't
|
||||
// include the relatedTarget (where focus is moving).
|
||||
if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
||||
state.current.isFocusWithin = false;
|
||||
removeAllGlobalListeners();
|
||||
if (onBlurWithin) onBlurWithin(e);
|
||||
if (onFocusWithinChange) onFocusWithinChange(false);
|
||||
}
|
||||
}, [
|
||||
onBlurWithin,
|
||||
onFocusWithinChange,
|
||||
state,
|
||||
removeAllGlobalListeners
|
||||
]);
|
||||
let onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
||||
let onFocus = (0, $3b9Q0$useCallback)((e)=>{
|
||||
// Ignore events bubbling through portals.
|
||||
if (!e.currentTarget.contains(e.target)) return;
|
||||
// Double check that document.activeElement actually matches e.target in case a previously chained
|
||||
// focus handler already moved focus somewhere else.
|
||||
const ownerDocument = (0, $3b9Q0$getOwnerDocument)(e.target);
|
||||
const activeElement = (0, $3b9Q0$getActiveElement)(ownerDocument);
|
||||
if (!state.current.isFocusWithin && activeElement === (0, $3b9Q0$getEventTarget)(e.nativeEvent)) {
|
||||
if (onFocusWithin) onFocusWithin(e);
|
||||
if (onFocusWithinChange) onFocusWithinChange(true);
|
||||
state.current.isFocusWithin = true;
|
||||
onSyntheticFocus(e);
|
||||
// Browsers don't fire blur events when elements are removed from the DOM.
|
||||
// However, if a focus event occurs outside the element we're tracking, we
|
||||
// can manually fire onBlur.
|
||||
let currentTarget = e.currentTarget;
|
||||
addGlobalListener(ownerDocument, 'focus', (e)=>{
|
||||
if (state.current.isFocusWithin && !(0, $3b9Q0$nodeContains)(currentTarget, e.target)) {
|
||||
let nativeEvent = new ownerDocument.defaultView.FocusEvent('blur', {
|
||||
relatedTarget: e.target
|
||||
});
|
||||
(0, $8a9cb279dc87e130$export$c2b7abe5d61ec696)(nativeEvent, currentTarget);
|
||||
let event = (0, $8a9cb279dc87e130$export$525bc4921d56d4a)(nativeEvent);
|
||||
onBlur(event);
|
||||
}
|
||||
}, {
|
||||
capture: true
|
||||
});
|
||||
}
|
||||
}, [
|
||||
onFocusWithin,
|
||||
onFocusWithinChange,
|
||||
onSyntheticFocus,
|
||||
addGlobalListener,
|
||||
onBlur
|
||||
]);
|
||||
if (isDisabled) return {
|
||||
focusWithinProps: {
|
||||
// These cannot be null, that would conflict in mergeProps
|
||||
onFocus: undefined,
|
||||
onBlur: undefined
|
||||
}
|
||||
};
|
||||
return {
|
||||
focusWithinProps: {
|
||||
onFocus: onFocus,
|
||||
onBlur: onBlur
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$9ab94262bd0047c7$export$420e68273165f4ec as useFocusWithin};
|
||||
//# sourceMappingURL=useFocusWithin.module.js.map
|
||||
100
node_modules/@react-aria/interactions/dist/useFocusWithin.module.js
generated
vendored
Normal file
100
node_modules/@react-aria/interactions/dist/useFocusWithin.module.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
import {createSyntheticEvent as $8a9cb279dc87e130$export$525bc4921d56d4a, setEventTarget as $8a9cb279dc87e130$export$c2b7abe5d61ec696, useSyntheticBlurEvent as $8a9cb279dc87e130$export$715c682d09d639cc} from "./utils.module.js";
|
||||
import {useRef as $3b9Q0$useRef, useCallback as $3b9Q0$useCallback} from "react";
|
||||
import {useGlobalListeners as $3b9Q0$useGlobalListeners, getOwnerDocument as $3b9Q0$getOwnerDocument, getActiveElement as $3b9Q0$getActiveElement, getEventTarget as $3b9Q0$getEventTarget, nodeContains as $3b9Q0$nodeContains} from "@react-aria/utils";
|
||||
|
||||
/*
|
||||
* Copyright 2020 Adobe. All rights reserved.
|
||||
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/ // Portions of the code in this file are based on code from react.
|
||||
// Original licensing for the following can be found in the
|
||||
// NOTICE file in the root directory of this source tree.
|
||||
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
|
||||
|
||||
|
||||
|
||||
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
||||
let { isDisabled: isDisabled, onBlurWithin: onBlurWithin, onFocusWithin: onFocusWithin, onFocusWithinChange: onFocusWithinChange } = props;
|
||||
let state = (0, $3b9Q0$useRef)({
|
||||
isFocusWithin: false
|
||||
});
|
||||
let { addGlobalListener: addGlobalListener, removeAllGlobalListeners: removeAllGlobalListeners } = (0, $3b9Q0$useGlobalListeners)();
|
||||
let onBlur = (0, $3b9Q0$useCallback)((e)=>{
|
||||
// Ignore events bubbling through portals.
|
||||
if (!e.currentTarget.contains(e.target)) return;
|
||||
// We don't want to trigger onBlurWithin and then immediately onFocusWithin again
|
||||
// when moving focus inside the element. Only trigger if the currentTarget doesn't
|
||||
// include the relatedTarget (where focus is moving).
|
||||
if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
||||
state.current.isFocusWithin = false;
|
||||
removeAllGlobalListeners();
|
||||
if (onBlurWithin) onBlurWithin(e);
|
||||
if (onFocusWithinChange) onFocusWithinChange(false);
|
||||
}
|
||||
}, [
|
||||
onBlurWithin,
|
||||
onFocusWithinChange,
|
||||
state,
|
||||
removeAllGlobalListeners
|
||||
]);
|
||||
let onSyntheticFocus = (0, $8a9cb279dc87e130$export$715c682d09d639cc)(onBlur);
|
||||
let onFocus = (0, $3b9Q0$useCallback)((e)=>{
|
||||
// Ignore events bubbling through portals.
|
||||
if (!e.currentTarget.contains(e.target)) return;
|
||||
// Double check that document.activeElement actually matches e.target in case a previously chained
|
||||
// focus handler already moved focus somewhere else.
|
||||
const ownerDocument = (0, $3b9Q0$getOwnerDocument)(e.target);
|
||||
const activeElement = (0, $3b9Q0$getActiveElement)(ownerDocument);
|
||||
if (!state.current.isFocusWithin && activeElement === (0, $3b9Q0$getEventTarget)(e.nativeEvent)) {
|
||||
if (onFocusWithin) onFocusWithin(e);
|
||||
if (onFocusWithinChange) onFocusWithinChange(true);
|
||||
state.current.isFocusWithin = true;
|
||||
onSyntheticFocus(e);
|
||||
// Browsers don't fire blur events when elements are removed from the DOM.
|
||||
// However, if a focus event occurs outside the element we're tracking, we
|
||||
// can manually fire onBlur.
|
||||
let currentTarget = e.currentTarget;
|
||||
addGlobalListener(ownerDocument, 'focus', (e)=>{
|
||||
if (state.current.isFocusWithin && !(0, $3b9Q0$nodeContains)(currentTarget, e.target)) {
|
||||
let nativeEvent = new ownerDocument.defaultView.FocusEvent('blur', {
|
||||
relatedTarget: e.target
|
||||
});
|
||||
(0, $8a9cb279dc87e130$export$c2b7abe5d61ec696)(nativeEvent, currentTarget);
|
||||
let event = (0, $8a9cb279dc87e130$export$525bc4921d56d4a)(nativeEvent);
|
||||
onBlur(event);
|
||||
}
|
||||
}, {
|
||||
capture: true
|
||||
});
|
||||
}
|
||||
}, [
|
||||
onFocusWithin,
|
||||
onFocusWithinChange,
|
||||
onSyntheticFocus,
|
||||
addGlobalListener,
|
||||
onBlur
|
||||
]);
|
||||
if (isDisabled) return {
|
||||
focusWithinProps: {
|
||||
// These cannot be null, that would conflict in mergeProps
|
||||
onFocus: undefined,
|
||||
onBlur: undefined
|
||||
}
|
||||
};
|
||||
return {
|
||||
focusWithinProps: {
|
||||
onFocus: onFocus,
|
||||
onBlur: onBlur
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export {$9ab94262bd0047c7$export$420e68273165f4ec as useFocusWithin};
|
||||
//# sourceMappingURL=useFocusWithin.module.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user