import * as i0 from '@angular/core'; import { AfterViewInit, OnDestroy, ElementRef, EventEmitter, ChangeDetectorRef, NgZone, ComponentRef, EmbeddedViewRef, InjectionToken, Injector, TemplateRef } from '@angular/core'; import * as i1 from '@angular/common'; import * as i2 from '@aposin/ng-aquila/icon'; import * as i3 from '@angular/cdk/overlay'; import { OverlayRef, Overlay, OverlayContainer } from '@angular/cdk/overlay'; import * as i4 from '@angular/cdk/portal'; import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal, ComponentType } from '@angular/cdk/portal'; import { FocusMonitor, AriaLivePoliteness, LiveAnnouncer } from '@angular/cdk/a11y'; import { BooleanInput } from '@angular/cdk/coercion'; import { AnimationEvent, AnimationTriggerMetadata } from '@angular/animations'; import { Subject, Observable } from 'rxjs'; /** The contextual type of a message. */ type CONTEXT = 'regular' | 'info' | 'error' | 'success' | 'warning'; declare class NxMessageComponent implements AfterViewInit, OnDestroy { private readonly _cdr; private readonly _focusMonitor; get _isInfo(): boolean; get _isSuccess(): boolean; get _isWarning(): boolean; get _isError(): boolean; _allowedContexts: CONTEXT[]; _closeButton: ElementRef; /** * Sets the context of the message. * The message box will color accordingly. Default: 'regular'. */ set context(value: CONTEXT); get context(): CONTEXT; _context: CONTEXT; /** Whether a message should have a close icon in order to be dismissed. */ set closable(value: BooleanInput); get closable(): boolean; _closable: boolean; /** Sets the label of the close button of the message. */ set closeButtonLabel(value: string); get closeButtonLabel(): string; private _closeButtonLabel; get _iconName(): string; /** Event emitted when the close icon of the message has been clicked. */ readonly closeEvent: EventEmitter; constructor(_cdr: ChangeDetectorRef, _focusMonitor: FocusMonitor); ngAfterViewInit(): void; ngOnDestroy(): void; _emitCloseEvent(): void; _updateContext(value: CONTEXT): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** The contextual type of a message. */ type NxMessageToastContext = 'info' | 'success'; /** * Configuration used when opening a message toast. */ declare class NxMessageToastConfig { /** * The politeness level for the LiveAnnouncer announcement. * * Default: `'polite'`. */ politeness?: AriaLivePoliteness; /** * Message to be announced by the LiveAnnouncer. When opening a toast message without a custom * component or template, the announcement message will default to the specified message. * * Default: `''`. */ announcementMessage?: string; /** * The length of time in milliseconds to wait before automatically dismissing the message toast. * * Default: `3000`. */ duration?: number; /** * Context of the message toast. * * Default: `'info'`. */ context?: NxMessageToastContext; /** Data being injected into the child component. */ data?: D | null; } /** * Needed so that the user text data can be injected in the message toast component. * @docs-private */ declare class NxMessageToastData { readonly data: string; constructor(data: string); } /** * Internal component that wraps user-provided message toast content. * @docs-private */ declare class NxMessageToastComponent extends BasePortalOutlet implements OnDestroy { private readonly _ngZone; private readonly _cdr; /** The message toast configuration. */ config: NxMessageToastConfig; /** Injected data into the notifciation. */ readonly data?: NxMessageToastData | undefined; /** Whether the component has been destroyed. */ private _destroyed; /** The portal outlet inside of this container into which the message toast content will be loaded. */ _portalOutlet: CdkPortalOutlet; /** Subject for notifying that the message toast has exited from view. */ readonly _onExit: Subject; /** Subject for notifying that the message toast has finished entering the view. */ readonly _onEnter: Subject; /** The state of the message toast animations. */ _animationState: string; /** ARIA role for the message toast container. */ _role: 'alert' | 'status' | null; _context: NxMessageToastContext; constructor(_ngZone: NgZone, _cdr: ChangeDetectorRef, /** The message toast configuration. */ config: NxMessageToastConfig, /** Injected data into the notifciation. */ data?: NxMessageToastData | undefined); /** Attach a component portal as content to this message toast container. */ attachComponentPortal(portal: ComponentPortal): ComponentRef; /** Attach a template portal as content to this message toast container. */ attachTemplatePortal(portal: TemplatePortal): EmbeddedViewRef; /** Handle end of animations, updating the state of the notification. */ onAnimationEnd(event: AnimationEvent): void; /** Begin animation of message toast entrance into view. */ enter(): void; /** Begin animation of the message toast exiting from view. */ exit(): void; /** Makes sure the exit callbacks have been invoked when the element is destroyed. */ ngOnDestroy(): void; /** * Removes the element in a microtask. Helps prevent errors where we end up * removing an element which is in the middle of an animation. */ private _completeExit; /** Asserts that no content is already attached to the container. */ private _assertNotAttached; _setAriaLabels(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type BANNER_CONTEXT = 'info' | 'error' | 'warning'; declare class NxMessageBannerComponent extends NxMessageComponent { /** * Sets the context of the message banner. The message box will color accordingly. * * Default: `'info'`. */ set context(value: BANNER_CONTEXT); get context(): BANNER_CONTEXT; _context: CONTEXT; _closable: boolean; _allowedContexts: CONTEXT[]; constructor(_cdr: ChangeDetectorRef, _fm: FocusMonitor); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class NxMessageModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare class NxMessageToastRef { /** * The instance of the component making up the content of the message toast. * @docs-private */ toastInstance: NxMessageToastComponent; private readonly _overlayRef; private readonly _componentRef; /** Subject for notifying the user that the message toast has been dismissed. */ private readonly _afterDismissed; /** Subject for notifying the user that the message toast has opened and appeared. */ private readonly _afterOpened; /** * Timeout ID for the duration setTimeout call. Used to clear the timeout if the message toast is * dismissed before the duration passes. */ private _durationTimeoutId; constructor( /** * The instance of the component making up the content of the message toast. * @docs-private */ toastInstance: NxMessageToastComponent, _overlayRef: OverlayRef, _componentRef: ComponentRef); /** Dismisses the message toast. */ dismiss(): void; /** Dismisses the message toast after some duration */ _dismissAfter(duration: number): void; /** Marks the message toast as opened */ _open(): void; /** Cleans up the DOM after closing. */ private _finishDismiss; /** Gets an observable that is notified when the message toast is finished closing. */ afterDismissed(): Observable; /** Gets an observable that is notified when the message toast has opened and appeared. */ afterOpened(): Observable; } /** Injection token that can be used to specify default message toast. */ declare const NX_MESSAGE_TOAST_DEFAULT_CONFIG: InjectionToken>; /** Injection token that can be used to access the data that was passed in to a message toast. */ declare const NX_MESSAGE_TOAST_COMPONENT_DATA: InjectionToken; /** A service for dispatching and displaying toast messages. */ declare class NxMessageToastService implements OnDestroy { private readonly _overlay; private readonly _overlayContainer; private readonly _injector; private readonly _live; private readonly _parentMessageToastService; private readonly _defaultConfig; /** * Reference to the current message toast in the view *at this level* (in the Angular injector tree). * If there is a parent message toast service, all operations should delegate to that parent * via `_oldToastMessageRef`. */ private _toastRefAtThisLevel; set _oldToastMessageRef(value: NxMessageToastRef | null); /** Reference to the currently opened message toast at *any* level. */ get _oldToastMessageRef(): NxMessageToastRef | null; constructor(_overlay: Overlay, _overlayContainer: OverlayContainer, _injector: Injector, _live: LiveAnnouncer, _parentMessageToastService: NxMessageToastService | null, _defaultConfig: NxMessageToastConfig | null); /** * Initializes the wrapper element for toast message in the overlay container. * Create a wrapper with ARIA attributes for accessibility */ private _initializeWrapper; /** * Creates and dispatches a message toast with a custom text. * @param text Text to be used for the message toast. * @param config Extra configuration for the message toast. */ open(text: string, config?: NxMessageToastConfig): NxMessageToastRef; /** * Creates and dispatches a message toast with a custom template for the content. * @param template Template to be used for the message toast. * @param config Extra configuration for the message toast. */ openFromTemplate(template: TemplateRef, config?: NxMessageToastConfig): NxMessageToastRef; /** * Creates and dispatches a message toast using a component for the content. * @param component Component to be used for the message toast. * @param config Extra configuration for the message toast. */ openFromComponent(component: ComponentType, config?: NxMessageToastConfig): NxMessageToastRef; private _attachToastComponent; private _createOverlay; /** Animates the old message toast out and the new one in. */ private _animateToast; private _createInjector; /** * Dismisses the currently visible message toast. */ dismiss(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Animations used by the Message Toast. * @docs-private */ declare const messageToastAnimations: { toastState: AnimationTriggerMetadata; }; /** @docs-private */ type NxMessageToastAnimationState = 'void' | 'visible' | 'hidden'; export { NX_MESSAGE_TOAST_COMPONENT_DATA, NX_MESSAGE_TOAST_DEFAULT_CONFIG, NxMessageBannerComponent, NxMessageComponent, NxMessageModule, NxMessageToastComponent, NxMessageToastConfig, NxMessageToastData, NxMessageToastRef, NxMessageToastService, messageToastAnimations }; export type { BANNER_CONTEXT, CONTEXT, NxMessageToastAnimationState, NxMessageToastContext };