import { Host, h, Fragment } from '@stencil/core';
import { getHostAttrs } from '../../utils';
/**
 * Provides a label for form elements.
 */
export class BsLabel {
  constructor() {
    /** Native attributes to pass through to the input element. */
    this.attrs = {};
    this.disabled = undefined;
    this.for = undefined;
    this.hide = undefined;
    this.passAttrs = '';
    this.required = undefined;
  }
  componentWillLoad() {
    this.attrs = getHostAttrs(this.hostEl, this.passAttrs.split(','));
  }
  render() {
    return (h(Host, { class: this.hide ? 'visually-hidden' : '' }, h("label", Object.assign({ "data-disabled": this.disabled, htmlFor: this.for }, this.attrs), h("span", { "data-slot": true }, h("slot", null)), this.required && (h(Fragment, null, h("span", { "data-required": true, "aria-hidden": "true" }, " *"), h("span", { class: "visually-hidden" }, "required"))))));
  }
  static get is() { return "bs-label"; }
  static get originalStyleUrls() {
    return {
      "$": ["bs-label.scss"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["bs-label.css"]
    };
  }
  static get properties() {
    return {
      "disabled": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Applies disabled styles to the label."
        },
        "attribute": "disabled",
        "reflect": false
      },
      "for": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Applies disabled styles to the input wrapper."
        },
        "attribute": "for",
        "reflect": false
      },
      "hide": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Applies visually-hidden class to the label."
        },
        "attribute": "hide",
        "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 <label>."
        },
        "attribute": "pass-attrs",
        "reflect": false,
        "defaultValue": "''"
      },
      "required": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Pass \"true\" to append \"*\" to label text."
        },
        "attribute": "required",
        "reflect": false
      }
    };
  }
  static get elementRef() { return "hostEl"; }
}
//# sourceMappingURL=bs-label.js.map
