@react-aria/focus 3.0.0-nightly.2840 → 3.0.0-nightly.2846
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FocusRing.main.js +44 -0
- package/dist/FocusRing.main.js.map +1 -0
- package/dist/FocusRing.mjs +35 -0
- package/dist/FocusRing.module.js +35 -0
- package/dist/FocusRing.module.js.map +1 -0
- package/dist/FocusScope.main.js +724 -0
- package/dist/FocusScope.main.js.map +1 -0
- package/dist/FocusScope.mjs +711 -0
- package/dist/FocusScope.module.js +711 -0
- package/dist/FocusScope.module.js.map +1 -0
- package/dist/focusSafely.main.js +39 -0
- package/dist/focusSafely.main.js.map +1 -0
- package/dist/focusSafely.mjs +34 -0
- package/dist/focusSafely.module.js +34 -0
- package/dist/focusSafely.module.js.map +1 -0
- package/dist/import.mjs +6 -939
- package/dist/isElementVisible.main.js +41 -0
- package/dist/isElementVisible.main.js.map +1 -0
- package/dist/isElementVisible.mjs +36 -0
- package/dist/isElementVisible.module.js +36 -0
- package/dist/isElementVisible.module.js.map +1 -0
- package/dist/main.js +17 -954
- package/dist/main.js.map +1 -1
- package/dist/module.js +6 -939
- package/dist/module.js.map +1 -1
- package/dist/useFocusRing.main.js +50 -0
- package/dist/useFocusRing.main.js.map +1 -0
- package/dist/useFocusRing.mjs +45 -0
- package/dist/useFocusRing.module.js +45 -0
- package/dist/useFocusRing.module.js.map +1 -0
- package/dist/useFocusable.main.js +75 -0
- package/dist/useFocusable.main.js.map +1 -0
- package/dist/useFocusable.mjs +65 -0
- package/dist/useFocusable.module.js +65 -0
- package/dist/useFocusable.module.js.map +1 -0
- package/dist/useHasTabbableChild.main.js +62 -0
- package/dist/useHasTabbableChild.main.js.map +1 -0
- package/dist/useHasTabbableChild.mjs +57 -0
- package/dist/useHasTabbableChild.module.js +57 -0
- package/dist/useHasTabbableChild.module.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var $a7a032acae3ddda9$exports = require("./FocusScope.main.js");
|
|
2
|
+
var $6RLDH$react = require("react");
|
|
3
|
+
var $6RLDH$reactariautils = require("@react-aria/utils");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$export(e, n, v, s) {
|
|
7
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
$parcel$export(module.exports, "useHasTabbableChild", () => $259c6413a286f2e6$export$eac1895992b9f3d6);
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $259c6413a286f2e6$export$eac1895992b9f3d6(ref, options) {
|
|
25
|
+
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
|
26
|
+
let [hasTabbableChild, setHasTabbableChild] = (0, $6RLDH$react.useState)(false);
|
|
27
|
+
(0, $6RLDH$reactariautils.useLayoutEffect)(()=>{
|
|
28
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
|
|
29
|
+
let update = ()=>{
|
|
30
|
+
if (ref.current) {
|
|
31
|
+
let walker = (0, $a7a032acae3ddda9$exports.getFocusableTreeWalker)(ref.current, {
|
|
32
|
+
tabbable: true
|
|
33
|
+
});
|
|
34
|
+
setHasTabbableChild(!!walker.nextNode());
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
update();
|
|
38
|
+
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
|
39
|
+
let observer = new MutationObserver(update);
|
|
40
|
+
observer.observe(ref.current, {
|
|
41
|
+
subtree: true,
|
|
42
|
+
childList: true,
|
|
43
|
+
attributes: true,
|
|
44
|
+
attributeFilter: [
|
|
45
|
+
"tabIndex",
|
|
46
|
+
"disabled"
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
return ()=>{
|
|
50
|
+
// Disconnect mutation observer when a React update occurs on the top-level component
|
|
51
|
+
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
|
52
|
+
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
|
53
|
+
// so we also update if a child component re-renders and adds/removes something tabbable.
|
|
54
|
+
observer.disconnect();
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return isDisabled ? false : hasTabbableChild;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=useHasTabbableChild.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,SAAS,0CAAoB,GAAuB,EAAE,OAAqC;IAChG,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, useState} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\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>, 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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {getFocusableTreeWalker as $9bf71ea28793e738$export$2d6ec8fc375ceafa} from "./FocusScope.mjs";
|
|
2
|
+
import {useState as $hGAaG$useState} from "react";
|
|
3
|
+
import {useLayoutEffect as $hGAaG$useLayoutEffect} from "@react-aria/utils";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
|
|
19
|
+
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
|
20
|
+
let [hasTabbableChild, setHasTabbableChild] = (0, $hGAaG$useState)(false);
|
|
21
|
+
(0, $hGAaG$useLayoutEffect)(()=>{
|
|
22
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
|
|
23
|
+
let update = ()=>{
|
|
24
|
+
if (ref.current) {
|
|
25
|
+
let walker = (0, $9bf71ea28793e738$export$2d6ec8fc375ceafa)(ref.current, {
|
|
26
|
+
tabbable: true
|
|
27
|
+
});
|
|
28
|
+
setHasTabbableChild(!!walker.nextNode());
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
update();
|
|
32
|
+
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
|
33
|
+
let observer = new MutationObserver(update);
|
|
34
|
+
observer.observe(ref.current, {
|
|
35
|
+
subtree: true,
|
|
36
|
+
childList: true,
|
|
37
|
+
attributes: true,
|
|
38
|
+
attributeFilter: [
|
|
39
|
+
"tabIndex",
|
|
40
|
+
"disabled"
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
return ()=>{
|
|
44
|
+
// Disconnect mutation observer when a React update occurs on the top-level component
|
|
45
|
+
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
|
46
|
+
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
|
47
|
+
// so we also update if a child component re-renders and adds/removes something tabbable.
|
|
48
|
+
observer.disconnect();
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return isDisabled ? false : hasTabbableChild;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
export {$83013635b024ae3d$export$eac1895992b9f3d6 as useHasTabbableChild};
|
|
57
|
+
//# sourceMappingURL=useHasTabbableChild.mjs.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {getFocusableTreeWalker as $9bf71ea28793e738$export$2d6ec8fc375ceafa} from "./FocusScope.module.js";
|
|
2
|
+
import {useState as $hGAaG$useState} from "react";
|
|
3
|
+
import {useLayoutEffect as $hGAaG$useLayoutEffect} from "@react-aria/utils";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2022 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
|
|
19
|
+
let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
|
|
20
|
+
let [hasTabbableChild, setHasTabbableChild] = (0, $hGAaG$useState)(false);
|
|
21
|
+
(0, $hGAaG$useLayoutEffect)(()=>{
|
|
22
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
|
|
23
|
+
let update = ()=>{
|
|
24
|
+
if (ref.current) {
|
|
25
|
+
let walker = (0, $9bf71ea28793e738$export$2d6ec8fc375ceafa)(ref.current, {
|
|
26
|
+
tabbable: true
|
|
27
|
+
});
|
|
28
|
+
setHasTabbableChild(!!walker.nextNode());
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
update();
|
|
32
|
+
// Update when new elements are inserted, or the tabIndex/disabled attribute updates.
|
|
33
|
+
let observer = new MutationObserver(update);
|
|
34
|
+
observer.observe(ref.current, {
|
|
35
|
+
subtree: true,
|
|
36
|
+
childList: true,
|
|
37
|
+
attributes: true,
|
|
38
|
+
attributeFilter: [
|
|
39
|
+
"tabIndex",
|
|
40
|
+
"disabled"
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
return ()=>{
|
|
44
|
+
// Disconnect mutation observer when a React update occurs on the top-level component
|
|
45
|
+
// so we update synchronously after re-rendering. Otherwise React will emit act warnings
|
|
46
|
+
// in tests since mutation observers fire asynchronously. The mutation observer is necessary
|
|
47
|
+
// so we also update if a child component re-renders and adds/removes something tabbable.
|
|
48
|
+
observer.disconnect();
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return isDisabled ? false : hasTabbableChild;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
export {$83013635b024ae3d$export$eac1895992b9f3d6 as useHasTabbableChild};
|
|
57
|
+
//# sourceMappingURL=useHasTabbableChild.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,SAAS,0CAAoB,GAAuB,EAAE,OAAqC;IAChG,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, useState} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\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>, 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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/focus",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.2846+c5e4b3701",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
27
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
25
|
+
"@react-aria/interactions": "3.0.0-nightly.2846+c5e4b3701",
|
|
26
|
+
"@react-aria/utils": "3.0.0-nightly.2846+c5e4b3701",
|
|
27
|
+
"@react-types/shared": "3.0.0-nightly.2846+c5e4b3701",
|
|
28
28
|
"@swc/helpers": "^0.5.0",
|
|
29
29
|
"clsx": "^2.0.0"
|
|
30
30
|
},
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "c5e4b3701fdb89eb551f1b3697ac253f06ef68fa"
|
|
38
38
|
}
|