import{e as o,_ as k,b as t,o as a,i as n,h as i,n as y,r as v,F as c,g as h,t as r,I as S,a as m,j as V,O as B}from"./vendor-1-1-33.js";const K={class:"flex flex-col gap-2"},q=["for"],w={key:0,class:"text-red-600"},C=["id","required","disabled","name","value"],N=["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=o(()=>!!k().label),f=e,x=g,s=o({get(){return f.modelValue},set(d){x("update:modelValue",d)}});return(d,u)=>(a(),t("div",K,[e.label||b.value?(a(),t("label",{key:0,for:e.id,class:y(`${e.disabled?"text-gray-200":"text-gray-900"} block text-sm font-medium dark:text-white`)},[e.label?(a(),t(c,{key:1},[h(r(e.label)+" ",1),e.required?(a(),t("span",w," *")):n("",!0)],64)):v(d.$slots,"label",{key:0})],10,q)):n("",!0),i(m("select",{id:e.id,"onUpdate:modelValue":u[0]||(u[0]=l=>s.value=l),class:y(`${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},[(a(!0),t(c,null,V(e.options,l=>(a(),t("option",{key:l[e.valueKey],value:l[e.valueKey],textContent:r(typeof e.textKey=="string"?l[e.textKey]:e.textKey(l))},null,8,N))),128))],10,C),[[S,s.value]]),e.help?(a(),t("div",$,r(e.help),1)):n("",!0),i(m("div",{class:"text-sm text-red-600"},r(e.error),513),[[B,e.error]])]))}};export{M as _};
