import { Component } from 'react'; import { observer } from 'mobx-react'; import classnames from 'classnames'; import FieldInterface from 'mobx-react-form/lib/models/FieldInterface'; // biome-ignore lint/suspicious/noShadowRestrictedNames: import Error from './error'; type Props = { field: FieldInterface; className: string; focus: boolean; showLabel: boolean; }; // TODO: Should this file be converted into the coding style similar to './toggle/index.tsx'? class Radio extends Component { static defaultProps = { focus: false, showLabel: true, }; inputElement = null; componentDidMount() { if (this.props.focus) { this.focus(); } } focus() { // @ts-expect-error Object is possibly 'null'. this.inputElement.focus(); } render() { const { field, className, showLabel } = this.props; return (
{field.label && showLabel && ( )}
{/* @ts-expect-error Property 'map' does not exist on type 'OptionsModel'. */} {field.options?.map(type => ( ))}
{field.error && }
); } } export default observer(Radio);