import{j as s}from"./index-DiwDH9aE.js";const j=({label:t,name:d="radio-group",options:x=[],value:n,onValueChange:m,disabled:l=!1,error:a,helperText:i,direction:u="row",required:c=!1,size:o="md",className:f=""})=>{const h=e=>{l||m?.(e)},g={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},p={sm:"text-xs",md:"text-sm",lg:"text-base"};return s.jsxs("div",{className:f,children:[t&&s.jsxs("label",{className:"block text-sm font-medium mb-2 text-gray-700",children:[t,c&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),i&&!a&&s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:i}),s.jsx("div",{className:`flex gap-4 ${u==="column"?"flex-col":"flex-row flex-wrap"}`,role:"radiogroup","aria-label":t,"aria-required":c,"aria-invalid":!!a,children:x.map(e=>{const b=n===e.value,r=`radio-${d}-${e.value}`;return s.jsxs("div",{className:`
                                flex items-start space-x-2
                                ${e.description?"py-2":""}
                            `,children:[s.jsx("input",{type:"radio",id:r,name:d,value:e.value,checked:b,onChange:()=>h(e.value),disabled:l,"aria-describedby":e.description?`${r}-description`:void 0,className:`
                                    ${g[o]} border-2 rounded-full mt-0.5
                                    text-[#00306e] bg-white
                                    focus:ring-[#00306e] focus:ring-2 focus:ring-offset-1
                                    transition-colors cursor-pointer
                                    disabled:opacity-50 disabled:cursor-not-allowed
                                    ${a?"border-red-500 focus:ring-red-500":"border-gray-300"}
                                `}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{htmlFor:r,className:`
                                        ${p[o]} font-medium cursor-pointer select-none
                                        ${l?"text-gray-400 cursor-not-allowed":"text-gray-700"}
                                        ${a?"text-red-600":""}
                                    `,children:e.label}),e.description&&s.jsx("p",{id:`${r}-description`,className:"text-xs text-gray-500 mt-0.5",children:e.description})]})]},e.value)})}),a&&s.jsx("p",{className:"mt-1.5 text-xs text-red-600",role:"alert",children:a})]})};j.displayName="RadioGroup";export{j as R};
