@react-aria/focus
Advanced tools
Comparing version 3.0.0-nightly-987f174ba-241015 to 3.0.0-nightly-993de98ad-241210
@@ -229,3 +229,3 @@ var $1c7f9157d722357d$exports = require("./focusSafely.main.js"); | ||
'video[controls]', | ||
'[contenteditable]' | ||
'[contenteditable]:not([contenteditable^="false"])' | ||
]; | ||
@@ -326,3 +326,2 @@ const $a7a032acae3ddda9$var$FOCUSABLE_ELEMENT_SELECTOR = $a7a032acae3ddda9$var$focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])'; | ||
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur | ||
// eslint-disable-next-line arrow-body-style | ||
(0, $euGna$reactariautils.useLayoutEffect)(()=>{ | ||
@@ -369,3 +368,3 @@ return ()=>{ | ||
(0, $1c7f9157d722357d$exports.focusSafely)(element); | ||
} catch (err) { | ||
} catch { | ||
// ignore | ||
@@ -375,3 +374,3 @@ } | ||
element.focus(); | ||
} catch (err) { | ||
} catch { | ||
// ignore | ||
@@ -483,3 +482,3 @@ } | ||
let focusedElement = ownerDocument.activeElement; | ||
if (!$a7a032acae3ddda9$var$isElementInScope(focusedElement, scopeRef.current)) return; | ||
if (!$a7a032acae3ddda9$var$isElementInChildScope(focusedElement, scopeRef) || !$a7a032acae3ddda9$var$shouldRestoreFocus(scopeRef)) return; | ||
let treeNode = $a7a032acae3ddda9$export$d06fae2ee68b101e.getTreeNode(scopeRef); | ||
@@ -501,7 +500,7 @@ if (!treeNode) return; | ||
// next element after the node to restore to instead. | ||
if ((!nextElement || !$a7a032acae3ddda9$var$isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) { | ||
if ((!nextElement || !$a7a032acae3ddda9$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) { | ||
walker.currentNode = nodeToRestore; | ||
// Skip over elements within the scope, in case the scope immediately follows the node to restore. | ||
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode(); | ||
while ($a7a032acae3ddda9$var$isElementInScope(nextElement, scopeRef.current)); | ||
while ($a7a032acae3ddda9$var$isElementInChildScope(nextElement, scopeRef)); | ||
e.preventDefault(); | ||
@@ -539,4 +538,3 @@ e.stopPropagation(); | ||
// if we already lost focus to the body and this was the active scope, then we should attempt to restore | ||
if (restoreFocus && nodeToRestore && // eslint-disable-next-line react-hooks/exhaustive-deps | ||
($a7a032acae3ddda9$var$isElementInScope(ownerDocument.activeElement, scopeRef.current) || ownerDocument.activeElement === ownerDocument.body && $a7a032acae3ddda9$var$shouldRestoreFocus(scopeRef))) { | ||
if (restoreFocus && nodeToRestore && (ownerDocument.activeElement && $a7a032acae3ddda9$var$isElementInChildScope(ownerDocument.activeElement, scopeRef) || ownerDocument.activeElement === ownerDocument.body && $a7a032acae3ddda9$var$shouldRestoreFocus(scopeRef))) { | ||
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it | ||
@@ -543,0 +541,0 @@ let clonedTree = $a7a032acae3ddda9$export$d06fae2ee68b101e.clone(); |
@@ -214,3 +214,3 @@ import {focusSafely as $6a99195332edec8b$export$80f3e147d781571c} from "./focusSafely.module.js"; | ||
'video[controls]', | ||
'[contenteditable]' | ||
'[contenteditable]:not([contenteditable^="false"])' | ||
]; | ||
@@ -311,3 +311,2 @@ const $9bf71ea28793e738$var$FOCUSABLE_ELEMENT_SELECTOR = $9bf71ea28793e738$var$focusableElements.join(':not([hidden]),') + ',[tabindex]:not([disabled]):not([hidden])'; | ||
// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur | ||
// eslint-disable-next-line arrow-body-style | ||
(0, $cgawC$useLayoutEffect)(()=>{ | ||
@@ -354,3 +353,3 @@ return ()=>{ | ||
(0, $6a99195332edec8b$export$80f3e147d781571c)(element); | ||
} catch (err) { | ||
} catch { | ||
// ignore | ||
@@ -360,3 +359,3 @@ } | ||
element.focus(); | ||
} catch (err) { | ||
} catch { | ||
// ignore | ||
@@ -468,3 +467,3 @@ } | ||
let focusedElement = ownerDocument.activeElement; | ||
if (!$9bf71ea28793e738$var$isElementInScope(focusedElement, scopeRef.current)) return; | ||
if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef)) return; | ||
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef); | ||
@@ -486,7 +485,7 @@ if (!treeNode) return; | ||
// next element after the node to restore to instead. | ||
if ((!nextElement || !$9bf71ea28793e738$var$isElementInScope(nextElement, scopeRef.current)) && nodeToRestore) { | ||
if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) { | ||
walker.currentNode = nodeToRestore; | ||
// Skip over elements within the scope, in case the scope immediately follows the node to restore. | ||
do nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode(); | ||
while ($9bf71ea28793e738$var$isElementInScope(nextElement, scopeRef.current)); | ||
while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)); | ||
e.preventDefault(); | ||
@@ -524,4 +523,3 @@ e.stopPropagation(); | ||
// if we already lost focus to the body and this was the active scope, then we should attempt to restore | ||
if (restoreFocus && nodeToRestore && // eslint-disable-next-line react-hooks/exhaustive-deps | ||
($9bf71ea28793e738$var$isElementInScope(ownerDocument.activeElement, scopeRef.current) || ownerDocument.activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) { | ||
if (restoreFocus && nodeToRestore && (ownerDocument.activeElement && $9bf71ea28793e738$var$isElementInChildScope(ownerDocument.activeElement, scopeRef) || ownerDocument.activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) { | ||
// freeze the focusScopeTree so it persists after the raf, otherwise during unmount nodes are removed from it | ||
@@ -528,0 +526,0 @@ let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone(); |
@@ -122,3 +122,3 @@ import { FocusableElement, RefObject, DOMAttributes, FocusableDOMProps, FocusableProps } from "@react-types/shared"; | ||
export function FocusRing(props: FocusRingProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>; | ||
export interface FocusableOptions extends FocusableProps, FocusableDOMProps { | ||
export interface FocusableOptions<T = FocusableElement> extends FocusableProps<T>, FocusableDOMProps { | ||
/** Whether focus should be disabled. */ | ||
@@ -131,3 +131,6 @@ isDisabled?: boolean; | ||
} | ||
export let FocusableProvider: React.ForwardRefExoticComponent<FocusableProviderProps & React.RefAttributes<FocusableElement>>; | ||
/** | ||
* Provides DOM props to the nearest focusable child. | ||
*/ | ||
export const FocusableProvider: React.ForwardRefExoticComponent<FocusableProviderProps & React.RefAttributes<FocusableElement>>; | ||
export interface FocusableAria { | ||
@@ -140,3 +143,3 @@ /** Props for the focusable element. */ | ||
*/ | ||
export function useFocusable(props: FocusableOptions, domRef: RefObject<FocusableElement | null>): FocusableAria; | ||
export function useFocusable<T extends FocusableElement = FocusableElement>(props: FocusableOptions<T>, domRef: RefObject<FocusableElement | null>): FocusableAria; | ||
interface AriaHasTabbableChildOptions { | ||
@@ -143,0 +146,0 @@ isDisabled?: boolean; |
@@ -39,5 +39,3 @@ var $1c7f9157d722357d$exports = require("./focusSafely.main.js"); | ||
} | ||
/** | ||
* Provides DOM props to the nearest focusable child. | ||
*/ function $fb504d83237fd6ac$var$FocusableProvider(props, ref) { | ||
const $fb504d83237fd6ac$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, ($parcel$interopDefault($ggOO2$react))).forwardRef(function FocusableProvider(props, ref) { | ||
let { children: children, ...otherProps } = props; | ||
@@ -52,4 +50,3 @@ let objRef = (0, $ggOO2$reactariautils.useObjectRef)(ref); | ||
}, children); | ||
} | ||
let $fb504d83237fd6ac$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, ($parcel$interopDefault($ggOO2$react))).forwardRef($fb504d83237fd6ac$var$FocusableProvider); | ||
}); | ||
function $fb504d83237fd6ac$export$4c014de7c8940b4c(props, domRef) { | ||
@@ -56,0 +53,0 @@ let { focusProps: focusProps } = (0, $ggOO2$reactariainteractions.useFocus)(props); |
@@ -28,5 +28,3 @@ import {focusSafely as $6a99195332edec8b$export$80f3e147d781571c} from "./focusSafely.module.js"; | ||
} | ||
/** | ||
* Provides DOM props to the nearest focusable child. | ||
*/ function $e6afbd83fe6ebbd2$var$FocusableProvider(props, ref) { | ||
const $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, $h8xso$react).forwardRef(function FocusableProvider(props, ref) { | ||
let { children: children, ...otherProps } = props; | ||
@@ -41,4 +39,3 @@ let objRef = (0, $h8xso$useObjectRef)(ref); | ||
}, children); | ||
} | ||
let $e6afbd83fe6ebbd2$export$13f3202a3e5ddd5 = /*#__PURE__*/ (0, $h8xso$react).forwardRef($e6afbd83fe6ebbd2$var$FocusableProvider); | ||
}); | ||
function $e6afbd83fe6ebbd2$export$4c014de7c8940b4c(props, domRef) { | ||
@@ -45,0 +42,0 @@ let { focusProps: focusProps } = (0, $h8xso$useFocus)(props); |
{ | ||
"name": "@react-aria/focus", | ||
"version": "3.0.0-nightly-987f174ba-241015", | ||
"version": "3.0.0-nightly-993de98ad-241210", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,5 +25,5 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/interactions": "^3.0.0-nightly-987f174ba-241015", | ||
"@react-aria/utils": "^3.0.0-nightly-987f174ba-241015", | ||
"@react-types/shared": "^3.0.0-nightly-987f174ba-241015", | ||
"@react-aria/interactions": "^3.0.0-nightly-993de98ad-241210", | ||
"@react-aria/utils": "^3.0.0-nightly-993de98ad-241210", | ||
"@react-types/shared": "^3.0.0-nightly-993de98ad-241210", | ||
"@swc/helpers": "^0.5.0", | ||
@@ -33,3 +33,3 @@ "clsx": "^2.0.0" | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
@@ -39,3 +39,3 @@ "publishConfig": { | ||
}, | ||
"stableVersion": "3.18.4" | ||
"stableVersion": "3.19.0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
383283
4419