import{j as r}from"./fields-wnm5Jtc6.js";import{R as y}from"./vendor-D21mNUGX.js";import{P as e}from"./index-pmrLY__j.js";import{g as R}from"./index.esm-DCQn2FO4.js";const N=({size:p="default",placeholder:u,id:a,defaultValue:i,description:n,values:o,onChangeCapture:f,validate:g,register:h,errors:b,disabled:x,muted:c,style:j})=>{const t=R(b,a),d=(v=null)=>r.jsxs(y.Fragment,{children:[r.jsx("div",{style:j,className:`${c?"":"acpt-select"}`,children:r.jsx("select",{id:a,name:a,"data-cy":`select-${a}`,defaultValue:v,placeholder:u,onChangeCapture:f,disabled:x,"aria-invalid":t?"true":"false",className:c?"muted":`form-control ${p} ${t?"has-errors":""}`,...h(a,g),children:o.map(s=>{const m=l=>l.value===null?r.jsx("option",{value:"",children:l.label}):r.jsx("option",{value:l.value,children:l.label});return s.options?r.jsx("optgroup",{label:s.label,"data-original":s.originalLabel?s.originalLabel:s.label,children:s.options.map(l=>m(l))}):m(s)})})}),t&&r.jsx("div",{"data-cy":`select-error-${a}`,className:"invalid-feedback",children:t.message}),n&&r.jsx("div",{className:"form-description",children:n})]});return i&&o.length>0?r.jsx("div",{className:"acpt-select-wrapper-with-values","data-current-value":i,children:d(i)}):d()};N.propTypes={id:e.string.isRequired,size:e.oneOf(["default","sm"]),style:e.string,placeholder:e.string,defaultValue:e.string,description:e.string,isMulti:e.bool,disabled:e.bool,muted:e.bool,values:e.array.isRequired,validate:e.func,register:e.func.isRequired,errors:e.array.isRequired};export{N as S};
