{"version":3,"file":"nw-style-guide-toasts.mjs","sources":["../../../projects/nw-style-guide/toasts/Toast.ts","../../../projects/nw-style-guide/toasts/toast-announcer.ts","../../../projects/nw-style-guide/toasts/toasts.component.ts","../../../projects/nw-style-guide/toasts/config.ts","../../../projects/nw-style-guide/toasts/toasts.service.ts","../../../projects/nw-style-guide/toasts/IToast.ts","../../../projects/nw-style-guide/toasts/public-api.ts","../../../projects/nw-style-guide/toasts/nw-style-guide-toasts.ts"],"sourcesContent":["import { TemplateRef } from '@angular/core';\nimport { IToast } from './IToast';\n\nexport class Toast implements IToast {\n    message: string | TemplateRef<any>;\n    typeId: string;\n    isDismissable?: boolean;\n    autoDismiss?: boolean = true;\n    dismissTimeout?: number = 3000;\n    size?: 'md';\n\n    constructor(options: IToast) {\n        Object.assign(this, options);\n    }\n}\n","import { DOCUMENT, Injectable, OnDestroy, inject } from '@angular/core';\n/**\n * Announces toasts from persistent body-level live regions rather than from a role on the toast.\n * The toast enters the DOM with its content, too late to be announced reliably, and an open\n * `aria-modal` dialog hides it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ToastAnnouncer implements OnDestroy {\n    private _document = inject(DOCUMENT);\n\n    private _politeRegion: HTMLElement;\n    private _assertiveRegion: HTMLElement;\n    private _dialogRegion: HTMLElement;\n    private _announceTimer: ReturnType<typeof setTimeout>;\n    private _dialogWaitTimer: ReturnType<typeof setTimeout>;\n    private _lastAnnounced = '';\n\n    announce(message: string, typeId: string): void {\n        if (!message) {\n            return;\n        }\n        this._cancelPending();\n\n        if (!this._getOpenDialog()) {\n            this._writeMessageToRegion(message, this._getRegion(typeId));\n            return;\n        }\n        this._announceAfterDialogCloses(message, typeId);\n    }\n\n    /**\n     * A toast is usually shown just before its dialog closes, so the announcement waits long enough\n     * for that to happen and then looks again. A dialog still open by then is one the user is being\n     * kept in — an error to correct — and is announced from inside.\n     */\n    private _announceAfterDialogCloses(message: string, typeId: string): void {\n        const DIALOG_WAIT_TIMEOUT = 500;\n\n        this._dialogWaitTimer = setTimeout(() => {\n            const dialog = this._getOpenDialog();\n            const region = dialog ? this._getDialogRegion(dialog) : this._getRegion(typeId);\n\n            this._writeMessageToRegion(message, region);\n        }, DIALOG_WAIT_TIMEOUT);\n    }\n\n    private _writeMessageToRegion(message: string, region: HTMLElement): void {\n        // The text cannot land in the same task the region does, or the two arrive as one change and\n        // nothing is announced. 100ms matches the CDK's `LiveAnnouncer`\n        const ANNOUNCE_DELAY = 100;\n        const text = this._distinguishFromLast(message);\n\n        this._announceTimer = setTimeout(() => (region.textContent = text), ANNOUNCE_DELAY);\n    }\n\n    /**\n     * A screen reader drops an update whose text matches what it has just announced, so clicking\n     * the same action twice would be heard once. Padding alternates on and off, which is enough to\n     * make each write a new string; comparing against the padded text keeps it self-correcting.\n     */\n    private _distinguishFromLast(message: string): string {\n        // A non-breaking space is not spoken, and unlike a plain space it is not normalised away —\n        // which would collapse the padded and unpadded messages back into the same string\n        const PADDING = ' ';\n        this._lastAnnounced = this._lastAnnounced === message ? message + PADDING : message;\n\n        return this._lastAnnounced;\n    }\n\n    private _getOpenDialog(): Element | undefined {\n        const dialogs = this._document.querySelectorAll('[aria-modal=\"true\"]');\n\n        // Overlays stack in DOM order, so the last one is the topmost\n        return dialogs[dialogs.length - 1];\n    }\n\n    /**\n     * Always an `alert`, even for a success: a polite region inside a dialog is not reliably\n     * announced, and interrupting beats staying silent. Recreated so it lands in the current dialog.\n     */\n    private _getDialogRegion(dialog: Element): HTMLElement {\n        this._dialogRegion?.remove();\n        this._dialogRegion = this._createRegion('alert', dialog);\n\n        return this._dialogRegion;\n    }\n\n    /**\n     * Built on first use and kept, so an app that only shows one type never grows the other region.\n     * It is still attached before the message is written, which is what the announce delay is for.\n     */\n    private _getRegion(typeId: string): HTMLElement {\n        if (typeId === 'error') {\n            return (this._assertiveRegion ??= this._createRegion('alert'));\n        }\n\n        return (this._politeRegion ??= this._createRegion('status'));\n    }\n\n    private _createRegion(role: string, host: Element = this._document.body): HTMLElement {\n        const region = this._document.createElement('div');\n\n        region.setAttribute('role', role);\n        region.setAttribute('aria-live', role === 'alert' ? 'assertive' : 'polite');\n        region.setAttribute('aria-atomic', 'true');\n        region.classList.add('sr-only');\n        host.appendChild(region);\n\n        return region;\n    }\n\n    private _cancelPending(): void {\n        clearTimeout(this._announceTimer);\n        clearTimeout(this._dialogWaitTimer);\n    }\n\n    ngOnDestroy(): void {\n        this._cancelPending();\n        this._politeRegion?.remove();\n        this._assertiveRegion?.remove();\n        this._dialogRegion?.remove();\n    }\n}\n","import {\n    ChangeDetectionStrategy,\n    ChangeDetectorRef,\n    Component,\n    DOCUMENT,\n    ElementRef,\n    QueryList,\n    TemplateRef,\n    ViewChildren,\n    inject\n} from '@angular/core';\nimport { IToast } from './IToast';\nimport { Toast } from './Toast';\nimport { ToastAnnouncer } from './toast-announcer';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { NgClass, NgTemplateOutlet } from '@angular/common';\n\n/**\n * Prefixes the message so that the toast's type is conveyed in text, for users who cannot see the\n * icon or the background colour that otherwise distinguish a success from an error.\n */\nconst TYPE_LABELS: Record<string, string> = {\n    success: 'Success:',\n    error: 'Error:'\n};\n\n@Component({\n    selector: 'nw-toasts',\n    template: `\n        <div class=\"toasts-container\">\n            @for (toast of toasts; track toast) {\n                <div\n                    #toastEl\n                    class=\"toast\"\n                    animate.enter=\"toast-animate-in\"\n                    animate.leave=\"toast-animate-out\"\n                    [ngClass]=\"['toast-' + toast.typeId, 'size-' + toast.size]\">\n                    @if (toast.typeId === 'success') {\n                        <i\n                            class=\"fas fa-check toast-icon\"\n                            aria-hidden=\"true\"></i>\n                    }\n                    @if (toast.typeId === 'error') {\n                        <i\n                            class=\"fas fa-exclamation toast-icon\"\n                            aria-hidden=\"true\"></i>\n                    }\n\n                    @if (getTypeLabel(toast.typeId)) {\n                        <span class=\"sr-only\">{{ getTypeLabel(toast.typeId) }}</span>\n                    }\n\n                    <!-- If templateRef render via ngTemplateOutlet-->\n                    @if (isTemplateRef(toast.message)) {\n                        <ng-container *ngTemplateOutlet=\"toast.message\"></ng-container>\n                    }\n\n                    @if (!isTemplateRef(toast.message)) {\n                        <p\n                            class=\"toast-message\"\n                            [innerHTML]=\"getInnerHTML(toast.message)\"></p>\n                    }\n\n                    @if (toast.isDismissable) {\n                        <button\n                            class=\"btn btn-md btn-ghost-alt btn-no-padding close-button\"\n                            aria-label=\"Dismiss notification\"\n                            (click)=\"dismiss(toast)\">\n                            <i\n                                class=\"far fa-times\"\n                                aria-hidden=\"true\"></i>\n                        </button>\n                    }\n                </div>\n            }\n        </div>\n    `,\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    imports: [NgClass, NgTemplateOutlet]\n})\nexport class ToastsComponent {\n    private _cdRef = inject(ChangeDetectorRef);\n    private _domSanitizer = inject(DomSanitizer);\n    private _announcer = inject(ToastAnnouncer);\n    private _document = inject<Document>(DOCUMENT);\n\n    @ViewChildren('toastEl') private _toastElements: QueryList<ElementRef<HTMLElement>>;\n\n    public toasts: Toast[] = [];\n\n    /**\n     * What had focus when each toast was shown, so that focus can be handed back if the toast is\n     * removed while the user is inside it. Kept off `Toast` to leave its public shape alone.\n     */\n    private _triggerElements = new WeakMap<Toast, HTMLElement>();\n\n    isTemplateRef(value: string | TemplateRef<any>): boolean {\n        return typeof value !== 'string';\n    }\n\n    getTypeLabel(typeId: string): string {\n        return TYPE_LABELS[typeId] || '';\n    }\n\n    getInnerHTML(message: string): SafeHtml {\n        return this._domSanitizer.bypassSecurityTrustHtml(message);\n    }\n\n    success(message: string | TemplateRef<any>): Toast {\n        const toast: IToast = {\n            message: message,\n            typeId: 'success',\n            isDismissable: false\n        };\n        return this.show(toast);\n    }\n\n    error(message: string | TemplateRef<any>): Toast {\n        const toast: IToast = {\n            message: message,\n            typeId: 'error',\n            isDismissable: true\n        };\n        return this.show(toast);\n    }\n\n    show(toast: IToast): Toast {\n        const _toast = new Toast(toast);\n        const trigger = this._document.activeElement;\n\n        if (trigger instanceof HTMLElement) {\n            this._triggerElements.set(_toast, trigger);\n        }\n\n        this.toasts.push(_toast);\n        this._cdRef.detectChanges();\n        this._announce(this.toasts.length - 1, _toast.typeId);\n\n        if (_toast.autoDismiss) {\n            setTimeout(() => {\n                this.removeToast(_toast);\n            }, _toast.dismissTimeout);\n        }\n        return _toast;\n    }\n\n    /**\n     * The message text is read back off the rendered toast rather than composed from\n     * `toast.message`, because a message may be a `TemplateRef` whose text is not knowable up\n     * front, and a string message may contain markup. It is read synchronously, while the index is\n     * known to be valid, so that a toast dismissed before the announcement lands still announces\n     * the right thing.\n     */\n    private _announce(index: number, typeId: string): void {\n        const element = this._toastElements?.get(index)?.nativeElement;\n\n        if (!element) {\n            return;\n        }\n        const messageText = this._getMessageText(element);\n\n        if (!messageText) {\n            return;\n        }\n        this._announcer.announce(`${this.getTypeLabel(typeId)} ${messageText}`.trim(), typeId);\n    }\n\n    /**\n     * The type prefix is stripped and re-joined with a space rather than being taken from the\n     * rendered text as-is: Angular drops the whitespace between the prefix and the message, so the\n     * two would otherwise run together into a single word.\n     */\n    private _getMessageText(element: HTMLElement): string {\n        const clone = element.cloneNode(true) as HTMLElement;\n\n        clone.querySelectorAll('.sr-only').forEach(node => node.remove());\n\n        return clone.textContent.replace(/\\s+/g, ' ').trim();\n    }\n\n    dismiss(toast: Toast) {\n        this.removeToast(toast);\n    }\n\n    removeToast(toast: Toast) {\n        const index = this.getToastIndex(toast);\n\n        if (index > -1) {\n            this._restoreFocus(toast, index);\n            this.toasts.splice(index, 1);\n            this._cdRef.detectChanges();\n        }\n    }\n\n    /**\n     * Focus is only moved when it is currently inside the toast being removed — the user is on its\n     * dismiss button — because removing the toast would otherwise drop focus to the body and lose\n     * their place. A toast removed while the user is elsewhere leaves focus alone, and covers the\n     * case of a focused toast auto-dismissing as well as one dismissed by hand.\n     */\n    private _restoreFocus(toast: Toast, index: number): void {\n        const element = this._toastElements?.get(index)?.nativeElement;\n\n        if (!element?.contains(this._document.activeElement)) {\n            return;\n        }\n        const trigger = this._triggerElements.get(toast);\n\n        // A trigger inside a dialog that has since closed is gone; there is nowhere to hand back to\n        if (trigger?.isConnected) {\n            trigger.focus();\n        }\n    }\n\n    getToastIndex(toast: Toast): number {\n        return this.toasts.indexOf(toast);\n    }\n}\n","import { IToastConfig } from './IToastConfig';\n\nexport const defaultConfig: IToastConfig = {\n    outletElement: document.body\n};\n","import { Injectable, ApplicationRef, Injector, TemplateRef, inject } from '@angular/core';\nimport { ComponentPortal, DomPortalOutlet } from '@angular/cdk/portal';\nimport { ToastsComponent } from './toasts.component';\nimport { IToast } from './IToast';\nimport { Toast } from './Toast';\nimport { IToastConfig } from './IToastConfig';\nimport { defaultConfig } from './config';\n\n@Injectable()\nexport class Toaster {\n    private _appRef = inject(ApplicationRef);\n    private _injector = inject(Injector);\n\n    private _toastPortal: ComponentPortal<ToastsComponent>;\n    private _outlet: DomPortalOutlet;\n    private _toastsComponentRef: ToastsComponent;\n    private _config: IToastConfig;\n\n    private _attachOutlet(): ToastsComponent {\n        /**\n         * If the `ToastsComponent` already exists return it\n         */\n        if (this._toastsComponentRef) {\n            return this._toastsComponentRef;\n        }\n        this._config = this._config || defaultConfig;\n        this._toastPortal = new ComponentPortal(ToastsComponent);\n        this._outlet = new DomPortalOutlet(this._config.outletElement, this._appRef, this._injector);\n        this._toastsComponentRef = this._outlet.attach(this._toastPortal).instance;\n        return this._toastsComponentRef;\n    }\n\n    show(toast: IToast): Toast {\n        this._attachOutlet();\n        return this._toastsComponentRef.show(toast);\n    }\n\n    success(message: string | TemplateRef<any>): Toast {\n        this._attachOutlet();\n        return this._toastsComponentRef.success(message);\n    }\n\n    error(message: string | TemplateRef<any>): Toast {\n        this._attachOutlet();\n        return this._toastsComponentRef.error(message);\n    }\n\n    dismiss(toast: Toast): void {\n        this._toastsComponentRef.dismiss(toast);\n    }\n\n    isToastActive(toast: Toast): boolean {\n        return this._toastsComponentRef.getToastIndex(toast) > -1;\n    }\n\n    /**\n     * Set the configuration values for a `Toaster` instance. This can only be called once\n     * per `Toaster` instance and must be called before the outlet is created\n     *\n     * @param config Configuration settings for the Toaster\n     */\n    setConfig(config: IToastConfig): void {\n        if (!this._config) {\n            this._config = config;\n        } else {\n            console.warn(`config has already been set for this Toaster instance with a value of`, this._config);\n        }\n    }\n}\n","import { TemplateRef } from '@angular/core';\n\nexport class IToast {\n    message: string | TemplateRef<any>;\n    typeId: string;\n    isDismissable?: boolean;\n    autoDismiss?: boolean;\n    dismissTimeout?: number;\n    size?: 'sm' | 'md';\n}\n","export { Toaster } from './toasts.service';\nexport { IToast } from './IToast';\nexport { Toast } from './Toast';\nexport { IToastConfig } from './IToastConfig';\n\nimport { Provider } from '@angular/core';\nimport { Toaster } from './toasts.service';\n\nexport function provideToasts(): Provider[] {\n    return [Toaster];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAGa,KAAK,CAAA;AAQd,IAAA,WAAA,CAAY,OAAe,EAAA;QAJ3B,IAAA,CAAA,WAAW,GAAa,IAAI;QAC5B,IAAA,CAAA,cAAc,GAAY,IAAI;AAI1B,QAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;IAChC;AACH;;ACbD;;;;AAIG;MAEU,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAEY,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;QAO5B,IAAA,CAAA,cAAc,GAAG,EAAE;AA2G9B,IAAA;IAzGG,QAAQ,CAAC,OAAe,EAAE,MAAc,EAAA;QACpC,IAAI,CAAC,OAAO,EAAE;YACV;QACJ;QACA,IAAI,CAAC,cAAc,EAAE;AAErB,QAAA,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE;AACxB,YAAA,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC5D;QACJ;AACA,QAAA,IAAI,CAAC,0BAA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