import { FormControl, FormControlLabel, RadioGroup as MuiRadioGroup, RadioGroupProps as MuiRadioGroupProps, Radio, Typography } from "@mui/material"; import React, { useState } from "react"; import { SvgIcon } from "../SvgIcon/SvgIcon"; interface RadioOption { value: string; label: string; subLabel?: string confidence?: string; } export interface RadioGroupProps extends MuiRadioGroupProps { options: RadioOption[]; initialValue?: string; iconName?: string; onOptionChange?: (value: string) => void; } export const RadioButton = ({ options, initialValue, onChange, onOptionChange, iconName, ...rest }: RadioGroupProps) => { const [selectedValue, setSelectedValue] = useState(initialValue); const handleRadioChange = (event: React.ChangeEvent) => { const newValue = event.target.value; setSelectedValue(newValue); if (onOptionChange) { onOptionChange(event.target.value); } }; return ( {options.map((option) => (
} label={''} /> {iconName ? ( ) : (<>)}
{option.label} ({option.confidence}% confidence) { option?.subLabel ? ({option?.subLabel}) : (<>) }
))}
); };