import{o as t,b as a,n as o,r as k,F as i,f as v,t as r,i as n,g as y,H as h,a as c,h as S,N as V,j as m,Z as B}from"./vendor-1-1-41.js";const K={class:"flex flex-col gap-2"},q=["for"],w={key:0,class:"text-red-600"},N=["id","required","disabled","name","value"],C=["value","textContent"],$={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",w," *")):n("",!0)],64)):k(d.$slots,"label",{key:0})],10,q)):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 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,N),[[h,s.value]]),e.help?(t(),a("div",$,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 _};
