{"version":3,"file":"eui-components-eui-dimmer.mjs","sources":["../../eui-dimmer/dimmer.component.ts","../../eui-dimmer/index.ts","../../eui-dimmer/eui-components-eui-dimmer.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, HostBinding, Input, ViewEncapsulation, inject } from '@angular/core';\nimport { coerceBooleanProperty, BooleanInput } from '@angular/cdk/coercion';\nimport { Event as NavigationEvent, NavigationStart, Router } from '@angular/router';\nimport { filter } from 'rxjs/operators';\n\nimport { EuiAppShellService } from '@eui/core';\n\n/**\n * @description\n * A dimming overlay component that provides a semi-transparent backdrop over page content.\n * Automatically integrates with browser navigation to manage dimmer state during back/forward actions.\n * Commonly used to indicate loading states, modal overlays, or to draw attention to specific UI elements.\n * \n * @usageNotes\n * ### Basic Usage\n * ```html\n * <eui-dimmer [isDimmerActive]=\"isLoading\"></eui-dimmer>\n * ```\n * \n * ### With Loading State\n * ```typescript\n * // Component\n * isLoading = false;\n * \n * loadData(): void {\n *   this.isLoading = true;\n *   this.dataService.fetch().subscribe(() => {\n *     this.isLoading = false;\n *   });\n * }\n * \n * // Template\n * <eui-dimmer [isDimmerActive]=\"isLoading\"></eui-dimmer>\n * <button (click)=\"loadData()\">Load Data</button>\n * ```\n * \n * ### Accessibility\n * - Dimmer does not trap focus or block interaction by itself\n * - Should be combined with modal dialogs or loading indicators for proper accessibility\n * - Consider adding `aria-busy=\"true\"` to parent container when dimmer is active\n * - Ensure keyboard users can still navigate when dimmer is visible\n * \n * ### Notes\n * - Automatically deactivates on browser back button navigation\n * - Integrates with `EuiAppShellService` for centralized state management\n * - Does not prevent user interaction - use with modal components for blocking behavior\n * - Typically placed at root level of application for full-page coverage\n * - CSS class `eui-dimmer--active` applied when active for custom styling\n */\n@Component({\n    selector: 'eui-dimmer',\n    template: '',\n    changeDetection: ChangeDetectionStrategy.Default,\n    styleUrls: ['./dimmer.scss'],\n    encapsulation: ViewEncapsulation.None,\n})\nexport class EuiDimmerComponent {\n    asService = inject(EuiAppShellService);\n\n    /**\n     * Gets the active state of the dimmer.\n     *\n     * @returns {boolean} True if dimmer is active, false otherwise.\n     */\n    @Input()\n    get isDimmerActive(): boolean {\n        return this._isDimmerActive;\n    }\n    /**\n     * Sets the active state of the dimmer.\n     *\n     * @param {BooleanInput} value - The value to set for the dimmer active state.\n     */\n    set isDimmerActive(value: BooleanInput) {\n        this._isDimmerActive = coerceBooleanProperty(value);\n    }\n\n    /**\n     * Gets the CSS classes to apply to the host element.\n     * Adds the 'eui-dimmer--active' class when the dimmer is active.\n     *\n     * @returns {string} The CSS classes as a space-separated string.\n     */\n    @HostBinding('class')\n    get cssClasses(): string {\n        return ['eui-dimmer', this._isDimmerActive ? 'eui-dimmer--active' : ''].join(' ').trim();\n    }\n\n    /**\n     * E2E testing attribute for the component.\n     */\n    @HostBinding('attr.data-e2e') @Input() e2eAttr = 'eui-dimmer';\n\n    /** The active state of the dimmer. */\n    private _isDimmerActive: true | false = false;\n\n    /** Debug flag to control logging. */\n    private _DEBUG: true | false = false;\n\n    /**\n     * Creates an instance of EuiDimmerComponent.\n     *\n     * Listens to router navigation events to handle dimmer state during navigation,\n     * particularly when the user navigates back in browser history.\n     *\n     * @param {EuiAppShellService} asService - The app shell service for dimmer state management.\n     * @param {Router} router - The Angular router service for navigation event monitoring.\n     */\n    constructor() {\n        const router = inject(Router);\n\n        // The events stream contains all the navigation events including the NavigationStart event\n        // which gives information about what initiated the navigation sequence\n        router.events.pipe(filter((event: NavigationEvent) => event instanceof NavigationStart)).subscribe((event: NavigationStart) => {\n            if (this._DEBUG) {\n                console.group('NavigationStart Event');\n                // Every navigation sequence is given a unique ID.\n                console.log('navigation id:', event.id);\n                console.log('route:', event.url);\n                // The 'navigationTrigger' will be one of:\n                // - imperative : ie. user clicked on a link\n                // - popstate : browser controlled change such as Back button which gets a new, unique ID\n                // - hashchange\n                // @See: https://angular.io/api/router/NavigationStart\n                console.log('trigger:', event.navigationTrigger);\n                // The 'restoredState' property is defined when the navigation event is triggered by a 'popstate' event\n                // It will contain the ID of the previous navigation event from which the browser is returning\n            }\n            if (event.restoredState) {\n                this.asService.setDimmerActiveState(false);\n                this._isDimmerActive = false;\n                if (this._DEBUG) {\n                    console.warn('restoring navigation id:', event.restoredState.navigationId);\n                }\n            }\n            if (this._DEBUG) {\n                console.groupEnd();\n            }\n        });\n    }\n}\n","import { EuiDimmerComponent } from './dimmer.component';\n\nexport * from './dimmer.component';\n\nexport const EUI_DIMMER = [\n    EuiDimmerComponent,\n] as const;\n\n// export { EuiDimmerComponent as EuiDimmer } from './dimmer.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCG;MAQU,kBAAkB,CAAA;AAG3B;;;;AAIG;AACH,IAAA,IACI,cAAc,GAAA;QACd,OAAO,IAAI,CAAC,eAAe;IAC/B;AACA;;;;AAIG;IACH,IAAI,cAAc,CAAC,KAAmB,EAAA;AAClC,QAAA,IAAI,CAAC,eAAe,GAAG,qBAAqB,CAAC,KAAK,CAAC;IACvD;AAEA;;;;;AAKG;AACH,IAAA,IACI,UAAU,GAAA;QACV,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,GAAG,oBAAoB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;IAC5F;AAaA;;;;;;;;AAQG;AACH,IAAA,WAAA,GAAA;AAnDA,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,kBAAkB,CAAC;AA+BtC;;AAEG;QACoC,IAAA,CAAA,OAAO,GAAG,YAAY;;QAGrD,IAAA,CAAA,eAAe,GAAiB,KAAK;;QAGrC,IAAA,CAAA,MAAM,GAAiB,KAAK;AAYhC,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;;;QAI7B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAsB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