import * as solid_js from 'solid-js'; import { JSX } from 'solid-js'; type ToastTypes = 'normal' | 'action' | 'success' | 'info' | 'warning' | 'error' | 'loading' | 'default'; type PromiseT = Promise | (() => Promise); type ToastContent = (() => JSX.Element) | JSX.Element; interface PromiseIExtendedResult extends ExternalToast { message: JSX.Element | string; } type PromiseTExtendedResult = PromiseIExtendedResult | ((data: Data) => PromiseIExtendedResult | Promise); type PromiseTResult = string | JSX.Element | ((data: Data) => JSX.Element | string | Promise); type PromiseExternalToast = Omit; type PromiseData = PromiseExternalToast & { loading?: string | JSX.Element; success?: PromiseTResult | PromiseTExtendedResult; error?: PromiseTResult | PromiseTExtendedResult; description?: PromiseTResult; finally?: () => void | Promise; }; interface ToastClassnames { toast?: string; title?: string; description?: string; loader?: string; closeButton?: string; cancelButton?: string; actionButton?: string; success?: string; error?: string; info?: string; warning?: string; loading?: string; default?: string; content?: string; icon?: string; } interface ToastIcons { success?: JSX.Element | null; info?: JSX.Element | null; warning?: JSX.Element | null; error?: JSX.Element | null; loading?: JSX.Element | null; close?: JSX.Element | null; } interface Action { label: JSX.Element; onClick: (event: MouseEvent) => void; actionButtonStyle?: JSX.CSSProperties; } interface ToastT { id: number | string; toasterId?: string; title?: ToastContent; type?: ToastTypes; icon?: JSX.Element | null; jsx?: JSX.Element; richColors?: boolean; invert?: boolean; closeButton?: boolean; dismissible?: boolean; description?: ToastContent; duration?: number; delete?: boolean; action?: Action | JSX.Element; cancel?: Action | JSX.Element; onDismiss?: (toast: ToastT) => void; onAutoClose?: (toast: ToastT) => void; promise?: PromiseT; cancelButtonStyle?: JSX.CSSProperties; actionButtonStyle?: JSX.CSSProperties; style?: JSX.CSSProperties; unstyled?: boolean; className?: string; classNames?: ToastClassnames; descriptionClassName?: string; position?: Position; testId?: string; class?: string; classes?: ToastClassnames; descriptionClass?: string; } type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center'; interface ToastOptions { className?: string; closeButton?: boolean; descriptionClassName?: string; style?: JSX.CSSProperties; cancelButtonStyle?: JSX.CSSProperties; actionButtonStyle?: JSX.CSSProperties; duration?: number; unstyled?: boolean; classNames?: ToastClassnames; closeButtonAriaLabel?: string; toasterId?: string; class?: string; classes?: ToastClassnames; descriptionClass?: string; } type Offset = { top?: string | number; right?: string | number; bottom?: string | number; left?: string | number; } | string | number; type SwipeDirection = 'top' | 'right' | 'bottom' | 'left'; interface ToasterProps { id?: string; invert?: boolean; theme?: 'light' | 'dark' | 'system'; position?: Position; hotkey?: string[]; richColors?: boolean; expand?: boolean; duration?: number; gap?: number; visibleToasts?: number; closeButton?: boolean; toastOptions?: ToastOptions; className?: string; style?: JSX.CSSProperties; offset?: Offset; mobileOffset?: Offset; dir?: 'rtl' | 'ltr' | 'auto'; swipeDirections?: SwipeDirection[]; icons?: ToastIcons; customAriaLabel?: string; containerAriaLabel?: string; pauseWhenPageIsHidden?: boolean; class?: string; } interface ToastToDismiss { id: number | string; dismiss: boolean; } type ExternalToast = Omit & { id?: number | string; toasterId?: string; }; declare function toastFunction(message: ToastContent, data?: ExternalToast): string | number; declare const toast: typeof toastFunction & { success: (message: ToastContent, data?: ExternalToast) => string | number; info: (message: ToastContent, data?: ExternalToast) => string | number; warning: (message: ToastContent, data?: ExternalToast) => string | number; error: (message: ToastContent, data?: ExternalToast) => string | number; custom: (jsx: (id: number | string) => JSX.Element, data?: ExternalToast) => string | number; message: (message: ToastContent, data?: ExternalToast) => string | number; promise: (promise: PromiseT, data?: PromiseData | undefined) => { unwrap: () => Promise; } | undefined; dismiss: (id?: number | string) => string | number | undefined; loading: (message: ToastContent, data?: ExternalToast) => string | number; } & { getHistory: () => (ToastT | ToastToDismiss)[]; getToasts: () => ToastT[]; }; declare function useSonner(): { toasts: solid_js.Accessor; }; declare function Toaster(props: ToasterProps): JSX.Element; export { type Action, type ExternalToast, type ToastClassnames, type ToastT, type ToastToDismiss, Toaster, type ToasterProps, toast, useSonner };