import { h, Host } from '@stencil/core';
import { getHostAttrs } from '../../utils';
/**
 * Displays an textarea element.
 */
export class BsTextarea {
  constructor() {
    /** Native attributes to pass through to the textarea element. */
    this.attrs = {};
    this.disabled = false;
    this.error = undefined;
    this.inputId = undefined;
    this.passAttrs = '';
    this.placeholder = undefined;
    this.required = undefined;
    this.rows = 6;
    this.value = undefined;
    this.hintId = undefined;
  }
  get aria() {
    return { [this.error ? 'aria-errormessage' : 'aria-describedby']: this.hintId };
  }
  componentWillLoad() {
    this.attrs = getHostAttrs(this.hostEl, [
      'autocomplete',
      'cols',
      'maxlength',
      'minlength',
      'name',
      ...this.passAttrs.split(',')
    ]);
  }
  render() {
    return (h(Host, null, h("textarea", Object.assign({ id: this.inputId, disabled: this.disabled, placeholder: this.placeholder, required: this.required, "data-error": this.error, value: this.value, rows: this.rows }, Object.assign(Object.assign({}, this.attrs), this.aria)))));
  }
  static get is() { return "bs-textarea"; }
  static get originalStyleUrls() {
    return {
      "$": ["bs-textarea.scss"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["bs-textarea.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 textarea."
        },
        "attribute": "disabled",
        "reflect": false,
        "defaultValue": "false"
      },
      "error": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Applies error styles to the textarea."
        },
        "attribute": "error",
        "reflect": 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
      },
      "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 <textarea>."
        },
        "attribute": "pass-attrs",
        "reflect": false,
        "defaultValue": "''"
      },
      "placeholder": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Placeholder attribute - same as native"
        },
        "attribute": "placeholder",
        "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 textarea."
        },
        "attribute": "required",
        "reflect": false
      },
      "rows": {
        "type": "number",
        "mutable": false,
        "complexType": {
          "original": "number",
          "resolved": "number",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Sets the `rows` attribute on the textarea."
        },
        "attribute": "rows",
        "reflect": false,
        "defaultValue": "6"
      },
      "value": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Sets the textarea value."
        },
        "attribute": "value",
        "reflect": false
      },
      "hintId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Adds an id to associate a hint to a textarea."
        },
        "attribute": "hint-id",
        "reflect": false
      }
    };
  }
  static get elementRef() { return "hostEl"; }
}
//# sourceMappingURL=bs-textarea.js.map
