import{d as q,a as x,r as v,e as o,f as i,x as m,h as p,v as B,aG as S,bB as V,g as u,bj as N,aI as k,z as w,i as C,o as s,a4 as D}from"./BxiWQxwE.js";const L={class:"input-wrapper"},I=["for"],M={class:"input-wrapper--clear"},$=["id","required","disabled","maxlength","minlength","type","placeholder","pattern"],j=["aria-label"],A=q({__name:"input-clear",props:{modelValue:{type:[String,Number,Date],required:!0},id:{type:String,required:!0},label:{type:String,required:!1,default:null},placeholder:{type:String,required:!1,default:null},disabled:{type:Boolean,required:!1},type:{type:String,required:!1,default:"text"},minLength:{type:Number,required:!1,default:null},maxLength:{type:Number,required:!1,default:null},pattern:{type:String,required:!1,default:null},required:{type:Boolean,required:!1,default:!1}},emits:["update:modelValue","blur","clear","focus"],setup(e,{expose:f,emit:c}){const g=e,{$messages:y}=x(),d=v(null);f({input:d});const a=o({get:()=>g.modelValue.toString(),set:n=>r("update:modelValue",n)}),b=o(()=>a.value.length>0),r=c;return(n,t)=>{const h=D;return s(),i("div",L,[e.label?(s(),i("label",{key:0,for:e.id},B(e.label),9,I)):m("",!0),p("div",M,[S(p("input",N({id:e.id},n.$attrs,{ref_key:"input",ref:d,"onUpdate:modelValue":t[0]||(t[0]=l=>k(a)?a.value=l:null),required:e.required,disabled:e.disabled,maxlength:e.maxLength,minlength:e.minLength,type:e.type,placeholder:e.placeholder,pattern:e.pattern,onBlur:t[1]||(t[1]=l=>r("blur",l)),onFocus:t[2]||(t[2]=l=>r("focus",l))}),null,16,$),[[V,u(a)]]),u(b)?(s(),i("button",{key:0,type:"button","aria-label":u(y)("aria.clearInput"),onClick:t[3]||(t[3]=w(l=>r("clear",l),["prevent"]))},[C(h)],8,j)):m("",!0)])])}}});export{A as _};
