UNPKG

react-cool-toast

Version:

A lightweight, customizable toast notification library for React

42 lines (41 loc) 2.54 kB
import { ToastOptions } from './types'; declare let addToast: ((_toast: Omit<import('./types').Toast, 'id' | 'createdAt'>) => string) | null; declare let removeToast: ((_id: string) => void) | null; declare let updateToast: ((_id: string, _updates: Partial<import('./types').Toast>) => void) | null; declare let clearToasts: (() => void) | null; export declare const setToastFunctions: (functions: { addToast: typeof addToast; removeToast: typeof removeToast; updateToast: typeof updateToast; clearToasts: typeof clearToasts; enableSounds?: boolean; }) => void; export declare const toast: { (message: string | React.ReactNode, options?: ToastOptions): string; success(message: string | React.ReactNode, options?: Omit<ToastOptions, "type">): string; error(message: string | React.ReactNode, options?: Omit<ToastOptions, "type">): string; warning(message: string | React.ReactNode, options?: Omit<ToastOptions, "type">): string; info(message: string | React.ReactNode, options?: Omit<ToastOptions, "type">): string; loading(message: string | React.ReactNode, options?: Omit<ToastOptions, "type">): string; promise<T>(promise: Promise<T>, messages: { loading: string | React.ReactNode; success: string | React.ReactNode | ((_data: T) => string | React.ReactNode); error: string | React.ReactNode | ((_error: any) => string | React.ReactNode); }, options?: Omit<ToastOptions, "type" | "duration">): Promise<T>; dismiss(id: string): void; dismissAll(): void; custom(message: string | React.ReactNode, options?: ToastOptions): string; action(message: string | React.ReactNode, actions: Array<{ label: string; onClick: () => void; style?: "primary" | "secondary" | "danger"; }>, options?: Omit<ToastOptions, "actions">): string; rich(message: string | React.ReactNode, options?: Omit<ToastOptions, "richContent">): string; silent(message: string | React.ReactNode, options?: Omit<ToastOptions, "sound">): string; progress(message: string | React.ReactNode, options?: Omit<ToastOptions, "showProgress">): string; glass(message: string | React.ReactNode, options?: Omit<ToastOptions, "theme">): string; neon(message: string | React.ReactNode, options?: Omit<ToastOptions, "theme">): string; minimal(message: string | React.ReactNode, options?: Omit<ToastOptions, "theme">): string; colorful(message: string | React.ReactNode, options?: Omit<ToastOptions, "theme">): string; }; export default toast;