import{proxyCustomElement,HTMLElement,createEvent,h}from"@stencil/core/internal/client";import{i as isRtl}from"./page-align.js";const scTabCss=":host{display:block}.tab{font-family:var(--sc-font-sans);color:var(--sc-color-gray-600);display:flex;align-items:center;justify-content:flex-start;line-height:1;padding:var(--sc-spacing-small) var(--sc-spacing-small);font-size:var(--sc-font-size-medium);font-weight:var(--sc-font-weight-semibold);border-radius:var(--sc-border-radius-small);cursor:pointer;transition:color 0.35s ease, background-color 0.35s ease;user-select:none;text-decoration:none}.tab.tab--active,.tab:hover{color:var(--sc-tab-active-color, var(--sc-color-gray-900));background-color:var(--sc-tab-active-background, var(--sc-color-gray-100))}.tab.tab--disabled{cursor:not-allowed;color:var(--sc-color-gray-400)}.tab__content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:var(--sc-line-height-dense)}.tab__prefix,.tab__suffix{flex:0 0 auto;display:flex;align-items:center}.tab__suffix{margin-left:auto}.tab__counter{background:var(--sc-color-gray-200);display:inline-block;padding:var(--sc-spacing-xx-small) var(--sc-spacing-small);border-radius:var(--sc-border-radius-pill);font-size:var(--sc-font-size-small);text-align:center;line-height:1;transition:color 0.35s ease, background-color 0.35s ease}.tab.tab--active .tab__counter,.tab:hover .tab__counter{background:var(--sc-color-white)}.tab--has-prefix{padding-left:var(--sc-spacing-small)}.tab--has-prefix .tab__content{padding-left:var(--sc-spacing-small)}.tab--has-suffix{padding-right:var(--sc-spacing-small)}.tab--has-suffix .tab__label{padding-right:var(--sc-spacing-small)}.tab--is-rtl.tab--has-prefix .tab__content{padding-left:0;padding-right:var(--sc-spacing-small)}",ScTabStyle0=scTabCss;let id=0;const ScTab$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.scClose=createEvent(this,"scClose",7),this.componentId="tab-"+ ++id,this.panel="",this.href=void 0,this.active=!1,this.disabled=!1,this.count=void 0,this.hasPrefix=!1,this.hasSuffix=!1}async triggerFocus(a){this.tab.focus(a)}async triggerBlur(){this.tab.blur()}handleSlotChange(){this.hasPrefix=!!this.el.querySelector('[slot="prefix"]'),this.hasSuffix=!!this.el.querySelector('[slot="suffix"]')}render(){this.el.id=this.el.id||this.componentId;const a=this.href?"a":"div";return h(a,{key:"0f2426401903f588be7e49f2c4d5b1a388caa0c2",part:"base "+(this.active?"active":""),href:this.href,class:{tab:!0,"tab--active":this.active,"tab--disabled":this.disabled,"tab--has-prefix":this.hasPrefix,"tab--has-suffix":this.hasSuffix,"tab--is-rtl":isRtl()},ref:a=>this.tab=a,role:"tab","aria-disabled":this.disabled?"true":"false","aria-selected":this.active?"true":"false",tabindex:this.disabled?"-1":"0"},h("span",{key:"1c1c5e9db0f05f7a59e5a4de6c7a304af74a297a",part:"prefix",class:"tab__prefix"},h("slot",{key:"ef0b377a4c2e838ed0a12bea845a2c516af4a212",onSlotchange:()=>this.handleSlotChange(),name:"prefix"})),h("div",{key:"06634369a8d2b14e67a350c0eea4a580d4133114",class:"tab__content",part:"content"},h("slot",{key:"38123e23fb2f01a9fdbf921d285e9941698f4de1"})),h("span",{key:"2e6fd26343a92788d3cbc02adb19f4dd3a8e0b24",part:"suffix",class:"tab__suffix"},h("slot",{key:"d3917849d831ae38a9d391a5db30c24fd9958fe9",onSlotchange:()=>this.handleSlotChange(),name:"suffix"})),h("slot",{key:"f64fe21bc057425cb5eeb9f95c68762a948aba45",name:"suffix"},!!this.count&&h("div",{key:"d2519b658ee06581f2895eda853459b4a5021918",class:"tab__counter",part:"counter"},this.count)))}get el(){return this}static get style(){return ScTabStyle0}},[1,"sc-tab",{panel:[513],href:[513],active:[516],disabled:[516],count:[1],hasPrefix:[32],hasSuffix:[32],triggerFocus:[64],triggerBlur:[64]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-tab"].forEach((a=>{"sc-tab"===a&&(customElements.get(a)||customElements.define(a,ScTab$1))}))}const ScTab=ScTab$1,defineCustomElement=defineCustomElement$1;export{ScTab,defineCustomElement};