import { Radio } from 'antd'; import { ReactNode } from 'react'; import { FieldInputProps, useField } from 'react-final-form'; import { isSelectGroup, SelectProps } from '../Select'; import FieldContainer from './FieldContainer'; import { useSelectOptions } from './FieldSelect'; import InfoBubble from './InfoBubble'; import { FieldProps } from './types'; import { getLabel } from './utils'; const RadioGroup = ({ value, onChange, label, options, }: { value: string; label?: string | ReactNode; options: ReturnType; onChange: FieldInputProps['onChange']; }) => { return ( <> {label && label !== '' && ( )} {options?.map((option, k) => { if (isSelectGroup(option)) { return ( ); } return ( {typeof option.label === 'string' && ( )} {typeof option.label !== 'string' && option.label} ); })} ); }; export const FieldRadio = ( props: FieldProps & { options?: SelectProps['selectOptions'] } ) => { const field = useField(props.name); const selectOptions = useSelectOptions(props.schema, props.options); if (!selectOptions) return null; return ( ); }; export default FieldRadio;