@react-aria/focus 3.5.5 → 3.6.0
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 +29 -25
- package/dist/main.js.map +1 -1
- package/dist/module.js +30 -26
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/FocusScope.tsx +18 -14
- package/src/useFocusRing.ts +9 -9
package/dist/main.js
CHANGED
|
@@ -415,22 +415,24 @@ function $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, opts, scope) {
|
|
|
415
415
|
var ref;
|
|
416
416
|
// Skip nodes inside the starting node.
|
|
417
417
|
if (opts === null || opts === void 0 ? void 0 : (ref = opts.from) === null || ref === void 0 ? void 0 : ref.contains(node)) return NodeFilter.FILTER_REJECT;
|
|
418
|
-
if (node.matches(selector) && $d5156037ad898a4d$export$e989c0fffaa6b27a(node) && (!scope || $a7a032acae3ddda9$var$isElementInScope(node, scope))) return NodeFilter.FILTER_ACCEPT;
|
|
418
|
+
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;
|
|
419
419
|
return NodeFilter.FILTER_SKIP;
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
|
|
423
423
|
return walker;
|
|
424
424
|
}
|
|
425
|
-
function $a7a032acae3ddda9$export$c5251b9e124bf29(ref
|
|
425
|
+
function $a7a032acae3ddda9$export$c5251b9e124bf29(ref, defaultOptions = {
|
|
426
|
+
}) {
|
|
426
427
|
return {
|
|
427
428
|
focusNext (opts = {
|
|
428
429
|
}) {
|
|
429
430
|
let root = ref.current;
|
|
430
|
-
let { from: from , tabbable: tabbable , wrap: wrap } = opts;
|
|
431
|
+
let { from: from , tabbable: tabbable = defaultOptions.tabbable , wrap: wrap = defaultOptions.wrap , accept: accept = defaultOptions.accept } = opts;
|
|
431
432
|
let node = from || document.activeElement;
|
|
432
433
|
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
|
433
|
-
tabbable: tabbable
|
|
434
|
+
tabbable: tabbable,
|
|
435
|
+
accept: accept
|
|
434
436
|
});
|
|
435
437
|
if (root.contains(node)) walker.currentNode = node;
|
|
436
438
|
let nextNode = walker.nextNode();
|
|
@@ -441,13 +443,13 @@ function $a7a032acae3ddda9$export$c5251b9e124bf29(ref) {
|
|
|
441
443
|
if (nextNode) $a7a032acae3ddda9$var$focusElement(nextNode, true);
|
|
442
444
|
return nextNode;
|
|
443
445
|
},
|
|
444
|
-
focusPrevious (opts = {
|
|
445
|
-
}) {
|
|
446
|
+
focusPrevious (opts = defaultOptions) {
|
|
446
447
|
let root = ref.current;
|
|
447
|
-
let { from: from , tabbable: tabbable , wrap: wrap } = opts;
|
|
448
|
+
let { from: from , tabbable: tabbable = defaultOptions.tabbable , wrap: wrap = defaultOptions.wrap , accept: accept = defaultOptions.accept } = opts;
|
|
448
449
|
let node = from || document.activeElement;
|
|
449
450
|
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
|
450
|
-
tabbable: tabbable
|
|
451
|
+
tabbable: tabbable,
|
|
452
|
+
accept: accept
|
|
451
453
|
});
|
|
452
454
|
if (root.contains(node)) walker.currentNode = node;
|
|
453
455
|
else {
|
|
@@ -463,23 +465,23 @@ function $a7a032acae3ddda9$export$c5251b9e124bf29(ref) {
|
|
|
463
465
|
if (previousNode) $a7a032acae3ddda9$var$focusElement(previousNode, true);
|
|
464
466
|
return previousNode;
|
|
465
467
|
},
|
|
466
|
-
focusFirst (opts = {
|
|
467
|
-
}) {
|
|
468
|
+
focusFirst (opts = defaultOptions) {
|
|
468
469
|
let root = ref.current;
|
|
469
|
-
let { tabbable: tabbable } = opts;
|
|
470
|
+
let { tabbable: tabbable = defaultOptions.tabbable , accept: accept = defaultOptions.accept } = opts;
|
|
470
471
|
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
|
471
|
-
tabbable: tabbable
|
|
472
|
+
tabbable: tabbable,
|
|
473
|
+
accept: accept
|
|
472
474
|
});
|
|
473
475
|
let nextNode = walker.nextNode();
|
|
474
476
|
if (nextNode) $a7a032acae3ddda9$var$focusElement(nextNode, true);
|
|
475
477
|
return nextNode;
|
|
476
478
|
},
|
|
477
|
-
focusLast (opts = {
|
|
478
|
-
}) {
|
|
479
|
+
focusLast (opts = defaultOptions) {
|
|
479
480
|
let root = ref.current;
|
|
480
|
-
let { tabbable: tabbable } = opts;
|
|
481
|
+
let { tabbable: tabbable = defaultOptions.tabbable , accept: accept = defaultOptions.accept } = opts;
|
|
481
482
|
let walker = $a7a032acae3ddda9$export$2d6ec8fc375ceafa(root, {
|
|
482
|
-
tabbable: tabbable
|
|
483
|
+
tabbable: tabbable,
|
|
484
|
+
accept: accept
|
|
483
485
|
});
|
|
484
486
|
let next = $a7a032acae3ddda9$var$last(walker);
|
|
485
487
|
if (next) $a7a032acae3ddda9$var$focusElement(next, true);
|
|
@@ -516,19 +518,21 @@ function $581a96d6eb128c1b$export$4e328f61c538687f(props = {
|
|
|
516
518
|
let state = $aB6Cp$react.useRef({
|
|
517
519
|
isFocused: false,
|
|
518
520
|
isFocusVisible: autoFocus || $aB6Cp$reactariainteractions.isFocusVisible()
|
|
519
|
-
})
|
|
521
|
+
});
|
|
520
522
|
let [isFocused1, setFocused] = $aB6Cp$react.useState(false);
|
|
521
|
-
let [isFocusVisibleState, setFocusVisible] = $aB6Cp$react.useState(()=>state.isFocused && state.isFocusVisible
|
|
523
|
+
let [isFocusVisibleState, setFocusVisible] = $aB6Cp$react.useState(()=>state.current.isFocused && state.current.isFocusVisible
|
|
522
524
|
);
|
|
523
|
-
let updateState = ()=>setFocusVisible(state.isFocused && state.isFocusVisible)
|
|
524
|
-
;
|
|
525
|
-
let onFocusChange = (isFocused)=>{
|
|
526
|
-
state.isFocused = isFocused;
|
|
525
|
+
let updateState = $aB6Cp$react.useCallback(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible)
|
|
526
|
+
, []);
|
|
527
|
+
let onFocusChange = $aB6Cp$react.useCallback((isFocused)=>{
|
|
528
|
+
state.current.isFocused = isFocused;
|
|
527
529
|
setFocused(isFocused);
|
|
528
530
|
updateState();
|
|
529
|
-
}
|
|
531
|
+
}, [
|
|
532
|
+
updateState
|
|
533
|
+
]);
|
|
530
534
|
$aB6Cp$reactariainteractions.useFocusVisibleListener((isFocusVisible)=>{
|
|
531
|
-
state.isFocusVisible = isFocusVisible;
|
|
535
|
+
state.current.isFocusVisible = isFocusVisible;
|
|
532
536
|
updateState();
|
|
533
537
|
}, [], {
|
|
534
538
|
isTextInput: isTextInput
|
|
@@ -543,7 +547,7 @@ function $581a96d6eb128c1b$export$4e328f61c538687f(props = {
|
|
|
543
547
|
});
|
|
544
548
|
return {
|
|
545
549
|
isFocused: isFocused1,
|
|
546
|
-
isFocusVisible: state.isFocused && isFocusVisibleState,
|
|
550
|
+
isFocusVisible: state.current.isFocused && isFocusVisibleState,
|
|
547
551
|
focusProps: within ? focusWithinProps : focusProps
|
|
548
552
|
};
|
|
549
553
|
}
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SEmBgB,yCAAW,CAAC,OAAoB,EAAE,CAAC;IACjD,EAA6E,AAA7E,2EAA6E;IAC7E,EAA4E,AAA5E,0EAA4E;IAC5E,EAA2E,AAA3E,yEAA2E;IAC3E,EAA+E,AAA/E,6EAA+E;IAC/E,EAAuB,AAAvB,qBAAuB;IACvB,EAAE,EAAE,mDAAsB,OAAO,CAAS,UAAE,CAAC;QAC3C,GAAG,CAAC,kBAAkB,GAAG,QAAQ,CAAC,aAAa;Q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AC;AACH,CAAC;","sources":["packages/@react-aria/focus/src/index.ts","packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/useFocusable.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './FocusScope';\nexport * from './FocusRing';\nexport * from './useFocusable';\nexport * from './useFocusRing';\nexport * from './focusSafely';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusSafely} from './focusSafely';\nimport {isElementVisible} from './isElementVisible';\nimport React, {ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\n// import {FocusScope, useFocusScope} from 'react-events/focus-scope';\n// export {FocusScope};\n\ninterface FocusScopeProps {\n /** The contents of the focus scope. */\n children: ReactNode,\n\n /**\n * Whether to contain focus inside the scope, so users cannot\n * move focus outside, for example in a modal dialog.\n */\n contain?: boolean,\n\n /**\n * Whether to restore focus back to the element that was focused\n * when the focus scope mounted, after the focus scope unmounts.\n */\n restoreFocus?: boolean,\n\n /** Whether to auto focus the first focusable element in the focus scope on mount. */\n autoFocus?: boolean\n}\n\ninterface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: HTMLElement,\n /** Whether to only include tabbable elements, or all focusable elements. */\n tabbable?: boolean,\n /** Whether focus should wrap around when it reaches the end of the scope. */\n wrap?: boolean\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): HTMLElement\n}\n\ntype ScopeRef = RefObject<HTMLElement[]>;\ninterface IFocusContext {\n scopeRef: ScopeRef,\n focusManager: FocusManager\n}\n\nconst FocusContext = React.createContext<IFocusContext>(null);\n\nlet activeScope: ScopeRef = null;\nlet scopes: Map<ScopeRef, ScopeRef | null> = new Map();\n\n// This is a hacky DOM-based implementation of a FocusScope until this RFC lands in React:\n// https://github.com/reactjs/rfcs/pull/109\n// For now, it relies on the DOM tree order rather than the React tree order, and is probably\n// less optimized for performance.\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport function FocusScope(props: FocusScopeProps) {\n let {children, contain, restoreFocus, autoFocus} = props;\n let startRef = useRef<HTMLSpanElement>();\n let endRef = useRef<HTMLSpanElement>();\n let scopeRef = useRef<HTMLElement[]>([]);\n let ctx = useContext(FocusContext);\n let parentScope = ctx?.scopeRef;\n\n useLayoutEffect(() => {\n // Find all rendered nodes between the sentinels and add them to the scope.\n let node = startRef.current.nextSibling;\n let nodes = [];\n while (node && node !== endRef.current) {\n nodes.push(node);\n node = node.nextSibling;\n }\n\n scopeRef.current = nodes;\n }, [children, parentScope]);\n\n useLayoutEffect(() => {\n scopes.set(scopeRef, parentScope);\n return () => {\n // Restore the active scope on unmount if this scope or a descendant scope is active.\n // Parent effect cleanups run before children, so we need to check if the\n // parent scope actually still exists before restoring the active scope to it.\n if (\n (scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) &&\n (!parentScope || scopes.has(parentScope))\n ) {\n activeScope = parentScope;\n }\n scopes.delete(scopeRef);\n };\n }, [scopeRef, parentScope]);\n\n useFocusContainment(scopeRef, contain);\n useRestoreFocus(scopeRef, restoreFocus, contain);\n useAutoFocus(scopeRef, autoFocus);\n\n let focusManager = createFocusManagerForScope(scopeRef);\n\n return (\n <FocusContext.Provider value={{scopeRef, focusManager}}>\n <span data-focus-scope-start hidden ref={startRef} />\n {children}\n <span data-focus-scope-end hidden ref={endRef} />\n </FocusContext.Provider>\n );\n}\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager {\n return useContext(FocusContext)?.focusManager;\n}\n\nfunction createFocusManagerForScope(scopeRef: React.RefObject<HTMLElement[]>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = sentinel;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[scope.length - 1].nextElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = sentinel;\n previousNode = walker.previousNode() as HTMLElement;\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[0].previousElementSibling;\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[scope.length - 1].nextElementSibling;\n let previousNode = walker.previousNode() as HTMLElement;\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n }\n };\n}\n\nconst focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nfunction getScopeRoot(scope: HTMLElement[]) {\n return scope[0].parentElement;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<HTMLElement[]>, contain: boolean) {\n let focusedNode = useRef<HTMLElement>();\n\n let raf = useRef(null);\n useLayoutEffect(() => {\n let scope = scopeRef.current;\n if (!contain) {\n return;\n }\n\n // Handle the Tab key to contain focus within the scope\n let onKeyDown = (e) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || scopeRef !== activeScope) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n let scope = scopeRef.current;\n if (!isElementInScope(focusedElement, scope)) {\n return;\n }\n\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n if (!nextElement) {\n walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n }\n\n e.preventDefault();\n if (nextElement) {\n focusElement(nextElement, true);\n }\n };\n\n let onFocus = (e) => {\n // If focusing an element in a child scope of the currently active scope, the child becomes active.\n // Moving out of the active scope to an ancestor is not allowed.\n if (!activeScope || isAncestorScope(activeScope, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n } else if (scopeRef === activeScope && !isElementInChildScope(e.target, scopeRef)) {\n // If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),\n // restore focus to the previously focused node or the first tabbable element in the active scope.\n if (focusedNode.current) {\n focusedNode.current.focus();\n } else if (activeScope) {\n focusFirstInScope(activeScope.current);\n }\n } else if (scopeRef === activeScope) {\n focusedNode.current = e.target;\n }\n };\n\n let onBlur = (e) => {\n // Firefox doesn't shift focus back to the Dialog properly without this\n raf.current = requestAnimationFrame(() => {\n // Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe\n if (scopeRef === activeScope && !isElementInChildScope(document.activeElement, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n focusedNode.current.focus();\n }\n });\n };\n\n document.addEventListener('keydown', onKeyDown, false);\n document.addEventListener('focusin', onFocus, false);\n scope.forEach(element => element.addEventListener('focusin', onFocus, false));\n scope.forEach(element => element.addEventListener('focusout', onBlur, false));\n return () => {\n document.removeEventListener('keydown', onKeyDown, false);\n document.removeEventListener('focusin', onFocus, false);\n scope.forEach(element => element.removeEventListener('focusin', onFocus, false));\n scope.forEach(element => element.removeEventListener('focusout', onBlur, false));\n };\n }, [scopeRef, contain]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => cancelAnimationFrame(raf.current);\n }, [raf]);\n}\n\nfunction isElementInAnyScope(element: Element) {\n for (let scope of scopes.keys()) {\n if (isElementInScope(element, scope.current)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isElementInScope(element: Element, scope: HTMLElement[]) {\n return scope.some(node => node.contains(element));\n}\n\nfunction isElementInChildScope(element: Element, scope: ScopeRef) {\n // node.contains in isElementInScope covers child scopes that are also DOM children,\n // but does not cover child scopes in portals.\n for (let s of scopes.keys()) {\n if ((s === scope || isAncestorScope(scope, s)) && isElementInScope(element, s.current)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {\n let parent = scopes.get(scope);\n if (!parent) {\n return false;\n }\n\n if (parent === ancestor) {\n return true;\n }\n\n return isAncestorScope(ancestor, parent);\n}\n\nfunction focusElement(element: HTMLElement | null, scroll = false) {\n if (element != null && !scroll) {\n try {\n focusSafely(element);\n } catch (err) {\n // ignore\n }\n } else if (element != null) {\n try {\n element.focus();\n } catch (err) {\n // ignore\n }\n }\n}\n\nfunction focusFirstInScope(scope: HTMLElement[]) {\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = sentinel;\n focusElement(walker.nextNode() as HTMLElement);\n}\n\nfunction useAutoFocus(scopeRef: RefObject<HTMLElement[]>, autoFocus: boolean) {\n const autoFocusRef = React.useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n activeScope = scopeRef;\n if (!isElementInScope(document.activeElement, activeScope.current)) {\n focusFirstInScope(scopeRef.current);\n }\n }\n autoFocusRef.current = false;\n }, []);\n}\n\nfunction useRestoreFocus(scopeRef: RefObject<HTMLElement[]>, restoreFocus: boolean, contain: boolean) {\n // create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.\n const nodeToRestoreRef = useRef(typeof document !== 'undefined' ? document.activeElement as HTMLElement : null);\n\n // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n useLayoutEffect(() => {\n let nodeToRestore = nodeToRestoreRef.current;\n if (!restoreFocus) {\n return;\n }\n\n // Handle the Tab key so that tabbing out of the scope goes to the next element\n // after the node that had focus when the scope mounted. This is important when\n // using portals for overlays, so that focus goes to the expected element when\n // tabbing out of the overlay.\n let onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n if (!isElementInScope(focusedElement, scopeRef.current)) {\n return;\n }\n\n // Create a DOM tree walker that matches all tabbable elements\n let walker = getFocusableTreeWalker(document.body, {tabbable: true});\n\n // Find the next tabbable element after the currently focused element\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n\n if (!document.body.contains(nodeToRestore) || nodeToRestore === document.body) {\n nodeToRestore = null;\n }\n\n // If there is no next element, or it is outside the current scope, move focus to the\n // next element after the node to restore to instead.\n if ((!nextElement || !isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) {\n walker.currentNode = nodeToRestore;\n\n // Skip over elements within the scope, in case the scope immediately follows the node to restore.\n do {\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n } while (isElementInScope(nextElement, scopeRef.current));\n\n e.preventDefault();\n e.stopPropagation();\n if (nextElement) {\n focusElement(nextElement, true);\n } else {\n // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)\n // then move focus to the body.\n // Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)\n if (!isElementInAnyScope(nodeToRestore)) {\n focusedElement.blur();\n } else {\n focusElement(nodeToRestore, true);\n }\n }\n }\n };\n\n if (!contain) {\n document.addEventListener('keydown', onKeyDown, true);\n }\n\n return () => {\n if (!contain) {\n document.removeEventListener('keydown', onKeyDown, true);\n }\n\n if (restoreFocus && nodeToRestore && isElementInScope(document.activeElement, scopeRef.current)) {\n requestAnimationFrame(() => {\n if (document.body.contains(nodeToRestore)) {\n focusElement(nodeToRestore);\n }\n });\n }\n };\n }, [scopeRef, restoreFocus, contain]);\n}\n\n/**\n * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}\n * that matches all focusable/tabbable elements.\n */\nexport function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOptions, scope?: HTMLElement[]) {\n let selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n let walker = document.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n {\n acceptNode(node) {\n // Skip nodes inside the starting node.\n if (opts?.from?.contains(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if ((node as HTMLElement).matches(selector)\n && isElementVisible(node as HTMLElement)\n && (!scope || isElementInScope(node as HTMLElement, scope))) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n }\n }\n );\n\n if (opts?.from) {\n walker.currentNode = opts.from;\n }\n\n return walker;\n}\n\n/**\n * Creates a FocusManager object that can be used to move focus within an element.\n */\nexport function createFocusManager(ref: RefObject<HTMLElement>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable});\n if (root.contains(node)) {\n walker.currentNode = node;\n }\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable});\n if (root.contains(node)) {\n walker.currentNode = node;\n } else {\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = root;\n previousNode = last(walker);\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let root = ref.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable});\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let root = ref.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable});\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n };\n}\n\nfunction last(walker: TreeWalker) {\n let next: HTMLElement;\n let last: HTMLElement;\n do {\n last = walker.lastChild() as HTMLElement;\n if (last) {\n next = last;\n }\n } while (last);\n return next;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusWithoutScrolling, runAfterTransition} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: HTMLElement) {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = document.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (document.activeElement === lastFocusedElement && document.contains(element)) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction isStyleVisible(element: Element) {\n if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and \n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */ \nexport function isElementVisible(element: Element, childElement?: Element) {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport clsx from 'clsx';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement} from 'react';\nimport {useFocusRing} from './useFocusRing';\n\ninterface FocusRingProps {\n /** Child element to apply CSS classes to. */\n children: ReactElement,\n /** CSS class to apply when the element is focused. */\n focusClass?: string,\n /** CSS class to apply when the element has keyboard focus. */\n focusRingClass?: string,\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default false\n */\n within?: boolean,\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps) {\n let {children, focusClass, focusRingClass} = props;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);\n let child = React.Children.only(children);\n\n return React.cloneElement(child, mergeProps(child.props, {\n ...focusProps,\n className: clsx({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n","import {HTMLAttributes, useState} from 'react';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useRef} from 'react';\n\ninterface FocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\ninterface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: FocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n }).current;\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.isFocused && state.isFocusVisible);\n\n let updateState = () => setFocusVisible(state.isFocused && state.isFocusVisible);\n\n let onFocusChange = isFocused => {\n state.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n };\n\n useFocusVisibleListener((isFocusVisible) => {\n state.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: state.isFocused && isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableDOMProps, FocusableProps} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useSyncRef} from '@react-aria/utils';\nimport React, {HTMLAttributes, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\ninterface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\ninterface FocusableProviderProps extends HTMLAttributes<HTMLElement> {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<HTMLElement>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue>(null);\n\nfunction useFocusableContext(ref: RefObject<HTMLElement>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let {ref: _, ...otherProps} = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: RefObject<HTMLElement>) {\n let {children, ...otherProps} = props;\n let context = {\n ...otherProps,\n ref\n };\n\n return (\n <FocusableContext.Provider value={context}>\n {children}\n </FocusableContext.Provider>\n );\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport {_FocusableProvider as FocusableProvider};\n\ninterface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<HTMLElement>): FocusableAria {\n let {focusProps} = useFocus(props);\n let {keyboardProps} = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n },\n interactionProps\n )\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SEmBgB,yCAAW,CAAC,OAAoB,EAAE,CAAC;IACjD,EAA6E,AAA7E,2EAA6E;IAC7E,EAA4E,AAA5E,0EAA4E;IAC5E,EAA2E,AAA3E,yEAA2E;IAC3E,EAA+E,AAA/E,6EAA+E;IAC/E,EAAuB,AAAvB,qBAAuB;IACvB,EAAE,EAAE,mDAAsB,OAAO,CAAS,UAAE,CAAC;QAC3C,GAAG,CAAC,kBAAkB,GAAG,QAAQ,CAAC,aAAa;QAC/C,wCAAkB,KAAO,CAAC;YACxB,EAA4E,AAA5E,0EAA4E;YAC5E,EAAE,EAAE,QAAQ,CAAC,aAAa,KAAK,kBAAkB,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,GAC5E,2CAAqB,CAAC,OAAO;QAEjC,CAAC;IACH,CAAC,MACC,2CAAqB,CAAC,OAAO;AAEjC,CAAC;;;ACpCD,EAUG,AAVH;;;;;;;;;;CAUG,AAVH,EAUG,UAEM,oCAAc,CAAC,OAAgB,EAAE,CAAC;IACzC,EAAE,IAAI,OAAO,YAAY,WAAW,OAAO,OAAO,YAAY,UAAU,GACtE,MAAM,CAAC,KAAK;IAGd,GAAG,CAAC,CAAC,UAAA,OAAO,eAAE,UAAU,EAAA,CAAC,GAAG,OAAO,CAAC,KAAK;IAEzC,GAAG,CAAC,SAAS,GACX,OAAO,KAAK,CAAM,SAClB,UAAU,KAAK,CAAQ,WACvB,UAAU,KAAK,CAAU;IAG3B,EAAE,EAAE,SAAS,EAAE,CAAC;QACd,KA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B;IAEpB,CAAC;AACH,CAAC;","sources":["packages/@react-aria/focus/src/index.ts","packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/useFocusable.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './FocusScope';\nexport * from './FocusRing';\nexport * from './useFocusable';\nexport * from './useFocusRing';\nexport * from './focusSafely';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusSafely} from './focusSafely';\nimport {isElementVisible} from './isElementVisible';\nimport React, {ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\n// import {FocusScope, useFocusScope} from 'react-events/focus-scope';\n// export {FocusScope};\n\ninterface FocusScopeProps {\n /** The contents of the focus scope. */\n children: ReactNode,\n\n /**\n * Whether to contain focus inside the scope, so users cannot\n * move focus outside, for example in a modal dialog.\n */\n contain?: boolean,\n\n /**\n * Whether to restore focus back to the element that was focused\n * when the focus scope mounted, after the focus scope unmounts.\n */\n restoreFocus?: boolean,\n\n /** Whether to auto focus the first focusable element in the focus scope on mount. */\n autoFocus?: boolean\n}\n\ninterface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: HTMLElement,\n /** Whether to only include tabbable elements, or all focusable elements. */\n tabbable?: boolean,\n /** Whether focus should wrap around when it reaches the end of the scope. */\n wrap?: boolean,\n /** A callback that determines whether the given element is focused. */\n accept?: (node: Element) => boolean\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): HTMLElement\n}\n\ntype ScopeRef = RefObject<HTMLElement[]>;\ninterface IFocusContext {\n scopeRef: ScopeRef,\n focusManager: FocusManager\n}\n\nconst FocusContext = React.createContext<IFocusContext>(null);\n\nlet activeScope: ScopeRef = null;\nlet scopes: Map<ScopeRef, ScopeRef | null> = new Map();\n\n// This is a hacky DOM-based implementation of a FocusScope until this RFC lands in React:\n// https://github.com/reactjs/rfcs/pull/109\n// For now, it relies on the DOM tree order rather than the React tree order, and is probably\n// less optimized for performance.\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport function FocusScope(props: FocusScopeProps) {\n let {children, contain, restoreFocus, autoFocus} = props;\n let startRef = useRef<HTMLSpanElement>();\n let endRef = useRef<HTMLSpanElement>();\n let scopeRef = useRef<HTMLElement[]>([]);\n let ctx = useContext(FocusContext);\n let parentScope = ctx?.scopeRef;\n\n useLayoutEffect(() => {\n // Find all rendered nodes between the sentinels and add them to the scope.\n let node = startRef.current.nextSibling;\n let nodes = [];\n while (node && node !== endRef.current) {\n nodes.push(node);\n node = node.nextSibling;\n }\n\n scopeRef.current = nodes;\n }, [children, parentScope]);\n\n useLayoutEffect(() => {\n scopes.set(scopeRef, parentScope);\n return () => {\n // Restore the active scope on unmount if this scope or a descendant scope is active.\n // Parent effect cleanups run before children, so we need to check if the\n // parent scope actually still exists before restoring the active scope to it.\n if (\n (scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) &&\n (!parentScope || scopes.has(parentScope))\n ) {\n activeScope = parentScope;\n }\n scopes.delete(scopeRef);\n };\n }, [scopeRef, parentScope]);\n\n useFocusContainment(scopeRef, contain);\n useRestoreFocus(scopeRef, restoreFocus, contain);\n useAutoFocus(scopeRef, autoFocus);\n\n let focusManager = createFocusManagerForScope(scopeRef);\n\n return (\n <FocusContext.Provider value={{scopeRef, focusManager}}>\n <span data-focus-scope-start hidden ref={startRef} />\n {children}\n <span data-focus-scope-end hidden ref={endRef} />\n </FocusContext.Provider>\n );\n}\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager {\n return useContext(FocusContext)?.focusManager;\n}\n\nfunction createFocusManagerForScope(scopeRef: React.RefObject<HTMLElement[]>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = sentinel;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[scope.length - 1].nextElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = sentinel;\n previousNode = walker.previousNode() as HTMLElement;\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[0].previousElementSibling;\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[scope.length - 1].nextElementSibling;\n let previousNode = walker.previousNode() as HTMLElement;\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n }\n };\n}\n\nconst focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nfunction getScopeRoot(scope: HTMLElement[]) {\n return scope[0].parentElement;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<HTMLElement[]>, contain: boolean) {\n let focusedNode = useRef<HTMLElement>();\n\n let raf = useRef(null);\n useLayoutEffect(() => {\n let scope = scopeRef.current;\n if (!contain) {\n return;\n }\n\n // Handle the Tab key to contain focus within the scope\n let onKeyDown = (e) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || scopeRef !== activeScope) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n let scope = scopeRef.current;\n if (!isElementInScope(focusedElement, scope)) {\n return;\n }\n\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n if (!nextElement) {\n walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n }\n\n e.preventDefault();\n if (nextElement) {\n focusElement(nextElement, true);\n }\n };\n\n let onFocus = (e) => {\n // If focusing an element in a child scope of the currently active scope, the child becomes active.\n // Moving out of the active scope to an ancestor is not allowed.\n if (!activeScope || isAncestorScope(activeScope, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n } else if (scopeRef === activeScope && !isElementInChildScope(e.target, scopeRef)) {\n // If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),\n // restore focus to the previously focused node or the first tabbable element in the active scope.\n if (focusedNode.current) {\n focusedNode.current.focus();\n } else if (activeScope) {\n focusFirstInScope(activeScope.current);\n }\n } else if (scopeRef === activeScope) {\n focusedNode.current = e.target;\n }\n };\n\n let onBlur = (e) => {\n // Firefox doesn't shift focus back to the Dialog properly without this\n raf.current = requestAnimationFrame(() => {\n // Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe\n if (scopeRef === activeScope && !isElementInChildScope(document.activeElement, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n focusedNode.current.focus();\n }\n });\n };\n\n document.addEventListener('keydown', onKeyDown, false);\n document.addEventListener('focusin', onFocus, false);\n scope.forEach(element => element.addEventListener('focusin', onFocus, false));\n scope.forEach(element => element.addEventListener('focusout', onBlur, false));\n return () => {\n document.removeEventListener('keydown', onKeyDown, false);\n document.removeEventListener('focusin', onFocus, false);\n scope.forEach(element => element.removeEventListener('focusin', onFocus, false));\n scope.forEach(element => element.removeEventListener('focusout', onBlur, false));\n };\n }, [scopeRef, contain]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => cancelAnimationFrame(raf.current);\n }, [raf]);\n}\n\nfunction isElementInAnyScope(element: Element) {\n for (let scope of scopes.keys()) {\n if (isElementInScope(element, scope.current)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isElementInScope(element: Element, scope: HTMLElement[]) {\n return scope.some(node => node.contains(element));\n}\n\nfunction isElementInChildScope(element: Element, scope: ScopeRef) {\n // node.contains in isElementInScope covers child scopes that are also DOM children,\n // but does not cover child scopes in portals.\n for (let s of scopes.keys()) {\n if ((s === scope || isAncestorScope(scope, s)) && isElementInScope(element, s.current)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {\n let parent = scopes.get(scope);\n if (!parent) {\n return false;\n }\n\n if (parent === ancestor) {\n return true;\n }\n\n return isAncestorScope(ancestor, parent);\n}\n\nfunction focusElement(element: HTMLElement | null, scroll = false) {\n if (element != null && !scroll) {\n try {\n focusSafely(element);\n } catch (err) {\n // ignore\n }\n } else if (element != null) {\n try {\n element.focus();\n } catch (err) {\n // ignore\n }\n }\n}\n\nfunction focusFirstInScope(scope: HTMLElement[]) {\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = sentinel;\n focusElement(walker.nextNode() as HTMLElement);\n}\n\nfunction useAutoFocus(scopeRef: RefObject<HTMLElement[]>, autoFocus: boolean) {\n const autoFocusRef = React.useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n activeScope = scopeRef;\n if (!isElementInScope(document.activeElement, activeScope.current)) {\n focusFirstInScope(scopeRef.current);\n }\n }\n autoFocusRef.current = false;\n }, []);\n}\n\nfunction useRestoreFocus(scopeRef: RefObject<HTMLElement[]>, restoreFocus: boolean, contain: boolean) {\n // create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.\n const nodeToRestoreRef = useRef(typeof document !== 'undefined' ? document.activeElement as HTMLElement : null);\n\n // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n useLayoutEffect(() => {\n let nodeToRestore = nodeToRestoreRef.current;\n if (!restoreFocus) {\n return;\n }\n\n // Handle the Tab key so that tabbing out of the scope goes to the next element\n // after the node that had focus when the scope mounted. This is important when\n // using portals for overlays, so that focus goes to the expected element when\n // tabbing out of the overlay.\n let onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n if (!isElementInScope(focusedElement, scopeRef.current)) {\n return;\n }\n\n // Create a DOM tree walker that matches all tabbable elements\n let walker = getFocusableTreeWalker(document.body, {tabbable: true});\n\n // Find the next tabbable element after the currently focused element\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n\n if (!document.body.contains(nodeToRestore) || nodeToRestore === document.body) {\n nodeToRestore = null;\n }\n\n // If there is no next element, or it is outside the current scope, move focus to the\n // next element after the node to restore to instead.\n if ((!nextElement || !isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) {\n walker.currentNode = nodeToRestore;\n\n // Skip over elements within the scope, in case the scope immediately follows the node to restore.\n do {\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n } while (isElementInScope(nextElement, scopeRef.current));\n\n e.preventDefault();\n e.stopPropagation();\n if (nextElement) {\n focusElement(nextElement, true);\n } else {\n // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)\n // then move focus to the body.\n // Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)\n if (!isElementInAnyScope(nodeToRestore)) {\n focusedElement.blur();\n } else {\n focusElement(nodeToRestore, true);\n }\n }\n }\n };\n\n if (!contain) {\n document.addEventListener('keydown', onKeyDown, true);\n }\n\n return () => {\n if (!contain) {\n document.removeEventListener('keydown', onKeyDown, true);\n }\n\n if (restoreFocus && nodeToRestore && isElementInScope(document.activeElement, scopeRef.current)) {\n requestAnimationFrame(() => {\n if (document.body.contains(nodeToRestore)) {\n focusElement(nodeToRestore);\n }\n });\n }\n };\n }, [scopeRef, restoreFocus, contain]);\n}\n\n/**\n * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}\n * that matches all focusable/tabbable elements.\n */\nexport function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOptions, scope?: HTMLElement[]) {\n let selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n let walker = document.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n {\n acceptNode(node) {\n // Skip nodes inside the starting node.\n if (opts?.from?.contains(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if ((node as HTMLElement).matches(selector)\n && isElementVisible(node as HTMLElement)\n && (!scope || isElementInScope(node as HTMLElement, scope))\n && (!opts?.accept || opts.accept(node as Element))\n ) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n }\n }\n );\n\n if (opts?.from) {\n walker.currentNode = opts.from;\n }\n\n return walker;\n}\n\n/**\n * Creates a FocusManager object that can be used to move focus within an element.\n */\nexport function createFocusManager(ref: RefObject<HTMLElement>, defaultOptions: FocusManagerOptions = {}): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n if (root.contains(node)) {\n walker.currentNode = node;\n }\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = defaultOptions) {\n let root = ref.current;\n let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n if (root.contains(node)) {\n walker.currentNode = node;\n } else {\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = root;\n previousNode = last(walker);\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = defaultOptions) {\n let root = ref.current;\n let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = defaultOptions) {\n let root = ref.current;\n let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n };\n}\n\nfunction last(walker: TreeWalker) {\n let next: HTMLElement;\n let last: HTMLElement;\n do {\n last = walker.lastChild() as HTMLElement;\n if (last) {\n next = last;\n }\n } while (last);\n return next;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusWithoutScrolling, runAfterTransition} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: HTMLElement) {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = document.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (document.activeElement === lastFocusedElement && document.contains(element)) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction isStyleVisible(element: Element) {\n if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and \n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */ \nexport function isElementVisible(element: Element, childElement?: Element) {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport clsx from 'clsx';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement} from 'react';\nimport {useFocusRing} from './useFocusRing';\n\ninterface FocusRingProps {\n /** Child element to apply CSS classes to. */\n children: ReactElement,\n /** CSS class to apply when the element is focused. */\n focusClass?: string,\n /** CSS class to apply when the element has keyboard focus. */\n focusRingClass?: string,\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default false\n */\n within?: boolean,\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps) {\n let {children, focusClass, focusRingClass} = props;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);\n let child = React.Children.only(children);\n\n return React.cloneElement(child, mergeProps(child.props, {\n ...focusProps,\n className: clsx({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n","import {HTMLAttributes, useCallback, useState} from 'react';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useRef} from 'react';\n\ninterface FocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\ninterface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: FocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: state.current.isFocused && isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableDOMProps, FocusableProps} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useSyncRef} from '@react-aria/utils';\nimport React, {HTMLAttributes, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\ninterface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\ninterface FocusableProviderProps extends HTMLAttributes<HTMLElement> {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<HTMLElement>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue>(null);\n\nfunction useFocusableContext(ref: RefObject<HTMLElement>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let {ref: _, ...otherProps} = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: RefObject<HTMLElement>) {\n let {children, ...otherProps} = props;\n let context = {\n ...otherProps,\n ref\n };\n\n return (\n <FocusableContext.Provider value={context}>\n {children}\n </FocusableContext.Provider>\n );\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport {_FocusableProvider as FocusableProvider};\n\ninterface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<HTMLElement>): FocusableAria {\n let {focusProps} = useFocus(props);\n let {keyboardProps} = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n },\n interactionProps\n )\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import $6nfFC$react, {useRef as $6nfFC$useRef, useContext as $6nfFC$useContext, useEffect as $6nfFC$useEffect, useState as $6nfFC$useState} from "react";
|
|
1
|
+
import $6nfFC$react, {useRef as $6nfFC$useRef, useContext as $6nfFC$useContext, useEffect as $6nfFC$useEffect, useState as $6nfFC$useState, useCallback as $6nfFC$useCallback} from "react";
|
|
2
2
|
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
3
|
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
4
|
import $6nfFC$clsx from "clsx";
|
|
@@ -396,22 +396,24 @@ function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
|
|
|
396
396
|
var ref;
|
|
397
397
|
// Skip nodes inside the starting node.
|
|
398
398
|
if (opts === null || opts === void 0 ? void 0 : (ref = opts.from) === null || ref === void 0 ? void 0 : ref.contains(node)) return NodeFilter.FILTER_REJECT;
|
|
399
|
-
if (node.matches(selector) && $645f2e67b85a24c9$export$e989c0fffaa6b27a(node) && (!scope || $9bf71ea28793e738$var$isElementInScope(node, scope))) return NodeFilter.FILTER_ACCEPT;
|
|
399
|
+
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;
|
|
400
400
|
return NodeFilter.FILTER_SKIP;
|
|
401
401
|
}
|
|
402
402
|
});
|
|
403
403
|
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
|
|
404
404
|
return walker;
|
|
405
405
|
}
|
|
406
|
-
function $9bf71ea28793e738$export$c5251b9e124bf29(ref
|
|
406
|
+
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {
|
|
407
|
+
}) {
|
|
407
408
|
return {
|
|
408
409
|
focusNext (opts = {
|
|
409
410
|
}) {
|
|
410
411
|
let root = ref.current;
|
|
411
|
-
let { from: from , tabbable: tabbable , wrap: wrap } = opts;
|
|
412
|
+
let { from: from , tabbable: tabbable = defaultOptions.tabbable , wrap: wrap = defaultOptions.wrap , accept: accept = defaultOptions.accept } = opts;
|
|
412
413
|
let node = from || document.activeElement;
|
|
413
414
|
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
414
|
-
tabbable: tabbable
|
|
415
|
+
tabbable: tabbable,
|
|
416
|
+
accept: accept
|
|
415
417
|
});
|
|
416
418
|
if (root.contains(node)) walker.currentNode = node;
|
|
417
419
|
let nextNode = walker.nextNode();
|
|
@@ -422,13 +424,13 @@ function $9bf71ea28793e738$export$c5251b9e124bf29(ref) {
|
|
|
422
424
|
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
423
425
|
return nextNode;
|
|
424
426
|
},
|
|
425
|
-
focusPrevious (opts = {
|
|
426
|
-
}) {
|
|
427
|
+
focusPrevious (opts = defaultOptions) {
|
|
427
428
|
let root = ref.current;
|
|
428
|
-
let { from: from , tabbable: tabbable , wrap: wrap } = opts;
|
|
429
|
+
let { from: from , tabbable: tabbable = defaultOptions.tabbable , wrap: wrap = defaultOptions.wrap , accept: accept = defaultOptions.accept } = opts;
|
|
429
430
|
let node = from || document.activeElement;
|
|
430
431
|
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
431
|
-
tabbable: tabbable
|
|
432
|
+
tabbable: tabbable,
|
|
433
|
+
accept: accept
|
|
432
434
|
});
|
|
433
435
|
if (root.contains(node)) walker.currentNode = node;
|
|
434
436
|
else {
|
|
@@ -444,23 +446,23 @@ function $9bf71ea28793e738$export$c5251b9e124bf29(ref) {
|
|
|
444
446
|
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
|
445
447
|
return previousNode;
|
|
446
448
|
},
|
|
447
|
-
focusFirst (opts = {
|
|
448
|
-
}) {
|
|
449
|
+
focusFirst (opts = defaultOptions) {
|
|
449
450
|
let root = ref.current;
|
|
450
|
-
let { tabbable: tabbable } = opts;
|
|
451
|
+
let { tabbable: tabbable = defaultOptions.tabbable , accept: accept = defaultOptions.accept } = opts;
|
|
451
452
|
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
452
|
-
tabbable: tabbable
|
|
453
|
+
tabbable: tabbable,
|
|
454
|
+
accept: accept
|
|
453
455
|
});
|
|
454
456
|
let nextNode = walker.nextNode();
|
|
455
457
|
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
456
458
|
return nextNode;
|
|
457
459
|
},
|
|
458
|
-
focusLast (opts = {
|
|
459
|
-
}) {
|
|
460
|
+
focusLast (opts = defaultOptions) {
|
|
460
461
|
let root = ref.current;
|
|
461
|
-
let { tabbable: tabbable } = opts;
|
|
462
|
+
let { tabbable: tabbable = defaultOptions.tabbable , accept: accept = defaultOptions.accept } = opts;
|
|
462
463
|
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
463
|
-
tabbable: tabbable
|
|
464
|
+
tabbable: tabbable,
|
|
465
|
+
accept: accept
|
|
464
466
|
});
|
|
465
467
|
let next = $9bf71ea28793e738$var$last(walker);
|
|
466
468
|
if (next) $9bf71ea28793e738$var$focusElement(next, true);
|
|
@@ -497,19 +499,21 @@ function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {
|
|
|
497
499
|
let state = $6nfFC$useRef({
|
|
498
500
|
isFocused: false,
|
|
499
501
|
isFocusVisible: autoFocus || $6nfFC$isFocusVisible()
|
|
500
|
-
})
|
|
502
|
+
});
|
|
501
503
|
let [isFocused1, setFocused] = $6nfFC$useState(false);
|
|
502
|
-
let [isFocusVisibleState, setFocusVisible] = $6nfFC$useState(()=>state.isFocused && state.isFocusVisible
|
|
504
|
+
let [isFocusVisibleState, setFocusVisible] = $6nfFC$useState(()=>state.current.isFocused && state.current.isFocusVisible
|
|
503
505
|
);
|
|
504
|
-
let updateState = ()=>setFocusVisible(state.isFocused && state.isFocusVisible)
|
|
505
|
-
;
|
|
506
|
-
let onFocusChange = (isFocused)=>{
|
|
507
|
-
state.isFocused = isFocused;
|
|
506
|
+
let updateState = $6nfFC$useCallback(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible)
|
|
507
|
+
, []);
|
|
508
|
+
let onFocusChange = $6nfFC$useCallback((isFocused)=>{
|
|
509
|
+
state.current.isFocused = isFocused;
|
|
508
510
|
setFocused(isFocused);
|
|
509
511
|
updateState();
|
|
510
|
-
}
|
|
512
|
+
}, [
|
|
513
|
+
updateState
|
|
514
|
+
]);
|
|
511
515
|
$6nfFC$useFocusVisibleListener((isFocusVisible)=>{
|
|
512
|
-
state.isFocusVisible = isFocusVisible;
|
|
516
|
+
state.current.isFocusVisible = isFocusVisible;
|
|
513
517
|
updateState();
|
|
514
518
|
}, [], {
|
|
515
519
|
isTextInput: isTextInput
|
|
@@ -524,7 +528,7 @@ function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {
|
|
|
524
528
|
});
|
|
525
529
|
return {
|
|
526
530
|
isFocused: isFocused1,
|
|
527
|
-
isFocusVisible: state.isFocused && isFocusVisibleState,
|
|
531
|
+
isFocusVisible: state.current.isFocused && isFocusVisibleState,
|
|
528
532
|
focusProps: within ? focusWithinProps : focusProps
|
|
529
533
|
};
|
|
530
534
|
}
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;SEmBgB,yCAAW,CAAC,OAAoB,EAAE,CAAC;IACjD,EAA6E,AAA7E,2EAA6E;IAC7E,EAA4E,AAA5E,0EAA4E;IAC5E,EAA2E,AAA3E,yEAA2E;IAC3E,EAA+E,AAA/E,6EAA+E;IAC/E,EAAuB,AAAvB,qBAAuB;IACvB,EAAE,EAAE,6BAAsB,OAAO,CAAS,UAAE,CAAC;QAC3C,GAAG,CAAC,kBAAkB,GAAG,QAAQ,CAAC,aAAa;QAC/C,yBAAkB,KAAO,CAAC;YACxB,EAA4E,AAA5E,0EAA4E;YAC5E,EAAE,EAAE,QAAQ,CAAC,aAAa,KAAK,kBAAkB,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,GAC5E,4BAAqB,CAAC,OAAO;QAEjC,CAAC;IACH,CAAC,MACC,4BAAqB,CAAC,OAAO;AAEjC,CAAC;;;ACpCD,EAUG,AAVH;;;;;;;;;;CAUG,AAVH,EAUG,UAEM,oCAAc,CAAC,OAAgB,EAAE,CAAC;IACzC,EAAE,IAAI,OAAO,YAAY,WAAW,OAAO,OAAO,YAAY,UAAU,GACt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,CAAC;IACpG,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,eAAQ,CAAC,KAAK;IACjC,GAAG,CAAC,CAAC,gBAAA,aAAa,EAAA,CAAC,GAAG,kBAAW,CAAC,KAAK;IACvC,GAAG,CAAC,YAAY,GAAG,iBAAU,CAAC,UAAU,EAAE,aAAa;IACvD,GAAG,CAAC,QAAQ,GAAG,yCAAmB,CAAC,MAAM;IACzC,GAAG,CAAC,gBAAgB,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC;IAAA,CAAC,GAAG,QAAQ;IACvD,GAAG,CAAC,YAAY,GAAG,aAAM,CAAC,KAAK,CAAC,SAAS;IAEzC,gBAAS,KAAO,CAAC;QACf,EAAE,EAAE,YAAY,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EACxC,yCAAW,CAAC,MAAM,CAAC,OAAO;QAE5B,YAAY,CAAC,OAAO,GAAG,KAAK;IAC9B,CAAC,EAAE,CAAC;QAAA,MAAM;IAAA,CAAC;IAEX,MAAM,CAAC,CAAC;QACN,cAAc,EAAE,iBAAU,CACxB,CAAC;eACI,YAAY;YACf,QAAQ,EAAE,KAAK,CAAC,mBAAmB,KAAK,KAAK,CAAC,UAAU,GAAG,EAAE,GAAG,SAAS;QAC3E,CAAC,EACD,gBAAgB;IAEpB,CAAC;AACH,CAAC;","sources":["packages/@react-aria/focus/src/index.ts","packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/useFocusable.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './FocusScope';\nexport * from './FocusRing';\nexport * from './useFocusable';\nexport * from './useFocusRing';\nexport * from './focusSafely';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusSafely} from './focusSafely';\nimport {isElementVisible} from './isElementVisible';\nimport React, {ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\n// import {FocusScope, useFocusScope} from 'react-events/focus-scope';\n// export {FocusScope};\n\ninterface FocusScopeProps {\n /** The contents of the focus scope. */\n children: ReactNode,\n\n /**\n * Whether to contain focus inside the scope, so users cannot\n * move focus outside, for example in a modal dialog.\n */\n contain?: boolean,\n\n /**\n * Whether to restore focus back to the element that was focused\n * when the focus scope mounted, after the focus scope unmounts.\n */\n restoreFocus?: boolean,\n\n /** Whether to auto focus the first focusable element in the focus scope on mount. */\n autoFocus?: boolean\n}\n\ninterface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: HTMLElement,\n /** Whether to only include tabbable elements, or all focusable elements. */\n tabbable?: boolean,\n /** Whether focus should wrap around when it reaches the end of the scope. */\n wrap?: boolean\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): HTMLElement\n}\n\ntype ScopeRef = RefObject<HTMLElement[]>;\ninterface IFocusContext {\n scopeRef: ScopeRef,\n focusManager: FocusManager\n}\n\nconst FocusContext = React.createContext<IFocusContext>(null);\n\nlet activeScope: ScopeRef = null;\nlet scopes: Map<ScopeRef, ScopeRef | null> = new Map();\n\n// This is a hacky DOM-based implementation of a FocusScope until this RFC lands in React:\n// https://github.com/reactjs/rfcs/pull/109\n// For now, it relies on the DOM tree order rather than the React tree order, and is probably\n// less optimized for performance.\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport function FocusScope(props: FocusScopeProps) {\n let {children, contain, restoreFocus, autoFocus} = props;\n let startRef = useRef<HTMLSpanElement>();\n let endRef = useRef<HTMLSpanElement>();\n let scopeRef = useRef<HTMLElement[]>([]);\n let ctx = useContext(FocusContext);\n let parentScope = ctx?.scopeRef;\n\n useLayoutEffect(() => {\n // Find all rendered nodes between the sentinels and add them to the scope.\n let node = startRef.current.nextSibling;\n let nodes = [];\n while (node && node !== endRef.current) {\n nodes.push(node);\n node = node.nextSibling;\n }\n\n scopeRef.current = nodes;\n }, [children, parentScope]);\n\n useLayoutEffect(() => {\n scopes.set(scopeRef, parentScope);\n return () => {\n // Restore the active scope on unmount if this scope or a descendant scope is active.\n // Parent effect cleanups run before children, so we need to check if the\n // parent scope actually still exists before restoring the active scope to it.\n if (\n (scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) &&\n (!parentScope || scopes.has(parentScope))\n ) {\n activeScope = parentScope;\n }\n scopes.delete(scopeRef);\n };\n }, [scopeRef, parentScope]);\n\n useFocusContainment(scopeRef, contain);\n useRestoreFocus(scopeRef, restoreFocus, contain);\n useAutoFocus(scopeRef, autoFocus);\n\n let focusManager = createFocusManagerForScope(scopeRef);\n\n return (\n <FocusContext.Provider value={{scopeRef, focusManager}}>\n <span data-focus-scope-start hidden ref={startRef} />\n {children}\n <span data-focus-scope-end hidden ref={endRef} />\n </FocusContext.Provider>\n );\n}\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager {\n return useContext(FocusContext)?.focusManager;\n}\n\nfunction createFocusManagerForScope(scopeRef: React.RefObject<HTMLElement[]>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = sentinel;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[scope.length - 1].nextElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = sentinel;\n previousNode = walker.previousNode() as HTMLElement;\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[0].previousElementSibling;\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[scope.length - 1].nextElementSibling;\n let previousNode = walker.previousNode() as HTMLElement;\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n }\n };\n}\n\nconst focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nfunction getScopeRoot(scope: HTMLElement[]) {\n return scope[0].parentElement;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<HTMLElement[]>, contain: boolean) {\n let focusedNode = useRef<HTMLElement>();\n\n let raf = useRef(null);\n useLayoutEffect(() => {\n let scope = scopeRef.current;\n if (!contain) {\n return;\n }\n\n // Handle the Tab key to contain focus within the scope\n let onKeyDown = (e) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || scopeRef !== activeScope) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n let scope = scopeRef.current;\n if (!isElementInScope(focusedElement, scope)) {\n return;\n }\n\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n if (!nextElement) {\n walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n }\n\n e.preventDefault();\n if (nextElement) {\n focusElement(nextElement, true);\n }\n };\n\n let onFocus = (e) => {\n // If focusing an element in a child scope of the currently active scope, the child becomes active.\n // Moving out of the active scope to an ancestor is not allowed.\n if (!activeScope || isAncestorScope(activeScope, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n } else if (scopeRef === activeScope && !isElementInChildScope(e.target, scopeRef)) {\n // If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),\n // restore focus to the previously focused node or the first tabbable element in the active scope.\n if (focusedNode.current) {\n focusedNode.current.focus();\n } else if (activeScope) {\n focusFirstInScope(activeScope.current);\n }\n } else if (scopeRef === activeScope) {\n focusedNode.current = e.target;\n }\n };\n\n let onBlur = (e) => {\n // Firefox doesn't shift focus back to the Dialog properly without this\n raf.current = requestAnimationFrame(() => {\n // Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe\n if (scopeRef === activeScope && !isElementInChildScope(document.activeElement, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n focusedNode.current.focus();\n }\n });\n };\n\n document.addEventListener('keydown', onKeyDown, false);\n document.addEventListener('focusin', onFocus, false);\n scope.forEach(element => element.addEventListener('focusin', onFocus, false));\n scope.forEach(element => element.addEventListener('focusout', onBlur, false));\n return () => {\n document.removeEventListener('keydown', onKeyDown, false);\n document.removeEventListener('focusin', onFocus, false);\n scope.forEach(element => element.removeEventListener('focusin', onFocus, false));\n scope.forEach(element => element.removeEventListener('focusout', onBlur, false));\n };\n }, [scopeRef, contain]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => cancelAnimationFrame(raf.current);\n }, [raf]);\n}\n\nfunction isElementInAnyScope(element: Element) {\n for (let scope of scopes.keys()) {\n if (isElementInScope(element, scope.current)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isElementInScope(element: Element, scope: HTMLElement[]) {\n return scope.some(node => node.contains(element));\n}\n\nfunction isElementInChildScope(element: Element, scope: ScopeRef) {\n // node.contains in isElementInScope covers child scopes that are also DOM children,\n // but does not cover child scopes in portals.\n for (let s of scopes.keys()) {\n if ((s === scope || isAncestorScope(scope, s)) && isElementInScope(element, s.current)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {\n let parent = scopes.get(scope);\n if (!parent) {\n return false;\n }\n\n if (parent === ancestor) {\n return true;\n }\n\n return isAncestorScope(ancestor, parent);\n}\n\nfunction focusElement(element: HTMLElement | null, scroll = false) {\n if (element != null && !scroll) {\n try {\n focusSafely(element);\n } catch (err) {\n // ignore\n }\n } else if (element != null) {\n try {\n element.focus();\n } catch (err) {\n // ignore\n }\n }\n}\n\nfunction focusFirstInScope(scope: HTMLElement[]) {\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = sentinel;\n focusElement(walker.nextNode() as HTMLElement);\n}\n\nfunction useAutoFocus(scopeRef: RefObject<HTMLElement[]>, autoFocus: boolean) {\n const autoFocusRef = React.useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n activeScope = scopeRef;\n if (!isElementInScope(document.activeElement, activeScope.current)) {\n focusFirstInScope(scopeRef.current);\n }\n }\n autoFocusRef.current = false;\n }, []);\n}\n\nfunction useRestoreFocus(scopeRef: RefObject<HTMLElement[]>, restoreFocus: boolean, contain: boolean) {\n // create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.\n const nodeToRestoreRef = useRef(typeof document !== 'undefined' ? document.activeElement as HTMLElement : null);\n\n // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n useLayoutEffect(() => {\n let nodeToRestore = nodeToRestoreRef.current;\n if (!restoreFocus) {\n return;\n }\n\n // Handle the Tab key so that tabbing out of the scope goes to the next element\n // after the node that had focus when the scope mounted. This is important when\n // using portals for overlays, so that focus goes to the expected element when\n // tabbing out of the overlay.\n let onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n if (!isElementInScope(focusedElement, scopeRef.current)) {\n return;\n }\n\n // Create a DOM tree walker that matches all tabbable elements\n let walker = getFocusableTreeWalker(document.body, {tabbable: true});\n\n // Find the next tabbable element after the currently focused element\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n\n if (!document.body.contains(nodeToRestore) || nodeToRestore === document.body) {\n nodeToRestore = null;\n }\n\n // If there is no next element, or it is outside the current scope, move focus to the\n // next element after the node to restore to instead.\n if ((!nextElement || !isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) {\n walker.currentNode = nodeToRestore;\n\n // Skip over elements within the scope, in case the scope immediately follows the node to restore.\n do {\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n } while (isElementInScope(nextElement, scopeRef.current));\n\n e.preventDefault();\n e.stopPropagation();\n if (nextElement) {\n focusElement(nextElement, true);\n } else {\n // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)\n // then move focus to the body.\n // Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)\n if (!isElementInAnyScope(nodeToRestore)) {\n focusedElement.blur();\n } else {\n focusElement(nodeToRestore, true);\n }\n }\n }\n };\n\n if (!contain) {\n document.addEventListener('keydown', onKeyDown, true);\n }\n\n return () => {\n if (!contain) {\n document.removeEventListener('keydown', onKeyDown, true);\n }\n\n if (restoreFocus && nodeToRestore && isElementInScope(document.activeElement, scopeRef.current)) {\n requestAnimationFrame(() => {\n if (document.body.contains(nodeToRestore)) {\n focusElement(nodeToRestore);\n }\n });\n }\n };\n }, [scopeRef, restoreFocus, contain]);\n}\n\n/**\n * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}\n * that matches all focusable/tabbable elements.\n */\nexport function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOptions, scope?: HTMLElement[]) {\n let selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n let walker = document.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n {\n acceptNode(node) {\n // Skip nodes inside the starting node.\n if (opts?.from?.contains(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if ((node as HTMLElement).matches(selector)\n && isElementVisible(node as HTMLElement)\n && (!scope || isElementInScope(node as HTMLElement, scope))) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n }\n }\n );\n\n if (opts?.from) {\n walker.currentNode = opts.from;\n }\n\n return walker;\n}\n\n/**\n * Creates a FocusManager object that can be used to move focus within an element.\n */\nexport function createFocusManager(ref: RefObject<HTMLElement>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable});\n if (root.contains(node)) {\n walker.currentNode = node;\n }\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable});\n if (root.contains(node)) {\n walker.currentNode = node;\n } else {\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = root;\n previousNode = last(walker);\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let root = ref.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable});\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let root = ref.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable});\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n };\n}\n\nfunction last(walker: TreeWalker) {\n let next: HTMLElement;\n let last: HTMLElement;\n do {\n last = walker.lastChild() as HTMLElement;\n if (last) {\n next = last;\n }\n } while (last);\n return next;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusWithoutScrolling, runAfterTransition} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: HTMLElement) {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = document.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (document.activeElement === lastFocusedElement && document.contains(element)) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction isStyleVisible(element: Element) {\n if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and \n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */ \nexport function isElementVisible(element: Element, childElement?: Element) {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport clsx from 'clsx';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement} from 'react';\nimport {useFocusRing} from './useFocusRing';\n\ninterface FocusRingProps {\n /** Child element to apply CSS classes to. */\n children: ReactElement,\n /** CSS class to apply when the element is focused. */\n focusClass?: string,\n /** CSS class to apply when the element has keyboard focus. */\n focusRingClass?: string,\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default false\n */\n within?: boolean,\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps) {\n let {children, focusClass, focusRingClass} = props;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);\n let child = React.Children.only(children);\n\n return React.cloneElement(child, mergeProps(child.props, {\n ...focusProps,\n className: clsx({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n","import {HTMLAttributes, useState} from 'react';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useRef} from 'react';\n\ninterface FocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\ninterface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: FocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n }).current;\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.isFocused && state.isFocusVisible);\n\n let updateState = () => setFocusVisible(state.isFocused && state.isFocusVisible);\n\n let onFocusChange = isFocused => {\n state.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n };\n\n useFocusVisibleListener((isFocusVisible) => {\n state.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: state.isFocused && isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableDOMProps, FocusableProps} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useSyncRef} from '@react-aria/utils';\nimport React, {HTMLAttributes, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\ninterface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\ninterface FocusableProviderProps extends HTMLAttributes<HTMLElement> {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<HTMLElement>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue>(null);\n\nfunction useFocusableContext(ref: RefObject<HTMLElement>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let {ref: _, ...otherProps} = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: RefObject<HTMLElement>) {\n let {children, ...otherProps} = props;\n let context = {\n ...otherProps,\n ref\n };\n\n return (\n <FocusableContext.Provider value={context}>\n {children}\n </FocusableContext.Provider>\n );\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport {_FocusableProvider as FocusableProvider};\n\ninterface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<HTMLElement>): FocusableAria {\n let {focusProps} = useFocus(props);\n let {keyboardProps} = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n },\n interactionProps\n )\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;SEmBgB,yCAAW,CAAC,OAAoB,EAAE,CAAC;IACjD,EAA6E,AAA7E,2EAA6E;IAC7E,EAA4E,AAA5E,0EAA4E;IAC5E,EAA2E,AAA3E,yEAA2E;IAC3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AA,UAAU,EAAA,CAAC,GAAG,eAAQ,CAAC,KAAK;IACjC,GAAG,CAAC,CAAC,gBAAA,aAAa,EAAA,CAAC,GAAG,kBAAW,CAAC,KAAK;IACvC,GAAG,CAAC,YAAY,GAAG,iBAAU,CAAC,UAAU,EAAE,aAAa;IACvD,GAAG,CAAC,QAAQ,GAAG,yCAAmB,CAAC,MAAM;IACzC,GAAG,CAAC,gBAAgB,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC;IAAA,CAAC,GAAG,QAAQ;IACvD,GAAG,CAAC,YAAY,GAAG,aAAM,CAAC,KAAK,CAAC,SAAS;IAEzC,gBAAS,KAAO,CAAC;QACf,EAAE,EAAE,YAAY,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EACxC,yCAAW,CAAC,MAAM,CAAC,OAAO;QAE5B,YAAY,CAAC,OAAO,GAAG,KAAK;IAC9B,CAAC,EAAE,CAAC;QAAA,MAAM;IAAA,CAAC;IAEX,MAAM,CAAC,CAAC;QACN,cAAc,EAAE,iBAAU,CACxB,CAAC;eACI,YAAY;YACf,QAAQ,EAAE,KAAK,CAAC,mBAAmB,KAAK,KAAK,CAAC,UAAU,GAAG,EAAE,GAAG,SAAS;QAC3E,CAAC,EACD,gBAAgB;IAEpB,CAAC;AACH,CAAC;","sources":["packages/@react-aria/focus/src/index.ts","packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/useFocusable.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './FocusScope';\nexport * from './FocusRing';\nexport * from './useFocusable';\nexport * from './useFocusRing';\nexport * from './focusSafely';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusSafely} from './focusSafely';\nimport {isElementVisible} from './isElementVisible';\nimport React, {ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useLayoutEffect} from '@react-aria/utils';\n\n// import {FocusScope, useFocusScope} from 'react-events/focus-scope';\n// export {FocusScope};\n\ninterface FocusScopeProps {\n /** The contents of the focus scope. */\n children: ReactNode,\n\n /**\n * Whether to contain focus inside the scope, so users cannot\n * move focus outside, for example in a modal dialog.\n */\n contain?: boolean,\n\n /**\n * Whether to restore focus back to the element that was focused\n * when the focus scope mounted, after the focus scope unmounts.\n */\n restoreFocus?: boolean,\n\n /** Whether to auto focus the first focusable element in the focus scope on mount. */\n autoFocus?: boolean\n}\n\ninterface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: HTMLElement,\n /** Whether to only include tabbable elements, or all focusable elements. */\n tabbable?: boolean,\n /** Whether focus should wrap around when it reaches the end of the scope. */\n wrap?: boolean,\n /** A callback that determines whether the given element is focused. */\n accept?: (node: Element) => boolean\n}\n\nexport interface FocusManager {\n /** Moves focus to the next focusable or tabbable element in the focus scope. */\n focusNext(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): HTMLElement,\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): HTMLElement\n}\n\ntype ScopeRef = RefObject<HTMLElement[]>;\ninterface IFocusContext {\n scopeRef: ScopeRef,\n focusManager: FocusManager\n}\n\nconst FocusContext = React.createContext<IFocusContext>(null);\n\nlet activeScope: ScopeRef = null;\nlet scopes: Map<ScopeRef, ScopeRef | null> = new Map();\n\n// This is a hacky DOM-based implementation of a FocusScope until this RFC lands in React:\n// https://github.com/reactjs/rfcs/pull/109\n// For now, it relies on the DOM tree order rather than the React tree order, and is probably\n// less optimized for performance.\n\n/**\n * A FocusScope manages focus for its descendants. It supports containing focus inside\n * the scope, restoring focus to the previously focused element on unmount, and auto\n * focusing children on mount. It also acts as a container for a programmatic focus\n * management interface that can be used to move focus forward and back in response\n * to user events.\n */\nexport function FocusScope(props: FocusScopeProps) {\n let {children, contain, restoreFocus, autoFocus} = props;\n let startRef = useRef<HTMLSpanElement>();\n let endRef = useRef<HTMLSpanElement>();\n let scopeRef = useRef<HTMLElement[]>([]);\n let ctx = useContext(FocusContext);\n let parentScope = ctx?.scopeRef;\n\n useLayoutEffect(() => {\n // Find all rendered nodes between the sentinels and add them to the scope.\n let node = startRef.current.nextSibling;\n let nodes = [];\n while (node && node !== endRef.current) {\n nodes.push(node);\n node = node.nextSibling;\n }\n\n scopeRef.current = nodes;\n }, [children, parentScope]);\n\n useLayoutEffect(() => {\n scopes.set(scopeRef, parentScope);\n return () => {\n // Restore the active scope on unmount if this scope or a descendant scope is active.\n // Parent effect cleanups run before children, so we need to check if the\n // parent scope actually still exists before restoring the active scope to it.\n if (\n (scopeRef === activeScope || isAncestorScope(scopeRef, activeScope)) &&\n (!parentScope || scopes.has(parentScope))\n ) {\n activeScope = parentScope;\n }\n scopes.delete(scopeRef);\n };\n }, [scopeRef, parentScope]);\n\n useFocusContainment(scopeRef, contain);\n useRestoreFocus(scopeRef, restoreFocus, contain);\n useAutoFocus(scopeRef, autoFocus);\n\n let focusManager = createFocusManagerForScope(scopeRef);\n\n return (\n <FocusContext.Provider value={{scopeRef, focusManager}}>\n <span data-focus-scope-start hidden ref={startRef} />\n {children}\n <span data-focus-scope-end hidden ref={endRef} />\n </FocusContext.Provider>\n );\n}\n\n/**\n * Returns a FocusManager interface for the parent FocusScope.\n * A FocusManager can be used to programmatically move focus within\n * a FocusScope, e.g. in response to user events like keyboard navigation.\n */\nexport function useFocusManager(): FocusManager {\n return useContext(FocusContext)?.focusManager;\n}\n\nfunction createFocusManagerForScope(scopeRef: React.RefObject<HTMLElement[]>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = sentinel;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[scope.length - 1].nextElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = sentinel;\n previousNode = walker.previousNode() as HTMLElement;\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[0].previousElementSibling;\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable}, scope);\n walker.currentNode = scope[scope.length - 1].nextElementSibling;\n let previousNode = walker.previousNode() as HTMLElement;\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n }\n };\n}\n\nconst focusableElements = [\n 'input:not([disabled]):not([type=hidden])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n 'button:not([disabled])',\n 'a[href]',\n 'area[href]',\n 'summary',\n 'iframe',\n 'object',\n 'embed',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]'\n];\n\nconst FOCUSABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])';\n\nfocusableElements.push('[tabindex]:not([tabindex=\"-1\"]):not([disabled])');\nconst TABBABLE_ELEMENT_SELECTOR = focusableElements.join(':not([hidden]):not([tabindex=\"-1\"]),');\n\nfunction getScopeRoot(scope: HTMLElement[]) {\n return scope[0].parentElement;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<HTMLElement[]>, contain: boolean) {\n let focusedNode = useRef<HTMLElement>();\n\n let raf = useRef(null);\n useLayoutEffect(() => {\n let scope = scopeRef.current;\n if (!contain) {\n return;\n }\n\n // Handle the Tab key to contain focus within the scope\n let onKeyDown = (e) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || scopeRef !== activeScope) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n let scope = scopeRef.current;\n if (!isElementInScope(focusedElement, scope)) {\n return;\n }\n\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n if (!nextElement) {\n walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n }\n\n e.preventDefault();\n if (nextElement) {\n focusElement(nextElement, true);\n }\n };\n\n let onFocus = (e) => {\n // If focusing an element in a child scope of the currently active scope, the child becomes active.\n // Moving out of the active scope to an ancestor is not allowed.\n if (!activeScope || isAncestorScope(activeScope, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n } else if (scopeRef === activeScope && !isElementInChildScope(e.target, scopeRef)) {\n // If a focus event occurs outside the active scope (e.g. user tabs from browser location bar),\n // restore focus to the previously focused node or the first tabbable element in the active scope.\n if (focusedNode.current) {\n focusedNode.current.focus();\n } else if (activeScope) {\n focusFirstInScope(activeScope.current);\n }\n } else if (scopeRef === activeScope) {\n focusedNode.current = e.target;\n }\n };\n\n let onBlur = (e) => {\n // Firefox doesn't shift focus back to the Dialog properly without this\n raf.current = requestAnimationFrame(() => {\n // Use document.activeElement instead of e.relatedTarget so we can tell if user clicked into iframe\n if (scopeRef === activeScope && !isElementInChildScope(document.activeElement, scopeRef)) {\n activeScope = scopeRef;\n focusedNode.current = e.target;\n focusedNode.current.focus();\n }\n });\n };\n\n document.addEventListener('keydown', onKeyDown, false);\n document.addEventListener('focusin', onFocus, false);\n scope.forEach(element => element.addEventListener('focusin', onFocus, false));\n scope.forEach(element => element.addEventListener('focusout', onBlur, false));\n return () => {\n document.removeEventListener('keydown', onKeyDown, false);\n document.removeEventListener('focusin', onFocus, false);\n scope.forEach(element => element.removeEventListener('focusin', onFocus, false));\n scope.forEach(element => element.removeEventListener('focusout', onBlur, false));\n };\n }, [scopeRef, contain]);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => cancelAnimationFrame(raf.current);\n }, [raf]);\n}\n\nfunction isElementInAnyScope(element: Element) {\n for (let scope of scopes.keys()) {\n if (isElementInScope(element, scope.current)) {\n return true;\n }\n }\n return false;\n}\n\nfunction isElementInScope(element: Element, scope: HTMLElement[]) {\n return scope.some(node => node.contains(element));\n}\n\nfunction isElementInChildScope(element: Element, scope: ScopeRef) {\n // node.contains in isElementInScope covers child scopes that are also DOM children,\n // but does not cover child scopes in portals.\n for (let s of scopes.keys()) {\n if ((s === scope || isAncestorScope(scope, s)) && isElementInScope(element, s.current)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction isAncestorScope(ancestor: ScopeRef, scope: ScopeRef) {\n let parent = scopes.get(scope);\n if (!parent) {\n return false;\n }\n\n if (parent === ancestor) {\n return true;\n }\n\n return isAncestorScope(ancestor, parent);\n}\n\nfunction focusElement(element: HTMLElement | null, scroll = false) {\n if (element != null && !scroll) {\n try {\n focusSafely(element);\n } catch (err) {\n // ignore\n }\n } else if (element != null) {\n try {\n element.focus();\n } catch (err) {\n // ignore\n }\n }\n}\n\nfunction focusFirstInScope(scope: HTMLElement[]) {\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = sentinel;\n focusElement(walker.nextNode() as HTMLElement);\n}\n\nfunction useAutoFocus(scopeRef: RefObject<HTMLElement[]>, autoFocus: boolean) {\n const autoFocusRef = React.useRef(autoFocus);\n useEffect(() => {\n if (autoFocusRef.current) {\n activeScope = scopeRef;\n if (!isElementInScope(document.activeElement, activeScope.current)) {\n focusFirstInScope(scopeRef.current);\n }\n }\n autoFocusRef.current = false;\n }, []);\n}\n\nfunction useRestoreFocus(scopeRef: RefObject<HTMLElement[]>, restoreFocus: boolean, contain: boolean) {\n // create a ref during render instead of useLayoutEffect so the active element is saved before a child with autoFocus=true mounts.\n const nodeToRestoreRef = useRef(typeof document !== 'undefined' ? document.activeElement as HTMLElement : null);\n\n // useLayoutEffect instead of useEffect so the active element is saved synchronously instead of asynchronously.\n useLayoutEffect(() => {\n let nodeToRestore = nodeToRestoreRef.current;\n if (!restoreFocus) {\n return;\n }\n\n // Handle the Tab key so that tabbing out of the scope goes to the next element\n // after the node that had focus when the scope mounted. This is important when\n // using portals for overlays, so that focus goes to the expected element when\n // tabbing out of the overlay.\n let onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n\n let focusedElement = document.activeElement as HTMLElement;\n if (!isElementInScope(focusedElement, scopeRef.current)) {\n return;\n }\n\n // Create a DOM tree walker that matches all tabbable elements\n let walker = getFocusableTreeWalker(document.body, {tabbable: true});\n\n // Find the next tabbable element after the currently focused element\n walker.currentNode = focusedElement;\n let nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n\n if (!document.body.contains(nodeToRestore) || nodeToRestore === document.body) {\n nodeToRestore = null;\n }\n\n // If there is no next element, or it is outside the current scope, move focus to the\n // next element after the node to restore to instead.\n if ((!nextElement || !isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) {\n walker.currentNode = nodeToRestore;\n\n // Skip over elements within the scope, in case the scope immediately follows the node to restore.\n do {\n nextElement = (e.shiftKey ? walker.previousNode() : walker.nextNode()) as HTMLElement;\n } while (isElementInScope(nextElement, scopeRef.current));\n\n e.preventDefault();\n e.stopPropagation();\n if (nextElement) {\n focusElement(nextElement, true);\n } else {\n // If there is no next element and the nodeToRestore isn't within a FocusScope (i.e. we are leaving the top level focus scope)\n // then move focus to the body.\n // Otherwise restore focus to the nodeToRestore (e.g menu within a popover -> tabbing to close the menu should move focus to menu trigger)\n if (!isElementInAnyScope(nodeToRestore)) {\n focusedElement.blur();\n } else {\n focusElement(nodeToRestore, true);\n }\n }\n }\n };\n\n if (!contain) {\n document.addEventListener('keydown', onKeyDown, true);\n }\n\n return () => {\n if (!contain) {\n document.removeEventListener('keydown', onKeyDown, true);\n }\n\n if (restoreFocus && nodeToRestore && isElementInScope(document.activeElement, scopeRef.current)) {\n requestAnimationFrame(() => {\n if (document.body.contains(nodeToRestore)) {\n focusElement(nodeToRestore);\n }\n });\n }\n };\n }, [scopeRef, restoreFocus, contain]);\n}\n\n/**\n * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker}\n * that matches all focusable/tabbable elements.\n */\nexport function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOptions, scope?: HTMLElement[]) {\n let selector = opts?.tabbable ? TABBABLE_ELEMENT_SELECTOR : FOCUSABLE_ELEMENT_SELECTOR;\n let walker = document.createTreeWalker(\n root,\n NodeFilter.SHOW_ELEMENT,\n {\n acceptNode(node) {\n // Skip nodes inside the starting node.\n if (opts?.from?.contains(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if ((node as HTMLElement).matches(selector)\n && isElementVisible(node as HTMLElement)\n && (!scope || isElementInScope(node as HTMLElement, scope))\n && (!opts?.accept || opts.accept(node as Element))\n ) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n }\n }\n );\n\n if (opts?.from) {\n walker.currentNode = opts.from;\n }\n\n return walker;\n}\n\n/**\n * Creates a FocusManager object that can be used to move focus within an element.\n */\nexport function createFocusManager(ref: RefObject<HTMLElement>, defaultOptions: FocusManagerOptions = {}): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n if (root.contains(node)) {\n walker.currentNode = node;\n }\n let nextNode = walker.nextNode() as HTMLElement;\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode() as HTMLElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = defaultOptions) {\n let root = ref.current;\n let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;\n let node = from || document.activeElement;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n if (root.contains(node)) {\n walker.currentNode = node;\n } else {\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n let previousNode = walker.previousNode() as HTMLElement;\n if (!previousNode && wrap) {\n walker.currentNode = root;\n previousNode = last(walker);\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = defaultOptions) {\n let root = ref.current;\n let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n let nextNode = walker.nextNode() as HTMLElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = defaultOptions) {\n let root = ref.current;\n let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n let next = last(walker);\n if (next) {\n focusElement(next, true);\n }\n return next;\n }\n };\n}\n\nfunction last(walker: TreeWalker) {\n let next: HTMLElement;\n let last: HTMLElement;\n do {\n last = walker.lastChild() as HTMLElement;\n if (last) {\n next = last;\n }\n } while (last);\n return next;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {focusWithoutScrolling, runAfterTransition} from '@react-aria/utils';\nimport {getInteractionModality} from '@react-aria/interactions';\n\n/**\n * A utility function that focuses an element while avoiding undesired side effects such\n * as page scrolling and screen reader issues with CSS transitions.\n */\nexport function focusSafely(element: HTMLElement) {\n // If the user is interacting with a virtual cursor, e.g. screen reader, then\n // wait until after any animated transitions that are currently occurring on\n // the page before shifting focus. This avoids issues with VoiceOver on iOS\n // causing the page to scroll when moving focus if the element is transitioning\n // from off the screen.\n if (getInteractionModality() === 'virtual') {\n let lastFocusedElement = document.activeElement;\n runAfterTransition(() => {\n // If focus did not move and the element is still in the document, focus it.\n if (document.activeElement === lastFocusedElement && document.contains(element)) {\n focusWithoutScrolling(element);\n }\n });\n } else {\n focusWithoutScrolling(element);\n }\n}\n","/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction isStyleVisible(element: Element) {\n if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {\n return false;\n }\n\n let {display, visibility} = element.style;\n\n let isVisible = (\n display !== 'none' &&\n visibility !== 'hidden' &&\n visibility !== 'collapse'\n );\n\n if (isVisible) {\n const {getComputedStyle} = element.ownerDocument.defaultView;\n let {display: computedDisplay, visibility: computedVisibility} = getComputedStyle(element);\n\n isVisible = (\n computedDisplay !== 'none' &&\n computedVisibility !== 'hidden' &&\n computedVisibility !== 'collapse'\n );\n }\n\n return isVisible;\n}\n\nfunction isAttributeVisible(element: Element, childElement?: Element) {\n return (\n !element.hasAttribute('hidden') &&\n (element.nodeName === 'DETAILS' &&\n childElement &&\n childElement.nodeName !== 'SUMMARY'\n ? element.hasAttribute('open')\n : true)\n );\n}\n\n/**\n * Adapted from https://github.com/testing-library/jest-dom and \n * https://github.com/vuejs/vue-test-utils-next/.\n * Licensed under the MIT License.\n * @param element - Element to evaluate for display or visibility.\n */ \nexport function isElementVisible(element: Element, childElement?: Element) {\n return (\n element.nodeName !== '#comment' &&\n isStyleVisible(element) &&\n isAttributeVisible(element, childElement) &&\n (!element.parentElement || isElementVisible(element.parentElement, element))\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport clsx from 'clsx';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement} from 'react';\nimport {useFocusRing} from './useFocusRing';\n\ninterface FocusRingProps {\n /** Child element to apply CSS classes to. */\n children: ReactElement,\n /** CSS class to apply when the element is focused. */\n focusClass?: string,\n /** CSS class to apply when the element has keyboard focus. */\n focusRingClass?: string,\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default false\n */\n within?: boolean,\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps) {\n let {children, focusClass, focusRingClass} = props;\n let {isFocused, isFocusVisible, focusProps} = useFocusRing(props);\n let child = React.Children.only(children);\n\n return React.cloneElement(child, mergeProps(child.props, {\n ...focusProps,\n className: clsx({\n [focusClass || '']: isFocused,\n [focusRingClass || '']: isFocusVisible\n })\n }));\n}\n","import {HTMLAttributes, useCallback, useState} from 'react';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useRef} from 'react';\n\ninterface FocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\ninterface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: FocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: state.current.isFocused && isFocusVisibleState,\n focusProps: within ? focusWithinProps : focusProps\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FocusableDOMProps, FocusableProps} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useSyncRef} from '@react-aria/utils';\nimport React, {HTMLAttributes, MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\ninterface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\ninterface FocusableProviderProps extends HTMLAttributes<HTMLElement> {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<HTMLElement>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue>(null);\n\nfunction useFocusableContext(ref: RefObject<HTMLElement>): FocusableContextValue {\n let context = useContext(FocusableContext) || {};\n useSyncRef(context, ref);\n\n // eslint-disable-next-line\n let {ref: _, ...otherProps} = context;\n return otherProps;\n}\n\n/**\n * Provides DOM props to the nearest focusable child.\n */\nfunction FocusableProvider(props: FocusableProviderProps, ref: RefObject<HTMLElement>) {\n let {children, ...otherProps} = props;\n let context = {\n ...otherProps,\n ref\n };\n\n return (\n <FocusableContext.Provider value={context}>\n {children}\n </FocusableContext.Provider>\n );\n}\n\nlet _FocusableProvider = React.forwardRef(FocusableProvider);\nexport {_FocusableProvider as FocusableProvider};\n\ninterface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<HTMLElement>): FocusableAria {\n let {focusProps} = useFocus(props);\n let {keyboardProps} = useKeyboard(props);\n let interactions = mergeProps(focusProps, keyboardProps);\n let domProps = useFocusableContext(domRef);\n let interactionProps = props.isDisabled ? {} : domProps;\n let autoFocusRef = useRef(props.autoFocus);\n\n useEffect(() => {\n if (autoFocusRef.current && domRef.current) {\n focusSafely(domRef.current);\n }\n autoFocusRef.current = false;\n }, [domRef]);\n\n return {\n focusableProps: mergeProps(\n {\n ...interactions,\n tabIndex: props.excludeFromTabOrder && !props.isDisabled ? -1 : undefined\n },\n interactionProps\n )\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ interface FocusManagerOptions {
|
|
|
28
28
|
tabbable?: boolean;
|
|
29
29
|
/** Whether focus should wrap around when it reaches the end of the scope. */
|
|
30
30
|
wrap?: boolean;
|
|
31
|
+
/** A callback that determines whether the given element is focused. */
|
|
32
|
+
accept?: (node: Element) => boolean;
|
|
31
33
|
}
|
|
32
34
|
export interface FocusManager {
|
|
33
35
|
/** Moves focus to the next focusable or tabbable element in the focus scope. */
|
|
@@ -61,7 +63,7 @@ export function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOpt
|
|
|
61
63
|
/**
|
|
62
64
|
* Creates a FocusManager object that can be used to move focus within an element.
|
|
63
65
|
*/
|
|
64
|
-
export function createFocusManager(ref: RefObject<HTMLElement
|
|
66
|
+
export function createFocusManager(ref: RefObject<HTMLElement>, defaultOptions?: FocusManagerOptions): FocusManager;
|
|
65
67
|
interface FocusRingProps {
|
|
66
68
|
/**
|
|
67
69
|
* Whether to show the focus ring when something
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAeA;;;GAGG;AACH,4BAA4B,OAAO,EAAE,WAAW,QAiB/C;AEhBD;IACE,uCAAuC;IACvC,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,qFAAqF;IACrF,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;IACE,qFAAqF;IACrF,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,OAAO,CAAA;
|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AEjB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;IACE,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;IAEnB,gDAAgD;IAChD,cAAc,EAAE,OAAO,CAAC;IAExB,mEAAmE;IACnE,UAAU,EAAE,eAAe,WAAW,CAAC,CAAA;CACxC;AAED;;;;GAIG;AACH,6BAA6B,KAAK,GAAE,cAAmB,GAAG,aAAa,CAyCtE;AC5DD;IACE,6CAA6C;IAC7C,QAAQ,EAAE,YAAY,CAAC;IACvB,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;GAIG;AACH,0BAA0B,KAAK,EAAE,gBAAc,sEAY9C;ACpCD,0BAA2B,SAAQ,cAAc,EAAE,iBAAiB;IAClE,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,gCAAiC,SAAQ,eAAe,WAAW,CAAC;IAClE,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAkCD,OAAA,IAAI,6GAAwD,CAAC;AAG7D;IACE,uCAAuC;IACvC,cAAc,EAAE,eAAe,WAAW,CAAC,CAAA;CAC5C;AAED;;GAEG;AACH,6BAA6B,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,WAAW,CAAC,GAAG,aAAa,CAwBnG","sources":["packages/@react-aria/focus/src/packages/@react-aria/focus/src/focusSafely.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/isElementVisible.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/FocusScope.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/useFocusRing.ts","packages/@react-aria/focus/src/packages/@react-aria/focus/src/FocusRing.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/useFocusable.tsx","packages/@react-aria/focus/src/packages/@react-aria/focus/src/index.ts","packages/@react-aria/focus/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './FocusScope';\nexport * from './FocusRing';\nexport * from './useFocusable';\nexport * from './useFocusRing';\nexport * from './focusSafely';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/focus",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/interactions": "^3.
|
|
22
|
-
"@react-aria/utils": "^3.
|
|
23
|
-
"@react-types/shared": "^3.
|
|
21
|
+
"@react-aria/interactions": "^3.9.0",
|
|
22
|
+
"@react-aria/utils": "^3.13.0",
|
|
23
|
+
"@react-types/shared": "^3.13.0",
|
|
24
24
|
"clsx": "^1.1.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
27
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "8f921ec5094e7c2b3c301bcb6133372e35a2052b"
|
|
33
33
|
}
|
package/src/FocusScope.tsx
CHANGED
|
@@ -44,7 +44,9 @@ interface FocusManagerOptions {
|
|
|
44
44
|
/** Whether to only include tabbable elements, or all focusable elements. */
|
|
45
45
|
tabbable?: boolean,
|
|
46
46
|
/** Whether focus should wrap around when it reaches the end of the scope. */
|
|
47
|
-
wrap?: boolean
|
|
47
|
+
wrap?: boolean,
|
|
48
|
+
/** A callback that determines whether the given element is focused. */
|
|
49
|
+
accept?: (node: Element) => boolean
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
export interface FocusManager {
|
|
@@ -487,7 +489,9 @@ export function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOpt
|
|
|
487
489
|
|
|
488
490
|
if ((node as HTMLElement).matches(selector)
|
|
489
491
|
&& isElementVisible(node as HTMLElement)
|
|
490
|
-
&& (!scope || isElementInScope(node as HTMLElement, scope))
|
|
492
|
+
&& (!scope || isElementInScope(node as HTMLElement, scope))
|
|
493
|
+
&& (!opts?.accept || opts.accept(node as Element))
|
|
494
|
+
) {
|
|
491
495
|
return NodeFilter.FILTER_ACCEPT;
|
|
492
496
|
}
|
|
493
497
|
|
|
@@ -506,13 +510,13 @@ export function getFocusableTreeWalker(root: HTMLElement, opts?: FocusManagerOpt
|
|
|
506
510
|
/**
|
|
507
511
|
* Creates a FocusManager object that can be used to move focus within an element.
|
|
508
512
|
*/
|
|
509
|
-
export function createFocusManager(ref: RefObject<HTMLElement
|
|
513
|
+
export function createFocusManager(ref: RefObject<HTMLElement>, defaultOptions: FocusManagerOptions = {}): FocusManager {
|
|
510
514
|
return {
|
|
511
515
|
focusNext(opts: FocusManagerOptions = {}) {
|
|
512
516
|
let root = ref.current;
|
|
513
|
-
let {from, tabbable, wrap} = opts;
|
|
517
|
+
let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;
|
|
514
518
|
let node = from || document.activeElement;
|
|
515
|
-
let walker = getFocusableTreeWalker(root, {tabbable});
|
|
519
|
+
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
|
516
520
|
if (root.contains(node)) {
|
|
517
521
|
walker.currentNode = node;
|
|
518
522
|
}
|
|
@@ -526,11 +530,11 @@ export function createFocusManager(ref: RefObject<HTMLElement>): FocusManager {
|
|
|
526
530
|
}
|
|
527
531
|
return nextNode;
|
|
528
532
|
},
|
|
529
|
-
focusPrevious(opts: FocusManagerOptions =
|
|
533
|
+
focusPrevious(opts: FocusManagerOptions = defaultOptions) {
|
|
530
534
|
let root = ref.current;
|
|
531
|
-
let {from, tabbable, wrap} = opts;
|
|
535
|
+
let {from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept} = opts;
|
|
532
536
|
let node = from || document.activeElement;
|
|
533
|
-
let walker = getFocusableTreeWalker(root, {tabbable});
|
|
537
|
+
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
|
534
538
|
if (root.contains(node)) {
|
|
535
539
|
walker.currentNode = node;
|
|
536
540
|
} else {
|
|
@@ -550,20 +554,20 @@ export function createFocusManager(ref: RefObject<HTMLElement>): FocusManager {
|
|
|
550
554
|
}
|
|
551
555
|
return previousNode;
|
|
552
556
|
},
|
|
553
|
-
focusFirst(opts =
|
|
557
|
+
focusFirst(opts = defaultOptions) {
|
|
554
558
|
let root = ref.current;
|
|
555
|
-
let {tabbable} = opts;
|
|
556
|
-
let walker = getFocusableTreeWalker(root, {tabbable});
|
|
559
|
+
let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;
|
|
560
|
+
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
|
557
561
|
let nextNode = walker.nextNode() as HTMLElement;
|
|
558
562
|
if (nextNode) {
|
|
559
563
|
focusElement(nextNode, true);
|
|
560
564
|
}
|
|
561
565
|
return nextNode;
|
|
562
566
|
},
|
|
563
|
-
focusLast(opts =
|
|
567
|
+
focusLast(opts = defaultOptions) {
|
|
564
568
|
let root = ref.current;
|
|
565
|
-
let {tabbable} = opts;
|
|
566
|
-
let walker = getFocusableTreeWalker(root, {tabbable});
|
|
569
|
+
let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;
|
|
570
|
+
let walker = getFocusableTreeWalker(root, {tabbable, accept});
|
|
567
571
|
let next = last(walker);
|
|
568
572
|
if (next) {
|
|
569
573
|
focusElement(next, true);
|
package/src/useFocusRing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {HTMLAttributes, useState} from 'react';
|
|
1
|
+
import {HTMLAttributes, useCallback, useState} from 'react';
|
|
2
2
|
import {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';
|
|
3
3
|
import {useRef} from 'react';
|
|
4
4
|
|
|
@@ -43,20 +43,20 @@ export function useFocusRing(props: FocusRingProps = {}): FocusRingAria {
|
|
|
43
43
|
let state = useRef({
|
|
44
44
|
isFocused: false,
|
|
45
45
|
isFocusVisible: autoFocus || isFocusVisible()
|
|
46
|
-
})
|
|
46
|
+
});
|
|
47
47
|
let [isFocused, setFocused] = useState(false);
|
|
48
|
-
let [isFocusVisibleState, setFocusVisible] = useState(() => state.isFocused && state.isFocusVisible);
|
|
48
|
+
let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);
|
|
49
49
|
|
|
50
|
-
let updateState = () => setFocusVisible(state.isFocused && state.isFocusVisible);
|
|
50
|
+
let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
|
|
51
51
|
|
|
52
|
-
let onFocusChange = isFocused => {
|
|
53
|
-
state.isFocused = isFocused;
|
|
52
|
+
let onFocusChange = useCallback(isFocused => {
|
|
53
|
+
state.current.isFocused = isFocused;
|
|
54
54
|
setFocused(isFocused);
|
|
55
55
|
updateState();
|
|
56
|
-
};
|
|
56
|
+
}, [updateState]);
|
|
57
57
|
|
|
58
58
|
useFocusVisibleListener((isFocusVisible) => {
|
|
59
|
-
state.isFocusVisible = isFocusVisible;
|
|
59
|
+
state.current.isFocusVisible = isFocusVisible;
|
|
60
60
|
updateState();
|
|
61
61
|
}, [], {isTextInput});
|
|
62
62
|
|
|
@@ -72,7 +72,7 @@ export function useFocusRing(props: FocusRingProps = {}): FocusRingAria {
|
|
|
72
72
|
|
|
73
73
|
return {
|
|
74
74
|
isFocused,
|
|
75
|
-
isFocusVisible: state.isFocused && isFocusVisibleState,
|
|
75
|
+
isFocusVisible: state.current.isFocused && isFocusVisibleState,
|
|
76
76
|
focusProps: within ? focusWithinProps : focusProps
|
|
77
77
|
};
|
|
78
78
|
}
|