@@ -44,7 +44,7 @@ function getToastClasses(type: string) {
4444function handleToastClick(toastId : string | number ) {
4545 const timer = toastTimers .value .get (toastId );
4646 if (timer ) {
47- clearTimeout ( timer .timeoutId );
47+ timer .stop ( );
4848 toastTimers .value .delete (toastId );
4949 }
5050 toast .dismiss (toastId );
@@ -73,6 +73,7 @@ function createAutoDissmiss(toastId: string | number, type: string, duration?: n
7373 remainingTime: autoDismissDelay ,
7474 startTime ,
7575 originalDuration: autoDismissDelay ,
76+ stop : () => clearTimeout (timeoutId ),
7677 };
7778
7879 toastTimers .value .set (toastId , timer );
@@ -105,6 +106,9 @@ function resumeAutoDissmiss(toastId: string | number) {
105106 toastTimers .value .delete (toastId );
106107 }, timer .remainingTime );
107108
109+ // Update the stop function to reference the new timeoutId
110+ timer .stop = () => clearTimeout (timer .timeoutId );
111+
108112 toastTimers .value .set (toastId , timer );
109113 }
110114}
@@ -148,11 +152,11 @@ watchEffect(() => {
148152 <div
149153 v-for =" activeToast in activeToasts"
150154 :key =" activeToast.id"
151- sc-toast-base bg =" opacity-90"
155+ sc-toast-base bg =" opacity-90 background "
152156 flex =" ~ items-center gap-3"
153157 p-2
154158 transition =" transition-all duration-200 ease-in-out"
155- class =" border rounded-lg cursor-pointer pointer-events-auto select-none hover:opacity-100 hover:scale-103 active:scale-98 bg-background "
159+ class =" border rounded-lg cursor-pointer pointer-events-auto select-none hover:opacity-100 hover:scale-103 active:scale-98"
156160 :class =" getToastClasses(activeToast.type || 'info')"
157161 @click =" handleToastClick(activeToast.id)"
158162 @mouseenter =" pauseAutoDissmiss(activeToast.id)"
0 commit comments