import{l as h}from"./lucide-vue-next-DqYmV2Wg.js";import{v as l,x as a,E as V,B as i,D as s,l as B,k as g,A as b,s as v,p as S,z as q,X as w,f as d,r as I}from"./x-CuOWXDIc.js";const C={class:"form-group"},N={key:0,class:"form-group__label"},z={key:0,class:"form-group__required"},$={class:"input-wrapper"},D={key:0,class:"input-wrapper__icon"},F=["value","placeholder","disabled","required","maxlength","rows"],E=["type","value","placeholder","disabled","required","maxlength"],T={key:4,class:"input-wrapper__suffix"},A={key:1,class:"form-group__error"},X={key:2,class:"form-group__hint"},H={__name:"TextField",props:{modelValue:{type:[String,Number],default:""},label:{type:String,default:""},placeholder:{type:String,default:""},hint:{type:String,default:""},error:{type:String,default:""},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},size:{type:String,default:"md"},type:{type:String,default:"text"},icon:{type:String,default:""},suffixIcon:{type:String,default:""},maxlength:{type:Number,default:null},clearable:{type:Boolean,default:!1},rows:{type:Number,default:3}},emits:["update:modelValue","focus","blur"],setup(e,{emit:x}){const u=e,c=x,r=I(!1),f=d(()=>u.icon?h[u.icon]:null),m=d(()=>u.suffixIcon?h[u.suffixIcon]:null),p=d(()=>{const t=["input"];return u.size==="sm"&&t.push("input-sm"),u.size==="lg"&&t.push("input-lg"),u.error&&t.push("input-error"),u.icon&&t.push("input--has-icon"),t});function y(t){c("update:modelValue",t.target.value)}function k(){c("update:modelValue","")}return(t,n)=>(l(),a("div",C,[e.label?(l(),a("label",N,[V(i(e.label)+" ",1),e.required?(l(),a("span",z,"*")):s("",!0)])):s("",!0),B("div",$,[f.value?(l(),a("div",D,[(l(),g(b(f.value),{class:"icon-md"}))])):s("",!0),e.type==="textarea"?(l(),a("textarea",{key:1,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,required:e.required,maxlength:e.maxlength,rows:e.rows,class:v(p.value),onInput:y,onFocus:n[0]||(n[0]=o=>{r.value=!0,t.$emit("focus",o)}),onBlur:n[1]||(n[1]=o=>{r.value=!1,t.$emit("blur",o)})},null,42,F)):(l(),a("input",{key:2,type:e.type,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,required:e.required,maxlength:e.maxlength,class:v(p.value),onInput:y,onFocus:n[2]||(n[2]=o=>{r.value=!0,t.$emit("focus",o)}),onBlur:n[3]||(n[3]=o=>{r.value=!1,t.$emit("blur",o)})},null,42,E)),e.clearable&&e.modelValue?(l(),a("button",{key:3,type:"button",class:"input-wrapper__clear",onClick:k},[S(q(w),{class:"icon-sm"})])):m.value?(l(),a("div",T,[(l(),g(b(m.value),{class:"icon-md"}))])):s("",!0)]),e.error?(l(),a("p",A,i(e.error),1)):e.hint?(l(),a("p",X,i(e.hint),1)):s("",!0)]))}};export{H as _};
