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