import{s as e}from"./utils-CXcsdpX-.js";import{a as t,i as n,n as r,r as i,t as a}from"./select-3HgKWKVz.js";import{aa as o}from"./index-CvTTLloU.js";import{t as s}from"./searchable-select-DgrThyTm.js";var c=e();function l({value:e,onValueChange:o,options:s,placeholder:l,className:u=``,disabled:d=!1,position:f=`popper`,side:p=`bottom`,align:m=`start`,sideOffset:h=5,contentClassName:g=``}){return(0,c.jsxs)(a,{value:e,onValueChange:o,disabled:d,children:[(0,c.jsx)(n,{className:u,children:(0,c.jsx)(t,{placeholder:l})}),(0,c.jsx)(r,{position:f,side:p,align:m,sideOffset:h,className:`z-[100] ${g}`,children:s.map(e=>(0,c.jsx)(i,{value:e.value,children:e.label},e.value))})]})}var u=7;function d({label:e,error:d,required:f,options:p,placeholder:m,id:h,value:g,disabled:_,onChange:v,className:y,searchable:b,emptyMessage:x}){let S=b??p.length>u;return(0,c.jsxs)(`div`,{className:`space-y-2 ${y??``}`,children:[e&&(0,c.jsxs)(o,{htmlFor:h,children:[e,` `,f&&(0,c.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),S?(0,c.jsx)(s,{id:h,value:g||void 0,onValueChange:e=>v?.({target:{value:e}}),options:p,placeholder:m,disabled:_,emptyMessage:x}):p.length===0?(0,c.jsxs)(a,{disabled:!0,children:[(0,c.jsx)(n,{id:h,className:`w-full`,children:(0,c.jsx)(t,{placeholder:x||`No options available`})}),(0,c.jsx)(r,{children:(0,c.jsx)(i,{value:`__empty__`,disabled:!0,children:x||`No options available`})})]}):(0,c.jsx)(l,{value:g||``,onValueChange:e=>v?.({target:{value:e}}),options:p,placeholder:m,disabled:_,className:`w-full`}),d&&(0,c.jsx)(`p`,{className:`text-sm text-destructive`,children:d})]})}export{d as t};