import{r as y,j as o}from"./vendor-react-wBh_31cN.js";import{C as v}from"./combobox-QqI9aNup.js";import{L as h}from"./label-gPWmc6ow.js";import{C as A}from"./index.esm-CAGtek53.js";import{d as C}from"./index-dNe6i2rS.js";const O=({name:a,control:i,options:l,disabled:f,placeholder:p,required:c,isLoading:e=!1,defaultValue:d=void 0,onSelectionChange:t,noResultsText:x,className:b,label:m,state:u})=>{const j=r=>s=>{!Array.isArray(s)&&typeof s=="string"&&(r(s),t==null||t(s))},n=y.useMemo(()=>e?[]:l.map(r=>({label:r.label,value:r.key})),[e,l]);return o.jsx(A,{name:a,control:i,rules:{required:c},defaultValue:d,render:({field:{value:r,onChange:s}})=>o.jsxs("div",{className:"flex flex-col gap-1",children:[m&&o.jsx(h,{children:m}),o.jsx(v,{className:C(u==="error"&&"border-destructive focus-visible:ring-destructive",b),disabled:e||f,placeholder:e?"Loading...":p,onChange:j(s),options:n,value:r,noResultsText:x})]})})};export{O as F};
