import { h } from "@stencil/core";
import Modal from "@ecl/modal";
export class EclModal {
    constructor() {
        this.variant = 'default';
        this.withBody = false;
        this.withBodyFixed = false;
        this.withHeader = false;
        this.noScript = false;
        this.withFooter = false;
        this.size = 'l';
    }
    getClass() {
        return [
            `ecl-modal`,
            `ecl-modal--${this.variant}`,
            `ecl-modal--${this.size}`,
            this.styleClass
        ].join(' ');
    }
    getContentClasses() {
        return this.size === 's' ? 'ecl-modal__content ecl-col-12' : 'ecl-modal__content ecl-col-m-10 ecl-col-l-8';
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    componentDidLoad() {
        if (!this.noScript) {
            ;
            window.ECL = window.ECL || {};
            ECL.Modal = Modal;
            const modal = new Modal(this.el.firstElementChild);
            modal.init();
        }
    }
    render() {
        return (h("dialog", { key: 'c72aa6843f88f1ddf0446055455e83f3f95adbb6', class: this.getClass(), "data-ecl-modal-toggle": this.toggleId, id: this.itemId }, h("div", { key: '4876a18c0df0cda22f5dcc956994066080100c92', class: "ecl-modal__container ecl-container" }, h("div", { key: 'facfee6beaf2d71e1f75af2a5de95c5ddd2b00c7', class: this.getContentClasses() }, h("header", { key: '5d50d1ea5c22dd889e52d2b8b8002cb931546457', class: "ecl-modal__header" }, this.withHeader && this.variant !== 'default' ? (h("ecl-icon", { icon: this.variant, size: "m", styleClass: `ecl-modal__icon sc-ecl-modal-${this.theme}` })) : '', this.withHeader ? (h("div", { class: "ecl-modal__header-content" }, h("slot", { name: "header" }))) : '', h("ecl-button", { key: '80dbaf201e659017b661c40ee1fb956d8330e9cc', theme: this.theme, type: "button", variant: "tertiary", "hide-label": true, buttonStyle: "neutral", styleClass: `ecl-modal__close sc-ecl-modal-${this.theme}`, "data-ecl-modal-close": true }, this.closeLabel, h("ecl-icon", { key: 'cf47a23a53e349064573a26868dffaccdb01aac3', icon: "close", size: "s", slot: "icon-after", "style-class": `sc-ecl-modal-${this.theme}` }))), h("div", { key: 'f7c91109d40d3410d5b641b8ae7ef05b7440704e', class: "ecl-modal__body" }, this.withBody ?
            h("div", { class: "ecl-modal__body-scroll", "data-ecl-modal-scroll": true }, h("slot", { name: "body" })) : '', this.withBody ?
            h("div", { class: "ecl-modal__body-overflow", "aria-hidden": "true" }) : '', this.withBodyFixed ?
            h("div", { class: "ecl-modal__body-fixed" }, h("slot", { name: "body-fixed" })) : ''), this.withFooter ?
            h("footer", { class: "ecl-modal__footer" }, h("div", { class: "ecl-modal__footer-content" }, h("slot", { name: "footer" }))) : ''))));
    }
    static get is() { return "ecl-modal"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "ec": ["./build/styles/ecl-modal-ec.css"],
            "eu": ["./build/styles/ecl-modal-eu.css"]
        };
    }
    static get styleUrls() {
        return {
            "ec": ["build/styles/ecl-modal-ec.css"],
            "eu": ["build/styles/ecl-modal-eu.css"]
        };
    }
    static get properties() {
        return {
            "theme": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "theme"
            },
            "variant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "variant",
                "defaultValue": "'default'"
            },
            "styleClass": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "style-class"
            },
            "withBody": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "with-body",
                "defaultValue": "false"
            },
            "withBodyFixed": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "with-body-fixed",
                "defaultValue": "false"
            },
            "withHeader": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "with-header",
                "defaultValue": "false"
            },
            "noScript": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "no-script",
                "defaultValue": "false"
            },
            "withFooter": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "with-footer",
                "defaultValue": "false"
            },
            "toggleId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "toggle-id"
            },
            "size": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "size",
                "defaultValue": "'l'"
            },
            "closeLabel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "close-label"
            },
            "itemId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "item-id"
            }
        };
    }
    static get elementRef() { return "el"; }
}
