'use strict';

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

const index = require('./index-128c5169.js');

const BsDropdown = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.dropdownchange = index.createEvent(this, "dropdownchange", 7);
    this.close = index.createEvent(this, "close", 7);
    this.dropdownId = undefined;
    this.shown = undefined;
    this.label = undefined;
    this.position = undefined;
    this.justify = undefined;
    this.variant = undefined;
  }
  /** Get the bs-dropdown-options element */
  get optionsEl() {
    var _a, _b;
    if (!this._optionsEl) {
      const slotEl = this.hostEl.shadowRoot.querySelector('slot');
      const slotContainer = (_a = slotEl.assignedElements) === null || _a === void 0 ? void 0 : _a.call(slotEl)[0];
      this._optionsEl = Array.from((_b = slotContainer === null || slotContainer === void 0 ? void 0 : slotContainer.children) !== null && _b !== void 0 ? _b : []).find((el) => el.tagName === 'BS-DROPDOWN-OPTIONS');
    }
    return this._optionsEl;
  }
  /** Reset the internally stored options element when slot gets updated */
  handleSlotChange() {
    this._optionsEl = undefined;
  }
  /** Pass down props */
  componentDidRender() {
    const optionsChild = this.optionsEl;
    // Stencil Vue wrappers have an issue with camelCase props currently
    // So, sending both attributes
    optionsChild === null || optionsChild === void 0 ? void 0 : optionsChild.setAttribute('dropdown-id', this.dropdownId);
    optionsChild === null || optionsChild === void 0 ? void 0 : optionsChild.setAttribute('dropdownid', this.dropdownId);
    optionsChild === null || optionsChild === void 0 ? void 0 : optionsChild.setAttribute('shown', this.shown ? 'true' : 'false');
    optionsChild === null || optionsChild === void 0 ? void 0 : optionsChild.setAttribute('label', this.label);
    optionsChild === null || optionsChild === void 0 ? void 0 : optionsChild.setAttribute('variant', this.variant);
    optionsChild === null || optionsChild === void 0 ? void 0 : optionsChild.setAttribute('position', this.position);
  }
  render() {
    return (index.h(index.Host, { "data-justify": this.justify || undefined }, index.h("div", { class: "bs-dropdown", part: "container" }, index.h("slot", { onSlotchange: this.handleSlotChange.bind(this) }))));
  }
  get hostEl() { return index.getElement(this); }
};

exports.bs_dropdown = BsDropdown;

//# sourceMappingURL=bs-dropdown.cjs.entry.js.map