import classnames from 'classnames'; import React from 'react'; import { connectField, HTMLFieldProps } from 'uniforms'; import type { Option } from './types'; import wrapField from './wrapField'; const base64: (string: string) => string = typeof btoa === 'undefined' ? /* istanbul ignore next */ x => Buffer.from(x).toString('base64') : btoa; const escape = (x: string) => base64(encodeURIComponent(x)).replace(/=+$/, ''); export type RadioFieldProps = HTMLFieldProps< string, HTMLDivElement, { options?: Option[]; inline?: boolean; inputClassName?: string; } >; function Radio(props: RadioFieldProps) { return wrapField( props, props.options?.map(item => (
)), ); } export default connectField(Radio, { kind: 'leaf' });