@react-aria/focus 3.5.5 → 3.7.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/module.js CHANGED
@@ -1,20 +1,8 @@
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";
5
5
 
6
- function $parcel$export(e, n, v, s) {
7
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
- }
9
- var $9bf71ea28793e738$exports = {};
10
-
11
- $parcel$export($9bf71ea28793e738$exports, "FocusScope", () => $9bf71ea28793e738$export$20e40289641fbbb6);
12
- $parcel$export($9bf71ea28793e738$exports, "useFocusManager", () => $9bf71ea28793e738$export$10c5169755ce7bd7);
13
- $parcel$export($9bf71ea28793e738$exports, "getFocusableTreeWalker", () => $9bf71ea28793e738$export$2d6ec8fc375ceafa);
14
- $parcel$export($9bf71ea28793e738$exports, "createFocusManager", () => $9bf71ea28793e738$export$c5251b9e124bf29);
15
- var $6a99195332edec8b$exports = {};
16
-
17
- $parcel$export($6a99195332edec8b$exports, "focusSafely", () => $6a99195332edec8b$export$80f3e147d781571c);
18
6
 
19
7
 
20
8
  function $6a99195332edec8b$export$80f3e147d781571c(element) {
@@ -128,11 +116,12 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
128
116
  focusNext (opts = {
129
117
  }) {
130
118
  let scope = scopeRef.current;
131
- let { from: from , tabbable: tabbable , wrap: wrap } = opts;
119
+ let { from: from , tabbable: tabbable , wrap: wrap , accept: accept } = opts;
132
120
  let node = from || document.activeElement;
133
121
  let sentinel = scope[0].previousElementSibling;
134
122
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
135
- tabbable: tabbable
123
+ tabbable: tabbable,
124
+ accept: accept
136
125
  }, scope);
137
126
  walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
138
127
  let nextNode = walker.nextNode();
@@ -146,11 +135,12 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
146
135
  focusPrevious (opts = {
147
136
  }) {
148
137
  let scope = scopeRef.current;
149
- let { from: from , tabbable: tabbable , wrap: wrap } = opts;
138
+ let { from: from , tabbable: tabbable , wrap: wrap , accept: accept } = opts;
150
139
  let node = from || document.activeElement;
151
140
  let sentinel = scope[scope.length - 1].nextElementSibling;
152
141
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
153
- tabbable: tabbable
142
+ tabbable: tabbable,
143
+ accept: accept
154
144
  }, scope);
155
145
  walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
156
146
  let previousNode = walker.previousNode();
@@ -164,9 +154,10 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
164
154
  focusFirst (opts = {
165
155
  }) {
166
156
  let scope = scopeRef.current;
167
- let { tabbable: tabbable } = opts;
157
+ let { tabbable: tabbable , accept: accept } = opts;
168
158
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
169
- tabbable: tabbable
159
+ tabbable: tabbable,
160
+ accept: accept
170
161
  }, scope);
171
162
  walker.currentNode = scope[0].previousElementSibling;
172
163
  let nextNode = walker.nextNode();
@@ -176,9 +167,10 @@ function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
176
167
  focusLast (opts = {
177
168
  }) {
178
169
  let scope = scopeRef.current;
179
- let { tabbable: tabbable } = opts;
170
+ let { tabbable: tabbable , accept: accept } = opts;
180
171
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
181
- tabbable: tabbable
172
+ tabbable: tabbable,
173
+ accept: accept
182
174
  }, scope);
183
175
  walker.currentNode = scope[scope.length - 1].nextElementSibling;
184
176
  let previousNode = walker.previousNode();
@@ -213,7 +205,14 @@ function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
213
205
  let raf = $6nfFC$useRef(null);
214
206
  $6nfFC$useLayoutEffect(()=>{
215
207
  let scope1 = scopeRef.current;
216
- if (!contain) return;
208
+ if (!contain) {
209
+ // if contain was changed, then we should cancel any ongoing waits to pull focus back into containment
210
+ if (raf.current) {
211
+ cancelAnimationFrame(raf.current);
212
+ raf.current = null;
213
+ }
214
+ return;
215
+ }
217
216
  // Handle the Tab key to contain focus within the scope
218
217
  let onKeyDown = (e)=>{
219
218
  if (e.key !== 'Tab' || e.altKey || e.ctrlKey || e.metaKey || scopeRef !== $9bf71ea28793e738$var$activeScope) return;
@@ -276,8 +275,9 @@ function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
276
275
  ]);
277
276
  // eslint-disable-next-line arrow-body-style
278
277
  $6nfFC$useEffect(()=>{
279
- return ()=>cancelAnimationFrame(raf.current)
280
- ;
278
+ return ()=>{
279
+ if (raf.current) cancelAnimationFrame(raf.current);
280
+ };
281
281
  }, [
282
282
  raf
283
283
  ]);
@@ -380,7 +380,8 @@ function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain)
380
380
  return ()=>{
381
381
  if (!contain) document.removeEventListener('keydown', onKeyDown, true);
382
382
  if (restoreFocus && nodeToRestore && $9bf71ea28793e738$var$isElementInScope(document.activeElement, scopeRef.current)) requestAnimationFrame(()=>{
383
- if (document.body.contains(nodeToRestore)) $9bf71ea28793e738$var$focusElement(nodeToRestore);
383
+ // Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere
384
+ if (document.body.contains(nodeToRestore) && document.activeElement === document.body) $9bf71ea28793e738$var$focusElement(nodeToRestore);
384
385
  });
385
386
  };
386
387
  }, [
@@ -396,22 +397,25 @@ function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
396
397
  var ref;
397
398
  // Skip nodes inside the starting node.
398
399
  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;
400
+ 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
401
  return NodeFilter.FILTER_SKIP;
401
402
  }
402
403
  });
403
404
  if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
404
405
  return walker;
405
406
  }
406
- function $9bf71ea28793e738$export$c5251b9e124bf29(ref) {
407
+ function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {
408
+ }) {
407
409
  return {
408
410
  focusNext (opts = {
409
411
  }) {
410
412
  let root = ref.current;
411
- let { from: from , tabbable: tabbable , wrap: wrap } = opts;
413
+ if (!root) return;
414
+ let { from: from , tabbable: tabbable = defaultOptions.tabbable , wrap: wrap = defaultOptions.wrap , accept: accept = defaultOptions.accept } = opts;
412
415
  let node = from || document.activeElement;
413
416
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
414
- tabbable: tabbable
417
+ tabbable: tabbable,
418
+ accept: accept
415
419
  });
416
420
  if (root.contains(node)) walker.currentNode = node;
417
421
  let nextNode = walker.nextNode();
@@ -422,13 +426,14 @@ function $9bf71ea28793e738$export$c5251b9e124bf29(ref) {
422
426
  if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
423
427
  return nextNode;
424
428
  },
425
- focusPrevious (opts = {
426
- }) {
429
+ focusPrevious (opts = defaultOptions) {
427
430
  let root = ref.current;
428
- let { from: from , tabbable: tabbable , wrap: wrap } = opts;
431
+ if (!root) return;
432
+ let { from: from , tabbable: tabbable = defaultOptions.tabbable , wrap: wrap = defaultOptions.wrap , accept: accept = defaultOptions.accept } = opts;
429
433
  let node = from || document.activeElement;
430
434
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
431
- tabbable: tabbable
435
+ tabbable: tabbable,
436
+ accept: accept
432
437
  });
433
438
  if (root.contains(node)) walker.currentNode = node;
434
439
  else {
@@ -444,23 +449,25 @@ function $9bf71ea28793e738$export$c5251b9e124bf29(ref) {
444
449
  if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
445
450
  return previousNode;
446
451
  },
447
- focusFirst (opts = {
448
- }) {
452
+ focusFirst (opts = defaultOptions) {
449
453
  let root = ref.current;
450
- let { tabbable: tabbable } = opts;
454
+ if (!root) return;
455
+ let { tabbable: tabbable = defaultOptions.tabbable , accept: accept = defaultOptions.accept } = opts;
451
456
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
452
- tabbable: tabbable
457
+ tabbable: tabbable,
458
+ accept: accept
453
459
  });
454
460
  let nextNode = walker.nextNode();
455
461
  if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
456
462
  return nextNode;
457
463
  },
458
- focusLast (opts = {
459
- }) {
464
+ focusLast (opts = defaultOptions) {
460
465
  let root = ref.current;
461
- let { tabbable: tabbable } = opts;
466
+ if (!root) return;
467
+ let { tabbable: tabbable = defaultOptions.tabbable , accept: accept = defaultOptions.accept } = opts;
462
468
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
463
- tabbable: tabbable
469
+ tabbable: tabbable,
470
+ accept: accept
464
471
  });
465
472
  let next = $9bf71ea28793e738$var$last(walker);
466
473
  if (next) $9bf71ea28793e738$var$focusElement(next, true);
@@ -479,15 +486,9 @@ function $9bf71ea28793e738$var$last(walker) {
479
486
  }
480
487
 
481
488
 
482
- var $907718708eab68af$exports = {};
483
-
484
- $parcel$export($907718708eab68af$exports, "FocusRing", () => $907718708eab68af$export$1a38b4ad7f578e1d);
485
-
486
489
 
487
490
 
488
- var $f7dceffc5ad7768b$exports = {};
489
491
 
490
- $parcel$export($f7dceffc5ad7768b$exports, "useFocusRing", () => $f7dceffc5ad7768b$export$4e328f61c538687f);
491
492
 
492
493
 
493
494
 
@@ -497,19 +498,21 @@ function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {
497
498
  let state = $6nfFC$useRef({
498
499
  isFocused: false,
499
500
  isFocusVisible: autoFocus || $6nfFC$isFocusVisible()
500
- }).current;
501
+ });
501
502
  let [isFocused1, setFocused] = $6nfFC$useState(false);
502
- let [isFocusVisibleState, setFocusVisible] = $6nfFC$useState(()=>state.isFocused && state.isFocusVisible
503
+ let [isFocusVisibleState, setFocusVisible] = $6nfFC$useState(()=>state.current.isFocused && state.current.isFocusVisible
503
504
  );
504
- let updateState = ()=>setFocusVisible(state.isFocused && state.isFocusVisible)
505
- ;
506
- let onFocusChange = (isFocused)=>{
507
- state.isFocused = isFocused;
505
+ let updateState = $6nfFC$useCallback(()=>setFocusVisible(state.current.isFocused && state.current.isFocusVisible)
506
+ , []);
507
+ let onFocusChange = $6nfFC$useCallback((isFocused)=>{
508
+ state.current.isFocused = isFocused;
508
509
  setFocused(isFocused);
509
510
  updateState();
510
- };
511
+ }, [
512
+ updateState
513
+ ]);
511
514
  $6nfFC$useFocusVisibleListener((isFocusVisible)=>{
512
- state.isFocusVisible = isFocusVisible;
515
+ state.current.isFocusVisible = isFocusVisible;
513
516
  updateState();
514
517
  }, [], {
515
518
  isTextInput: isTextInput
@@ -524,7 +527,7 @@ function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {
524
527
  });
525
528
  return {
526
529
  isFocused: isFocused1,
527
- isFocusVisible: state.isFocused && isFocusVisibleState,
530
+ isFocusVisible: state.current.isFocused && isFocusVisibleState,
528
531
  focusProps: within ? focusWithinProps : focusProps
529
532
  };
530
533
  }
@@ -544,10 +547,6 @@ function $907718708eab68af$export$1a38b4ad7f578e1d(props) {
544
547
  }
545
548
 
546
549
 
547
- var $e6afbd83fe6ebbd2$exports = {};
548
-
549
- $parcel$export($e6afbd83fe6ebbd2$exports, "FocusableProvider", () => $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5);
550
- $parcel$export($e6afbd83fe6ebbd2$exports, "useFocusable", () => $e6afbd83fe6ebbd2$export$4c014de7c8940b4c);
551
550
 
552
551
 
553
552
 
@@ -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;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AAG;IACL,CAAC;IAED,MAAM,0CACH,sCAAgB,CAAC,QAAQ;QAAC,KAAK,EAAE,OAAO;OACtC,QAAQ;AAGf,CAAC;AAED,GAAG,CAAC,wCAAkB,iBAAG,YAAK,CAAC,UAAU,CAAC,uCAAiB;SAW3C,yCAAY,CAAC,KAAuB,EAAE,MAA8B,EAAiB,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 )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AAC,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 {FocusScope, useFocusManager, getFocusableTreeWalker, createFocusManager} from './FocusScope';\nexport {FocusRing} from './FocusRing';\nexport {FocusableProvider, useFocusable} from './useFocusable';\nexport {useFocusRing} from './useFocusRing';\nexport {focusSafely} from './focusSafely';\n\nexport type {FocusScopeProps, FocusManager, FocusManagerOptions} from './FocusScope';\nexport type {FocusRingProps} from './FocusRing';\nexport type {FocusableAria, FocusableOptions, FocusableProviderProps} from './useFocusable';\nexport type {AriaFocusRingProps, FocusRingAria} from './useFocusRing';\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 {FocusableElement} from '@react-types/shared';\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\nexport interface 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\nexport interface FocusManagerOptions {\n /** The element to start searching from. The currently focused element by default. */\n from?: Element,\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): FocusableElement,\n /** Moves focus to the previous focusable or tabbable element in the focus scope. */\n focusPrevious(opts?: FocusManagerOptions): FocusableElement,\n /** Moves focus to the first focusable or tabbable element in the focus scope. */\n focusFirst(opts?: FocusManagerOptions): FocusableElement,\n /** Moves focus to the last focusable or tabbable element in the focus scope. */\n focusLast(opts?: FocusManagerOptions): FocusableElement\n}\n\ntype ScopeRef = RefObject<Element[]>;\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<Element[]>([]);\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<Element[]>): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let scope = scopeRef.current;\n let {from, tabbable, wrap, accept} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable, accept}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let nextNode = walker.nextNode() as FocusableElement;\n if (!nextNode && wrap) {\n walker.currentNode = sentinel;\n nextNode = walker.nextNode() as FocusableElement;\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, accept} = opts;\n let node = from || document.activeElement;\n let sentinel = scope[scope.length - 1].nextElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable, accept}, scope);\n walker.currentNode = isElementInScope(node, scope) ? node : sentinel;\n let previousNode = walker.previousNode() as FocusableElement;\n if (!previousNode && wrap) {\n walker.currentNode = sentinel;\n previousNode = walker.previousNode() as FocusableElement;\n }\n if (previousNode) {\n focusElement(previousNode, true);\n }\n return previousNode;\n },\n focusFirst(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable, accept} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable, accept}, scope);\n walker.currentNode = scope[0].previousElementSibling;\n let nextNode = walker.nextNode() as FocusableElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = {}) {\n let scope = scopeRef.current;\n let {tabbable, accept} = opts;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable, accept}, scope);\n walker.currentNode = scope[scope.length - 1].nextElementSibling;\n let previousNode = walker.previousNode() as FocusableElement;\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: Element[]) {\n return scope[0].parentElement;\n}\n\nfunction useFocusContainment(scopeRef: RefObject<Element[]>, contain: boolean) {\n let focusedNode = useRef<FocusableElement>();\n\n let raf = useRef(null);\n useLayoutEffect(() => {\n let scope = scopeRef.current;\n if (!contain) {\n // if contain was changed, then we should cancel any ongoing waits to pull focus back into containment\n if (raf.current) {\n cancelAnimationFrame(raf.current);\n raf.current = null;\n }\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;\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 FocusableElement;\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 FocusableElement;\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 () => {\n if (raf.current) {\n cancelAnimationFrame(raf.current);\n }\n };\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: Element[]) {\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: FocusableElement | 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: Element[]) {\n let sentinel = scope[0].previousElementSibling;\n let walker = getFocusableTreeWalker(getScopeRoot(scope), {tabbable: true}, scope);\n walker.currentNode = sentinel;\n focusElement(walker.nextNode() as FocusableElement);\n}\n\nfunction useAutoFocus(scopeRef: RefObject<Element[]>, 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<Element[]>, 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 FocusableElement : 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 FocusableElement;\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 FocusableElement;\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 FocusableElement;\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 // Only restore focus if we've lost focus to the body, the alternative is that focus has been purposefully moved elsewhere\n if (document.body.contains(nodeToRestore) && document.activeElement === document.body) {\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: Element, opts?: FocusManagerOptions, scope?: Element[]) {\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 Element).matches(selector)\n && isElementVisible(node as Element)\n && (!scope || isElementInScope(node as Element, 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<Element>, defaultOptions: FocusManagerOptions = {}): FocusManager {\n return {\n focusNext(opts: FocusManagerOptions = {}) {\n let root = ref.current;\n if (!root) {\n return;\n }\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 FocusableElement;\n if (!nextNode && wrap) {\n walker.currentNode = root;\n nextNode = walker.nextNode() as FocusableElement;\n }\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusPrevious(opts: FocusManagerOptions = defaultOptions) {\n let root = ref.current;\n if (!root) {\n return;\n }\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 FocusableElement;\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 if (!root) {\n return;\n }\n let {tabbable = defaultOptions.tabbable, accept = defaultOptions.accept} = opts;\n let walker = getFocusableTreeWalker(root, {tabbable, accept});\n let nextNode = walker.nextNode() as FocusableElement;\n if (nextNode) {\n focusElement(nextNode, true);\n }\n return nextNode;\n },\n focusLast(opts = defaultOptions) {\n let root = ref.current;\n if (!root) {\n return;\n }\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: FocusableElement;\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\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 {FocusableElement} from '@react-types/shared';\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: FocusableElement) {\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\nexport interface FocusRingProps {\n /** Child element to apply CSS classes to. */\n children: ReactElement,\n /** CSS class to apply when the element is focused. */\n focusClass?: string,\n /** CSS class to apply when the element has keyboard focus. */\n focusRingClass?: string,\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default false\n */\n within?: boolean,\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\n/**\n * A utility component that applies a CSS class when an element has keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function FocusRing(props: FocusRingProps) {\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 {DOMAttributes} from '@react-types/shared';\nimport {isFocusVisible, useFocus, useFocusVisibleListener, useFocusWithin} from '@react-aria/interactions';\nimport {useCallback, useState} from 'react';\nimport {useRef} from 'react';\n\nexport interface AriaFocusRingProps {\n /**\n * Whether to show the focus ring when something\n * inside the container element has focus (true), or\n * only if the container itself has focus (false).\n * @default 'false'\n */\n within?: boolean,\n\n /** Whether the element is a text input. */\n isTextInput?: boolean,\n\n /** Whether the element will be auto focused. */\n autoFocus?: boolean\n}\n\nexport interface FocusRingAria {\n /** Whether the element is currently focused. */\n isFocused: boolean,\n\n /** Whether keyboard focus should be visible. */\n isFocusVisible: boolean,\n\n /** Props to apply to the container element with the focus ring. */\n focusProps: DOMAttributes\n}\n\n/**\n * Determines whether a focus ring should be shown to indicate keyboard focus.\n * Focus rings are visible only when the user is interacting with a keyboard,\n * not with a mouse, touch, or other input methods.\n */\nexport function useFocusRing(props: AriaFocusRingProps = {}): FocusRingAria {\n let {\n autoFocus = false,\n isTextInput,\n within\n } = props;\n let state = useRef({\n isFocused: false,\n isFocusVisible: autoFocus || isFocusVisible()\n });\n let [isFocused, setFocused] = useState(false);\n let [isFocusVisibleState, setFocusVisible] = useState(() => state.current.isFocused && state.current.isFocusVisible);\n\n let updateState = useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);\n\n let onFocusChange = useCallback(isFocused => {\n state.current.isFocused = isFocused;\n setFocused(isFocused);\n updateState();\n }, [updateState]);\n\n useFocusVisibleListener((isFocusVisible) => {\n state.current.isFocusVisible = isFocusVisible;\n updateState();\n }, [], {isTextInput});\n\n let {focusProps} = useFocus({\n isDisabled: within,\n onFocusChange\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !within,\n onFocusWithinChange: onFocusChange\n });\n\n return {\n isFocused,\n isFocusVisible: 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 {DOMAttributes, FocusableDOMProps, FocusableElement, FocusableProps} from '@react-types/shared';\nimport {focusSafely} from './';\nimport {mergeProps, useSyncRef} from '@react-aria/utils';\nimport React, {MutableRefObject, ReactNode, RefObject, useContext, useEffect, useRef} from 'react';\nimport {useFocus, useKeyboard} from '@react-aria/interactions';\n\nexport interface FocusableOptions extends FocusableProps, FocusableDOMProps {\n /** Whether focus should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface FocusableProviderProps extends DOMAttributes {\n /** The child element to provide DOM props to. */\n children?: ReactNode\n}\n\ninterface FocusableContextValue extends FocusableProviderProps {\n ref?: MutableRefObject<FocusableElement>\n}\n\nlet FocusableContext = React.createContext<FocusableContextValue>(null);\n\nfunction useFocusableContext(ref: RefObject<FocusableElement>): 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<FocusableElement>) {\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\nexport interface FocusableAria {\n /** Props for the focusable element. */\n focusableProps: DOMAttributes\n}\n\n/**\n * Used to make an element focusable and capable of auto focus.\n */\nexport function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement>): 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"}