import { Component, Host, h, Prop, Event, Watch } from '@stencil/core';
export class UxplSwitchInput {
  constructor() {
    this.inputId = `toggle-button-${toggleButtonIds++}`;
    /**
     * If `true`, the toggle is selected.
     */
    this.checked = false;
    this.onClick = () => {
      this.checked = !this.checked;
    };
  }
  checkedChanged(isChecked) {
    this.uxplChange.emit({
      checked: isChecked,
      value: this.value
    });
  }
  render() {
    return (h(Host, null,
      h("div", { class: "pl-toggle" },
        h("input", { disabled: this.disabled, checked: this.checked, class: "pl-toggle__input", type: "checkbox", id: this.inputId, "aria-checked": "false", onClick: () => this.onClick() }),
        h("label", { class: "pl-toggle__label", htmlFor: this.inputId },
          h("slot", null)))));
  }
  static get is() { return "uxpl-switch-input"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["uxpl-switch-input.css"]
  }; }
  static get styleUrls() { return {
    "$": ["uxpl-switch-input.css"]
  }; }
  static get properties() { return {
    "label": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "label"
      },
      "attribute": "label",
      "reflect": false
    },
    "value": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "value"
      },
      "attribute": "value",
      "reflect": false
    },
    "checked": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "If `true`, the toggle is selected."
      },
      "attribute": "checked",
      "reflect": false,
      "defaultValue": "false"
    },
    "disabled": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "disabled"
      },
      "attribute": "disabled",
      "reflect": false
    }
  }; }
  static get events() { return [{
      "method": "uxplChange",
      "name": "uxplChange",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": "Value changed"
      },
      "complexType": {
        "original": "ToggleChangeEventDetail",
        "resolved": "ToggleChangeEventDetail",
        "references": {
          "ToggleChangeEventDetail": {
            "location": "import",
            "path": "../../models/switch-input"
          }
        }
      }
    }]; }
  static get watchers() { return [{
      "propName": "checked",
      "methodName": "checkedChanged"
    }]; }
}
let toggleButtonIds = 0;
