import { ToastId, ToastProps } from "@chakra-ui/react"; import { ReactNode } from "react"; /** Picks the icon and accent; "loading" never auto-dismisses unless a duration is passed. */ export type ToasterStatus = "success" | "error" | "warning" | "info" | "loading"; /** Options for showToast(); `children` is dead (never rendered) — pass `description` instead. */ export type ToasterToastProps = Pick & { /** @deprecated Never rendered by showToast; pass `description`. */ children?: ToastProps['children']; /** Defaults to "top-right"; fixed at show time — update() cannot move a toast. */ position?: "top" | "bottom" | "top-right" | "top-left" | "bottom-right" | "bottom-left"; /** Defaults to "info". */ status?: ToasterStatus; /** Auto-dismiss delay in ms; defaults to 5000, or null (stay until closed) for status "loading". */ duration?: number | null; /** * Optional action buttons rendered under the message (Jira-style "View" / * "Copy link" affordances). Receives the toast's own `onClose` so an action * can dismiss the toast. Kept a render-prop so callers style buttons with * their app theme; the Toaster only positions them. */ actions?: (onClose: () => void) => ReactNode; }; /** Shape of the ToasterContext value; useToaster() throws if called outside a mounted ToasterProvider. */ export interface ToasterContextType { /** Shows a toast and returns its id, for a later update() or close(). */ showToast: (children: ToasterToastProps) => ToastId; /** Merges props into a live toast (e.g. loading → success); a new status without a duration re-derives the default. */ update: (id: ToastId, props: Partial) => void; /** Dismisses one toast by id. */ close: (id: ToastId) => void; } /** Props for ToasterProvider — just the app subtree it wraps in the toast context. */ export interface ToasterChildren { children: ReactNode; }