import { ReactNode, Dispatch } from 'react'; import { IconType } from '../Icon'; import { ALinkProps, ButtonLinkProps } from '../Link'; export interface SimpleToast { readonly label: string; readonly message?: string; readonly onClose?: (id: ToastId) => void; readonly duration?: number; readonly hasCloseButton?: boolean; } export interface ActionToast extends SimpleToast { readonly action: { readonly icon: IconType; readonly text: string; readonly link: ButtonLinkProps | ALinkProps; }; } export interface ProgressToast extends SimpleToast { readonly progress: { readonly value: number; readonly label: string; }; } export declare type ToastsMap = ReadonlyMap; export declare type ShowToastHandler = (toast: BaseToastValue, id?: ToastId) => ToastId; export declare type HideToastHandler = (id: ToastId) => void; export declare type SimpleToastCreator = (toast: SimpleToast, id?: ToastId) => ToastId; export declare type ActionToastCreator = (toast: ActionToast, id?: ToastId) => ToastId; export declare type ProgressToastCreator = (toast: ProgressToast, id?: ToastId) => ToastId; export interface ToastCallbacks { readonly showToast: ShowToastHandler; readonly hideToast: HideToastHandler; readonly clearToasts: () => void; readonly showSuccessToast: SimpleToastCreator; readonly showErrorToast: SimpleToastCreator; readonly showWarningToast: SimpleToastCreator; readonly showInfoToast: SimpleToastCreator; readonly showLoadingToast: SimpleToastCreator; readonly showProgressToast: ProgressToastCreator; readonly showActionToast: ActionToastCreator; } export interface BaseToastValue { readonly icon: ReactNode; readonly label: ReactNode; readonly message?: ReactNode; readonly duration?: number; readonly hasCloseButton?: boolean; readonly onClose?: (id: ToastId) => void; } export declare enum ToastActionType { TOAST_CREATE = 0, TOAST_REMOVE = 1, TOAST_REMOVE_ALL = 2 } export declare type ToastId = string; export interface ToastCreateAction { readonly id: ToastId; readonly type: ToastActionType.TOAST_CREATE; readonly data: BaseToastValue; } export interface ToastRemoveAction { readonly id: ToastId; readonly type: ToastActionType.TOAST_REMOVE; } export interface ToastRemoveAllAction { readonly type: ToastActionType.TOAST_REMOVE_ALL; } export declare type ToastAction = ToastCreateAction | ToastRemoveAction | ToastRemoveAllAction; export declare const NI: () => never; export interface ToastContextType extends ToastCallbacks { readonly dispatch: Dispatch; readonly toasts: ToastsMap; } export declare const ToastsContext: import("react").Context;