import { h } from "@stencil/core";
import { _t } from "../i18n/i18n";
import { findOrCreateOnReady } from "../utils";
export class DrawerToggle {
  constructor() {
    this.clickToggle = () => this.toggleDrawer();
    this.icon = "settings";
    this.buttonTitle = _t("webmapgl.drawer-toggle.label");
    this.disabled = false;
  }
  async componentWillLoad() {
    if (this.drawer == undefined)
      this.drawer = await findOrCreateOnReady("gl-drawer");
  }
  toggleDrawer() {
    this.drawer.open = !this.drawer.open;
  }
  render() {
    return (h("ion-button", { onClick: this.clickToggle, title: this.buttonTitle, disabled: this.disabled }, h("ion-icon", { slot: "icon-only", name: this.icon })));
  }
  static get is() { return "gl-drawer-toggle"; }
  static get properties() {
    return {
      "icon": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Icon to display in the button."
        },
        "attribute": "icon",
        "reflect": false,
        "defaultValue": "\"settings\""
      },
      "buttonTitle": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Text to display in the button."
        },
        "attribute": "button-title",
        "reflect": false,
        "defaultValue": "_t(\"webmapgl.drawer-toggle.label\")"
      },
      "disabled": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Whether the button is enabled"
        },
        "attribute": "disabled",
        "reflect": false,
        "defaultValue": "false"
      }
    };
  }
  static get elementRef() { return "el"; }
}
//# sourceMappingURL=drawer-toggle.js.map
