import * as React from 'react'; import { cn } from '../utils/cn'; import { ComponentOption } from '../types'; export type RadioOption = ComponentOption; export interface RadioGroupProps extends Omit< React.HTMLAttributes, 'onChange' > { options: RadioOption[]; value?: string; onChange?: (value: string) => void; name: string; orientation?: 'horizontal' | 'vertical'; } const RadioGroup = React.forwardRef( ( { className, options, value, onChange, name, orientation = 'vertical', ...props }, ref ) => { return (
{options.map((option) => { const id = `${name}-${option.value}`; return (
onChange?.(e.target.value)} className="h-4 w-4 border-gray-300 text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50" />
); })}
); } ); RadioGroup.displayName = 'RadioGroup'; export { RadioGroup };