@react-aria/focus 3.10.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +180 -150
- package/dist/main.js.map +1 -1
- package/dist/module.js +180 -150
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/module.js
CHANGED
|
@@ -1,9 +1,41 @@
|
|
|
1
|
+
import $6nfFC$swchelperssrc_define_propertymjs from "@swc/helpers/src/_define_property.mjs";
|
|
1
2
|
import $6nfFC$react, {useRef as $6nfFC$useRef, useContext as $6nfFC$useContext, useMemo as $6nfFC$useMemo, useEffect as $6nfFC$useEffect, useState as $6nfFC$useState, useCallback as $6nfFC$useCallback} from "react";
|
|
2
3
|
import {useLayoutEffect as $6nfFC$useLayoutEffect, runAfterTransition as $6nfFC$runAfterTransition, focusWithoutScrolling as $6nfFC$focusWithoutScrolling, mergeProps as $6nfFC$mergeProps, useSyncRef as $6nfFC$useSyncRef} from "@react-aria/utils";
|
|
3
4
|
import {getInteractionModality as $6nfFC$getInteractionModality, isFocusVisible as $6nfFC$isFocusVisible, useFocusVisibleListener as $6nfFC$useFocusVisibleListener, useFocus as $6nfFC$useFocus, useFocusWithin as $6nfFC$useFocusWithin, useKeyboard as $6nfFC$useKeyboard} from "@react-aria/interactions";
|
|
4
5
|
import $6nfFC$clsx from "clsx";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
* governing permissions and limitations under the License.
|
|
17
|
+
*/ /*
|
|
18
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
19
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
+
* governing permissions and limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
/*
|
|
29
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
30
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
|
31
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
32
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
33
|
+
*
|
|
34
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
35
|
+
* the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
36
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
37
|
+
* governing permissions and limitations under the License.
|
|
38
|
+
*/
|
|
7
39
|
|
|
8
40
|
function $6a99195332edec8b$export$80f3e147d781571c(element) {
|
|
9
41
|
// If the user is interacting with a virtual cursor, e.g. screen reader, then
|
|
@@ -11,13 +43,13 @@ function $6a99195332edec8b$export$80f3e147d781571c(element) {
|
|
|
11
43
|
// the page before shifting focus. This avoids issues with VoiceOver on iOS
|
|
12
44
|
// causing the page to scroll when moving focus if the element is transitioning
|
|
13
45
|
// from off the screen.
|
|
14
|
-
if ($6nfFC$getInteractionModality() ===
|
|
46
|
+
if ((0, $6nfFC$getInteractionModality)() === "virtual") {
|
|
15
47
|
let lastFocusedElement = document.activeElement;
|
|
16
|
-
$6nfFC$runAfterTransition(()=>{
|
|
48
|
+
(0, $6nfFC$runAfterTransition)(()=>{
|
|
17
49
|
// If focus did not move and the element is still in the document, focus it.
|
|
18
|
-
if (document.activeElement === lastFocusedElement && document.contains(element)) $6nfFC$focusWithoutScrolling(element);
|
|
50
|
+
if (document.activeElement === lastFocusedElement && document.contains(element)) (0, $6nfFC$focusWithoutScrolling)(element);
|
|
19
51
|
});
|
|
20
|
-
} else $6nfFC$focusWithoutScrolling(element);
|
|
52
|
+
} else (0, $6nfFC$focusWithoutScrolling)(element);
|
|
21
53
|
}
|
|
22
54
|
|
|
23
55
|
|
|
@@ -34,42 +66,41 @@ function $6a99195332edec8b$export$80f3e147d781571c(element) {
|
|
|
34
66
|
*/ function $645f2e67b85a24c9$var$isStyleVisible(element) {
|
|
35
67
|
if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) return false;
|
|
36
68
|
let { display: display , visibility: visibility } = element.style;
|
|
37
|
-
let isVisible = display !==
|
|
69
|
+
let isVisible = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
|
|
38
70
|
if (isVisible) {
|
|
39
71
|
const { getComputedStyle: getComputedStyle } = element.ownerDocument.defaultView;
|
|
40
72
|
let { display: computedDisplay , visibility: computedVisibility } = getComputedStyle(element);
|
|
41
|
-
isVisible = computedDisplay !==
|
|
73
|
+
isVisible = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
|
|
42
74
|
}
|
|
43
75
|
return isVisible;
|
|
44
76
|
}
|
|
45
77
|
function $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) {
|
|
46
|
-
return !element.hasAttribute(
|
|
78
|
+
return !element.hasAttribute("hidden") && (element.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element.hasAttribute("open") : true);
|
|
47
79
|
}
|
|
48
80
|
function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element, childElement) {
|
|
49
|
-
return element.nodeName !==
|
|
81
|
+
return element.nodeName !== "#comment" && $645f2e67b85a24c9$var$isStyleVisible(element) && $645f2e67b85a24c9$var$isAttributeVisible(element, childElement) && (!element.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element.parentElement, element));
|
|
50
82
|
}
|
|
51
83
|
|
|
52
84
|
|
|
53
85
|
|
|
54
86
|
|
|
55
|
-
const $9bf71ea28793e738$var$FocusContext = /*#__PURE__*/ $6nfFC$react.createContext(null);
|
|
87
|
+
const $9bf71ea28793e738$var$FocusContext = /*#__PURE__*/ (0, $6nfFC$react).createContext(null);
|
|
56
88
|
let $9bf71ea28793e738$var$activeScope = null;
|
|
57
89
|
function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
|
|
58
90
|
let { children: children , contain: contain , restoreFocus: restoreFocus , autoFocus: autoFocus } = props;
|
|
59
|
-
let startRef = $6nfFC$useRef();
|
|
60
|
-
let endRef = $6nfFC$useRef();
|
|
61
|
-
let scopeRef = $6nfFC$useRef([]);
|
|
62
|
-
let ctx = $6nfFC$useContext($9bf71ea28793e738$var$FocusContext);
|
|
63
|
-
var
|
|
91
|
+
let startRef = (0, $6nfFC$useRef)();
|
|
92
|
+
let endRef = (0, $6nfFC$useRef)();
|
|
93
|
+
let scopeRef = (0, $6nfFC$useRef)([]);
|
|
94
|
+
let ctx = (0, $6nfFC$useContext)($9bf71ea28793e738$var$FocusContext);
|
|
95
|
+
var _ctx_scopeRef;
|
|
64
96
|
// The parent scope is based on the JSX tree, using context.
|
|
65
97
|
// However, if a new scope mounts outside the active scope (e.g. DialogContainer launched from a menu),
|
|
66
98
|
// we want the parent scope to be the active scope instead.
|
|
67
|
-
let ctxParent = (
|
|
68
|
-
let
|
|
69
|
-
, [
|
|
99
|
+
let ctxParent = (_ctx_scopeRef = ctx === null || ctx === void 0 ? void 0 : ctx.scopeRef) !== null && _ctx_scopeRef !== void 0 ? _ctx_scopeRef : null;
|
|
100
|
+
let parentScope = (0, $6nfFC$useMemo)(()=>$9bf71ea28793e738$var$activeScope && $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope) && !$9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, ctxParent) ? $9bf71ea28793e738$var$activeScope : ctxParent, [
|
|
70
101
|
ctxParent
|
|
71
102
|
]);
|
|
72
|
-
$6nfFC$useLayoutEffect(()=>{
|
|
103
|
+
(0, $6nfFC$useLayoutEffect)(()=>{
|
|
73
104
|
// Find all rendered nodes between the sentinels and add them to the scope.
|
|
74
105
|
let node = startRef.current.nextSibling;
|
|
75
106
|
let nodes = [];
|
|
@@ -80,19 +111,19 @@ function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
|
|
|
80
111
|
scopeRef.current = nodes;
|
|
81
112
|
}, [
|
|
82
113
|
children,
|
|
83
|
-
|
|
114
|
+
parentScope
|
|
84
115
|
]);
|
|
85
116
|
// add to the focus scope tree in render order because useEffects/useLayoutEffects run children first whereas render runs parent first
|
|
86
117
|
// which matters when constructing a tree
|
|
87
|
-
if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(
|
|
88
|
-
let
|
|
89
|
-
|
|
118
|
+
if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parentScope) && !$9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) $9bf71ea28793e738$export$d06fae2ee68b101e.addTreeNode(scopeRef, parentScope);
|
|
119
|
+
let node = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
|
120
|
+
node.contain = contain;
|
|
90
121
|
$9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
|
|
91
122
|
$9bf71ea28793e738$var$useFocusContainment(scopeRef, contain);
|
|
92
123
|
$9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain);
|
|
93
124
|
$9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus);
|
|
94
125
|
// this layout effect needs to run last so that focusScopeTree cleanup happens at the last moment possible
|
|
95
|
-
$6nfFC$useLayoutEffect(()=>{
|
|
126
|
+
(0, $6nfFC$useLayoutEffect)(()=>{
|
|
96
127
|
if (scopeRef) return ()=>{
|
|
97
128
|
// Scope may have been re-parented.
|
|
98
129
|
let parentScope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef).parent.scopeRef;
|
|
@@ -104,32 +135,31 @@ function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
|
|
|
104
135
|
};
|
|
105
136
|
}, [
|
|
106
137
|
scopeRef,
|
|
107
|
-
|
|
138
|
+
parentScope
|
|
108
139
|
]);
|
|
109
140
|
let focusManager = $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef);
|
|
110
|
-
return
|
|
141
|
+
return /*#__PURE__*/ (0, $6nfFC$react).createElement($9bf71ea28793e738$var$FocusContext.Provider, {
|
|
111
142
|
value: {
|
|
112
143
|
scopeRef: scopeRef,
|
|
113
144
|
focusManager: focusManager
|
|
114
145
|
}
|
|
115
|
-
}, /*#__PURE__*/ $6nfFC$react.createElement("span", {
|
|
146
|
+
}, /*#__PURE__*/ (0, $6nfFC$react).createElement("span", {
|
|
116
147
|
"data-focus-scope-start": true,
|
|
117
148
|
hidden: true,
|
|
118
149
|
ref: startRef
|
|
119
|
-
}), children, /*#__PURE__*/ $6nfFC$react.createElement("span", {
|
|
150
|
+
}), children, /*#__PURE__*/ (0, $6nfFC$react).createElement("span", {
|
|
120
151
|
"data-focus-scope-end": true,
|
|
121
152
|
hidden: true,
|
|
122
153
|
ref: endRef
|
|
123
|
-
}))
|
|
154
|
+
}));
|
|
124
155
|
}
|
|
125
156
|
function $9bf71ea28793e738$export$10c5169755ce7bd7() {
|
|
126
|
-
var
|
|
127
|
-
return (
|
|
157
|
+
var _useContext;
|
|
158
|
+
return (_useContext = (0, $6nfFC$useContext)($9bf71ea28793e738$var$FocusContext)) === null || _useContext === void 0 ? void 0 : _useContext.focusManager;
|
|
128
159
|
}
|
|
129
160
|
function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
|
130
161
|
return {
|
|
131
|
-
focusNext (opts = {
|
|
132
|
-
}) {
|
|
162
|
+
focusNext (opts = {}) {
|
|
133
163
|
let scope = scopeRef.current;
|
|
134
164
|
let { from: from , tabbable: tabbable , wrap: wrap , accept: accept } = opts;
|
|
135
165
|
let node = from || document.activeElement;
|
|
@@ -147,8 +177,7 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
|
|
147
177
|
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
148
178
|
return nextNode;
|
|
149
179
|
},
|
|
150
|
-
focusPrevious (opts = {
|
|
151
|
-
}) {
|
|
180
|
+
focusPrevious (opts = {}) {
|
|
152
181
|
let scope = scopeRef.current;
|
|
153
182
|
let { from: from , tabbable: tabbable , wrap: wrap , accept: accept } = opts;
|
|
154
183
|
let node = from || document.activeElement;
|
|
@@ -166,8 +195,7 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
|
|
166
195
|
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
|
167
196
|
return previousNode;
|
|
168
197
|
},
|
|
169
|
-
focusFirst (opts = {
|
|
170
|
-
}) {
|
|
198
|
+
focusFirst (opts = {}) {
|
|
171
199
|
let scope = scopeRef.current;
|
|
172
200
|
let { tabbable: tabbable , accept: accept } = opts;
|
|
173
201
|
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
|
|
@@ -179,8 +207,7 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
|
|
179
207
|
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
180
208
|
return nextNode;
|
|
181
209
|
},
|
|
182
|
-
focusLast (opts = {
|
|
183
|
-
}) {
|
|
210
|
+
focusLast (opts = {}) {
|
|
184
211
|
let scope = scopeRef.current;
|
|
185
212
|
let { tabbable: tabbable , accept: accept } = opts;
|
|
186
213
|
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
|
|
@@ -195,21 +222,21 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
|
|
195
222
|
};
|
|
196
223
|
}
|
|
197
224
|
const $9bf71ea28793e738$var$focusableElements = [
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
225
|
+
"input:not([disabled]):not([type=hidden])",
|
|
226
|
+
"select:not([disabled])",
|
|
227
|
+
"textarea:not([disabled])",
|
|
228
|
+
"button:not([disabled])",
|
|
229
|
+
"a[href]",
|
|
230
|
+
"area[href]",
|
|
231
|
+
"summary",
|
|
232
|
+
"iframe",
|
|
233
|
+
"object",
|
|
234
|
+
"embed",
|
|
235
|
+
"audio[controls]",
|
|
236
|
+
"video[controls]",
|
|
237
|
+
"[contenteditable]"
|
|
211
238
|
];
|
|
212
|
-
const $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(
|
|
239
|
+
const $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
|
213
240
|
$9bf71ea28793e738$var$focusableElements.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
|
214
241
|
const $9bf71ea28793e738$var$TABBABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(':not([hidden]):not([tabindex="-1"]),');
|
|
215
242
|
function $9bf71ea28793e738$var$getScopeRoot(scope) {
|
|
@@ -224,10 +251,10 @@ function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
|
|
|
224
251
|
return true;
|
|
225
252
|
}
|
|
226
253
|
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
|
227
|
-
let focusedNode = $6nfFC$useRef();
|
|
228
|
-
let raf = $6nfFC$useRef(null);
|
|
229
|
-
$6nfFC$useLayoutEffect(()=>{
|
|
230
|
-
let
|
|
254
|
+
let focusedNode = (0, $6nfFC$useRef)();
|
|
255
|
+
let raf = (0, $6nfFC$useRef)(null);
|
|
256
|
+
(0, $6nfFC$useLayoutEffect)(()=>{
|
|
257
|
+
let scope = scopeRef.current;
|
|
231
258
|
if (!contain) {
|
|
232
259
|
// if contain was changed, then we should cancel any ongoing waits to pull focus back into containment
|
|
233
260
|
if (raf.current) {
|
|
@@ -238,7 +265,7 @@ function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
|
|
238
265
|
}
|
|
239
266
|
// Handle the Tab key to contain focus within the scope
|
|
240
267
|
let onKeyDown = (e)=>{
|
|
241
|
-
if (e.key !==
|
|
268
|
+
if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef)) return;
|
|
242
269
|
let focusedElement = document.activeElement;
|
|
243
270
|
let scope = scopeRef.current;
|
|
244
271
|
if (!$9bf71ea28793e738$var$isElementInScope(focusedElement, scope)) return;
|
|
@@ -280,26 +307,22 @@ function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
|
|
280
307
|
}
|
|
281
308
|
});
|
|
282
309
|
};
|
|
283
|
-
document.addEventListener(
|
|
284
|
-
document.addEventListener(
|
|
285
|
-
|
|
286
|
-
);
|
|
287
|
-
scope1.forEach((element)=>element.addEventListener('focusout', onBlur, false)
|
|
288
|
-
);
|
|
310
|
+
document.addEventListener("keydown", onKeyDown, false);
|
|
311
|
+
document.addEventListener("focusin", onFocus, false);
|
|
312
|
+
scope.forEach((element)=>element.addEventListener("focusin", onFocus, false));
|
|
313
|
+
scope.forEach((element)=>element.addEventListener("focusout", onBlur, false));
|
|
289
314
|
return ()=>{
|
|
290
|
-
document.removeEventListener(
|
|
291
|
-
document.removeEventListener(
|
|
292
|
-
|
|
293
|
-
);
|
|
294
|
-
scope1.forEach((element)=>element.removeEventListener('focusout', onBlur, false)
|
|
295
|
-
);
|
|
315
|
+
document.removeEventListener("keydown", onKeyDown, false);
|
|
316
|
+
document.removeEventListener("focusin", onFocus, false);
|
|
317
|
+
scope.forEach((element)=>element.removeEventListener("focusin", onFocus, false));
|
|
318
|
+
scope.forEach((element)=>element.removeEventListener("focusout", onBlur, false));
|
|
296
319
|
};
|
|
297
320
|
}, [
|
|
298
321
|
scopeRef,
|
|
299
322
|
contain
|
|
300
323
|
]);
|
|
301
324
|
// eslint-disable-next-line arrow-body-style
|
|
302
|
-
$6nfFC$useEffect(()=>{
|
|
325
|
+
(0, $6nfFC$useEffect)(()=>{
|
|
303
326
|
return ()=>{
|
|
304
327
|
if (raf.current) cancelAnimationFrame(raf.current);
|
|
305
328
|
};
|
|
@@ -311,8 +334,7 @@ function $9bf71ea28793e738$var$isElementInAnyScope(element) {
|
|
|
311
334
|
return $9bf71ea28793e738$var$isElementInChildScope(element);
|
|
312
335
|
}
|
|
313
336
|
function $9bf71ea28793e738$var$isElementInScope(element, scope) {
|
|
314
|
-
return scope.some((node)=>node.contains(element)
|
|
315
|
-
);
|
|
337
|
+
return scope.some((node)=>node.contains(element));
|
|
316
338
|
}
|
|
317
339
|
function $9bf71ea28793e738$var$isElementInChildScope(element, scope = null) {
|
|
318
340
|
// node.contains in isElementInScope covers child scopes that are also DOM children,
|
|
@@ -326,8 +348,8 @@ function $9bf71ea28793e738$export$1258395f99bf9cbf(element) {
|
|
|
326
348
|
return $9bf71ea28793e738$var$isElementInChildScope(element, $9bf71ea28793e738$var$activeScope);
|
|
327
349
|
}
|
|
328
350
|
function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
|
|
329
|
-
var
|
|
330
|
-
let parent = (
|
|
351
|
+
var _focusScopeTree_getTreeNode;
|
|
352
|
+
let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
|
|
331
353
|
while(parent){
|
|
332
354
|
if (parent.scopeRef === ancestor) return true;
|
|
333
355
|
parent = parent.parent;
|
|
@@ -336,7 +358,7 @@ function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
|
|
|
336
358
|
}
|
|
337
359
|
function $9bf71ea28793e738$var$focusElement(element, scroll = false) {
|
|
338
360
|
if (element != null && !scroll) try {
|
|
339
|
-
$6a99195332edec8b$export$80f3e147d781571c(element);
|
|
361
|
+
(0, $6a99195332edec8b$export$80f3e147d781571c)(element);
|
|
340
362
|
} catch (err) {
|
|
341
363
|
// ignore
|
|
342
364
|
}
|
|
@@ -364,8 +386,8 @@ function $9bf71ea28793e738$var$focusFirstInScope(scope, tabbable = true) {
|
|
|
364
386
|
$9bf71ea28793e738$var$focusElement(nextNode);
|
|
365
387
|
}
|
|
366
388
|
function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
|
|
367
|
-
const autoFocusRef = $6nfFC$react.useRef(autoFocus);
|
|
368
|
-
$6nfFC$useEffect(()=>{
|
|
389
|
+
const autoFocusRef = (0, $6nfFC$react).useRef(autoFocus);
|
|
390
|
+
(0, $6nfFC$useEffect)(()=>{
|
|
369
391
|
if (autoFocusRef.current) {
|
|
370
392
|
$9bf71ea28793e738$var$activeScope = scopeRef;
|
|
371
393
|
if (!$9bf71ea28793e738$var$isElementInScope(document.activeElement, $9bf71ea28793e738$var$activeScope.current)) $9bf71ea28793e738$var$focusFirstInScope(scopeRef.current);
|
|
@@ -378,7 +400,7 @@ function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
|
|
|
378
400
|
function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain) {
|
|
379
401
|
// tracks the active scope, in case restore and contain are both false.
|
|
380
402
|
// if either are true, this is tracked in useRestoreFocus or useFocusContainment.
|
|
381
|
-
$6nfFC$useLayoutEffect(()=>{
|
|
403
|
+
(0, $6nfFC$useLayoutEffect)(()=>{
|
|
382
404
|
if (restore || contain) return;
|
|
383
405
|
let scope = scopeRef.current;
|
|
384
406
|
let onFocus = (e)=>{
|
|
@@ -386,13 +408,11 @@ function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain)
|
|
|
386
408
|
if ($9bf71ea28793e738$var$isElementInScope(target, scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
|
387
409
|
else if (!$9bf71ea28793e738$var$isElementInAnyScope(target)) $9bf71ea28793e738$var$activeScope = null;
|
|
388
410
|
};
|
|
389
|
-
document.addEventListener(
|
|
390
|
-
scope.forEach((element)=>element.addEventListener(
|
|
391
|
-
);
|
|
411
|
+
document.addEventListener("focusin", onFocus, false);
|
|
412
|
+
scope.forEach((element)=>element.addEventListener("focusin", onFocus, false));
|
|
392
413
|
return ()=>{
|
|
393
|
-
document.removeEventListener(
|
|
394
|
-
scope.forEach((element)=>element.removeEventListener(
|
|
395
|
-
);
|
|
414
|
+
document.removeEventListener("focusin", onFocus, false);
|
|
415
|
+
scope.forEach((element)=>element.removeEventListener("focusin", onFocus, false));
|
|
396
416
|
};
|
|
397
417
|
}, [
|
|
398
418
|
scopeRef,
|
|
@@ -410,10 +430,10 @@ function $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef) {
|
|
|
410
430
|
}
|
|
411
431
|
function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
|
|
412
432
|
// create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.
|
|
413
|
-
const nodeToRestoreRef = $6nfFC$useRef(typeof document !==
|
|
433
|
+
const nodeToRestoreRef = (0, $6nfFC$useRef)(typeof document !== "undefined" ? document.activeElement : null);
|
|
414
434
|
// restoring scopes should all track if they are active regardless of contain, but contain already tracks it plus logic to contain the focus
|
|
415
435
|
// restoring-non-containing scopes should only care if they become active so they can perform the restore
|
|
416
|
-
$6nfFC$useLayoutEffect(()=>{
|
|
436
|
+
(0, $6nfFC$useLayoutEffect)(()=>{
|
|
417
437
|
let scope = scopeRef.current;
|
|
418
438
|
if (!restoreFocus || contain) return;
|
|
419
439
|
let onFocus = ()=>{
|
|
@@ -421,13 +441,11 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
421
441
|
// Moving out of the active scope to an ancestor is not allowed.
|
|
422
442
|
if (!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
|
423
443
|
};
|
|
424
|
-
document.addEventListener(
|
|
425
|
-
scope.forEach((element)=>element.addEventListener(
|
|
426
|
-
);
|
|
444
|
+
document.addEventListener("focusin", onFocus, false);
|
|
445
|
+
scope.forEach((element)=>element.addEventListener("focusin", onFocus, false));
|
|
427
446
|
return ()=>{
|
|
428
|
-
document.removeEventListener(
|
|
429
|
-
scope.forEach((element)=>element.removeEventListener(
|
|
430
|
-
);
|
|
447
|
+
document.removeEventListener("focusin", onFocus, false);
|
|
448
|
+
scope.forEach((element)=>element.removeEventListener("focusin", onFocus, false));
|
|
431
449
|
};
|
|
432
450
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
433
451
|
}, [
|
|
@@ -435,7 +453,7 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
435
453
|
contain
|
|
436
454
|
]);
|
|
437
455
|
// useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.
|
|
438
|
-
$6nfFC$useLayoutEffect(()=>{
|
|
456
|
+
(0, $6nfFC$useLayoutEffect)(()=>{
|
|
439
457
|
if (!restoreFocus) return;
|
|
440
458
|
$9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef).nodeToRestore = nodeToRestoreRef.current;
|
|
441
459
|
// Handle the Tab key so that tabbing out of the scope goes to the next element
|
|
@@ -443,7 +461,7 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
443
461
|
// using portals for overlays, so that focus goes to the expected element when
|
|
444
462
|
// tabbing out of the overlay.
|
|
445
463
|
let onKeyDown = (e)=>{
|
|
446
|
-
if (e.key !==
|
|
464
|
+
if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
447
465
|
let focusedElement = document.activeElement;
|
|
448
466
|
if (!$9bf71ea28793e738$var$isElementInScope(focusedElement, scopeRef.current)) return;
|
|
449
467
|
let nodeToRestore = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef).nodeToRestore;
|
|
@@ -464,7 +482,7 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
464
482
|
walker.currentNode = nodeToRestore;
|
|
465
483
|
// Skip over elements within the scope, in case the scope immediately follows the node to restore.
|
|
466
484
|
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
|
467
|
-
while ($9bf71ea28793e738$var$isElementInScope(nextElement, scopeRef.current))
|
|
485
|
+
while ($9bf71ea28793e738$var$isElementInScope(nextElement, scopeRef.current));
|
|
468
486
|
e.preventDefault();
|
|
469
487
|
e.stopPropagation();
|
|
470
488
|
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
|
@@ -475,9 +493,9 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
|
|
|
475
493
|
else $9bf71ea28793e738$var$focusElement(nodeToRestore, true);
|
|
476
494
|
}
|
|
477
495
|
};
|
|
478
|
-
if (!contain) document.addEventListener(
|
|
496
|
+
if (!contain) document.addEventListener("keydown", onKeyDown, true);
|
|
479
497
|
return ()=>{
|
|
480
|
-
if (!contain) document.removeEventListener(
|
|
498
|
+
if (!contain) document.removeEventListener("keydown", onKeyDown, true);
|
|
481
499
|
let nodeToRestore = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef).nodeToRestore;
|
|
482
500
|
// if we already lost focus to the body and this was the active scope, then we should attempt to restore
|
|
483
501
|
if (restoreFocus && nodeToRestore && // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -520,21 +538,19 @@ function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
|
|
|
520
538
|
let selector = (opts === null || opts === void 0 ? void 0 : opts.tabbable) ? $9bf71ea28793e738$var$TABBABLE_ELEMENT_SELECTOR : $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR;
|
|
521
539
|
let walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
|
|
522
540
|
acceptNode (node) {
|
|
523
|
-
var
|
|
541
|
+
var _opts_from;
|
|
524
542
|
// Skip nodes inside the starting node.
|
|
525
|
-
if (opts === null || opts === void 0 ? void 0 : (
|
|
526
|
-
if (node.matches(selector) && $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;
|
|
543
|
+
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;
|
|
544
|
+
if (node.matches(selector) && (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;
|
|
527
545
|
return NodeFilter.FILTER_SKIP;
|
|
528
546
|
}
|
|
529
547
|
});
|
|
530
548
|
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
|
|
531
549
|
return walker;
|
|
532
550
|
}
|
|
533
|
-
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {
|
|
534
|
-
}) {
|
|
551
|
+
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {}) {
|
|
535
552
|
return {
|
|
536
|
-
focusNext (opts = {
|
|
537
|
-
}) {
|
|
553
|
+
focusNext (opts = {}) {
|
|
538
554
|
let root = ref.current;
|
|
539
555
|
if (!root) return;
|
|
540
556
|
let { from: from , tabbable: tabbable = defaultOptions.tabbable , wrap: wrap = defaultOptions.wrap , accept: accept = defaultOptions.accept } = opts;
|
|
@@ -607,7 +623,7 @@ function $9bf71ea28793e738$var$last(walker) {
|
|
|
607
623
|
do {
|
|
608
624
|
last = walker.lastChild();
|
|
609
625
|
if (last) next = last;
|
|
610
|
-
}while (last)
|
|
626
|
+
}while (last);
|
|
611
627
|
return next;
|
|
612
628
|
}
|
|
613
629
|
class $9bf71ea28793e738$var$Tree {
|
|
@@ -637,8 +653,7 @@ class $9bf71ea28793e738$var$Tree {
|
|
|
637
653
|
for (let current of this.traverse())if (current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node.scopeRef.current)) current.nodeToRestore = node.nodeToRestore;
|
|
638
654
|
let children = node.children;
|
|
639
655
|
parentNode.removeChild(node);
|
|
640
|
-
if (children.length > 0) children.forEach((child)=>parentNode.addChild(child)
|
|
641
|
-
);
|
|
656
|
+
if (children.length > 0) children.forEach((child)=>parentNode.addChild(child));
|
|
642
657
|
this.fastMap.delete(node.scopeRef);
|
|
643
658
|
}
|
|
644
659
|
// Pre Order Depth First
|
|
@@ -652,7 +667,7 @@ class $9bf71ea28793e738$var$Tree {
|
|
|
652
667
|
return newTree;
|
|
653
668
|
}
|
|
654
669
|
constructor(){
|
|
655
|
-
this
|
|
670
|
+
(0, $6nfFC$swchelperssrc_define_propertymjs)(this, "fastMap", new Map());
|
|
656
671
|
this.root = new $9bf71ea28793e738$var$TreeNode({
|
|
657
672
|
scopeRef: null
|
|
658
673
|
});
|
|
@@ -669,55 +684,62 @@ class $9bf71ea28793e738$var$TreeNode {
|
|
|
669
684
|
node.parent = undefined;
|
|
670
685
|
}
|
|
671
686
|
constructor(props){
|
|
672
|
-
this
|
|
673
|
-
this
|
|
687
|
+
(0, $6nfFC$swchelperssrc_define_propertymjs)(this, "children", []);
|
|
688
|
+
(0, $6nfFC$swchelperssrc_define_propertymjs)(this, "contain", false);
|
|
674
689
|
this.scopeRef = props.scopeRef;
|
|
675
690
|
}
|
|
676
691
|
}
|
|
677
692
|
let $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree();
|
|
678
693
|
|
|
679
694
|
|
|
695
|
+
/*
|
|
696
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
697
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
698
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
699
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
700
|
+
*
|
|
701
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
702
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
703
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
704
|
+
* governing permissions and limitations under the License.
|
|
705
|
+
*/
|
|
680
706
|
|
|
681
707
|
|
|
682
708
|
|
|
683
709
|
|
|
684
710
|
|
|
685
|
-
|
|
686
|
-
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {
|
|
687
|
-
}) {
|
|
711
|
+
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
|
|
688
712
|
let { autoFocus: autoFocus = false , isTextInput: isTextInput , within: within } = props;
|
|
689
|
-
let state = $6nfFC$useRef({
|
|
713
|
+
let state = (0, $6nfFC$useRef)({
|
|
690
714
|
isFocused: false,
|
|
691
|
-
isFocusVisible: autoFocus || $6nfFC$isFocusVisible()
|
|
715
|
+
isFocusVisible: autoFocus || (0, $6nfFC$isFocusVisible)()
|
|
692
716
|
});
|
|
693
|
-
let [
|
|
694
|
-
let [isFocusVisibleState, setFocusVisible] = $6nfFC$useState(()=>state.current.isFocused && state.current.isFocusVisible
|
|
695
|
-
);
|
|
696
|
-
let
|
|
697
|
-
, []);
|
|
698
|
-
let onFocusChange = $6nfFC$useCallback((isFocused)=>{
|
|
717
|
+
let [isFocused, setFocused] = (0, $6nfFC$useState)(false);
|
|
718
|
+
let [isFocusVisibleState, setFocusVisible] = (0, $6nfFC$useState)(()=>state.current.isFocused && state.current.isFocusVisible);
|
|
719
|
+
let updateState = (0, $6nfFC$useCallback)(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
|
720
|
+
let onFocusChange = (0, $6nfFC$useCallback)((isFocused)=>{
|
|
699
721
|
state.current.isFocused = isFocused;
|
|
700
722
|
setFocused(isFocused);
|
|
701
723
|
updateState();
|
|
702
724
|
}, [
|
|
703
725
|
updateState
|
|
704
726
|
]);
|
|
705
|
-
$6nfFC$useFocusVisibleListener((isFocusVisible)=>{
|
|
727
|
+
(0, $6nfFC$useFocusVisibleListener)((isFocusVisible)=>{
|
|
706
728
|
state.current.isFocusVisible = isFocusVisible;
|
|
707
729
|
updateState();
|
|
708
730
|
}, [], {
|
|
709
731
|
isTextInput: isTextInput
|
|
710
732
|
});
|
|
711
|
-
let { focusProps: focusProps } = $6nfFC$useFocus({
|
|
733
|
+
let { focusProps: focusProps } = (0, $6nfFC$useFocus)({
|
|
712
734
|
isDisabled: within,
|
|
713
735
|
onFocusChange: onFocusChange
|
|
714
736
|
});
|
|
715
|
-
let { focusWithinProps: focusWithinProps } = $6nfFC$useFocusWithin({
|
|
737
|
+
let { focusWithinProps: focusWithinProps } = (0, $6nfFC$useFocusWithin)({
|
|
716
738
|
isDisabled: !within,
|
|
717
739
|
onFocusWithinChange: onFocusChange
|
|
718
740
|
});
|
|
719
741
|
return {
|
|
720
|
-
isFocused:
|
|
742
|
+
isFocused: isFocused,
|
|
721
743
|
isFocusVisible: state.current.isFocused && isFocusVisibleState,
|
|
722
744
|
focusProps: within ? focusWithinProps : focusProps
|
|
723
745
|
};
|
|
@@ -726,27 +748,36 @@ function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {
|
|
|
726
748
|
|
|
727
749
|
function $907718708eab68af$export$1a38b4ad7f578e1d(props) {
|
|
728
750
|
let { children: children , focusClass: focusClass , focusRingClass: focusRingClass } = props;
|
|
729
|
-
let { isFocused: isFocused , isFocusVisible: isFocusVisible , focusProps: focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f(props);
|
|
730
|
-
let child = $6nfFC$react.Children.only(children);
|
|
731
|
-
return
|
|
751
|
+
let { isFocused: isFocused , isFocusVisible: isFocusVisible , focusProps: focusProps } = (0, $f7dceffc5ad7768b$export$4e328f61c538687f)(props);
|
|
752
|
+
let child = (0, $6nfFC$react).Children.only(children);
|
|
753
|
+
return /*#__PURE__*/ (0, $6nfFC$react).cloneElement(child, (0, $6nfFC$mergeProps)(child.props, {
|
|
732
754
|
...focusProps,
|
|
733
|
-
className: $6nfFC$clsx({
|
|
734
|
-
[focusClass ||
|
|
735
|
-
[focusRingClass ||
|
|
755
|
+
className: (0, $6nfFC$clsx)({
|
|
756
|
+
[focusClass || ""]: isFocused,
|
|
757
|
+
[focusRingClass || ""]: isFocusVisible
|
|
736
758
|
})
|
|
737
|
-
}))
|
|
759
|
+
}));
|
|
738
760
|
}
|
|
739
761
|
|
|
740
762
|
|
|
763
|
+
/*
|
|
764
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
765
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
766
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
767
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
768
|
+
*
|
|
769
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
770
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
771
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
772
|
+
* governing permissions and limitations under the License.
|
|
773
|
+
*/
|
|
741
774
|
|
|
742
775
|
|
|
743
776
|
|
|
744
|
-
|
|
745
|
-
let $e6afbd83fe6ebbd2$var$FocusableContext = /*#__PURE__*/ $6nfFC$react.createContext(null);
|
|
777
|
+
let $e6afbd83fe6ebbd2$var$FocusableContext = /*#__PURE__*/ (0, $6nfFC$react).createContext(null);
|
|
746
778
|
function $e6afbd83fe6ebbd2$var$useFocusableContext(ref) {
|
|
747
|
-
let context = $6nfFC$useContext($e6afbd83fe6ebbd2$var$FocusableContext) || {
|
|
748
|
-
|
|
749
|
-
$6nfFC$useSyncRef(context, ref);
|
|
779
|
+
let context = (0, $6nfFC$useContext)($e6afbd83fe6ebbd2$var$FocusableContext) || {};
|
|
780
|
+
(0, $6nfFC$useSyncRef)(context, ref);
|
|
750
781
|
// eslint-disable-next-line
|
|
751
782
|
let { ref: _ , ...otherProps } = context;
|
|
752
783
|
return otherProps;
|
|
@@ -759,27 +790,26 @@ function $e6afbd83fe6ebbd2$var$useFocusableContext(ref) {
|
|
|
759
790
|
...otherProps,
|
|
760
791
|
ref: ref
|
|
761
792
|
};
|
|
762
|
-
return
|
|
793
|
+
return /*#__PURE__*/ (0, $6nfFC$react).createElement($e6afbd83fe6ebbd2$var$FocusableContext.Provider, {
|
|
763
794
|
value: context
|
|
764
|
-
}, children)
|
|
795
|
+
}, children);
|
|
765
796
|
}
|
|
766
|
-
let $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 = /*#__PURE__*/ $6nfFC$react.forwardRef($e6afbd83fe6ebbd2$var$FocusableProvider);
|
|
797
|
+
let $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, $6nfFC$react).forwardRef($e6afbd83fe6ebbd2$var$FocusableProvider);
|
|
767
798
|
function $e6afbd83fe6ebbd2$export$4c014de7c8940b4c(props, domRef) {
|
|
768
|
-
let { focusProps: focusProps } = $6nfFC$useFocus(props);
|
|
769
|
-
let { keyboardProps: keyboardProps } = $6nfFC$useKeyboard(props);
|
|
770
|
-
let interactions = $6nfFC$mergeProps(focusProps, keyboardProps);
|
|
799
|
+
let { focusProps: focusProps } = (0, $6nfFC$useFocus)(props);
|
|
800
|
+
let { keyboardProps: keyboardProps } = (0, $6nfFC$useKeyboard)(props);
|
|
801
|
+
let interactions = (0, $6nfFC$mergeProps)(focusProps, keyboardProps);
|
|
771
802
|
let domProps = $e6afbd83fe6ebbd2$var$useFocusableContext(domRef);
|
|
772
|
-
let interactionProps = props.isDisabled ? {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
if (autoFocusRef.current && domRef.current) $6a99195332edec8b$export$80f3e147d781571c(domRef.current);
|
|
803
|
+
let interactionProps = props.isDisabled ? {} : domProps;
|
|
804
|
+
let autoFocusRef = (0, $6nfFC$useRef)(props.autoFocus);
|
|
805
|
+
(0, $6nfFC$useEffect)(()=>{
|
|
806
|
+
if (autoFocusRef.current && domRef.current) (0, $6a99195332edec8b$export$80f3e147d781571c)(domRef.current);
|
|
777
807
|
autoFocusRef.current = false;
|
|
778
808
|
}, [
|
|
779
809
|
domRef
|
|
780
810
|
]);
|
|
781
811
|
return {
|
|
782
|
-
focusableProps: $6nfFC$mergeProps({
|
|
812
|
+
focusableProps: (0, $6nfFC$mergeProps)({
|
|
783
813
|
...interactions,
|
|
784
814
|
tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined
|
|
785
815
|
}, interactionProps)
|