import { h } from "@stencil/core";
export class EclDescriptionListDefinition {
    constructor() {
        this.type = 'text';
        this.styleClass = '';
        this.collapsible = false;
        this.getMarkup = (itemsArray) => {
            if (this.type === 'link' && itemsArray) {
                return (itemsArray.map((link) => (h("li", { class: `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}` }, h("ecl-link", { theme: this.theme, styleClass: `sc-ecl-description-list-${this.theme}`, path: link.path }, link.label)))));
            }
            else if (this.type === 'link' && !itemsArray) {
                return h("slot", null);
            }
            if (this.type === 'inline' && itemsArray) {
                return (itemsArray.map((inline) => (h("li", { class: `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}` }, h("ecl-link", { styleClass: `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("li", { 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 === 'tag' && itemsArray) {
                return (itemsArray.map((tag) => (h("li", { class: `ecl-description-list__definition-item sc-ecl-description-list-${this.theme}` }, h("ecl-tag", { variant: "link", url: tag.url }, " ", tag.label)))));
            }
            else if (this.type === 'tag' && !itemsArray) {
                return h("slot", null);
            }
            if (this.type === 'text') {
                return h("slot", null);
            }
        };
    }
    getClass() {
        return [
            `ecl-description-list__definition`,
            `sc-ecl-description-list-${this.theme}`,
            `ecl-description-list__definition--${this.type}`,
            this.styleClass
        ].join(' ');
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    render() {
        const itemsArray = this.items ? JSON.parse(this.items) : false;
        return (h("dd", { key: 'efb399271f7f92ec08334aa7bfa7d8614c45d51e', class: this.getClass() }, h("ul", Object.assign({ key: '4b148a12be780264c66bc7e498b987ab7c47c857', class: `ecl-description-list__definition-list sc-ecl-description-list-${this.theme}` }, (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": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "type",
                "defaultValue": "'text'"
            },
            "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",
                "defaultValue": "''"
            },
            "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"
            },
            "items": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "items"
            },
            "collapsible": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "collapsible",
                "defaultValue": "false"
            }
        };
    }
}
