/*! Strand UI | MIT License | dillingerstaffing.com */
import type { ComponentChildren, JSX } from "preact";
export type ToastStatus = "info" | "success" | "warning" | "error";
export interface ToastOptions {
message: string;
status?: ToastStatus;
/** Milliseconds before auto-dismiss; 0 keeps it until dismissed. */
duration?: number;
}
interface ToastContextValue {
/** Shows a toast and returns its id. */
toast: (options: ToastOptions) => number;
/** Removes the toast with that id, if it is still showing. */
dismiss: (id: number) => void;
}
/** The `toast()` function of the nearest `ToastProvider`. */
export declare function useToast(): ToastContextValue;
export interface ToastProviderProps {
children?: ComponentChildren;
className?: string;
/** How many toasts show at once; the oldest leaves when a new one arrives past it. Unbounded by default. */
maxCount?: number;
/** Auto-dismiss waits while the pointer or focus is on a toast (WCAG 2.2.1). */
pauseOnHover?: boolean;
}
/**
* Manages the toasts of its subtree.
*
* @example
*
* const { toast, dismiss } = useToast(); const id = toast({ message: "Saved", status: "success" });
*/
export declare const ToastProvider: {
({ children, className, maxCount, pauseOnHover }: ToastProviderProps): JSX.Element;
displayName: string;
};
export interface ToastProps extends Omit, "status"> {
status?: ToastStatus;
message: string;
/** Renders the dismiss control. */
onDismiss?: () => void;
}
/**
* Standalone notification message.
*
* @example
*
*/
export declare const Toast: import("preact").FunctionalComponent & {
ref?: import("preact").Ref | undefined;
}>;
export {};
//# sourceMappingURL=Toast.d.ts.map