import{_ as V,a as x,m as S,o as l,c as i,an as s,aG as c,d as B,F as k,s as N,u as m,I as f,h as y,e as I,f as p,t as M}from"./index-4e8c1b57.js";const E={class:"base-input-group"},w=["id","placeholder","disabled","value"],H={key:1,class:"input-container"},$=["id","type","placeholder","autocomplete","disabled","min","max","value","readonly"],C={key:2,class:"form-error"},D={__name:"BaseInput",props:{modelValue:[String,Number],modelModifiers:{default:()=>({})},value:String,id:String,name:String,placeholder:String,autocomplete:String,disabled:Boolean,readonly:Boolean,min:String,max:String,type:{type:String,default:"text"},error:String,underlined:{type:Boolean,default:!1},textarea:{type:Boolean,default:!1},minHeight:String,height:String},emits:["update:modelValue"],setup(e,{emit:h}){const n=e,o=x(null),u=h,r=S(()=>n.modelModifiers.lazy?"change":"input");function g(a){let t=a.target.value;n.modelModifiers.number&&(t=t===""?"":Number(t)),u("update:modelValue",t)}function v(a){if(n.modelModifiers.number){const t=`${n.modelValue??""}${event.key}`,d=Number(t);isNaN(d)&&a.preventDefault()}}function b(){u("update:modelValue",""),o.value.focus()}return(a,t)=>(l(),i("div",E,[e.textarea?(l(),i("textarea",s({key:0,class:"base-input",id:e.id,placeholder:e.placeholder,disabled:e.disabled,value:e.modelValue},{[c(r.value)]:t[0]||(t[0]=d=>a.$emit("update:modelValue",d.target.value))},{style:{"min-height":e.minHeight,height:e.height}}),` `,16,w)):(l(),i("div",H,[B("input",s({ref_key:"inputElement",ref:o,class:["base-input",{"base-input--underlined":e.underlined,"search-box":e.type==="search"}],id:e.id,type:e.type,placeholder:e.placeholder,autocomplete:e.autocomplete,disabled:e.disabled,min:e.min,max:e.max,value:e.modelValue??e.value,onKeypress:v},{[c(r.value)]:g},{readonly:e.readonly}),null,16,$),["text","search"].includes(e.type)&&(e.modelValue||e.value)&&!e.readonly?(l(),k(m(f),{key:0,icon:"material-symbols:close-rounded",inline:"true",class:"clear-all",onClick:N(b,["stop"])})):y("",!0)])),e.error?(l(),i("div",C,[I(m(f),{icon:"fluent:error-circle-12-filled",inline:"true"}),p(" "+M(e.error),1)])):y("",!0)]))}},z=V(D,[["__scopeId","data-v-ff0e12d3"]]);export{z as B};