import { Host, h } from '@stencil/core';
import { getHostAttrs } from '../../utils';
/**
 * Displays an input element styled like a search field.
 * @docsPage
 * @exSlot
 */
export class BsInputSearch {
  constructor() {
    /** Native attributes to pass through to the input element. */
    this.attrs = {};
    this.disabled = false;
    this.passAttrs = '';
    this.placeholder = "Search Items";
    this.ariaLabel = "Search Items";
    this.hintId = undefined;
    this.value = '';
  }
  componentWillLoad() {
    this.attrs = getHostAttrs(this.hostEl, [
      'autocomplete',
      'id',
      'maxlength',
      'minlength',
      'name',
      ...this.passAttrs.split(',')
    ]);
  }
  render() {
    const passAttrs = 'aria-label';
    return (h(Host, null, h("bs-input-addon", { disabled: this.disabled }, h("bs-icon-search", null), h("bs-input", Object.assign({ "aria-label": this.ariaLabel, "data-autowidth": true, disabled: this.disabled, passAttrs: passAttrs, placeholder: this.placeholder, value: this.value }, Object.assign(Object.assign({}, this.attrs), { 'aria-describedby': this.hintId }))), !this.disabled &&
      h("button", { title: "Clear", type: "button", onClick: () => this.onclear.emit() }, h("bs-icon-close", { size: "sm" })))));
  }
  static get is() { return "bs-input-search"; }
  static get originalStyleUrls() {
    return {
      "$": ["bs-input-search.scss"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["bs-input-search.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 input."
        },
        "attribute": "disabled",
        "reflect": false,
        "defaultValue": "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 <input>."
        },
        "attribute": "pass-attrs",
        "reflect": false,
        "defaultValue": "''"
      },
      "placeholder": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Placeholder attribute - same as native."
        },
        "attribute": "placeholder",
        "reflect": false,
        "defaultValue": "\"Search Items\""
      },
      "ariaLabel": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "aria-label to set on the internal input element."
        },
        "attribute": "aria-label",
        "reflect": false,
        "defaultValue": "\"Search Items\""
      },
      "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 an input."
        },
        "attribute": "hint-id",
        "reflect": false
      },
      "value": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Sets the input value."
        },
        "attribute": "value",
        "reflect": false,
        "defaultValue": "''"
      }
    };
  }
  static get events() {
    return [{
        "method": "onclear",
        "name": "onclear",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emits the clear button is clicked."
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }];
  }
  static get elementRef() { return "hostEl"; }
}
//# sourceMappingURL=bs-input-search.js.map
