import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
import { NgClass } from '@angular/common';

/**
 * @description Componente de alerta que exibe mensagens informativas, de sucesso, aviso ou erro.
 * Suporta fechamento manual pelo usuário e emite um evento ao ser fechado.
 *
 * @example
 * ```html
 * <s-alert
 *   severity="warning"
 *   summary="Atenção"
 *   detail="Verifique os dados antes de continuar."
 *   (closed)="onAlertClosed()"
 * />
 * ```
 *
 * @category Feedback
 */
class AlertComponent {
    /**
     * @description Nível de severidade do alerta, que define a cor e o ícone exibidos.
     * - `'info'`: alerta informativo (padrão).
     * - `'success'`: alerta de sucesso.
     * - `'warning'`: alerta de aviso.
     * - `'error'`: alerta de erro.
     *
     * @default 'info'
     */
    // sonar-ignore: Refactor this union type to have less than 3 elements
    severity = 'info';
    /**
     * @description Título principal do alerta exibido em destaque. Campo obrigatório.
     */
    summary;
    /**
     * @description Mensagem detalhada exibida abaixo do título do alerta. Campo obrigatório.
     */
    detail;
    /**
     * @description Quando `true`, exibe o botão de fechar o alerta.
     * Quando `false`, o alerta não pode ser dispensado pelo usuário.
     *
     * @default true
     */
    closable = true;
    /**
     * @description Emitido quando o usuário fecha o alerta clicando no botão de fechar.
     */
    closed = new EventEmitter();
    get isOpen() {
        return this._isOpen;
    }
    closeAlert() {
        this._isOpen = false;
    }
    showAlert() {
        this._isOpen = true;
    }
    onClose() {
        this.closed.emit();
        this.closeAlert();
    }
    _isOpen = true;
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AlertComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: AlertComponent, isStandalone: true, selector: "s-alert", inputs: { severity: "severity", summary: "summary", detail: "detail", closable: "closable" }, outputs: { closed: "closed" }, ngImport: i0, template: "@if (isOpen) {\n<div\n    class=\"alert flex items-center justify-between gap-4 rounded-medium border-l-4 m-2 py-3 px-4 shadow-[1px_1px_2px_rgba(0,0,0,0.2)]\"\n    [ngClass]=\"{\n        'alert--info': severity === 'info',\n        'alert--success': severity === 'success',\n        'alert--warning': severity === 'warning',\n        'alert--error': severity === 'error',\n        'bg-hippie-blue-50 border-primary': severity === 'info',\n        'bg-teal-50 border-criticality-green': severity === 'success',\n        'bg-buttercup-50 border-criticality-yellow': severity === 'warning',\n        'bg-sunset-orange-50 border-criticality-red': severity === 'error',\n    }\"\n>\n    <div class=\"content flex items-center gap-4\">\n        <div\n            class=\"icon-container inline-flex flex-shrink-0 items-center justify-center h-10 w-10 rounded-[50%]\"\n            [ngClass]=\"{\n                'bg-primary': severity === 'info',\n                'bg-criticality-green': severity === 'success',\n                'bg-criticality-yellow': severity === 'warning',\n                'bg-criticality-red': severity === 'error',\n            }\"\n        >\n            <i\n                class=\"fas\"\n                [ngClass]=\"{\n                    'fa-info': severity === 'info',\n                    'fa-check': severity === 'success',\n                    'fa-exclamation-triangle': severity === 'warning',\n                    'fa-times': severity === 'error',\n                    'text-grayscale-0': severity !== 'warning',\n                    'text-grayscale-90': severity === 'warning',\n                }\"\n            ></i>\n        </div>\n        <div class=\"text-container flex flex-col gap-4\">\n            <div class=\"text flex flex-col justify-start\">\n                @if (summary) {\n                    <span class=\"summary font-open-sans text-sm font-bold text-grayscale-90\">{{ summary }}</span>\n                }\n\n                @if (detail) {\n                    <span class=\"detail font-open-sans text-sm text-grayscale-90\">{{ detail }}</span>\n                }\n            </div>\n        </div>\n    </div>\n    @if (closable) {\n        <button\n            class=\"close-option bg-transparent border-0 text-grayscale-90 cursor-pointer text-base p-1\"\n            (click)=\"onClose()\"\n        >\n            <i class=\"fas fa-times\"></i>\n        </button>\n    }\n</div>\n}\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AlertComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-alert', standalone: true, imports: [NgClass], template: "@if (isOpen) {\n<div\n    class=\"alert flex items-center justify-between gap-4 rounded-medium border-l-4 m-2 py-3 px-4 shadow-[1px_1px_2px_rgba(0,0,0,0.2)]\"\n    [ngClass]=\"{\n        'alert--info': severity === 'info',\n        'alert--success': severity === 'success',\n        'alert--warning': severity === 'warning',\n        'alert--error': severity === 'error',\n        'bg-hippie-blue-50 border-primary': severity === 'info',\n        'bg-teal-50 border-criticality-green': severity === 'success',\n        'bg-buttercup-50 border-criticality-yellow': severity === 'warning',\n        'bg-sunset-orange-50 border-criticality-red': severity === 'error',\n    }\"\n>\n    <div class=\"content flex items-center gap-4\">\n        <div\n            class=\"icon-container inline-flex flex-shrink-0 items-center justify-center h-10 w-10 rounded-[50%]\"\n            [ngClass]=\"{\n                'bg-primary': severity === 'info',\n                'bg-criticality-green': severity === 'success',\n                'bg-criticality-yellow': severity === 'warning',\n                'bg-criticality-red': severity === 'error',\n            }\"\n        >\n            <i\n                class=\"fas\"\n                [ngClass]=\"{\n                    'fa-info': severity === 'info',\n                    'fa-check': severity === 'success',\n                    'fa-exclamation-triangle': severity === 'warning',\n                    'fa-times': severity === 'error',\n                    'text-grayscale-0': severity !== 'warning',\n                    'text-grayscale-90': severity === 'warning',\n                }\"\n            ></i>\n        </div>\n        <div class=\"text-container flex flex-col gap-4\">\n            <div class=\"text flex flex-col justify-start\">\n                @if (summary) {\n                    <span class=\"summary font-open-sans text-sm font-bold text-grayscale-90\">{{ summary }}</span>\n                }\n\n                @if (detail) {\n                    <span class=\"detail font-open-sans text-sm text-grayscale-90\">{{ detail }}</span>\n                }\n            </div>\n        </div>\n    </div>\n    @if (closable) {\n        <button\n            class=\"close-option bg-transparent border-0 text-grayscale-90 cursor-pointer text-base p-1\"\n            (click)=\"onClose()\"\n        >\n            <i class=\"fas fa-times\"></i>\n        </button>\n    }\n</div>\n}\n" }]
        }], propDecorators: { severity: [{
                type: Input
            }], summary: [{
                type: Input,
                args: [{ required: true }]
            }], detail: [{
                type: Input,
                args: [{ required: true }]
            }], closable: [{
                type: Input
            }], closed: [{
                type: Output
            }] } });

class AlertModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AlertModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: AlertModule, imports: [AlertComponent], exports: [AlertComponent] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AlertModule });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: AlertModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [AlertComponent],
                    exports: [AlertComponent],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { AlertComponent, AlertModule };
//# sourceMappingURL=seniorsistemas-angular-components-alert.mjs.map
