vchikalkin 32f265fc8d optimize package/ui/elements imports
optimize antd/link imports

ui/elements/text: use antd component

ui/element: optimize input, input-number, switch, checkbox imports

fix Number typename

ui/elements: optimize Radio, Segmented, Select

move type Status to store types

fix TableInsurance builders

packages/ui: remove antd dir

Output/Results: fix elements margin

revert Loading status to elements

packages/ui: remove value from props

remove unnecessary loading prop
2023-05-16 11:31:45 +03:00

35 lines
929 B
TypeScript

import type { RadioChangeEvent, RadioGroupProps, SpaceProps } from 'antd';
import { Radio as AntRadio, Space } from 'antd';
import type { CheckboxOptionType } from 'antd/lib/checkbox';
import type { Key } from 'react';
type RadioProps = Omit<RadioGroupProps, 'onChange' | 'options'> & {
onChange?: (value: unknown) => void;
options?: CheckboxOptionType[];
spaceProps?: SpaceProps;
};
export default function Radio({
value = null,
options,
spaceProps,
onChange,
...props
}: RadioProps) {
function handleChange(event: RadioChangeEvent) {
if (onChange) onChange(event.target.value);
}
return (
<AntRadio.Group onChange={handleChange} value={value} {...props}>
<Space {...spaceProps}>
{options?.map((option) => (
<AntRadio key={option.value as Key} value={option.value}>
{option.label}
</AntRadio>
))}
</Space>
</AntRadio.Group>
);
}