import{o as t,c as a,n as o,r as k,F as i,e as v,t as r,h as n,w as y,V as h,b as c,g as S,$ as V,i as m,a1 as B}from"./vendor-1-1-49.js";const K={class:"flex flex-col gap-2"},w=["for"],q={key:0,class:"text-red-600"},$=["id","required","disabled","name","value"],C=["value","textContent"],N={key:1,class:"text-xs text-gray-500 dark:text-gray-400"},M={__name:"MdrSelect",props:{modelValue:[Number,String,Boolean,Array],error:{type:String,default:""},required:{type:Boolean,default:!1},id:{type:String,default:()=>Math.random().toString(20).substr(2,10)},name:{type:String,default:""},label:{type:String,default:""},valueKey:{type:String,default:"value"},textKey:{type:[String,Function],default:"text"},options:{type:[Array,Object]},disabled:{type:Boolean,default:!1},dense:{type:Boolean,default:!1},help:{type:String,default:""},background:{type:String,default:""}},emits:["update:modelValue"],setup(e,{emit:g}){const b=m(()=>!!B().label),f=e,x=g,s=m({get(){return f.modelValue},set(d){x("update:modelValue",d)}});return(d,u)=>(t(),a("div",K,[e.label||b.value?(t(),a("label",{key:0,for:e.id,class:o(`${e.disabled?"text-gray-200":"text-gray-900"} block text-sm font-medium dark:text-white`)},[e.label?(t(),a(i,{key:1},[v(r(e.label)+" ",1),e.required?(t(),a("span",q," *")):n("",!0)],64)):k(d.$slots,"label",{key:0})],10,w)):n("",!0),y(c("select",{id:e.id,"onUpdate:modelValue":u[0]||(u[0]=l=>s.value=l),class:o(`${e.dense?"!p-1":"!p-2.5"} ${e.background?e.background:"!bg-gray-50"} !border !border-gray-300 !text-gray-900 !text-sm !rounded-lg focus:ring-primary-500 focus:border-primary-500 block min-w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500`),required:e.required,disabled:e.disabled,name:e.name,value:e.modelValue},[(t(!0),a(i,null,S(e.options,l=>(t(),a("option",{key:l[e.valueKey],value:l[e.valueKey],textContent:r(typeof e.textKey=="string"?l[e.textKey]:e.textKey(l))},null,8,C))),128))],10,$),[[h,s.value]]),e.help?(t(),a("div",N,r(e.help),1)):n("",!0),y(c("div",{class:"text-sm text-red-600"},r(e.error),513),[[V,e.error]])]))}};export{M as _};
