import { h } from "@stencil/core";
export class DgaListItem {
    componentWillLoad() {
        const parentElement = this.el.closest('[type]');
        if (parentElement) {
            this.inheritedType = parentElement.getAttribute('type');
        }
    }
    // componentWillLoad() {
    //   if (this.type === 'with-icon' && !this.icon) {
    //     throw new Error('Icon prop is required when type is "with-icon"');
    //   }
    // }
    getListClass() {
        return {
            'list-item': true,
            [`list-item--level-${this.level}`]: true,
            [`list-item--${this.type}`]: true
        };
    }
    renderMarker() {
        if (this.type === 'ordered') {
            return (h("span", { class: "list-item__marker" }, this.level === 'one' ? this.itemNumber : this.itemLetter));
        }
        return null;
    }
    render() {
        return (h("li", { key: 'df45d1fcf2b6dc607196b39395ece55339349f72', class: this.getListClass() }, this.type === 'with-icon' && (h("span", { key: '99e3ee7f770ec29449a0f1c7839eccf944adfc6a', class: "list-item__icon", innerHTML: this.icon })), this.renderMarker(), h("span", { key: '1780e286f0df877c4e98ded2ec704ad86f1bc9c2', class: "list-item__text" }, this.itemText)));
    }
    static get is() { return "dga-list-item"; }
    static get originalStyleUrls() {
        return {
            "$": ["dga-list-item.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["dga-list-item.css"]
        };
    }
    static get properties() {
        return {
            "type": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "ListItemProps['type']",
                    "resolved": "\"ordered\" | \"unordered\" | \"with-icon\"",
                    "references": {
                        "ListItemProps": {
                            "location": "local",
                            "path": "/home/mamoud/Documents/temp/components/platform-code-cross-platform-storybook/packages/core/src/components/dga-list/dga-list-item.tsx",
                            "id": "src/components/dga-list/dga-list-item.tsx::ListItemProps"
                        }
                    }
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "type",
                "reflect": false
            },
            "level": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "ListItemProps['level']",
                    "resolved": "\"one\" | \"two\"",
                    "references": {
                        "ListItemProps": {
                            "location": "local",
                            "path": "/home/mamoud/Documents/temp/components/platform-code-cross-platform-storybook/packages/core/src/components/dga-list/dga-list-item.tsx",
                            "id": "src/components/dga-list/dga-list-item.tsx::ListItemProps"
                        }
                    }
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "level",
                "reflect": false
            },
            "itemText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "item-text",
                "reflect": false
            },
            "itemNumber": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "item-number",
                "reflect": false
            },
            "itemLetter": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "item-letter",
                "reflect": false
            },
            "icon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "attribute": "icon",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "inheritedType": {}
        };
    }
    static get elementRef() { return "el"; }
}
//# sourceMappingURL=dga-list-item.js.map
