import * as i0 from '@angular/core'; import { InjectionToken, EventEmitter, OnInit, OnDestroy, QueryList, ComponentRef } from '@angular/core'; import { Overlay, ScrollStrategyOptions, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; declare const TOASTER_CONFIG: InjectionToken; declare class ToasterConfig { /** * Status chooses color scheme for the toast. * */ type: string; /** * Duration is timeout between toast appears and disappears. 0 keeps the toast indefinitely on the screen * */ duration: number; /** * Determines where on the screen toast have to be rendered. * */ position: ToastPosition; /** * Destroy by click means you can hide the toast by clicking it. * */ destroyByClick: boolean; constructor(config: Partial); } declare class Toast { message: string; config: ToasterConfig; } declare enum ToastType { SUCCESS = "success", ERROR = "error", WARNING = "warning", INFO = "info" } declare enum ToastLogicalPosition { TOP_START = "top-start", TOP_END = "top-end", BOTTOM_START = "bottom-start", BOTTOM_END = "bottom-end" } declare enum ToastPhysicalPosition { TOP_RIGHT = "top-right", TOP_LEFT = "top-left", BOTTOM_RIGHT = "bottom-right", BOTTOM_LEFT = "bottom-left" } type ToastPosition = ToastPhysicalPosition | ToastLogicalPosition; declare class ToasterComponent { toast: Toast; destroy: EventEmitter; get success(): boolean; get info(): boolean; get warning(): boolean; get primary(): boolean; get destroyByClick(): boolean; onClick(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ToasterContainerComponent implements OnInit, OnDestroy { content: Toast[]; toasts: QueryList; fadeIn: any; constructor(); ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ToasterRef { private toasterContainer; private toast; constructor(toasterContainer: ToasterContainer, toast: Toast); close(): void; } declare class ToasterContainerOverlayService { private overlay; constructor(overlay: Overlay); get scrollStrategies(): ScrollStrategyOptions; create(config?: OverlayConfig): OverlayRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ToasterContainer { protected position: ToastPosition; protected containerRef: ComponentRef; protected toasts: Toast[]; protected prevToast: Toast | null; get nativeElement(): any; constructor(position: ToastPosition, containerRef: ComponentRef); attach(toast: Toast): ToasterRef; destroy(toast: Toast): void; private attachToast; private attachToTop; private setDestroyTimeout; private subscribeOnClick; private updateContainer; } declare function patch(container: ComponentRef, containerContext: Object): ComponentRef; declare class ToasterContainerRegistry { private overlay; private overlayService; private document; private overlays; constructor(overlay: Overlay, overlayService: ToasterContainerOverlayService, document: any); get(position: ToastPosition): ToasterContainer; private instantiateContainer; private createContainer; private existsInDom; private toLogicalPosition; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * The `ToasterService` provides a capability to build toast notifications. * * `ToasterService.show(message, config)` accepts two params, config is optional. * * ### Import * * Import `ToasterModule` to your app module. * ```ts * @NgModule({ * imports: [ * // ... * ToasterModule, * ], * }) * export class AppModule { } * ``` * * ### Usage * * Calling `ToasterService.show(...)` will render new toast and return `ToasterRef` with * help of which you may close newly created toast by calling `close` method. * * ```ts * const toastRef: ToasterRef = this.toasterService.show(...); * toastRef.close(); * ``` * * Config accepts following options: * * `type` - coloring and icon of the toast. * Default is `info`. * * `duration` - the time after which the toast will be destroyed. * `0` means endless toast, that may be destroyed by click only. * Default is 3000 ms. * * `position` - determines where on the screen toast will be rendered. * Default is `top-end`, hardcoded for now. * * `destroyByClick` - provides a capability to destroy toast by click. * Default is true. * */ declare class ToasterService { private globalConfig; private containerRegistry; constructor(globalConfig: ToasterConfig, containerRegistry: ToasterContainerRegistry); /** * Shows toast with message and user config. * */ show(message: string, userConfig?: Partial): ToasterRef; /** * Shows success toast with message, title and user config. * */ success(message: string, config?: Partial): ToasterRef; /** * Shows error toast with message, title and user config. * */ error(message: string, config?: Partial): ToasterRef; /** * Shows warning toast with message, title and user config. * */ warning(message: string, config?: Partial): ToasterRef; /** * Shows info toast with message, title and user config. * */ info(message: string, config?: Partial): ToasterRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { TOASTER_CONFIG, Toast, ToastLogicalPosition, ToastPhysicalPosition, ToastType, ToasterComponent, ToasterConfig, ToasterContainer, ToasterContainerComponent, ToasterContainerOverlayService, ToasterContainerRegistry, ToasterRef, ToasterService, patch }; export type { ToastPosition };