import { Component, Event, h, Prop, State } from '@stencil/core';
export class UxplOptionList {
  constructor() {
    /**
     * Options
     */
    this.options = [];
    this.inputFocus = false;
  }
  componentWillLoad() {
  }
  componentDidLoad() {
  }
  toggleFocus() {
    this.inputFocus = !this.inputFocus;
  }
  render() {
    return (h("div", { class: "tc-option-input-container" },
      h("div", { class: {
          'tc-form-field': true,
          'tc-option-input': true,
          'tc-error': !this.valid,
          'tc-option-field': true
        } },
        h("div", { class: {
            'tc-option-input-box': true,
            'tc-focus': this.inputFocus
          } },
          h("input", { list: "options", type: this.type, class: "tc-option-input", value: this.value, placeholder: "Text value here", disabled: this.disabled, required: this.required, onFocus: () => this.toggleFocus(), onBlur: () => this.toggleFocus(), onChange: (e) => this.changed.emit(e), onKeyUp: (e) => this.keys.emit(e.key) }),
          h("datalist", { id: "options" }, this.options.map((option) => h("option", null, option)))),
        h("label", null, this.label))));
  }
  static get is() { return "uxpl-option-list"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["uxpl-option-list.css"]
  }; }
  static get styleUrls() { return {
    "$": ["uxpl-option-list.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
    },
    "type": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "type"
      },
      "attribute": "type",
      "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
    },
    "placeholder": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "placeholder"
      },
      "attribute": "placeholder",
      "reflect": false
    },
    "disabled": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "disabled"
      },
      "attribute": "disabled",
      "reflect": false
    },
    "required": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "required"
      },
      "attribute": "required",
      "reflect": false
    },
    "valid": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "valid"
      },
      "attribute": "valid",
      "reflect": false
    },
    "options": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "string[]",
        "resolved": "string[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Options"
      },
      "defaultValue": "[]"
    }
  }; }
  static get states() { return {
    "inputFocus": {}
  }; }
  static get events() { return [{
      "method": "changed",
      "name": "changed",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": "Value changed"
      },
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      }
    }, {
      "method": "keys",
      "name": "keys",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": "Key typed changed"
      },
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      }
    }]; }
}
