From 8fc6d2118ca969f1de2c389729085751e1d38c0d Mon Sep 17 00:00:00 2001 From: Pedro Laxe Date: Tue, 17 Feb 2026 20:00:10 -0300 Subject: [PATCH 1/2] feat: adding dimiss --- src/sileo.tsx | 11 ++++++++++- src/toast.tsx | 1 + src/types.ts | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sileo.tsx b/src/sileo.tsx index 0a7336f..4929813 100644 --- a/src/sileo.tsx +++ b/src/sileo.tsx @@ -68,6 +68,7 @@ interface SileoProps { onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; onDismiss?: () => void; + dismiss?: boolean; } /* ---------------------------------- Icons --------------------------------- */ @@ -136,6 +137,7 @@ export const Sileo = memo(function Sileo({ onMouseEnter, onMouseLeave, onDismiss, + dismiss, }: SileoProps) { const next: View = useMemo( () => ({ title, description, state, icon, styles, button, fill }), @@ -542,6 +544,13 @@ export const Sileo = memo(function Sileo({ if (exiting || !onDismiss) return; const target = e.target as HTMLElement; if (target.closest("[data-sileo-button]")) return; + + // Se dismiss estiver habilitado, fecha o toast ao clicar + if (dismiss) { + onDismiss(); + return; + } + pointerStartRef.current = e.clientY; e.currentTarget.setPointerCapture(e.pointerId); const el = buttonRef.current; @@ -551,7 +560,7 @@ export const Sileo = memo(function Sileo({ el.addEventListener("pointerup", h.onUp, { passive: true }); } }, - [exiting, onDismiss], + [exiting, onDismiss, dismiss], ); /* --------------------------------- Render --------------------------------- */ diff --git a/src/toast.tsx b/src/toast.tsx index 9256a98..e9b61fb 100644 --- a/src/toast.tsx +++ b/src/toast.tsx @@ -423,6 +423,7 @@ export function Toaster({ onMouseEnter={h.enter} onMouseLeave={h.leave} onDismiss={h.dismiss} + dismiss={item.dismiss} /> ); })} diff --git a/src/types.ts b/src/types.ts index 0e51f43..4092969 100644 --- a/src/types.ts +++ b/src/types.ts @@ -42,4 +42,5 @@ export interface SileoOptions { roundness?: number; autopilot?: boolean | { expand?: number; collapse?: number }; button?: SileoButton; + dismiss?: boolean; } From 2057532a76ce7616876e70081f387ce7aa090a9e Mon Sep 17 00:00:00 2001 From: Pedro Laxe Date: Tue, 17 Feb 2026 20:04:50 -0300 Subject: [PATCH 2/2] Remove comment for toast dismiss Remove comment about dismissing toast on click --- src/sileo.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sileo.tsx b/src/sileo.tsx index 4929813..73d3c21 100644 --- a/src/sileo.tsx +++ b/src/sileo.tsx @@ -545,7 +545,6 @@ export const Sileo = memo(function Sileo({ const target = e.target as HTMLElement; if (target.closest("[data-sileo-button]")) return; - // Se dismiss estiver habilitado, fecha o toast ao clicar if (dismiss) { onDismiss(); return;