import { Observable } from 'rxjs'; import * as i0 from '@angular/core'; import { TemplateRef, InjectionToken, Provider } from '@angular/core'; /** * Toast notification type. */ type ComToastType = 'success' | 'warn' | 'error' | 'info'; /** * Toast container position on screen. */ type ComToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center'; /** * Reason a toast was dismissed. */ type ComToastDismissReason = 'auto' | 'manual' | 'action' | 'limit'; /** * Event emitted when a toast is dismissed. */ interface ComToastDismissEvent { /** The reason the toast was dismissed. */ reason: ComToastDismissReason; } /** * Global toast configuration. Provide via `provideComToastConfig()`. */ interface ComToastConfig { /** Screen position of the toast container. Default: `'bottom-right'` */ position?: ComToastPosition; /** Auto-dismiss duration in milliseconds. `0` = no auto-dismiss. Default: `5000` */ duration?: number; /** Maximum visible toasts. Default: `5` */ maxVisible?: number; /** Pause auto-dismiss timer on hover. Default: `true` */ pauseOnHover?: boolean; /** Show progress bar for auto-dismissing toasts. Default: `true` */ showProgress?: boolean; /** Show close button. Default: `true` */ showClose?: boolean; } /** * Data for an individual toast notification. */ interface ComToastData { /** Toast type. Default: `'info'` */ type?: ComToastType; /** Optional title displayed above the message. */ title?: string; /** The toast message. */ message: string; /** Optional action button. */ action?: { label: string; }; /** Lucide icon name override. */ icon?: string; /** Per-toast auto-dismiss duration override (ms). */ duration?: number; /** Per-toast progress bar visibility override. */ showProgress?: boolean; /** Per-toast close button visibility override. */ showClose?: boolean; /** Custom template for the toast content. */ customTemplate?: TemplateRef; } /** * Context provided to custom toast templates. */ interface ComToastTemplateContext { /** The toast data. */ $implicit: ComToastData; /** Function to dismiss the toast. */ dismiss: () => void; /** Function to trigger the action. */ action: () => void; } /** * Reference to an active toast notification. * Returned by `ComToastService` methods for programmatic control. */ declare class ComToastRef { private readonly dismissSubject; private readonly actionSubject; private readonly dismissFn; private dismissed; constructor(dismissFn: () => void); /** Programmatically dismiss the toast. */ dismiss(): void; /** Emits once when the toast is dismissed (for any reason). */ afterDismissed(): Observable; /** Emits when the action button is clicked. */ afterAction(): Observable; /** @internal */ _notifyDismissed(event: ComToastDismissEvent): void; /** @internal */ _notifyAction(): void; } /** * Service for creating toast notifications imperatively. * * @example * ```typescript * const toast = inject(ComToastService); * toast.success('File uploaded successfully.'); * toast.error('Failed to save.', 'Error'); * * const ref = toast.show({ type: 'info', message: 'Item deleted.', action: { label: 'Undo' } }); * ref.afterAction().subscribe(() => undoDelete()); * ``` */ declare class ComToastService { private readonly overlay; private readonly injector; private readonly destroyRef; private readonly platformId; private readonly document; private readonly globalConfig; private overlayRef; private readonly toasts; private readonly position; private readonly timers; private readonly refs; private readonly animationFallbacks; private readonly dismissReasons; private rafHandle; private readonly config; constructor(); /** * Show a toast notification with full configuration. */ show(data: ComToastData): ComToastRef; /** Show a success toast. */ success(message: string, title?: string): ComToastRef; /** Show a warning toast. */ warn(message: string, title?: string): ComToastRef; /** Show an error toast. */ error(message: string, title?: string): ComToastRef; /** Show an info toast. */ info(message: string, title?: string): ComToastRef; /** Dismiss all active toasts. */ dismissAll(): void; private showByType; private ensureContainer; private buildPositionStrategy; private dismiss; private removeToast; private handleAction; private dismissLatest; private enforceMaxVisible; private startTimer; private ensureRafLoop; private pauseTimer; private resumeTimer; private clearTimer; private now; private updateToast; private disposeOverlay; private dispose; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Injection token for global toast configuration. */ declare const COM_TOAST_CONFIG: InjectionToken; /** * Provides global toast configuration. * * @example * ```typescript * bootstrapApplication(AppComponent, { * providers: [ * provideComToastConfig({ position: 'top-center', duration: 3000 }), * ], * }); * ``` */ declare function provideComToastConfig(config: ComToastConfig): Provider; /** * CVA variants for an individual toast card. * * @tokens `--color-success`, `--color-success-foreground`, * `--color-warn`, `--color-warn-foreground`, * `--color-warn-subtle`, `--color-warn-subtle-foreground`, * `--color-primary-subtle`, `--color-primary-subtle-foreground`, * `--color-border`, `--shadow-overlay`, `--radius-card` */ declare const toastVariants: (props?: { type?: ComToastType; }) => string; /** * CVA variants for the toast container positioning. */ declare const toastContainerVariants: (props?: { position?: ComToastPosition; }) => string; /** * CVA variants for the toast progress bar. */ declare const toastProgressVariants: (props?: { type?: ComToastType; }) => string; /** * CVA variants for the toast close button. * * @tokens `--color-ring`, `--radius-card`, * `--color-success-foreground-muted`, `--color-warn-subtle-foreground-muted`, * `--color-warn-foreground-muted`, `--color-primary-subtle-foreground-muted` */ declare const toastCloseButtonVariants: (props?: { type?: ComToastType; }) => string; export { COM_TOAST_CONFIG, ComToastRef, ComToastService, provideComToastConfig, toastCloseButtonVariants, toastContainerVariants, toastProgressVariants, toastVariants }; export type { ComToastConfig, ComToastData, ComToastDismissEvent, ComToastDismissReason, ComToastPosition, ComToastTemplateContext, ComToastType };