import{r as s,c as i,h as t,F as n}from"./p-0d5a2e05.js";const o=class{constructor(t){s(this,t);this.onSelect=i(this,"onSelect",7);this.variant="solid";this.dpIsActive=false;this.selectedOption=null}handlePrefixClick(){this.prefixBtn.classList.toggle("open")}handleOptionSelect(s){this.selectedOption=s;this.onSelect.emit(s.value);const i=this.prefixBtn.querySelector(".dropdown__label");if(i){i.classList.add("dropdown__label--selection")}this.prefixBtn.classList.remove("open");this.prefixBtn.classList.add("selected")}render(){if(this.type==="text"){return t("div",{class:`input__prefix input__prefix--${this.variant}-text`},t("span",{class:"input__prefix-label"},this.label))}if(this.type==="button"){return t("button",{class:`input__prefix input__prefix--${this.variant}`,onMouseDown:()=>this.dpIsActive=true,onMouseUp:()=>this.dpIsActive=false,onMouseOut:()=>this.dpIsActive=false,onClick:()=>this.handlePrefixClick(),ref:s=>this.prefixBtn=s},t("span",{class:"input__prefix-icon"},t("dga-icon-v2",Object.assign({},this.icon))),t("span",{class:"dropdown__label"},this.selectedOption&&Object.keys(this.selectedOption).length?this.selectedOption.label:" "),t("span",{class:"input__prefix-label"},this.label))}return t(n,null,t("button",{class:`input__prefix input__prefix--${this.variant} input__dropdown-btn`,onMouseDown:()=>this.dpIsActive=true,onMouseUp:()=>this.dpIsActive=false,onMouseOut:()=>this.dpIsActive=false,onClick:()=>this.handlePrefixClick(),ref:s=>this.prefixBtn=s},t("span",{class:"input__prefix-icon"},this.icon),t("span",{class:"dropdown__label"},this.selectedOption&&Object.keys(this.selectedOption).length?this.selectedOption.label:" "),t("span",{class:"input__prefix-label"},this.label),t("span",{class:"input__prefix-chevron"},t("dga-icon",{icon:"ArrowDown01Icon",variant:"stroke"}))),t("ul",{class:"input__dropdown-list"},this.options&&this.options.map((s=>{var i;return t("li",{key:s.value},t("button",{class:`dropdown__option ${((i=this.selectedOption)===null||i===void 0?void 0:i.value)===s.value?"selected":""}`,onClick:()=>this.handleOptionSelect(s)},t("span",{class:"dropdown__option-label"},s.label),t("span",{class:"dropdown__option-icon"},t("dga-icon",{icon:"Tick02Icon",variant:"solid"}))))}))))}};export{o as dga_prefix};
//# sourceMappingURL=p-6aec10a0.entry.js.map