import { useContext } from 'react'; import HintText from '../../common/HintText'; import { CheckboxRadioContext } from '../../utils/context'; import { RadioButtonProps } from './types'; import clsx from 'clsx'; const RadioButton = ({ checked, hintText, id, isSmall, label, name, onBlur, onChange, ...props }: RadioButtonProps) => { const hintTextId = `hint-text-${id}`; function handleBlur(event: React.FocusEvent) { if (typeof onBlur === 'function') { onBlur(event); } } function handleChange(event: React.ChangeEvent) { if (typeof onChange === 'function') { onChange(event); } } isSmall = isSmall || useContext(CheckboxRadioContext).isSmall; name = name || useContext(CheckboxRadioContext).name; return (
{hintText && {hintText}}
); }; RadioButton.displayName = 'RadioButton'; export default RadioButton;