import { r as registerInstance, h, H as Host, g as getElement } from './index-92f6d7ee.js';

const BsTab = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.activeTabId = undefined;
    this.hidden = false;
    this.panelId = undefined;
  }
  get isActive() {
    return this.activeTabId && this.activeTabId === this.hostEl.id;
  }
  get panelIdComputed() {
    return this.panelId || `${this.hostEl.id}-panel`;
  }
  validSiblingOrNull(el) {
    var _a, _b;
    return (((_a = el === null || el === void 0 ? void 0 : el.dataset) === null || _a === void 0 ? void 0 : _a.hidden) === '' || ((_b = el === null || el === void 0 ? void 0 : el.dataset) === null || _b === void 0 ? void 0 : _b.hidden) === 'true') ? null : el;
  }
  // avoid unnecessary re-renders
  componentShouldUpdate(newValue, oldValue, propName) {
    if (newValue === oldValue)
      return false;
    if (propName === 'activeTabId') {
      return newValue === this.hostEl.id || oldValue === this.hostEl.id;
    }
  }
  handleKeydown(e) {
    if (e.key === 'Enter' || e.key === ' ') {
      e.preventDefault();
      e.stopPropagation();
      this.hostEl.click();
    }
  }
  render() {
    return (h(Host, { "aria-controls": this.panelIdComputed, "aria-selected": this.isActive ? "true" : "false", "data-hidden": this.hidden || undefined, role: "tab", tabindex: "0" }, h("slot", null)));
  }
  get hostEl() { return getElement(this); }
};

export { BsTab as bs_tab };

//# sourceMappingURL=bs-tab.entry.js.map