import { Host, h } from '@stencil/core';
/**
 * For internal use within bs-input-field, bs-textarea-field, and bs-select-field
 * to conditionally render helper text and character count.
 */
export class BsFieldDetails {
  constructor() {
    this.charCount = undefined;
    this.charMax = undefined;
    this.error = undefined;
    this.errorMsg = undefined;
    this.hint = undefined;
    this.hintId = undefined;
  }
  get hintMsg() {
    return this.errorMsg || this.hint || undefined;
  }
  render() {
    return (h(Host, { class: "bs-field-details" }, this.hintMsg && (h("span", { id: this.hintId, class: "bs-hint", "data-error": this.error || undefined }, this.hintMsg)), this.charMax && (h("span", { class: "bs-character-count", "data-error": (this.charCount > this.charMax) || undefined }, this.charCount || '0', " / ", this.charMax))));
  }
  static get is() { return "bs-field-details"; }
  static get originalStyleUrls() {
    return {
      "$": ["bs-field-details.scss"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["bs-field-details.css"]
    };
  }
  static get properties() {
    return {
      "charCount": {
        "type": "number",
        "mutable": false,
        "complexType": {
          "original": "number",
          "resolved": "number",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "The number of characters that have been entered by the user."
        },
        "attribute": "char-count",
        "reflect": false
      },
      "charMax": {
        "type": "number",
        "mutable": false,
        "complexType": {
          "original": "number",
          "resolved": "number",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Pass value to show character count and set the maximum number of characters that are allowed to be submitted by the user."
        },
        "attribute": "char-max",
        "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 helper text."
        },
        "attribute": "error",
        "reflect": false
      },
      "errorMsg": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Pass error text."
        },
        "attribute": "error-msg",
        "reflect": false
      },
      "hint": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Pass single helper text."
        },
        "attribute": "hint",
        "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 an input."
        },
        "attribute": "hint-id",
        "reflect": false
      }
    };
  }
}
//# sourceMappingURL=bs-field-details.js.map
