{"version":3,"file":"eui-components-eui-alert.mjs","sources":["../../eui-alert/eui-alert-title.component.ts","../../eui-alert/eui-alert.component.ts","../../eui-alert/eui-alert.component.html","../../eui-alert/index.ts","../../eui-alert/eui-components-eui-alert.ts"],"sourcesContent":["import { Component, HostBinding } from '@angular/core';\n\n/**\n * @description\n * Title subcomponent for eui-alert that displays a prominent heading above the alert message.\n * Provides semantic structure and visual hierarchy within alert messages.\n * Content is projected via ng-content, allowing text or inline elements as title content.\n * Automatically styled to match the parent alert's variant and visual design.\n * Must be used as a direct child of eui-alert component for proper styling and structure.\n *\n * @usageNotes\n * #### Alert with title\n * ```html\n * <eui-alert euiSuccess>\n *   <eui-alert-title>Success</eui-alert-title>\n *   Your operation completed successfully.\n * </eui-alert>\n * ```\n *\n * #### Alert with title and multiple variants\n * ```html\n * <eui-alert euiWarning>\n *   <eui-alert-title>Warning</eui-alert-title>\n *   Please review the following issues before proceeding.\n * </eui-alert>\n * ```\n *\n * ### Accessibility\n * - Provides semantic structure that helps screen readers distinguish title from content\n * - Title is announced first, giving context before the main message\n * - Visual hierarchy aids users with cognitive disabilities in understanding message importance\n *\n * ### Notes\n * - Must be used within eui-alert component\n * - Should be placed before the main alert content\n * - Only one title per alert is recommended for clarity\n * - Title styling automatically inherits from parent alert variant\n * - Keep titles concise - typically 1-3 words for quick comprehension\n */\n@Component({\n    selector: 'eui-alert-title',\n    template: '<ng-content />',\n    styleUrl: 'eui-alert-title.scss',\n})\nexport class EuiAlertTitleComponent {\n    /**\n     * @description\n     * Computes and returns the CSS classes for the label title component based on its current state.\n     *\n     * @default 'eui-alert-title'\n     * @returns {string} Space-separated string of CSS class names\n     */\n    @HostBinding('class') class = 'eui-alert-title';\n}\n","import {\n    Component,\n    HostBinding,\n    ChangeDetectionStrategy,\n    ContentChild,\n    forwardRef,\n    QueryList,\n    input,\n    output,\n    booleanAttribute,\n    inject,\n    model,\n    OnInit,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\n\nimport { EUI_ICON_BUTTON } from '@eui/components/eui-icon-button';\nimport { EUI_ICON_STATE } from '@eui/components/eui-icon-state';\nimport { BaseStatesDirective } from '@eui/components/shared';\nimport { EuiAlertTitleComponent } from './eui-alert-title.component';\n\n/**\n * @description\n * Alert component for displaying short, important messages that attract user attention without interrupting tasks.\n * Provides semantic variants (success, info, warning, danger) with corresponding visual styling and icons.\n * Supports optional title section, close button, and keyboard focus for accessibility.\n * Visibility can be controlled programmatically or by user dismissal via close button.\n * Includes ARIA attributes for screen reader support and unique ID generation for content association.\n *\n * @structure\n * - Supports four semantic variants: success, info, warning, and danger (via BaseStatesDirective)\n * - Optional title section via `<eui-alert-title>` content projection\n * - Main content area for alert message (projected via ng-content)\n * - Optional close button when `isCloseable` is true\n * - Icon state indicator matching the alert variant\n *\n * @features\n * - Closeable: Can be dismissed by user via close button\n * - Focusable: Can receive keyboard focus for accessibility\n * - Visibility control: Can be shown/hidden via `isVisible` model\n * - Accessibility: Includes ARIA attributes (role=\"alert\", aria-describedby)\n * - Unique ID generation for content association\n *\n * @usageNotes\n * #### Basic alert (defaults to info variant)\n * ```html\n * <eui-alert>\n *   Important message for the user\n * </eui-alert>\n * ```\n *\n * #### Alert with title and variant\n * ```html\n * <eui-alert euiSuccess>\n *   <eui-alert-title>Success</eui-alert-title>\n *   Your changes have been saved successfully.\n * </eui-alert>\n * ```\n *\n * #### Closeable alert with visibility control\n * ```html\n * <eui-alert euiWarning [isCloseable]=\"true\" [(isVisible)]=\"showAlert\" (closeAlert)=\"onClose()\">\n *   This is a dismissible warning message.\n * </eui-alert>\n * ```\n *\n * #### Focusable alert for keyboard navigation\n * ```html\n * <eui-alert euiDanger [isFocusable]=\"true\">\n *   Critical error that requires attention.\n * </eui-alert>\n * ```\n *\n * ### Accessibility\n * - Uses role=\"alert\" for immediate screen reader announcement of important messages\n * - aria-describedby links alert to its content for proper association\n * - Keyboard focusable when isFocusable is true (tabindex=\"0\")\n * - Close button is keyboard accessible with Enter/Space keys\n * - Semantic variants provide visual and contextual meaning for all users\n * - Icon state indicators supplement color for users with color vision deficiencies\n *\n * ### Notes\n * - Defaults to info variant if no variant is specified\n * - isVisible is a two-way bindable model for programmatic control\n * - closeAlert event emits false when alert is dismissed\n * - Alert remains in DOM when hidden (display: none), use *ngIf for removal\n * - Use sparingly to avoid alert fatigue - reserve for truly important messages\n * - Consider toast notifications for less critical, temporary messages\n */\n@Component({\n    templateUrl: './eui-alert.component.html',\n    selector: 'div[euiAlert], eui-alert',\n    styleUrl: './eui-alert.scss',\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    imports: [\n        NgTemplateOutlet,\n        ...EUI_ICON_BUTTON,\n        ...EUI_ICON_STATE,\n    ],\n    hostDirectives: [\n        {\n            directive: BaseStatesDirective,\n            inputs: [\n                'euiSuccess',\n                'euiInfo',\n                'euiWarning',\n                'euiDanger',\n                'euiVariant',\n            ],\n        },\n    ],\n})\nexport class EuiAlertComponent implements OnInit {\n    baseStatesDirective = inject(BaseStatesDirective);\n\n    /**\n     * @description\n     * Computes and returns the CSS classes for the component based on its current state.\n     *\n     * @returns {string} Space-separated string of CSS class names\n     */\n    @HostBinding('class')\n    public get cssClasses(): string {\n        return [\n            this.baseStatesDirective.getCssClasses('eui-alert'),\n            this.isFocusable() ? 'eui-alert--focusable' : '',\n            this.isCloseable() ? 'eui-alert--closeable' : '',\n            !this.isVisible() ? 'eui-alert--hidden' : '',\n            this.alertTitle ? 'eui-alert--with-title': '',\n        ]\n            .join(' ')\n            .trim();\n    }\n\n    /**\n     * Sets the `role` attribute for the host element.\n     *\n     * @default 'alert'\n     */\n    @HostBinding('attr.role') role = 'alert';\n\n    /**\n     * Sets the `aria-describedby` attribute for the host element.\n     *\n     * @default `alertContent-${uniqueId}`\n     * @returns The ID of the element associated with the alert.\n     */\n    @HostBinding('attr.aria-describedby')\n    get ariaDescribedBy(): string {\n        return `alertContent-${this.uniqueId}`;\n    }\n\n    /**\n     * Sets the `tabindex` attribute for the host element.\n     *\n     * @returns '0' if defined as focusable else '1' as string.\n     */\n    @HostBinding('attr.tabindex')\n    get tabindex(): string {\n        return this.isFocusable() ? '0' : '-1';\n    }\n\n    /**\n     * Sets the `data-e2e` attribute for the host element. It is used for end-to-end testing.\n     *\n     * @default 'eui-alert'\n     */\n    @HostBinding('attr.data-e2e')\n    get e2eAttribute(): string {\n        return this.e2eAttr();\n    }\n\n    /**\n     * Data attribute value for end-to-end testing identification.\n     * Applied as data-e2e attribute on the host element.\n     * @default 'eui-alert'\n     */\n    e2eAttr = input('eui-alert');\n\n    /**\n     * Enables a close button allowing users to dismiss the alert.\n     * When true, displays a close icon button that hides the alert and emits closeAlert event.\n     * @default false\n     */\n    isCloseable = input(false, { transform: booleanAttribute });\n\n    /**\n     * Makes the alert focusable via keyboard navigation.\n     * When true, sets tabindex to 0 enabling keyboard focus for accessibility.\n     * @default false\n     */\n    isFocusable = input(false, { transform: booleanAttribute });\n\n    /**\n     * Controls the visibility state of the alert.\n     * Two-way bindable model that can be programmatically controlled or updated by user dismissal.\n     * @default true\n     */\n    isVisible = model(true);\n\n    /**\n     * Emitted when the alert is closed via the close button.\n     * Payload: boolean - always emits false to indicate alert is hidden\n     * Triggered when user clicks the close button (when isCloseable is true).\n     */\n    closeAlert = output<boolean>();\n\n    /**\n     * Content for the alert title given by `<eui-alert-title>`.\n     */\n    @ContentChild(forwardRef(() => EuiAlertTitleComponent), { static: false }) alertTitle: QueryList<EuiAlertTitleComponent>;\n\n    /**\n     * @description\n     * Unique identifier for the alert component.\n     * This ID is used to associate the alert with its content for accessibility purposes.\n     * It is generated using the `crypto` API to ensure uniqueness.\n     */\n    private uniqueId = crypto.randomUUID();\n\n    /**\n     * Initializes the component.\n     * Generates a unique ID for the alert on component initialization.\n     */\n    ngOnInit(): void {\n        if (!this.baseStatesDirective.euiVariant) {\n            this.baseStatesDirective.euiInfo = true;\n        }\n    }\n\n    /**\n     * Hide the alert and emits the `closeAlert` event when the close button is clicked.\n     */\n    onCloseClick(): void {\n        this.isVisible.set(false);\n        this.closeAlert.emit(false);\n    }\n}\n","@if (alertTitle) {\n    <div class=\"eui-alert-container\">\n        <div class=\"eui-alert-title-wrapper\">\n            <ng-content *ngTemplateOutlet=\"icon\"/>\n            <ng-content select=\"eui-alert-title\"/>\n        </div>\n        <ng-content *ngTemplateOutlet=\"body\"/>\n    </div>\n} @else {\n    <ng-content *ngTemplateOutlet=\"icon\"/>\n    <ng-content *ngTemplateOutlet=\"body\"/>\n}\n\n<ng-template #icon>\n    <eui-icon-state class=\"eui-alert-icon\" \n        [euiInfo]=\"baseStatesDirective.euiInfo\"\n        [euiWarning]=\"baseStatesDirective.euiWarning\"\n        [euiDanger]=\"baseStatesDirective.euiDanger\"\n        [euiSuccess]=\"baseStatesDirective.euiSuccess\"/>\n</ng-template>\n\n<ng-template #body>\n    <div class=\"eui-alert-content\" [id]=\"ariaDescribedBy\">\n        <ng-content/>\n    </div>\n</ng-template>\n\n@if (isCloseable()) {\n    <eui-icon-button class=\"eui-alert-close\"\n        icon=\"eui-close\"\n        euiRounded\n        (buttonClick)=\"onCloseClick()\"\n        fillColor=\"secondary\"\n        ariaLabel=\"Close alert icon\"\n        [euiInfo]=\"baseStatesDirective.euiInfo\"\n        [euiWarning]=\"baseStatesDirective.euiWarning\"\n        [euiDanger]=\"baseStatesDirective.euiDanger\"\n        [euiSuccess]=\"baseStatesDirective.euiSuccess\"/>\n}\n","import { EuiAlertTitleComponent } from './eui-alert-title.component';\nimport { EuiAlertComponent } from './eui-alert.component';\n\nexport * from './eui-alert.component';\nexport * from './eui-alert-title.component';\n\nexport const EUI_ALERT = [\n    EuiAlertComponent,\n    EuiAlertTitleComponent,\n] as const;","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;MAMU,sBAAsB,CAAA;AALnC,IAAA,WAAA,GAAA;AAMI;;;;;;AAMG;QACmB,IAAA,C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