'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-305226cb.js');
const index$1 = require('./index-f92a5850.js');
require('./v4-c23234d2.js');

const bsInputSearchCss = ":where(bs-input-search){display:inline-block;width:100%}bs-input-search :where(bs-input-addon) :where(bs-icon-search){padding-left:0.75rem}bs-input-search :where(bs-input-addon) :where(bs-icon-close){padding-right:0.75rem}bs-input-search :where(bs-input-addon) :where(button){align-items:center;background-color:transparent;cursor:pointer;display:flex;height:100%}";

const BsInputSearch = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.clear = index.createEvent(this, "clear", 7);
    /** Native attributes to pass through to the input element. */
    this.attrs = {};
    this.disabled = false;
    this.passAttrs = '';
    this.placeholder = 'Search Items';
    this.hintId = undefined;
    this.inputId = undefined;
    this.value = '';
  }
  componentWillLoad() {
    var _a, _b;
    this.attrs = index$1.getHostAttrs(this.hostEl, [
      'autocomplete',
      'maxlength',
      'minlength',
      'name',
      ...this.passAttrs.split(',')
    ]);
    // Only add aria-label if hintId (used for aria-describedby) is not given
    if (!this.hintId) {
      const ariaLabel = (_b = (_a = this.hostEl.attributes.getNamedItem('aria-label')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 'Search Items';
      this.attrs['aria-label'] = ariaLabel;
    }
  }
  render() {
    const passAttrs = `aria-label,${this.passAttrs}`;
    return (index.h(index.Host, null, index.h("bs-input-addon", { disabled: this.disabled }, index.h("bs-icon-search", null), index.h("bs-input", Object.assign({ "data-autowidth": true, disabled: this.disabled, "hint-id": this.hintId, "input-id": this.inputId, "pass-attrs": passAttrs, placeholder: this.placeholder, value: this.value }, this.attrs)), !this.disabled &&
      index.h("button", { title: "Clear", type: "button", onClick: () => this.clear.emit() }, index.h("bs-icon-close", { size: "sm" })))));
  }
  get hostEl() { return index.getElement(this); }
};
BsInputSearch.style = bsInputSearchCss;

exports.bs_input_search = BsInputSearch;

//# sourceMappingURL=bs-input-search.cjs.entry.js.map