import { h, Host } from '@stencil/core';
import { getHostAttrs } from '../../utils';
/**
 * Display a select element with custom options.
 */
export class BsSelect {
  constructor() {
    /** Native attributes to pass through to the <select>. */
    this.attrs = {};
    this.disabled = false;
    this.inputId = undefined;
    this.required = undefined;
    this.error = undefined;
    this.hintId = undefined;
    this.value = undefined;
    this.passAttrs = '';
  }
  get aria() {
    return { [this.error ? 'aria-errormessage' : 'aria-describedby']: this.hintId };
  }
  componentWillLoad() {
    this.attrs = getHostAttrs(this.hostEl, [
      'autocomplete',
      'multiple',
      'id',
      'name',
      'size',
      ...this.passAttrs.split(',')
    ]);
  }
  render() {
    return (h(Host, null, h("select", Object.assign({ id: this.inputId, class: "bs-select", "data-slot": true, disabled: this.disabled, required: this.required, "data-error": this.error }, Object.assign(Object.assign({}, this.attrs), this.aria)), h("slot", null))));
  }
  static get is() { return "bs-select"; }
  static get originalStyleUrls() {
    return {
      "$": ["bs-select.scss"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["bs-select.css"]
    };
  }
  static get properties() {
    return {
      "disabled": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Sets the disabled state on the select element."
        },
        "attribute": "disabled",
        "reflect": false,
        "defaultValue": "false"
      },
      "inputId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Pass id attribute to set on the native input element."
        },
        "attribute": "input-id",
        "reflect": false
      },
      "required": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Sets the required state on the select element."
        },
        "attribute": "required",
        "reflect": false
      },
      "error": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Applies error styles to the select."
        },
        "attribute": "error",
        "reflect": false
      },
      "hintId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Adds an id to associate a hint to a select."
        },
        "attribute": "hint-id",
        "reflect": false
      },
      "value": {
        "type": "any",
        "mutable": false,
        "complexType": {
          "original": "string | number",
          "resolved": "number | string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Sets the input value."
        },
        "attribute": "value",
        "reflect": false
      },
      "passAttrs": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "List additional attributes by name (comma-separated) to pass through to <select>."
        },
        "attribute": "pass-attrs",
        "reflect": false,
        "defaultValue": "''"
      }
    };
  }
  static get elementRef() { return "hostEl"; }
}
//# sourceMappingURL=bs-select.js.map
