@react-stately/toast
Advanced tools
Comparing version
@@ -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.5042+68403fe55", | ||
"version": "3.0.0-nightly-016590a4a-250131", | ||
"description": "Spectrum UI components in React", | ||
@@ -26,3 +26,3 @@ "license": "Apache-2.0", | ||
"@swc/helpers": "^0.5.0", | ||
"use-sync-external-store": "^1.2.0" | ||
"use-sync-external-store": "^1.4.0" | ||
}, | ||
@@ -33,8 +33,7 @@ "devDependencies": { | ||
"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" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "68403fe55489dce3de1b3094c957d598ad719861" | ||
} | ||
} | ||
} |
@@ -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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
844
1.44%0
-100%65980
-13.44%16
-5.88%