import{C as u,j as l,t as a,z as n,k as o,x as g,y as d,J as k,Q as C,u as v,l as _,m,D as f}from"./vendor-CoimUlS3.js";import{_ as y}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{CheckCircle as w,AlertCircle as B,ChevronDown as S}from"./ui-CI37mw-K.js";import{v as p}from"./utils-CXPYudwi.js";const V={inheritAttrs:!1,components:{ChevronDown:S,AlertCircle:B,CheckCircle:w},props:{id:{type:String,default(){return`select-input-${p()}`}},error:String,label:String,helperText:String,successMessage:String,required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},isLoading:{type:Boolean,default:!1},size:{type:String,default:"md",validator:t=>["sm","md","lg"].includes(t)},modelValue:[String,Number,Boolean]},emits:["update:modelValue","focus","blur","change"],data(){return{selected:this.modelValue,isOpen:!1}},watch:{selected(t){this.$emit("update:modelValue",t)},modelValue(t){t!==this.selected&&(this.selected=t)}},methods:{onFocus(){this.isOpen=!0,this.$emit("focus")},onBlur(){this.isOpen=!1,this.$emit("blur")},onChange(t){this.$emit("change",t)},focus(){this.$refs.input.focus()},select(){this.$refs.input.select()},blur(){this.$refs.input.blur()}}},A=["for"],D={key:0,class:"text-red-500 ml-1"},q={class:"relative"},z=["id","required","disabled"],N={class:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none"},F={key:0,class:"absolute inset-y-0 right-8 flex items-center"},M={key:1,class:"mt-2 text-sm text-slate-500 dark:text-slate-400"},O={key:2,class:"mt-2 flex items-center gap-2 text-sm text-red-600 dark:text-red-400"},T={key:3,class:"mt-2 flex items-center gap-2 text-sm text-green-600 dark:text-green-400"};function L(t,s,e,j,c,i){const h=u("ChevronDown"),x=u("AlertCircle"),b=u("CheckCircle");return a(),l("div",{class:f(["relative",t.$attrs.class])},[e.label?(a(),l("label",{key:0,for:e.id,class:"block text-sm font-medium text-slate-700 dark:text-slate-300 mb-2"},[g(d(e.label)+" ",1),e.required?(a(),l("span",D,"*")):n("",!0)],8,A)):n("",!0),o("div",q,[k(o("select",v({id:e.id,ref:"input","onUpdate:modelValue":s[0]||(s[0]=r=>c.selected=r)},{...t.$attrs,class:null},{class:["w-full px-4 py-3 pr-10 bg-white dark:bg-slate-700 border border-slate-300 dark:border-slate-600 rounded-lg text-sm text-slate-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-blue-400 dark:focus:border-blue-400 transition-all duration-200 appearance-none cursor-pointer",e.error?"border-red-500 dark:border-red-400 focus:ring-red-500 focus:border-red-500":"",e.disabled?"bg-slate-50 dark:bg-slate-800 text-slate-500 dark:text-slate-400 cursor-not-allowed":"",e.size==="sm"?"px-3 py-2 text-xs":"",e.size==="lg"?"px-4 py-4 text-base":""],required:e.required,disabled:e.disabled,onFocus:s[1]||(s[1]=(...r)=>i.onFocus&&i.onFocus(...r)),onBlur:s[2]||(s[2]=(...r)=>i.onBlur&&i.onBlur(...r)),onChange:s[3]||(s[3]=(...r)=>i.onChange&&i.onChange(...r))}),[_(t.$slots,"default")],16,z),[[C,c.selected]]),o("div",N,[m(h,{class:f(["w-4 h-4 transition-transform duration-200",c.isOpen?"rotate-180":"",e.error?"text-red-500 dark:text-red-400":"text-slate-400 dark:text-slate-500",e.disabled?"text-slate-300 dark:text-slate-600":""])},null,8,["class"])]),e.isLoading?(a(),l("div",F,[...s[4]||(s[4]=[o("div",{class:"animate-spin rounded-full h-4 w-4 border-2 border-slate-300 border-t-blue-600"},null,-1)])])):n("",!0)]),e.helperText&&!e.error?(a(),l("div",M,d(e.helperText),1)):n("",!0),e.error?(a(),l("div",O,[m(x,{class:"w-4 h-4 flex-shrink-0"}),o("span",null,d(e.error),1)])):n("",!0),e.successMessage&&!e.error?(a(),l("div",T,[m(b,{class:"w-4 h-4 flex-shrink-0"}),o("span",null,d(e.successMessage),1)])):n("",!0)],2)}const Q=y(V,[["render",L]]);export{Q as S};
