"use client"; import React, { memo, useCallback, useId } from "react"; import RadioButton from "./RadioButton"; interface RadioOption { value: string; label: string; ariaLabel?: string; } interface RadioGroupProps { name?: string; value?: string; onChange?: (data: { value: string }) => void; mode?: "standard" | "inverse"; state?: "default" | "hover" | "focus"; disabled?: boolean; options?: RadioOption[]; className?: string; "aria-label"?: string; } const RadioGroup = ({ name, value, onChange, mode = "standard", state = "default", disabled = false, options = [], className = "", ...props }: RadioGroupProps) => { // Generate unique ID for accessibility if not provided const generatedId = useId(); const groupId = name || `radio-group-${generatedId}`; const handleChange = useCallback( (optionValue: string) => { if (!disabled && onChange) { onChange({ value: optionValue }); } }, [disabled, onChange], ); return (