import{tab_styles_default as t}from"./chunk.NAC5KFYD.js";import{SlIconButton as e}from"./chunk.LOVM4XL6.js";import{LocalizeController as s}from"./chunk.2A3352EO.js";import{watch as i}from"./chunk.C7FWPEOY.js";import{ShoelaceElement as a}from"./chunk.Z7XDKKOD.js";import{__decorateClass as o}from"./chunk.6M63UXML.js";import{classMap as l}from"../../../../lit/directives/class-map.js";import{html as r}from"../../../../lit/index.js";import{property as c,query as n}from"../../../../lit/decorators.js";var b=0,d=class extends a{constructor(){super(...arguments),this.localize=new s(this),this.attrId=++b,this.componentId=`sl-tab-${this.attrId}`,this.panel="",this.active=!1,this.closable=!1,this.disabled=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","tab")}handleCloseClick(t){t.stopPropagation(),this.emit("sl-close")}handleActiveChange(){this.setAttribute("aria-selected",this.active?"true":"false")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false")}focus(t){this.tab.focus(t)}blur(){this.tab.blur()}render(){return this.id=this.id.length>0?this.id:this.componentId,r`
      <div
        part="base"
        class=${l({tab:!0,"tab--active":this.active,"tab--closable":this.closable,"tab--disabled":this.disabled})}
        tabindex=${this.disabled?"-1":"0"}
      >
        <slot></slot>
        ${this.closable?r`
              <sl-icon-button
                part="close-button"
                exportparts="base:close-button__base"
                name="x-lg"
                library="system"
                label=${this.localize.term("close")}
                class="tab__close-button"
                @click=${this.handleCloseClick}
                tabindex="-1"
              ></sl-icon-button>
            `:""}
      </div>
    `}};d.styles=t,d.dependencies={"sl-icon-button":e},o([n(".tab")],d.prototype,"tab",2),o([c({reflect:!0})],d.prototype,"panel",2),o([c({type:Boolean,reflect:!0})],d.prototype,"active",2),o([c({type:Boolean})],d.prototype,"closable",2),o([c({type:Boolean,reflect:!0})],d.prototype,"disabled",2),o([i("active")],d.prototype,"handleActiveChange",1),o([i("disabled")],d.prototype,"handleDisabledChange",1);export{d as SlTab};