// #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 { Themeable } from '../../../../Controls/Behaviors/Themeable';
import { Appearanceable } from '../../../Behaviors/Appearanceable';
import { Closeable } from '../../../Behaviors/Closeable';
import { ContentAlignable } from '../../../Behaviors/ContentAlignable';
import { Disableable } from '../../../Behaviors/Disableable';
import { Elevatable } from '../../../Behaviors/Elevatable';
import { Fitable } from '../../../Behaviors/Fitable';
import { Openable } from '../../../Behaviors/Openable';
import { Orientable } from '../../../Behaviors/Orientable';
import { TextFormattable } from '../../../Behaviors/TextFormattable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { Appearance } from '../../../Types/Appearance';
import { Size } from '../../../Types/Size';
import { Variant } from '../../../Types/Variant';
import { CustomElement } from '../../Abstracts/CustomElement';
import { ButtonElement } from '../../Buttons/Button/ButtonElement';
import { StackElement } from '../../Layouts/Stack/StackElement';
import { IconElement } from '../../Media/Icon/IconElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { bannerElementTemplate } from './BannerElementTemplate';
import { BannerHeaderElement } from './BannerHeaderElement';
import { BannerSubHeaderElement } from './BannerSubHeaderElement';
import { bannerElementJoyStyle } from './Themes/BannerElement.Joy';
import { bannerElementRetroStyle } from './Themes/BannerElement.Retro';
import { bannerElementCosmopolitanStyle } from './Themes/BannerElement.Cosmopolitan';
import { getSlotElements } from '../../../../Dom/Slot';
// #endregion
/**
 * Banner - A flexible and customizable component for displaying prominent messages or actions.
 *
 * @description
 * The `Banner` component is designed for presenting important messages or actions within an application.
 * It supports customizable styles, headers, subheaders, and actions, making it suitable for notifications,
 * announcements, or alerts. The component is fully customizable with CSS parts and properties, ensuring seamless
 * integration into various designs.
 *
 * @name Banner
 * @element mosaik-banner
 * @category Notifications
 *
 * @slot header - Slot for the banner header content.
 * @slot subHeader - Slot for the banner subheader content.
 * @slot close - Slot for the close button or icon.
 * @slot actions - Slot for additional actions inside the banner.
 *
 * @csspart root - The root part of the banner.
 * @csspart heading - The heading part of the banner.
 * @csspart icon - The icon part of the banner.
 * @csspart text - The text part of the banner.
 * @csspart header - The header container part of the banner.
 * @csspart subHeader - The subheader container part of the banner.
 * @csspart close - The close button or icon part of the banner.
 * @csspart actions - The actions container part of the banner.
 * @csspart elevation - The elevation part of the banner.
 *
 * @cssprop {unknown} --banner-font-family - The font family for the banner.
 * @cssprop {unknown} --banner-font-size - The font size for the banner.
 * @cssprop {unknown} --banner-font-weight - The font weight for the banner.
 * @cssprop {unknown} --banner-background-color - The background color for the banner.
 * @cssprop {unknown} --banner-border-color - The border color for the banner.
 * @cssprop {unknown} --banner-foreground-color - The foreground color for the banner.
 * @cssprop {unknown} --banner-border-width - The border width for the banner.
 * @cssprop {unknown} --banner-border-radius - The border radius for the banner.
 * @cssprop {unknown} --banner-border-style - The border style for the banner.
 * @cssprop {unknown} --banner-transition-duration - The transition duration for the banner.
 * @cssprop {unknown} --banner-transition-mode - The transition mode for the banner.
 * @cssprop {unknown} --banner-transition-property - The transition property for the banner.
 * @cssprop {unknown} --banner-shadow - The shadow effect for the banner.
 * @cssprop {unknown} --banner-padding-top - The top padding for the banner.
 * @cssprop {unknown} --banner-padding-left - The left padding for the banner.
 * @cssprop {unknown} --banner-padding-bottom - The bottom padding for the banner.
 * @cssprop {unknown} --banner-padding-right - The right padding for the banner.
 * @cssprop {unknown} --banner-gap - The gap between elements within the banner.
 *
 * @dependency {IconElement} - The Icon element.
 * @dependency {TextElement} - The Text element.
 * @dependency {BannerHeaderElement} - The Banner Header element.
 * @dependency {BannerSubHeaderElement} - The Banner Sub Header element.
 * @dependency {StackElement} - The Stack element.
 *
 * @example
 * ```html
 * <mosaik-banner>
 *   <div slot="header">Important Update</div>
 *   <div slot="subHeader">Details about the update go here.</div>
 *   <mosaik-icon slot="close" name="close"></mosaik-icon>
 *   <div slot="actions">
 *       <button>Take Action</button>
 *   </div>
 * </mosaik-banner>
 * ```
 *
 * @public
 */
let BannerElement = class BannerElement extends Themeable(Openable(Closeable(Disableable(Variantable(Appearanceable(Fitable(Elevatable(Orientable(ContentAlignable(TextFormattable(CustomElement))))))))))) {
    // #region Fields
    _actionElements;
    _icon;
    _iconSize;
    _header;
    _subHeader;
    _isOpen;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._actionElements = [];
        this._icon = '';
        this._iconSize = null;
        this._header = '';
        this._subHeader = '';
        this._isOpen = false;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-banner';
    }
    /**
     * Gets or sets the `icon` property.
     *
     * @public
     */
    get icon() {
        return this._icon;
    }
    set icon(value) {
        if (this._icon !== value) {
            this._icon = value;
            this.requestUpdate('icon');
        }
    }
    /**
     * Gets or sets the `iconSize` property.
     *
     * @public
     * @attr
     */
    get iconSize() {
        return this._iconSize;
    }
    set iconSize(value) {
        if (this._iconSize !== value) {
            this._iconSize = value;
            this.requestUpdate('iconSize');
        }
    }
    /**
     * Gets or sets the `header` property.
     *
     * @public
     */
    get header() {
        return this._header;
    }
    set header(value) {
        if (this._header !== value) {
            this._header = value;
            this.requestUpdate('header');
        }
    }
    /**
     * Gets or sets the `subHeader` property.
     *
     * @public
     */
    get subHeader() {
        return this._subHeader;
    }
    set subHeader(value) {
        if (this._subHeader !== value) {
            this._subHeader = value;
            this.requestUpdate('subHeader');
        }
    }
    /**
     * Gets or sets the `isOpen` property that allows you to show or hide the `BannerComponent`.
     *
     * @public
     * @attr
     */
    get isOpen() {
        return this._isOpen;
    }
    set isOpen(value) {
        if (this._isOpen !== value) {
            if (value) {
                void this.open();
            }
            else {
                void this.close();
            }
        }
    }
    // #endregion
    // #region Methods
    /**
     * Opens the `BannerElement`.
     *
     * @public
     * @override
     */
    async open() {
        if (this.disabled) {
            return;
        }
        if (this._isOpen) {
            return;
        }
        return super.open()
            .then(() => {
            this._isOpen = true;
            this.requestUpdate('isOpen');
        });
    }
    /**
     * Closes the `BannerElement`.
     *
     * @public
     * @override
     */
    async close() {
        if (this.disabled) {
            return false;
        }
        if (!this._isOpen) {
            return false;
        }
        return super.close()
            .then((x) => {
            this._isOpen = false;
            this.requestUpdate('isOpen');
            return x;
        });
    }
    /**
     * Toggles the `BannerElement`.
     * If the `BannerElement` is open, it will close it. If it is closed, it will open it.
     *
     * @public
     */
    async toggle() {
        if (this._isOpen) {
            return this.close().then(() => void 0);
        }
        return this.open();
    }
    /**
     * @protected
     * @override
     */
    onApplyTemplate() {
        super.onApplyTemplate();
        this._actionElements = getSlotElements(this, 'actions', ButtonElement);
    }
    onDisabledPropertyChanged(_prev, next) {
        if (next !== undefined) {
            this._actionElements.forEach((x) => x.disabled = next);
        }
    }
    onVariantPropertyChanged(_prev, next) {
        this._actionElements.forEach((x) => x.variant = next ?? Variant.Default);
    }
    onAppearancePropertyChanged(_prev, next) {
        this._actionElements.forEach((x) => x.appearance = next ?? Appearance.Default);
    }
};
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], BannerElement.prototype, "icon", null);
__decorate([
    Attribute({ type: Size }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], BannerElement.prototype, "iconSize", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], BannerElement.prototype, "header", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], BannerElement.prototype, "subHeader", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], BannerElement.prototype, "isOpen", null);
__decorate([
    Watch('disabled'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean, Boolean]),
    __metadata("design:returntype", void 0)
], BannerElement.prototype, "onDisabledPropertyChanged", null);
__decorate([
    Watch('variant'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], BannerElement.prototype, "onVariantPropertyChanged", null);
__decorate([
    Watch('appearance'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], BannerElement.prototype, "onAppearancePropertyChanged", null);
BannerElement = __decorate([
    Component({
        selector: 'mosaik-banner',
        template: bannerElementTemplate,
        themes: {
            joy: bannerElementJoyStyle,
            retro: bannerElementRetroStyle,
            cosmopolitan: bannerElementCosmopolitanStyle
        },
        imports: [
            IconElement,
            TextElement,
            BannerHeaderElement,
            BannerSubHeaderElement,
            StackElement
        ]
    }),
    __metadata("design:paramtypes", [])
], BannerElement);
export { BannerElement };
//# sourceMappingURL=BannerElement.js.map