import { tab_styles_default } from "./chunk.LFMBQ5XL.js"; import { SlIconButton } from "./chunk.E7U2HBHY.js"; import { LocalizeController } from "./chunk.2SU6QBUU.js"; import { e } from "./chunk.3RBSSBZT.js"; import { watch } from "./chunk.JMZM2TDT.js"; import { component_styles_default } from "./chunk.INZSKSLC.js"; import { ShoelaceElement, e as e2, n } from "./chunk.OGQ452CI.js"; import { x } from "./chunk.OOP2EFQH.js"; import { __decorateClass } from "./chunk.W27M6RDR.js"; // src/components/tab/tab.component.ts var id = 0; var SlTab = class extends ShoelaceElement { constructor() { super(...arguments); this.localize = new LocalizeController(this); this.attrId = ++id; this.componentId = `sl-tab-${this.attrId}`; this.panel = ""; this.active = false; this.closable = false; this.disabled = false; this.tabIndex = 0; } connectedCallback() { super.connectedCallback(); this.setAttribute("role", "tab"); } handleCloseClick(event) { event.stopPropagation(); this.emit("sl-close"); } handleActiveChange() { this.setAttribute("aria-selected", this.active ? "true" : "false"); } handleDisabledChange() { this.setAttribute("aria-disabled", this.disabled ? "true" : "false"); if (this.disabled && !this.active) { this.tabIndex = -1; } else { this.tabIndex = 0; } } render() { this.id = this.id.length > 0 ? this.id : this.componentId; return x`
${this.closable ? x` ` : ""}
`; } }; SlTab.styles = [component_styles_default, tab_styles_default]; SlTab.dependencies = { "sl-icon-button": SlIconButton }; __decorateClass([ e2(".tab") ], SlTab.prototype, "tab", 2); __decorateClass([ n({ reflect: true }) ], SlTab.prototype, "panel", 2); __decorateClass([ n({ type: Boolean, reflect: true }) ], SlTab.prototype, "active", 2); __decorateClass([ n({ type: Boolean, reflect: true }) ], SlTab.prototype, "closable", 2); __decorateClass([ n({ type: Boolean, reflect: true }) ], SlTab.prototype, "disabled", 2); __decorateClass([ n({ type: Number, reflect: true }) ], SlTab.prototype, "tabIndex", 2); __decorateClass([ watch("active") ], SlTab.prototype, "handleActiveChange", 1); __decorateClass([ watch("disabled") ], SlTab.prototype, "handleDisabledChange", 1); export { SlTab };