react-epic-trails-ds
Version:
A flexible and customizable design system for React, providing pre-built UI components, typography, and themes to enhance web app development.
48 lines (39 loc) • 1.34 kB
text/typescript
import { ReactNode } from "react";
export interface ToastProviderProps {
children: ReactNode;
}
export interface ToastContainerProps {
toasts: Toast[];
onDismiss: (id: string) => void;
}
export interface PositionGroupProps {
position: ToastPosition;
toasts: Toast[];
onDismiss: (id: string) => void;
}
export type ToastType = 'success' | 'error' | 'info' | 'warning';
export type ToastPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
export interface ToastOptions {
duration?: number;
position?: ToastPosition;
closable?: boolean;
onClose?: () => void;
}
export interface Toast {
id: string;
message: string;
type: ToastType;
duration: number;
position: ToastPosition;
closable: boolean;
onClose?: () => void;
}
export interface ToastContextProps {
showToast: (message: string, type?: ToastType, options?: ToastOptions) => string;
success: (message: string, options?: ToastOptions) => string;
error: (message: string, options?: ToastOptions) => string;
info: (message: string, options?: ToastOptions) => string;
warning: (message: string, options?: ToastOptions) => string;
dismiss: (id: string) => void;
dismissAll: () => void;
}