import { TemplateRef } from '@angular/core'; import { MotionOptions } from '@primeuix/motion'; import { PassThroughOption, PassThrough, ToastMessageOptions } 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; } /** * 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'; /** * 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 { ToastCloseEvent, ToastHeadlessTemplateContext, ToastItemCloseEvent, ToastMessageTemplateContext, ToastPassThrough, ToastPassThroughOptions, ToastPositionType, ToastTemplates };