import{r as t,b as x,j as l}from"./app--5U4-9K0.js";function p(o){const{id:s,value:c,onChange:r}=o,e=o.option;return l.jsxs("div",{className:"rl-form-flex-control",children:[l.jsx("input",{disabled:e.disabled,type:"checkbox",value:e.value,id:`${s}-${e.value}`,checked:c.includes(e.value),onChange:r}),l.jsxs("div",{className:"rl-form-inline-label",children:[l.jsx("label",{htmlFor:`${s}-${e.value}`,children:e.label}),e.caption&&l.jsx("small",{className:"rl-form-control-caption",children:e.caption})]})]},e.value)}const f=t.memo(function({id:s,label:c,value:r,required:e,options:i,flexDirection:u="col"}){const n=x(s,"change","value"),d=t.useCallback(a=>{const h=a.target.checked?[...r,a.target.value]:r.filter(m=>m!==a.target.value);n(h)},[n,r]);return l.jsxs("div",{className:"rl-form-group",children:[c&&l.jsxs("label",{children:[c," ",e&&l.jsx("span",{className:"rl-required",children:"*"})]}),l.jsx("div",{className:`rl-form-control-group rl-flex-${u}`,children:i.map(a=>l.jsx(p,{id:s,value:r,onChange:d,option:a},typeof a=="string"?a:a.value))})]})});f.displayName="CheckboxGroup";export{f as default};
