import{_ as p,a as g,i as x,s as b,O as k,k as d,c,d as h,e as r,D as S,t as y,o as a}from"./Bgmy51Qv.js";const B={name:"AjaxButton",components:{Spinner:g},props:{color:{type:String,default:"white"},text:{type:String,default:null},loadingText:{type:String,default:null},fetchingData:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},onlyIcon:{type:String,default:null},activateBtn:{type:Boolean,default:!1},type:{type:String,default:""}},setup(e,{emit:o}){const n=x(),{activated:t}=b(n),{t:i}=k(),f=e.text||i("profile.submit"),l=e.loadingText||i("profile.gr"),s=e.type||i("profile.submit"),u=d(()=>e.fetchingData),_=d(()=>e.fetchingData),m=d(()=>e.activateBtn||t.value);return{propText:f,propLoadingText:l,propType:s,disable:_,isActive:m,btnClicked:()=>{e.type!=="Submit"&&o("clicked")},fetchingData:u}}},D=["disabled","type"],T={key:2},v={key:3};function C(e,o,n,t,i,f){const l=g;return a(),c("button",{onClickPassive:o[0]||(o[0]=(...s)=>t.btnClicked&&t.btnClicked(...s)),class:"ajax-btn",disabled:t.disable||n.disabled||!t.isActive,type:t.propType},[t.fetchingData?(a(),h(l,{key:0,color:n.color},null,8,["color"])):r("",!0),n.onlyIcon&&!t.fetchingData?(a(),c("i",{key:1,class:S(["icon",n.onlyIcon])},null,2)):r("",!0),!n.onlyIcon&&t.propLoadingText&&t.fetchingData?(a(),c("span",T,y(t.propLoadingText),1)):!n.onlyIcon&&!t.fetchingData?(a(),c("span",v,y(t.propText),1)):r("",!0)],40,D)}const j=p(B,[["render",C]]);export{j as A};
