@react-aria/toast
Advanced tools
Comparing version 3.0.0-nightly-a98da553e-241116 to 3.0.0-nightly-b3a4d6c11-241119
@@ -33,3 +33,3 @@ var $f49b2d6c91681304$exports = require("./intlStrings.main.js"); | ||
(0, $ijFUR$react.useEffect)(()=>{ | ||
if (!timer) return; | ||
if (timer == null || timeout == null) return; | ||
timer.reset(timeout); | ||
@@ -36,0 +36,0 @@ return ()=>{ |
@@ -27,3 +27,3 @@ import $7WpW4$intlStringsmodulejs from "./intlStrings.module.js"; | ||
(0, $7WpW4$useEffect)(()=>{ | ||
if (!timer) return; | ||
if (timer == null || timeout == null) return; | ||
timer.reset(timeout); | ||
@@ -30,0 +30,0 @@ return ()=>{ |
@@ -45,3 +45,3 @@ var $f49b2d6c91681304$exports = require("./intlStrings.main.js"); | ||
// If no toast has focus, then don't do anything. | ||
if (focusedToast.current === -1 || state.visibleToasts.length === 0) { | ||
if (focusedToast.current === -1 || state.visibleToasts.length === 0 || !ref.current) { | ||
toasts.current = []; | ||
@@ -48,0 +48,0 @@ prevVisibleToasts.current = state.visibleToasts; |
@@ -39,3 +39,3 @@ import $ckyCP$intlStringsmodulejs from "./intlStrings.module.js"; | ||
// If no toast has focus, then don't do anything. | ||
if (focusedToast.current === -1 || state.visibleToasts.length === 0) { | ||
if (focusedToast.current === -1 || state.visibleToasts.length === 0 || !ref.current) { | ||
toasts.current = []; | ||
@@ -42,0 +42,0 @@ prevVisibleToasts.current = state.visibleToasts; |
{ | ||
"name": "@react-aria/toast", | ||
"version": "3.0.0-nightly-a98da553e-241116", | ||
"version": "3.0.0-nightly-b3a4d6c11-241119", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,13 +25,13 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/i18n": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/interactions": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/landmark": "3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/utils": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-stately/toast": "3.0.0-nightly-a98da553e-241116", | ||
"@react-types/button": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-types/shared": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/i18n": "^3.0.0-nightly-b3a4d6c11-241119", | ||
"@react-aria/interactions": "^3.0.0-nightly-b3a4d6c11-241119", | ||
"@react-aria/landmark": "3.0.0-nightly-b3a4d6c11-241119", | ||
"@react-aria/utils": "^3.0.0-nightly-b3a4d6c11-241119", | ||
"@react-stately/toast": "3.0.0-nightly-b3a4d6c11-241119", | ||
"@react-types/button": "^3.0.0-nightly-b3a4d6c11-241119", | ||
"@react-types/shared": "^3.0.0-nightly-b3a4d6c11-241119", | ||
"@swc/helpers": "^0.5.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" | ||
}, | ||
@@ -38,0 +38,0 @@ "publishConfig": { |
@@ -54,3 +54,3 @@ /* | ||
useEffect(() => { | ||
if (!timer) { | ||
if (timer == null || timeout == null) { | ||
return; | ||
@@ -57,0 +57,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import {AriaLabelingProps, DOMAttributes, RefObject} from '@react-types/shared'; | ||
import {AriaLabelingProps, DOMAttributes, FocusableElement, RefObject} from '@react-types/shared'; | ||
import {focusWithoutScrolling, mergeProps, useLayoutEffect} from '@react-aria/utils'; | ||
@@ -44,8 +44,8 @@ import {getInteractionModality, useFocusWithin, useHover} from '@react-aria/interactions'; | ||
// if they only show one toast at a time. | ||
let toasts = useRef([]); | ||
let toasts = useRef<FocusableElement[]>([]); | ||
let prevVisibleToasts = useRef(state.visibleToasts); | ||
let focusedToast = useRef(null); | ||
let focusedToast = useRef<number | null>(null); | ||
useLayoutEffect(() => { | ||
// If no toast has focus, then don't do anything. | ||
if (focusedToast.current === -1 || state.visibleToasts.length === 0) { | ||
if (focusedToast.current === -1 || state.visibleToasts.length === 0 || !ref.current) { | ||
toasts.current = []; | ||
@@ -55,3 +55,3 @@ prevVisibleToasts.current = state.visibleToasts; | ||
} | ||
toasts.current = [...ref.current.querySelectorAll('[role="alertdialog"]')]; | ||
toasts.current = [...ref.current.querySelectorAll('[role="alertdialog"]')] as FocusableElement[]; | ||
// If the visible toasts haven't changed, we don't need to do anything. | ||
@@ -108,7 +108,7 @@ if (prevVisibleToasts.current.length === state.visibleToasts.length | ||
let lastFocused = useRef(null); | ||
let lastFocused = useRef<FocusableElement | null>(null); | ||
let {focusWithinProps} = useFocusWithin({ | ||
onFocusWithin: (e) => { | ||
state.pauseAll(); | ||
lastFocused.current = e.relatedTarget; | ||
lastFocused.current = e.relatedTarget as FocusableElement; | ||
}, | ||
@@ -115,0 +115,0 @@ onBlurWithin: () => { |
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
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
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
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
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
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
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
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
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
174029
+ Added@react-aria/landmark@3.0.0-nightly-b3a4d6c11-241119(transitive)
+ Added@react-stately/toast@3.0.0-nightly-b3a4d6c11-241119(transitive)
+ Addedreact@19.0.0-rc-fb9a90fa48-20240614(transitive)
- Removed@react-aria/landmark@3.0.0-nightly-a98da553e-241116(transitive)
- Removed@react-stately/toast@3.0.0-nightly-a98da553e-241116(transitive)
Updated@react-aria/interactions@^3.0.0-nightly-b3a4d6c11-241119