import{p as h,c as l,o as n,g as s,d,t as i,n as u}from"./app-fEKA3BkQ.js";const x={key:0,class:"label mb-1 capitalize"},v=["type","value","placeholder","required","step"],b={key:0,class:"my-1 text-sm font-light text-danger-600"},p={key:1,class:"text-sm flex gap-1"},V={__name:"InputField",props:{label:{type:String,default:""},customStyle:{type:String,default:""},modelValue:{type:[String,Number],default:""},type:{type:String,default:"text"},validationMessage:{type:[String,Array],default:""},placeholder:{type:String,default:"Example: text..."},isRequired:{type:Boolean,default:!1},step:{type:String,default:"any"},maxLength:{type:[Number,String]}},emits:["update:modelValue"],setup(e,{emit:g}){const t=e,c=g,y=a=>{c("update:modelValue",a.target.value)},f=h(()=>{var a;return t.maxLength?((a=t.modelValue)==null?void 0:a.length)>t.maxLength:!1});return(a,r)=>{var o,m;return n(),l("div",{class:u(["w-full",e.customStyle])},[e.label?(n(),l("label",x,i(a.trans(e.label)),1)):s("",!0),d("input",{type:e.type,value:e.modelValue,onInput:y,class:u(["input",{"border border-danger-600":e.validationMessage,"border-b border-danger-600":f.value}]),placeholder:e.placeholder,required:e.isRequired,step:e.step},null,42,v),e.validationMessage||e.maxLength?(n(),l("div",{key:1,class:u(["mt-1 flex items-center",{"justify-between":e.validationMessage,"justify-end":!e.validationMessage}])},[e.validationMessage?(n(),l("div",b,i(e.validationMessage),1)):s("",!0),e.maxLength?(n(),l("div",p,[d("span",{class:u([((o=t.modelValue)==null?void 0:o.length)>t.maxLength?"text-danger-600":"text-green-600"])},i(((m=e.modelValue)==null?void 0:m.length)??0),3),r[0]||(r[0]=d("span",null,"/",-1)),d("span",null,i(t.maxLength),1)])):s("",!0)],2)):s("",!0)],2)}}};export{V as _};
