import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-7e09edea.js';
import { b as getHostAttrs } from './index-ed2d325c.js';

const bsInputSearchCss = "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) {
    registerInstance(this, hostRef);
    this.clear = 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.value = '';
  }
  componentWillLoad() {
    var _a, _b;
    this.attrs = getHostAttrs(this.hostEl, [
      'autocomplete',
      'id',
      '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 (h(Host, null, h("bs-input-addon", { disabled: this.disabled }, h("bs-icon-search", null), h("bs-input", Object.assign({ "data-autowidth": true, disabled: this.disabled, "hint-id": this.hintId, "pass-attrs": passAttrs, placeholder: this.placeholder, value: this.value }, this.attrs)), !this.disabled &&
      h("button", { title: "Clear", type: "button", onClick: () => this.clear.emit() }, h("bs-icon-close", { size: "sm" })))));
  }
  get hostEl() { return getElement(this); }
};
BsInputSearch.style = bsInputSearchCss;

export { BsInputSearch as bs_input_search };

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