// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { fadeOut } from '../../../../Animations/Presets/Fade';
import { shakeHorizontal } from '../../../../Animations/Presets/Shake';
import { Animatable } from '../../../Behaviors/Animatable';
import { Themeable } from '../../../Behaviors/Themeable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { TextOverflow } from '../../../Types/TextOverflow';
import { CustomElement } from '../../Abstracts/CustomElement';
import { TextElement } from '../Text/TextElement';
import { errorElementTemplate } from './ErrorElementTemplate';
import { errorElementCosmopolitanStyle } from './Themes/ErrorElement.Cosmopolitan';
import { errorElementJoyStyle } from './Themes/ErrorElement.Joy';
import { errorElementMemphisStyle } from './Themes/ErrorElement.Memphis';
// #endregion
/**
 * Error - A visual component for displaying error messages with optional icons and animations.
 *
 * @description
 * The Error component provides a consistent way to display error messages, validation feedback, and
 * warning text across your application. It supports configurable text overflow handling (truncate or wrap),
 * optional icon slots for visual indicators, and built-in shake and fade-out animations to draw attention
 * to errors. The component is ideal for form validation messages, inline errors, and notification content.
 *
 * @name Error
 * @element mosaik-error
 * @category Primitives
 *
 * @slot icon - Optional icon to display before the error text
 *
 * @csspart root - The root container element
 * @csspart text - The text display element
 *
 * @cssprop {String} --error-background-color - Background color of the error container
 * @cssprop {String} --error-border-color - Border color for the error outline
 * @cssprop {String} --error-border-radius - Corner rounding radius
 * @cssprop {String} --error-border-style - Border line style
 * @cssprop {String} --error-border-width - Border thickness
 * @cssprop {String} --error-font-family - Font family for error text
 * @cssprop {String} --error-font-size - Font size for error text
 * @cssprop {String} --error-font-weight - Font weight for error text
 * @cssprop {String} --error-foreground-color - Text color
 * @cssprop {String} --error-gap - Spacing between icon and text
 * @cssprop {String} --error-shadow - Drop shadow or elevation effect
 * @cssprop {String} --error-transition-duration - Duration of animations
 * @cssprop {String} --error-transition-mode - Timing function for transitions
 * @cssprop {String} --error-transition-property - CSS properties to transition
 *
 * @dependency {TextElement} - Text rendering component for error messages
 *
 * @example
 * Basic error message:
 * ```html
 * <mosaik-error text="Invalid email address"></mosaik-error>
 * ```
 *
 * @example
 * Error with icon:
 * ```html
 * <mosaik-error text="Connection failed">
 *   <mosaik-icon slot="icon" data="error-icon-path"></mosaik-icon>
 * </mosaik-error>
 * ```
 *
 * @example
 * Error with text wrapping:
 * ```html
 * <mosaik-error
 *   text="This is a longer error message that should wrap to multiple lines"
 *   text-overflow="wrap">
 * </mosaik-error>
 * ```
 *
 * @example
 * Animated error appearance:
 * ```html
 * <mosaik-error id="validationError" text="Required field" style="display: none;"></mosaik-error>
 * <script>
 *   const error = document.querySelector('#validationError');
 *   error.style.display = 'block';
 *   error.onEnterAnimation(); // Triggers shake animation
 * </script>
 * ```
 *
 * @public
 */
let ErrorElement = class ErrorElement extends Themeable(Animatable(CustomElement)) {
    // #region Fields
    _text;
    _textOverflow;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._text = '';
        this._textOverflow = TextOverflow.Truncate;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @readonly
    */
    static get is() {
        return 'mosaik-error';
    }
    /**
     * Gets or sets the `text` property.
     *
     * @public
     * @attr
     */
    get text() {
        return this._text;
    }
    set text(value) {
        if (this._text !== value) {
            this._text = value;
            this.requestUpdate('text');
        }
    }
    /**
     * Gets or sets the `textOverflow` property.
     *
     * @public
     * @attr
     */
    get textOverflow() {
        return this._textOverflow;
    }
    set textOverflow(value) {
        if (this._textOverflow !== value) {
            this._textOverflow = value;
            this.requestUpdate('textOverflow');
        }
    }
    // #endregion
    // #region Methods
    /**
    * @public
    * @override
    */
    onEnterAnimation() {
        return this.play(shakeHorizontal);
    }
    /**
     * @public
     * @override
     */
    onExitAnimation() {
        return this.play(fadeOut);
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ErrorElement.prototype, "text", null);
__decorate([
    Attribute({ type: TextOverflow }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ErrorElement.prototype, "textOverflow", null);
ErrorElement = __decorate([
    Component({
        selector: 'mosaik-error',
        template: errorElementTemplate,
        themes: {
            joy: errorElementJoyStyle,
            memphis: errorElementMemphisStyle,
            cosmopolitan: errorElementCosmopolitanStyle
        },
        imports: [
            TextElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ErrorElement);
export { ErrorElement };
//# sourceMappingURL=ErrorElement.js.map