UNPKG

react-toast-kit

Version:

A modern, accessible toast notification system for React applications with automatic CSS injection

99 lines (94 loc) 3.83 kB
import { T as ToastTheme, a as ToastPosition, b as ToastAnimation, c as ToastStyle, P as ProgressBarStyle, d as Toast, e as ToastPlugin } from './toast-Bt1UHpOE.cjs'; export { C as CustomAnimation, S as StrictToastOptions, i as ToastOptions, j as ToastVariant, h as cleanup, r as registerPlugin, f as toast, g as unregisterPlugin, u as useToastStore } from './toast-Bt1UHpOE.cjs'; import * as React from 'react'; import 'zustand'; interface ToastProviderProps { children: React.ReactNode; theme?: ToastTheme; position?: ToastPosition; maxToasts?: number; defaultAnimation?: ToastAnimation; defaultStyle?: ToastStyle; defaultDuration?: number; defaultDismissible?: boolean; defaultPauseOnHover?: boolean; defaultDismissOnClick?: boolean; defaultProgressBarStyle?: ProgressBarStyle; defaultProgressBarColor?: string; defaultProgressBarPosition?: 'top' | 'bottom' | 'left' | 'right'; defaultProgressBarThickness?: number; defaultProgressAnimation?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring'; defaultFloating?: boolean; defaultRippleEffect?: boolean; defaultSwipeToDismiss?: boolean; defaultPriority?: 'low' | 'normal' | 'high'; defaultStagger?: number; containerClassName?: string; topOffset?: number; bottomOffset?: number; leftOffset?: number; rightOffset?: number; enableAccessibleAnnouncements?: boolean; enableDevMode?: boolean; enableDevTools?: boolean; suppressHydrationWarning?: boolean; globalClassName?: string; globalStyle?: React.CSSProperties; } interface ToastProviderContext { theme: ToastTheme; effectiveTheme: 'light' | 'dark'; position: ToastPosition; maxToasts: number; defaultAnimation: ToastAnimation; defaultStyle: ToastStyle; defaultDuration: number; defaultDismissible: boolean; defaultPauseOnHover: boolean; defaultDismissOnClick: boolean; defaultProgressBarStyle?: ProgressBarStyle; defaultProgressBarColor?: string; defaultProgressBarPosition: 'top' | 'bottom' | 'left' | 'right'; defaultProgressBarThickness: number; defaultProgressAnimation: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring'; defaultFloating: boolean; defaultRippleEffect: boolean; defaultSwipeToDismiss: boolean; defaultPriority: 'low' | 'normal' | 'high'; defaultStagger: number; globalClassName?: string; globalStyle?: React.CSSProperties; } declare const ToastProviderContext: React.Context<ToastProviderContext | null>; declare const ToastProvider: React.FC<ToastProviderProps>; declare const useToastProvider: () => ToastProviderContext; /** * Hook to access toast functionality * Provides a convenient way to access toast functions and state */ declare const useToast: () => { toasts: Toast[]; theme: ToastTheme; effectiveTheme: "light" | "dark"; maxToasts: number; plugins: ToastPlugin[]; addToast: (toast: Toast) => string; removeToast: (id: string) => void; updateToast: (id: string, toast: Partial<Toast>) => void; clearAllToasts: () => void; pauseToast: (id: string) => void; resumeToast: (id: string) => void; setTheme: (theme: ToastTheme) => void; setMaxToasts: (max: number) => void; registerPlugin: (plugin: ToastPlugin) => void; unregisterPlugin: (name: string) => void; getToastById: (id: string) => Toast | undefined; hasToasts: () => boolean; stats: { total: number; byVariant: Record<string, number>; byPosition: Record<ToastPosition, number>; }; }; declare const injectCSS: () => void; export { ProgressBarStyle, Toast, ToastAnimation, ToastPlugin, ToastPosition, ToastProvider, ToastStyle, ToastTheme, injectCSS, useToast, useToastProvider };