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:"dc0a1ee900194643f3409e70246c33bf28311527",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:"ec966161d42efc0272f9fd92bd45594a088e0eb4",part:"prefix",class:"tab__prefix"},h("slot",{key:"6c86cf09cc99826234b7b8d3ff5836778e1bddf7",onSlotchange:()=>this.handleSlotChange(),name:"prefix"})),h("div",{key:"e845ea35b518e04d21db1c02d4cfa3c862ec6288",class:"tab__content",part:"content"},h("slot",{key:"de121939c91b93f0015d28e8c1d00539e681a915"})),h("span",{key:"1423fd72991feb4543fa571fd2d987a8e2c3fc1b",part:"suffix",class:"tab__suffix"},h("slot",{key:"085b1aaa5f1fcf2b327d6972d89444a3dced7831",onSlotchange:()=>this.handleSlotChange(),name:"suffix"})),h("slot",{key:"5a0b434ed46afdaeeecc2407ba311b18779de5a7",name:"suffix"},!!this.count&&h("div",{key:"93a4772746ede6e0567cc1c9b0b1851d0b5e9044",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"}}