import{h}from"@stencil/core";export class ScButtonGroup{constructor(){this.label=void 0,this.separate=void 0}findButton(t){return["sc-button"].includes(t.tagName.toLowerCase())?t:t.querySelector(["sc-button"].join(","))}handleFocus(t){const e=this.findButton(t.target);null==e||e.classList.add("sc-button-group__button--focus")}handleBlur(t){const e=this.findButton(t.target);null==e||e.classList.remove("sc-button-group__button--focus")}handleMouseOver(t){const e=this.findButton(t.target);null==e||e.classList.add("sc-button-group__button--hover")}handleMouseOut(t){const e=this.findButton(t.target);null==e||e.classList.remove("sc-button-group__button--hover")}handleSlotChange(){if(this.separate)return;const t=this.el.shadowRoot.querySelector("slot").assignedElements({flatten:!0});t.forEach((e=>{const s=this.el.shadowRoot.querySelector("slot").assignedNodes().indexOf(e),o=this.findButton(e);null===o&&this.separate||(o.classList.add("sc-button-group__button"),o.classList.toggle("sc-button-group__button--first",0===s),o.classList.toggle("sc-button-group__button--inner",s>0&&s<t.length-1),o.classList.toggle("sc-button-group__button--last",s===t.length-1))}))}render(){return h("sc-form-control",{key:"92417f50ee6590ac0827f9202634ca82145f2918",part:"base",class:{"button-group":!0,"button-group--separate":this.separate},role:"group","aria-label":this.label,onFocusout:t=>this.handleBlur(t),onFocusin:t=>this.handleFocus(t),onMouseOver:t=>this.handleMouseOver(t),onMouseOut:t=>this.handleMouseOut(t),label:this.label},h("slot",{key:"73e89d0eab17bc101e501eab499e0f8f7acae885",onSlotchange:()=>this.handleSlotChange()}))}static get is(){return"sc-button-group"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-button-group.scss"]}}static get styleUrls(){return{$:["sc-button-group.css"]}}static get properties(){return{label:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"label",reflect:!1},separate:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"separate",reflect:!1}}}static get elementRef(){return"el"}}