import { h } from "@stencil/core";
export class EclDescriptionListDefinition {
    constructor() {
        this.getMarkup = (itemsArray) => {
            if (this.type === 'link' && itemsArray) {
                return itemsArray.map((link) => (h("ecl-link", { theme: this.theme, styleClass: `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}`, path: link.path }, link.icon ?
                    h("ecl-icon", { theme: this.theme, slot: "icon-before", icon: link.icon })
                    : '', link.label)));
            }
            else if (this.type === 'link' && !itemsArray) {
                return h("slot", null);
            }
            if (this.type === 'inline' && itemsArray) {
                return itemsArray.map((inline) => (h("ecl-link", { styleClass: `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}`, path: inline.path, theme: this.theme }, inline.label)));
            }
            else if (this.type === 'inline' && !itemsArray) {
                return h("slot", null);
            }
            if (this.type === 'taxonomy' && itemsArray) {
                return itemsArray.map((taxonomy) => (h("span", { class: `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}` }, taxonomy.path ?
                    h("ecl-link", { theme: this.theme, path: taxonomy.path }, taxonomy.label) : taxonomy)));
            }
            else if (this.type === 'taxonomy' && !itemsArray) {
                return h("slot", null);
            }
            if (this.type === 'text') {
                return h("slot", null);
            }
        };
        this.type = 'text';
        this.styleClass = '';
        this.theme = 'ec';
        this.items = undefined;
        this.collapsible = false;
    }
    getClass() {
        return [
            `ecl-description-list__definition`,
            `sc-ecl-description-list-${this.theme}`,
            `ecl-description-list__definition--${this.type}`,
            this.styleClass
        ].join(' ');
    }
    render() {
        const itemsArray = this.items ? JSON.parse(this.items) : false;
        return (h("dd", Object.assign({ class: this.getClass() }, (this.collapsible ? { 'data-ecl-description-list-collapsible': true } : {})), this.getMarkup(itemsArray)));
    }
    static get is() { return "ecl-description-list-definition"; }
    static get properties() {
        return {
            "type": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "type",
                "reflect": false,
                "defaultValue": "'text'"
            },
            "styleClass": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "style-class",
                "reflect": false,
                "defaultValue": "''"
            },
            "theme": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "theme",
                "reflect": false,
                "defaultValue": "'ec'"
            },
            "items": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "items",
                "reflect": false
            },
            "collapsible": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "attribute": "collapsible",
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
}
//# sourceMappingURL=ecl-description-list-definition.js.map
