import{h}from"@stencil/core";import{isRtl}from"../../../functions/page-align";let id=0;export class ScTab{constructor(){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(e){this.tab.focus(e)}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 e=this.href?"a":"div";return h(e,{key:"d16bad31462e47b7882c20f4c8e7f6676981bbfe",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:e=>this.tab=e,role:"tab","aria-disabled":this.disabled?"true":"false","aria-selected":this.active?"true":"false",tabindex:this.disabled?"-1":"0"},h("span",{key:"d5b57befcc2cf92e52ef364d417f09d3c74efb56",part:"prefix",class:"tab__prefix"},h("slot",{key:"4dfbef0a3469f9a1d12fba8d0eda5a043f8a4ee1",onSlotchange:()=>this.handleSlotChange(),name:"prefix"})),h("div",{key:"b308abb29825fff55bb260d456a8d4bf08e708f5",class:"tab__content",part:"content"},h("slot",{key:"34a0a872cc665d52e2abbd48544086c6df0f22c7"})),h("span",{key:"7cc2b156a9e3514e39580123310ea8db704a2702",part:"suffix",class:"tab__suffix"},h("slot",{key:"1994ee24040a3d3c80c5839a8008f62aba8e6822",onSlotchange:()=>this.handleSlotChange(),name:"suffix"})),h("slot",{key:"0017ec488420701f3bd1fd7ea7ce267be8355797",name:"suffix"},!!this.count&&h("div",{key:"5b8340936ee4ef32e2366d70cf995ee269ad6c25",class:"tab__counter",part:"counter"},this.count)))}static get is(){return"sc-tab"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-tab.scss"]}}static get styleUrls(){return{$:["sc-tab.css"]}}static get properties(){return{panel:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"The name of the tab panel the tab will control. The panel must be located in the same tab group."},attribute:"panel",reflect:!0,defaultValue:"''"},href:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"href",reflect:!0},active:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Draws the tab in an active state."},attribute:"active",reflect:!0,defaultValue:"false"},disabled:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Draws the tab in a disabled state."},attribute:"disabled",reflect:!0,defaultValue:"false"},count:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"count",reflect:!1}}}static get states(){return{hasPrefix:{},hasSuffix:{}}}static get events(){return[{method:"scClose",name:"scClose",bubbles:!0,cancelable:!0,composed:!0,docs:{tags:[],text:"Close event"},complexType:{original:"void",resolved:"void",references:{}}}]}static get methods(){return{triggerFocus:{complexType:{signature:"(options?: FocusOptions) => Promise<void>",parameters:[{name:"options",type:"FocusOptions",docs:""}],references:{Promise:{location:"global",id:"global::Promise"},FocusOptions:{location:"global",id:"global::FocusOptions"}},return:"Promise<void>"},docs:{text:"Sets focus to the tab.",tags:[]}},triggerBlur:{complexType:{signature:"() => Promise<void>",parameters:[],references:{Promise:{location:"global",id:"global::Promise"}},return:"Promise<void>"},docs:{text:"Removes focus from the tab.",tags:[]}}}}static get elementRef(){return"el"}}