import { Component, Element, Host, Prop, h } from '@stencil/core';
/**
 * @slot - A slot for adding text and a component that can be labeled.
 */
export class Label {
  constructor() {
    /** If input is required label needs to know for styling. */
    this.required = false;
    /** Displays label in  bold or medium font-weight. */
    this.weight = 'bold';
    this.renderTooltipOutsideShadowRoot = (container) => {
      if (container !== undefined) {
        let tooltipContainer = container.querySelector('.tooltip-container');
        if (!tooltipContainer) {
          tooltipContainer = container.ownerDocument.createElement('div');
          tooltipContainer.classList.add('tooltip-container');
          tooltipContainer.innerText = this.tooltip;
          container.appendChild(tooltipContainer);
        }
      }
    };
  }
  //--------------------------------------------------------------------------
  //
  //  Lifecycle Methods
  //
  //--------------------------------------------------------------------------
  componentDidRender() {
    // This tooltip is temporary until our tooltip component is built
    if (this.tooltip)
      this.renderTooltipOutsideShadowRoot(this.iconContainer);
  }
  render() {
    return (h(Host, null,
      h("slot", null),
      this.tooltip && (h("div", { class: "icon-container", ref: (div) => {
          this.iconContainer = div;
        } },
        h("abds-icon", { icon: "information-circle", size: "md", "stroke-width": "medium" })))));
  }
  static get is() { return "abds-label"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["label.css"]
  }; }
  static get styleUrls() { return {
    "$": ["label.css"]
  }; }
  static get properties() { return {
    "for": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Input id associated with label."
      },
      "attribute": "for",
      "reflect": true
    },
    "required": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "If input is required label needs to know for styling."
      },
      "attribute": "required",
      "reflect": true,
      "defaultValue": "false"
    },
    "tooltip": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Content to display in tooltip."
      },
      "attribute": "tooltip",
      "reflect": true
    },
    "weight": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Weight",
        "resolved": "\"bold\" | \"medium\"",
        "references": {
          "Weight": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Displays label in  bold or medium font-weight."
      },
      "attribute": "weight",
      "reflect": true,
      "defaultValue": "'bold'"
    }
  }; }
  static get elementRef() { return "host"; }
}
//# sourceMappingURL=label.js.map