@react-stately/toast
Advanced tools
Comparing version 3.0.0-nightly-a98da553e-241116 to 3.0.0-nightly-ab9fd5c68-241122
@@ -27,3 +27,3 @@ export interface ToastStateProps { | ||
/** The current animation state for the toast. */ | ||
animation?: 'entering' | 'queued' | 'exiting'; | ||
animation?: 'entering' | 'queued' | 'exiting' | null; | ||
} | ||
@@ -30,0 +30,0 @@ export interface ToastState<T> { |
@@ -63,3 +63,3 @@ var $pwpJQ$react = require("react"); | ||
key: toastKey, | ||
timer: options.timeout ? new $c995945a643dde76$var$Timer(()=>this.close(toastKey), options.timeout) : null | ||
timer: options.timeout ? new $c995945a643dde76$var$Timer(()=>this.close(toastKey), options.timeout) : undefined | ||
}; | ||
@@ -111,3 +111,6 @@ let low = 0; | ||
})); | ||
this.visibleToasts = prevToasts.concat(toasts).sort((a, b)=>b.priority - a.priority); | ||
this.visibleToasts = prevToasts.concat(toasts).sort((a, b)=>{ | ||
var _b_priority, _a_priority; | ||
return ((_b_priority = b.priority) !== null && _b_priority !== void 0 ? _b_priority : 0) - ((_a_priority = a.priority) !== null && _a_priority !== void 0 ? _a_priority : 0); | ||
}); | ||
} else if (action === 'close' && this.hasExitAnimation) // Cause a rerender to happen for exit animation | ||
@@ -161,2 +164,3 @@ this.visibleToasts = this.visibleToasts.map((t)=>{ | ||
constructor(callback, delay){ | ||
this.startTime = null; | ||
this.remaining = delay; | ||
@@ -163,0 +167,0 @@ this.callback = callback; |
@@ -55,3 +55,3 @@ import {useMemo as $cNx9A$useMemo, useCallback as $cNx9A$useCallback} from "react"; | ||
key: toastKey, | ||
timer: options.timeout ? new $77b352cf12efcf73$var$Timer(()=>this.close(toastKey), options.timeout) : null | ||
timer: options.timeout ? new $77b352cf12efcf73$var$Timer(()=>this.close(toastKey), options.timeout) : undefined | ||
}; | ||
@@ -103,3 +103,6 @@ let low = 0; | ||
})); | ||
this.visibleToasts = prevToasts.concat(toasts).sort((a, b)=>b.priority - a.priority); | ||
this.visibleToasts = prevToasts.concat(toasts).sort((a, b)=>{ | ||
var _b_priority, _a_priority; | ||
return ((_b_priority = b.priority) !== null && _b_priority !== void 0 ? _b_priority : 0) - ((_a_priority = a.priority) !== null && _a_priority !== void 0 ? _a_priority : 0); | ||
}); | ||
} else if (action === 'close' && this.hasExitAnimation) // Cause a rerender to happen for exit animation | ||
@@ -153,2 +156,3 @@ this.visibleToasts = this.visibleToasts.map((t)=>{ | ||
constructor(callback, delay){ | ||
this.startTime = null; | ||
this.remaining = delay; | ||
@@ -155,0 +159,0 @@ this.callback = callback; |
{ | ||
"name": "@react-stately/toast", | ||
"version": "3.0.0-nightly-a98da553e-241116", | ||
"version": "3.0.0-nightly-ab9fd5c68-241122", | ||
"description": "Spectrum UI components in React", | ||
@@ -32,3 +32,3 @@ "license": "Apache-2.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,3 +38,3 @@ "publishConfig": { | ||
}, | ||
"stableVersion": "3.0.0-beta.6" | ||
"stableVersion": "3.0.0-beta.7" | ||
} |
@@ -45,3 +45,3 @@ /* | ||
/** The current animation state for the toast. */ | ||
animation?: 'entering' | 'queued' | 'exiting' | ||
animation?: 'entering' | 'queued' | 'exiting' | null | ||
} | ||
@@ -124,3 +124,3 @@ | ||
key: toastKey, | ||
timer: options.timeout ? new Timer(() => this.close(toastKey), options.timeout) : null | ||
timer: options.timeout ? new Timer(() => this.close(toastKey), options.timeout) : undefined | ||
}; | ||
@@ -178,3 +178,3 @@ | ||
.map(t => ({...t, animation: 'exiting'})); | ||
this.visibleToasts = prevToasts.concat(toasts).sort((a, b) => b.priority - a.priority); | ||
this.visibleToasts = prevToasts.concat(toasts).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0)); | ||
} else if (action === 'close' && this.hasExitAnimation) { | ||
@@ -219,3 +219,3 @@ // Cause a rerender to happen for exit animation | ||
private timerId; | ||
private startTime: number; | ||
private startTime: number | null = null; | ||
private remaining: number; | ||
@@ -241,3 +241,3 @@ private callback: () => void; | ||
this.timerId = null; | ||
this.remaining -= Date.now() - this.startTime; | ||
this.remaining -= Date.now() - this.startTime!; | ||
} | ||
@@ -244,0 +244,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
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
66015
844