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:"d59a2867f77b7b44929030bb09ea96006c67e953",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:"aa7f7a332cdbb56ad67023dd8566351d2789f6ac",part:"prefix",class:"tab__prefix"},h("slot",{key:"9b2fd6a64e7ac280b42b561733ea3c7eaf45b4ee",onSlotchange:()=>this.handleSlotChange(),name:"prefix"})),h("div",{key:"940ebb2134c1d111287b3eba53e2bef31cde0ee9",class:"tab__content",part:"content"},h("slot",{key:"8471b332d4e199e595698e763a59168cb4ed05e2"})),h("span",{key:"9c96223519ed7eb896b90fdb5c19adb73a80ab52",part:"suffix",class:"tab__suffix"},h("slot",{key:"f5c2b14e979c107ec91ba2e4d1884e6cf97b0eb3",onSlotchange:()=>this.handleSlotChange(),name:"suffix"})),h("slot",{key:"d00c5addd212c74eda441f7b726ccd42691f52a6",name:"suffix"},!!this.count&&h("div",{key:"ec20397f26769ec8d48b9f075ab2b4b7d9f78551",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"}}