import { h } from '@stencil/core';
/**
 * S'utilise avec des materials-list-item à placer à l'intérieur du tag.
 * <materials-dropdown>
 *   <materials-list-item></materials-list-item>
 * </materials-dropdown>
 */
export class Dropdown {
    componentDidLoad() {
        this.materialsMenuEl.setPosition(this.menuPosition);
        if (this.buttonType)
            this.buttonEl[this.buttonType] = true;
    }
    componentWillUpdate() {
        if (this.buttonType)
            this.buttonEl[this.buttonType] = true;
    }
    async openMenu() {
        this.materialsMenuEl.open();
    }
    async closeMenu() {
        this.materialsMenuEl.close();
    }
    async isOpen() {
        return this.materialsMenuEl.isOpen();
    }
    renderIconHelper() {
        return this.iconHelper ? h("materials-icon", { style: { 'margin-left': '8px', 'margin-right': '-8px' }, name: this.iconHelper }) : '';
    }
    render() {
        return (h("div", null,
            this.iconOnly &&
                h("materials-icon-button", { onClick: () => this.openMenu(), icon: this.icon }),
            !this.iconOnly &&
                h("materials-button", { color: this.color, onClick: () => this.openMenu(), icon: this.icon, ref: el => this.buttonEl = el },
                    this.menuTitle,
                    this.renderIconHelper()),
            h("materials-menu", { ref: el => this.materialsMenuEl = el },
                h("slot", null))));
    }
    static get is() { return "materials-dropdown"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["dropdown.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["dropdown.css"]
    }; }
    static get properties() { return {
        "menuTitle": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "menu-title",
            "reflect": false
        },
        "menuPosition": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "'TOP_LEFT' | 'TOP_RIGHT' | 'BOTTOM_LEFT' | 'BOTTOM_RIGHT' | 'TOP_START' | 'TOP_END' | 'BOTTOM_START' | 'BOTTOM_END'",
                "resolved": "\"BOTTOM_END\" | \"BOTTOM_LEFT\" | \"BOTTOM_RIGHT\" | \"BOTTOM_START\" | \"TOP_END\" | \"TOP_LEFT\" | \"TOP_RIGHT\" | \"TOP_START\"",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "menu-position",
            "reflect": false
        },
        "icon": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "icon",
            "reflect": false
        },
        "iconOnly": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "icon-only",
            "reflect": false
        },
        "color": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "color",
            "reflect": false
        },
        "buttonType": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "button-type",
            "reflect": false
        },
        "iconHelper": {
            "type": "string",
            "mutable": false,
            "complexType": {
                "original": "string",
                "resolved": "string",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "attribute": "icon-helper",
            "reflect": false
        }
    }; }
    static get methods() { return {
        "openMenu": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "closeMenu": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "isOpen": {
            "complexType": {
                "signature": "() => Promise<boolean>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<boolean>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        }
    }; }
}
