// #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 { Dimensionable } from '../../../Behaviors/Dimensionable';
import { Fitable } from '../../../Behaviors/Fitable';
import { Insetable } from '../../../Behaviors/Insetable';
import { Themeable } from '../../../Behaviors/Themeable';
import { InlineStyleController } from '../../../Controllers/InlineStyleController';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { boxElementTemplate } from './BoxElementTemplate';
import { boxElementCosmopolitanStyle } from './Themes/BoxElement.Cosmopolitan';
import { boxElementJoyStyle } from './Themes/BoxElement.Joy';
import { boxElementMemphisStyle } from './Themes/BoxElement.Memphis';
// #endregion
/**
 * Box - A rectangular container used to group or layout other elements.
 *
 * @description
 * Is a equivalent to a `<div>` element with additional features.
 * Also known as a "container" or "panel".
 *
 * @name Box
 * @element mosaik-box
 * @category Primitives
 *
 * @slot - Default slot for child elements.
 * @slot dismiss - Slot for dismiss button.
 *
 * @csspart dismiss - The dismiss part.
 *
 * @cssprop {String} --box-background-color - The background color CSS custom property.
 * @cssprop {String} --box-border-color - The border color CSS custom property.
 * @cssprop {String} --box-border-radius - The border radius CSS custom property.
 * @cssprop {String} --box-border-style - The border style CSS custom property.
 * @cssprop {String} --box-border-width - The border width CSS custom property.
 * @cssprop {String} --box-font-family - The font family CSS custom property.
 * @cssprop {String} --box-font-letter-spacing - The font letter spacing CSS custom property.
 * @cssprop {String} --box-font-line-height - The font line height CSS custom property.
 * @cssprop {String} --box-font-size - The font size CSS custom property.
 * @cssprop {String} --box-font-text-decoration - The font text decoration CSS custom property.
 * @cssprop {String} --box-font-text-transform - The font text transform CSS custom property.
 * @cssprop {String} --box-font-weight - The font weight CSS custom property.
 * @cssprop {String} --box-foreground-color - The foreground color CSS custom property.
 * @cssprop {String} --box-gap - The gap CSS custom property.
 * @cssprop {String} --box-height - The height CSS custom property.
 * @cssprop {String} --box-padding-bottom - The padding bottom CSS custom property.
 * @cssprop {String} --box-padding-left - The padding left CSS custom property.
 * @cssprop {String} --box-padding-right - The padding right CSS custom property.
 * @cssprop {String} --box-padding-top - The padding top CSS custom property.
 * @cssprop {String} --box-shadow - The shadow CSS custom property.
 * @cssprop {String} --box-shadow-blur - The shadow blur CSS custom property.
 * @cssprop {String} --box-shadow-color - The shadow color CSS custom property.
 * @cssprop {String} --box-shadow-offset-x - The shadow offset x CSS custom property.
 * @cssprop {String} --box-shadow-offset-y - The shadow offset y CSS custom property.
 * @cssprop {String} --box-shadow-spread - The shadow spread CSS custom property.
 * @cssprop {String} --box-transition-duration - The transition duration CSS custom property.
 * @cssprop {String} --box-transition-mode - The transition mode CSS custom property.
 * @cssprop {String} --box-transition-property - The transition property CSS custom property.
 * @cssprop {String} --box-translate - The translate CSS custom property.
 * @cssprop {String} --box-width - The width CSS custom property.
 *
 * @example
 * Basic box container:
 * ```html
 * <mosaik-box>
 *   <p>Content goes here</p>
 * </mosaik-box>
 * ```
 *
 * @example
 * Highlighted cornered box:
 * ```html
 * <mosaik-box highlighted cornered>
 *   <p>Highlighted panel</p>
 * </mosaik-box>
 * ```
 *
 * @public
 */
let BoxElement = class BoxElement extends Themeable(Fitable(Dimensionable(Insetable(CustomElement)))) {
    // #region Fields
    _inlineStyleController;
    _highlighted;
    _cornered;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._highlighted = false;
        this._cornered = false;
        this._inlineStyleController = new InlineStyleController(this);
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-box';
    }
    /**
     * Gets or sets the `highlighted` property.
     *
     * @public
     * @attr
     */
    get highlighted() {
        return this._highlighted;
    }
    set highlighted(value) {
        if (this._highlighted !== value) {
            this._highlighted = value;
            this.requestUpdate('highlighted');
        }
    }
    /**
     * Gets or sets the `cornered` property.
     *
     * @public
     * @attr
     */
    get cornered() {
        return this._cornered;
    }
    set cornered(value) {
        if (this._cornered !== value) {
            this._cornered = value;
            this.requestUpdate('cornered');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @public
     * @override
     */
    get width() {
        return super.width;
    }
    set width(value) {
        super.width = value;
        if (this.fit !== 'width' && this.fit !== 'both') {
            this._inlineStyleController.set('min-width', value);
            this._inlineStyleController.set('width', value);
        }
    }
    /**
     * @public
     * @override
     */
    get height() {
        return super.height;
    }
    set height(value) {
        super.height = value;
        if (this.fit !== 'height' && this.fit !== 'both') {
            this._inlineStyleController.set('min-height', value);
            this._inlineStyleController.set('height', value);
        }
    }
    /**
     * @public
     * @override
     */
    get fit() {
        return super.fit;
    }
    set fit(value) {
        super.fit = value;
        if (value === 'width') {
            this._inlineStyleController.set('min-width', this.width);
            this._inlineStyleController.set('width', this.width);
            this._inlineStyleController.set('min-height', 'auto');
            this._inlineStyleController.set('height', 'auto');
        }
        else if (value === 'height') {
            this._inlineStyleController.set('min-width', 'auto');
            this._inlineStyleController.set('width', 'auto');
            this._inlineStyleController.set('min-height', this.height);
            this._inlineStyleController.set('height', this.height);
        }
        else if (value === 'both') {
            this._inlineStyleController.set('min-width', this.width);
            this._inlineStyleController.set('width', this.width);
            this._inlineStyleController.set('min-height', this.height);
            this._inlineStyleController.set('height', this.height);
        }
        else {
            this._inlineStyleController.set('min-width', 'auto');
            this._inlineStyleController.set('width', 'auto');
            this._inlineStyleController.set('min-height', 'auto');
            this._inlineStyleController.set('height', 'auto');
        }
    }
};
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], BoxElement.prototype, "highlighted", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], BoxElement.prototype, "cornered", null);
BoxElement = __decorate([
    Component({
        selector: 'mosaik-box',
        template: boxElementTemplate,
        themes: {
            joy: boxElementJoyStyle,
            memphis: boxElementMemphisStyle,
            cosmopolitan: boxElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], BoxElement);
export { BoxElement };
//# sourceMappingURL=BoxElement.js.map