import { h } from "@stencil/core";
import { HideModal } from "./util";
export class DgaModal {
    constructor() {
        this.showCloseButton = true;
        this.featuredIconStyle = 'light';
        this.featuredIconType = 'InformationCircle';
        this.secondBtnPosition = 'left';
        this.position = 'center';
        this.open = false;
        this.staticModal = false;
        this.buttonsList = [];
    }
    handleClickOutside(event) {
        event.stopPropagation();
        event.preventDefault();
        if (this.staticModal)
            return;
        HideModal(this.name);
    }
    componentWillLoad() {
        this.el.childNodes.forEach(item => {
            const el = item;
            if (el.tagName === 'DGA-MODAL-HEADER' && el.attributes.getNamedItem('slot') === null) {
                el.setAttribute('slot', 'modal-header');
            }
            if (el.tagName === 'DGA-MODAL-BODY' && el.attributes.getNamedItem('slot') === null) {
                el.setAttribute('slot', 'modal-body');
            }
            if (el.tagName === 'DGA-MODAL-ACTIONS' && el.attributes.getNamedItem('slot') === null) {
                el.setAttribute('slot', 'modal-actions');
            }
        });
    }
    render() {
        return (h("dialog", Object.assign({ key: '0f0e144856afdbf2c4fe96e977de210e0abb1ba3', onClick: e => this.handleClickOutside(e), ref: el => (this.dialogRef = el), class: `dga-flex-align-${this.position}` }, (this.open && { open: this.open }), { hidden: !this.open }), h("div", { key: '9314a5b5018c171b63829ba216cf91bd372bfef7', class: "modal", ref: el => (this.containergRef = el), onClick: e => e.stopPropagation() }, this.showCloseButton && (h("div", { key: '9379c813612875cc4294ca1b738e18f9d3c0983e', class: "modal__close-btn" }, h("dga-button", { key: '330b50db32c018490c2df5eff5ad6beee6a8ae1d', size: "md", iconOnly: true, iconType: "Cancel01Icon", iconProps: {
                variant: 'stroke',
                color: '#161616',
                type: 'rounded',
            }, onClick: this.onClose, variant: "subtle" }))), h("slot", { key: 'd7d277580bab87917d4c6eb3b5fe8f4540a2f463', name: "modal-header" }), h("slot", { key: 'd94a7692d39b2bd502001942af69c2da578a8e25', name: "modal-body" }), h("slot", { key: '9afecdc73f2d63af344a5065570204afa09ad486', name: "modal-actions" }))));
    }
    static get is() { return "dga-modal-v2"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["dga-modal.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["dga-modal.css"]
        };
    }
    static get properties() {
        return {
            "modalTitle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "title",
                "reflect": false
            },
            "showCloseButton": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "show-close-button",
                "reflect": false,
                "defaultValue": "true"
            },
            "onClose": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(event: any) => void",
                    "resolved": "(event: any) => void",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            },
            "featuredIconColor": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'brand' | 'gray' | 'error' | 'warning' | 'success' | 'info'",
                    "resolved": "\"brand\" | \"error\" | \"gray\" | \"info\" | \"success\" | \"warning\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "featured-icon-color",
                "reflect": false
            },
            "featuredIconStyle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'light' | 'outlined' | 'dark'",
                    "resolved": "\"dark\" | \"light\" | \"outlined\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "featured-icon-style",
                "reflect": false,
                "defaultValue": "'light'"
            },
            "featuredIconType": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'InformationCircle' | 'AlertCircle'",
                    "resolved": "\"AlertCircle\" | \"InformationCircle\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "featured-icon-type",
                "reflect": false,
                "defaultValue": "'InformationCircle'"
            },
            "featuredIconCircle": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "featured-icon-circle",
                "reflect": false
            },
            "featuredIconSize": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'xl' | 'lg' | 'md' | 'sm'",
                    "resolved": "\"lg\" | \"md\" | \"sm\" | \"xl\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "featured-icon-size",
                "reflect": false
            },
            "alignmentCenter": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "alignment-center",
                "reflect": false
            },
            "actionFillContainer": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "action-fill-container",
                "reflect": false
            },
            "actionStack": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "action-stack",
                "reflect": false
            },
            "secondBtnPosition": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'left' | 'right'",
                    "resolved": "\"left\" | \"right\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "second-btn-position",
                "reflect": false,
                "defaultValue": "'left'"
            },
            "position": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'start' | 'end' | 'center'",
                    "resolved": "\"center\" | \"end\" | \"start\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "position",
                "reflect": false,
                "defaultValue": "'center'"
            },
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "name",
                "reflect": false
            },
            "open": {
                "type": "boolean",
                "mutable": true,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "open",
                "reflect": true,
                "defaultValue": "false"
            },
            "staticModal": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "static-modal",
                "reflect": false,
                "defaultValue": "false"
            },
            "buttonsList": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "Array<{\n    id?: string;\n    label: string;\n    onClick: (event?: any) => void;\n    extraClass?: string;\n    title?: string;\n  }>",
                    "resolved": "{ id?: string; label: string; onClick: (event?: any) => void; extraClass?: string; title?: string; }[]",
                    "references": {
                        "Array": {
                            "location": "global",
                            "id": "global::Array"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "defaultValue": "[]"
            }
        };
    }
    static get elementRef() { return "el"; }
}
//# sourceMappingURL=dga-modal-v2.js.map
