import{r as t,c as e,h as s,H as i}from"./p-2b0a6102.js";const n=class{constructor(s){t(this,s);this.optmouseenter=e(this,"optmouseenter",7);this.optselect=e(this,"optselect",7);this.value=undefined;this.variant=undefined;this.optionsId=undefined;this.selected=false;this.focused=false;this.index=undefined}componentDidLoad(){this.onFocusChange(this.focused)}onFocusChange(t){if(t){this.option.focus()}else{this.option.blur()}}handleKeyDown(t){var e;switch(t.key){case" ":case"Enter":case"NumpadEnter":this.handleSelect();(e=this.option.querySelector("a"))===null||e===void 0?void 0:e.click();break}t.preventDefault()}handleMouseEnter(){this.optmouseenter.emit(this.index)}handleSelect(){var t;this.optselect.emit({id:this.id,index:this.index,value:this.value});(t=this.option.querySelector("a"))===null||t===void 0?void 0:t.click()}get id(){return`${this.optionsId}-option-${this.index}`}render(){return s(i,{value:this.value},s("li",{role:"option","data-selected":this.selected?"":undefined,"data-variant":this.variant||undefined,"aria-selected":this.selected?"true":undefined,id:this.id,tabIndex:-1,ref:t=>this.option=t},s("slot",null)))}static get watchers(){return{focused:["onFocusChange"]}}};const h="bs-dropdown-with-options{display:block}";const d=class{constructor(s){t(this,s);this.optselected=e(this,"optselected",7);this.close=e(this,"close",7);this.enterend=e(this,"enterend",3);this.leaveend=e(this,"leaveend",3);this.toggleId=undefined;this.containerId=undefined;this.optionsId=undefined;this.width=undefined;this.top=false;this.center=false;this.label=undefined;this.selectedValue=undefined;this.enterControlled=false;this.enterTrigger=false;this.leaveTrigger=false;this.helperText=undefined;this.helperDescription=undefined;this.isVisible=false}handleEnterEnd(){this.isVisible=true;this.enterend.emit()}handleOptSelected(t){t.stopPropagation();this.isVisible=false;this.optselected.emit(t.detail);this.close.emit()}handleClose(t){t.stopPropagation();if(this.isVisible){this.isVisible=false;this.close.emit()}}render(){return s(i,null,s("bs-dropdown",{width:this.width,top:this.top,center:this.center,toggleId:this.toggleId,containerId:this.containerId,enterControlled:this.enterControlled,enterTrigger:this.enterTrigger,leaveTrigger:this.leaveTrigger,helperText:this.helperText,helperDescription:this.helperDescription,onClose:t=>this.handleClose(t),onEnterend:()=>this.handleEnterEnd(),onLeaveend:()=>this.leaveend.emit()},s("bs-dropdown-option-list",{optionsId:this.optionsId,visible:this.isVisible,focusDelay:0,label:this.label,selectedValue:this.selectedValue,onOptselected:t=>this.handleOptSelected(t),onClose:t=>this.handleClose(t)},s("slot",null))))}};d.style=h;export{n as bs_dropdown_option,d as bs_dropdown_with_options};
//# sourceMappingURL=p-9ad5cfca.entry.js.map