import{r as e,c as t,h as i,H as s}from"./p-1617f73a.js";const n=class{constructor(i){e(this,i);this.mousefocus=t(this,"mousefocus",7);this.optionselect=t(this,"optionselect",7);this.value=undefined;this.variant=undefined;this.selected=false;this.shown=undefined;this.focused=undefined;this.index=undefined;this.dropdownId=undefined}componentDidLoad(){this.onFocusChange(this.focused)}onFocusChange(e){if(e){this.option.focus()}else{this.option.blur()}}handleKeyDown(e){if(this.shown){switch(e.key){case" ":this.handleSelect();e.preventDefault();break;case"Enter":this.handleSelect();break;case"NumpadEnter":this.handleSelect();break}}}handleMouseEnter(){this.mousefocus.emit(this.index)}handleSelect(){this.optionselect.emit({id:this.id,index:this.index,value:this.value})}get id(){return`${this.dropdownId}-option-${this.index}`}render(){return i(s,{"data-selected":this.selected?"":undefined,"data-variant":this.variant||undefined},i("li",{role:"option","data-selected":this.selected?"":undefined,"data-variant":this.variant||undefined,"aria-selected":this.selected?"true":undefined,tabIndex:this.shown?-1:undefined,id:this.id,ref:e=>this.option=e,part:"option"},i("slot",null)))}static get watchers(){return{focused:["onFocusChange"]}}};export{n as bs_dropdown_option};
//# sourceMappingURL=p-077f9470.entry.js.map