import { default as React } from 'react'; /** * Toast type determines visual styling and ARIA semantics. * - info: Informational messages (role="status", polite) * - success: Success confirmations (role="status", polite) * - warning: Warning messages (role="status", polite) * - error: Error messages (role="alert", assertive) */ export type ToastType = "info" | "success" | "warning" | "error" | "loading"; /** * Toast placement determines position on screen. * Maps to Chakra UI placement values and numpad positions for hotkeys. */ export type ToastPlacement = "top-start" | "top-end" | "bottom-start" | "bottom-end"; /** * Action button configuration for toast. */ export type ToastAction = { /** Label text for the action button */ label: string; /** Press handler for the action button */ onPress: () => void; }; /** * Toast visual variant. * - solid: Bold colored background with contrast text (default) * - subtle: Subtle background with border * - accent-start: Subtle background with a colored accent line on the inline-start edge */ export type ToastVariant = "solid" | "subtle" | "accent-start"; /** * Options for creating a toast notification. */ export type ToastOptions = { /** Toast type determines styling and ARIA role */ type?: ToastType; /** Visual variant (default: "accent-start") */ variant?: ToastVariant; /** Title text */ title: string; /** Description text providing additional context */ description?: string; /** Optional action button */ action?: ToastAction; /** Custom icon element that replaces the default type-based icon */ icon?: React.ReactElement; /** Auto-dismiss duration in milliseconds (default: 6000, Infinity = never) */ duration?: number; /** Placement on screen (default: "top-end") */ placement?: ToastPlacement; /** Whether the close button is visible (default: false) */ closable?: boolean; /** * Override the default `aria-live` politeness level. * By default, `error` toasts use `"assertive"` and all others use `"polite"`. */ "aria-live"?: "polite" | "assertive" | "off"; }; /** * Promise toast configuration for loading/success/error states. */ export type ToastPromiseOptions = { /** Toast options for loading state */ loading: ToastOptions; /** Toast options for success state */ success: ToastOptions; /** Toast options for error state */ error: ToastOptions; }; /** * Internal type representing the toast data object passed by Chakra UI's Toaster * render prop. Only covers the fields accessed by the outlet. */ export type ChakraToastData = { id?: string; type?: string; title?: string; description?: string; action?: { label: string; onClick: () => void; }; meta?: { closable?: boolean; variant?: ToastVariant; icon?: React.ReactElement; "aria-live"?: "polite" | "assertive" | "off"; }; }; /** * Toast manager API for imperative toast control. */ export type ToastManagerApi = { /** Create a toast and return its ID */ create: (options: ToastOptions) => string; /** Update an existing toast */ update: (id: string, options: Partial) => void; /** Dismiss toast(s) with animation */ dismiss: (id?: string) => void; /** Remove toast(s) immediately without animation */ remove: (id?: string) => void; /** Create info toast */ info: (options: Omit) => string; /** Create success toast */ success: (options: Omit) => string; /** Create warning toast */ warning: (options: Omit) => string; /** Create error toast */ error: (options: Omit) => string; /** Create promise toast with loading/success/error states */ promise: (promise: Promise, options: ToastPromiseOptions, config?: Pick) => void; /** Reset manager state (testing only) */ reset: () => void; };