import { TemplateRef } from '@angular/core'; import { MotionOptions } from '@primeuix/motion'; import { ToastMessageOptions, PassThrough, PassThroughOption } from 'primeng/api'; /** * Custom pass-through(pt) options for Toast. * @template I Type of instance. * * @see {@link Toast.pt} * @group Interface */ interface ToastPassThroughOptions { /** * Used to pass attributes to the host's DOM element. */ host?: PassThroughOption; /** * Used to pass attributes to the root's DOM element. */ root?: PassThroughOption; /** * Used to pass attributes to the message's DOM element. */ message?: PassThroughOption; /** * Used to pass attributes to the message content's DOM element. */ messageContent?: PassThroughOption; /** * Used to pass attributes to the message icon's DOM element. */ messageIcon?: PassThroughOption; /** * Used to pass attributes to the message text's DOM element. */ messageText?: PassThroughOption; /** * Used to pass attributes to the summary's DOM element. */ summary?: PassThroughOption; /** * Used to pass attributes to the detail's DOM element. */ detail?: PassThroughOption; /** * Used to pass attributes to the close button's DOM element. */ closeButton?: PassThroughOption; /** * Used to pass attributes to the close icon's DOM element. */ closeIcon?: PassThroughOption; /** * Used to pass options to the motion component/directive. */ motion?: MotionOptions; } /** * Defines valid pass-through options in Toast. * @see {@link ToastPassThroughOptions} * * @template I Type of instance. */ type ToastPassThrough = PassThrough>; /** * Custom message template context. * @group Interface */ interface ToastMessageTemplateContext { /** * Message instance. */ $implicit: ToastMessageOptions | null | undefined; /** * Callback to close this toast. */ closeFn: (event?: Event) => void; } /** * Custom headless template context. * @group Interface */ interface ToastHeadlessTemplateContext { /** * Message instance. */ $implicit: ToastMessageOptions | null | undefined; /** * Callback to close the toast. */ closeFn: (event: Event) => void; } /** * Defines valid templates in Toast. * @group Templates */ interface ToastTemplates { /** * Custom message template. * @param {ToastMessageTemplateContext} context - message context. */ message(context: ToastMessageTemplateContext): TemplateRef; /** * Custom headless template. * @param {ToastHeadlessTemplateContext} context - headless context. */ headless(context: ToastHeadlessTemplateContext): TemplateRef; } /** * Defines the position type for Toast. */ type ToastPositionType = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center'; /** * Defines the layout mode for the Toast. * - `stacked`: toasts collapse into a stack and expand on hover/focus. * - `expanded`: every toast renders expanded; auto-dismiss only pauses while hovered. */ type ToastModeType = 'stacked' | 'expanded'; /** * Breakpoints configuration for responsive Toast styling. * Keys are media query breakpoints (e.g., '960px', '640px'). * Values are CSS style objects. * @group Types */ type ToastBreakpoints = Record>; /** * Custom close event. * @see {@link Toast.onClose} * @group Events */ interface ToastCloseEvent { /** * Message of the closed element. */ message: ToastMessageOptions; } /** * Custom close event. * @see {@link ToastItem.onClose} */ interface ToastItemCloseEvent extends ToastCloseEvent { /** * Index of the closed element. */ index: number; } export type { ToastBreakpoints, ToastCloseEvent, ToastHeadlessTemplateContext, ToastItemCloseEvent, ToastMessageTemplateContext, ToastModeType, ToastPassThrough, ToastPassThroughOptions, ToastPositionType, ToastTemplates };