import { h, } from "@stencil/core";
export class DropdownItem {
    /** Icon to show in the dropdown item. */
    icon;
    /** Link the dropdown item should navigate to when clicked. */
    href = "";
    /** Where to open the link. */
    target = "_self";
    /** If true, this dropdown item is hidden. */
    hide = false;
    /** If true, this item is shown in an error style. */
    error = false;
    size = 'l';
    /** Fired when the dropdown item is clicked or selected. */
    ifxDropdownItem;
    el;
    handleMenuSize(event) {
        this.size = event.detail;
    }
    handleEventEmission() {
        this.ifxDropdownItem.emit(this.el.textContent);
    }
    render() {
        const hasHref = this.href !== undefined && this.href !== null && this.href !== '';
        const common = {
            class: `dropdown-item ${this.size === 's' ? 'small' : ""} ${this.hide ? 'hide' : ""} ${this.error ? 'error' : ""}`,
            onClick: () => this.handleEventEmission(),
            role: 'menuitem'
        };
        if (!hasHref)
            common.tabIndex = 0;
        return (h("a", { key: '97d71de191bc99ad5419c53fc5c02c4f0b72ebe3', ...common, ...(hasHref ? { href: this.href, target: this.target, error: this.error } : {}) }, this.icon && h("ifx-icon", { key: '0fe37b2bb72b04af588f6a767717c2e3a03dd056', class: "icon", icon: this.icon }), h("span", { key: 'f23fddda13075d96e982b6c03f43498c74d23a69' }, h("slot", { key: '487e72e6372de61439a444e0c9c460555344eaf7' }))));
    }
    static get is() { return "ifx-dropdown-item"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["dropdown-item.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["dropdown-item.css"]
        };
    }
    static get properties() {
        return {
            "icon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon to show in the dropdown item."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "icon"
            },
            "href": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Link the dropdown item should navigate to when clicked."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "href",
                "defaultValue": "\"\""
            },
            "target": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Where to open the link."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "target",
                "defaultValue": "\"_self\""
            },
            "hide": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If true, this dropdown item is hidden."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "hide",
                "defaultValue": "false"
            },
            "error": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If true, this item is shown in an error style."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "error",
                "defaultValue": "false"
            }
        };
    }
    static get states() {
        return {
            "size": {}
        };
    }
    static get events() {
        return [{
                "method": "ifxDropdownItem",
                "name": "ifxDropdownItem",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Fired when the dropdown item is clicked or selected."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }];
    }
    static get elementRef() { return "el"; }
    static get listeners() {
        return [{
                "name": "menuSize",
                "method": "handleMenuSize",
                "target": "body",
                "capture": false,
                "passive": false
            }];
    }
}
