import { Corner, MDCMenu } from '@material/menu';
import { h, Host } from '@stencil/core';
export class Menu {
    componentDidLoad() {
        this.mdcMenuEl = new MDCMenu(this.menuEl);
    }
    async setPosition(position) {
        this.mdcMenuEl.setAnchorCorner(Corner[position]);
    }
    async setAnchorMargin(margin) {
        this.mdcMenuEl.setAnchorMargin(margin);
    }
    async isOpen() {
        return Promise.resolve(this.mdcMenuEl.open);
    }
    async open() {
        this.mdcMenuEl.open = true;
    }
    async close() {
        this.mdcMenuEl.open = false;
    }
    render() {
        return (h(Host, null,
            h("style", null, this.maxHeight && `
            .mdc-menu{
              max-height: ${this.maxHeight}px!important;
            }
          `),
            h("div", { class: "mdc-menu-surface--anchor" },
                h("div", { class: "mdc-menu mdc-menu-surface", ref: el => { this.menuEl = el; } },
                    h("ul", { class: { 'mdc-list': true, 'no-padding': this.noPadding }, role: "menu", "aria-hidden": "true", "aria-orientation": "vertical" },
                        h("slot", null))))));
    }
    static get is() { return "materials-menu"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() { return {
        "$": ["menu.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["menu.css"]
    }; }
    static get properties() { return {
        "noPadding": {
            "type": "boolean",
            "mutable": false,
            "complexType": {
                "original": "boolean",
                "resolved": "boolean",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Override default CSS mdc-list padding-top & bottom."
            },
            "attribute": "no-padding",
            "reflect": false
        },
        "maxHeight": {
            "type": "number",
            "mutable": false,
            "complexType": {
                "original": "number",
                "resolved": "number",
                "references": {}
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": "Max-height of the menu"
            },
            "attribute": "max-height",
            "reflect": false
        }
    }; }
    static get methods() { return {
        "setPosition": {
            "complexType": {
                "signature": "(position: \"TOP_LEFT\" | \"TOP_RIGHT\" | \"BOTTOM_LEFT\" | \"BOTTOM_RIGHT\" | \"TOP_START\" | \"TOP_END\" | \"BOTTOM_START\" | \"BOTTOM_END\") => Promise<void>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "setAnchorMargin": {
            "complexType": {
                "signature": "(margin: AnchorMargin) => Promise<void>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    },
                    "AnchorMargin": {
                        "location": "import",
                        "path": "./anchor-margin"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "isOpen": {
            "complexType": {
                "signature": "() => Promise<boolean>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<boolean>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "open": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        },
        "close": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "",
                "tags": []
            }
        }
    }; }
    static get elementRef() { return "host"; }
}
