vchikalkin 156c6c51b5 project: use yarn workspaces
(merge branch release/monorepo)
2022-12-20 22:04:45 +03:00

33 lines
765 B
TypeScript

import type { SegmentedProps } from 'antd';
import { Form, Segmented as AntSegmented } from 'antd';
import type { FC } from 'react';
import type { BaseElementProps, BaseOption } from './types';
const { Item: FormItem } = Form;
type ElementProps = BaseElementProps<string | number> & {
options: BaseOption[];
};
export default (function Segmented({
value,
setValue,
options,
status,
isValid,
help,
...props
}: ElementProps) {
return (
<FormItem hasFeedback validateStatus={isValid === false ? 'error' : ''} help={help}>
<AntSegmented
value={value}
onChange={setValue}
disabled={status === 'Disabled'}
options={options}
{...props}
/>
</FormItem>
);
} as FC<Partial<SegmentedProps>>);