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:"67dc6e9d4fc3b03405b95d73860d0607b1349dac",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:"edbced0df2b42aad7538d658f61491492a960d70",part:"prefix",class:"tab__prefix"},h("slot",{key:"c3a83ae9dfcbe0cd3f44f921ac4b16f70bb1ad19",onSlotchange:()=>this.handleSlotChange(),name:"prefix"})),h("div",{key:"8e1c4a2e772f466e05d57db467f9c6770744e54c",class:"tab__content",part:"content"},h("slot",{key:"0f2e2522e62e76bbfbf0d38087f636c9c08345c4"})),h("span",{key:"bedcb638ce2e070f4b1de5cf6286b71b972a974e",part:"suffix",class:"tab__suffix"},h("slot",{key:"8fa99c53e36534b260c5d92924bfda6ba81374f5",onSlotchange:()=>this.handleSlotChange(),name:"suffix"})),h("slot",{key:"28b079ac845a18c6798a9b39341025e2299be0bf",name:"suffix"},!!this.count&&h("div",{key:"c7738b146feca28aefcf203eec911890d94b2c0a",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"}}