import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { v as v4, b as getHostAttrsWithId } from './index2.js';
import { d as defineCustomElement$6 } from './bs-character-count2.js';
import { d as defineCustomElement$5 } from './bs-field-layout2.js';
import { d as defineCustomElement$4 } from './bs-hint2.js';
import { d as defineCustomElement$3 } from './bs-label2.js';
import { d as defineCustomElement$2 } from './bs-textarea2.js';

const bsTextareaFieldCss = "bs-textarea-field{display:block;width:100%}";

const BsTextareaField$1 = /*@__PURE__*/ proxyCustomElement(class BsTextareaField extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    /** Native attributes to pass through to the input element. */
    this.attrs = {};
    this.charMax = undefined;
    this.disabled = false;
    this.error = undefined;
    this.hints = undefined;
    this.label = undefined;
    this.placeholder = undefined;
    this.required = undefined;
    this.value = '';
    this.passAttrs = '';
    this.hintId = null;
  }
  get charCount() {
    var _a;
    return ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0;
  }
  componentWillLoad() {
    this.hintId = this.hints ? v4() : null;
    this.attrs = getHostAttrsWithId(this.hostEl, [
      'autocomplete',
      'maxlength',
      'minlength',
      'name',
      ...this.passAttrs.split(',')
    ]);
  }
  render() {
    return (h(Host, null, h("bs-field-layout", { disabled: this.disabled, error: this.error, hints: this.hints, label: this.label, labelFor: this.attrs.id, required: this.required, charCount: this.charCount, charMax: this.charMax, hintId: this.hintId }, h("bs-textarea", Object.assign({ disabled: this.disabled, error: this.error, placeholder: this.placeholder, required: this.required, value: this.value, hintId: this.hintId }, this.attrs)))));
  }
  get hostEl() { return this; }
  static get style() { return bsTextareaFieldCss; }
}, [0, "bs-textarea-field", {
    "charMax": [2, "char-max"],
    "disabled": [4],
    "error": [4],
    "hints": [1],
    "label": [1],
    "placeholder": [1],
    "required": [4],
    "value": [1],
    "passAttrs": [1, "pass-attrs"],
    "hintId": [32]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["bs-textarea-field", "bs-character-count", "bs-field-layout", "bs-hint", "bs-label", "bs-textarea"];
  components.forEach(tagName => { switch (tagName) {
    case "bs-textarea-field":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, BsTextareaField$1);
      }
      break;
    case "bs-character-count":
      if (!customElements.get(tagName)) {
        defineCustomElement$6();
      }
      break;
    case "bs-field-layout":
      if (!customElements.get(tagName)) {
        defineCustomElement$5();
      }
      break;
    case "bs-hint":
      if (!customElements.get(tagName)) {
        defineCustomElement$4();
      }
      break;
    case "bs-label":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "bs-textarea":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}

const BsTextareaField = BsTextareaField$1;
const defineCustomElement = defineCustomElement$1;

export { BsTextareaField, defineCustomElement };

//# sourceMappingURL=bs-textarea-field.js.map