27 lines
658 B
TypeScript

import { Form, Input as AntInput } from 'antd';
import type { ChangeEvent } from 'react';
import type { BaseElementProps } from './types';
const { Item: FormItem } = Form;
export default function Input({
value,
setValue,
status,
isValid,
help,
...props
}: BaseElementProps<string>) {
function handleChange(e: ChangeEvent<HTMLInputElement>) {
setValue(e.target.value);
}
return (
<FormItem hasFeedback validateStatus={isValid === false ? 'error' : ''} help={help}>
<AntInput value={value} onChange={handleChange} disabled={status === 'Disabled'} {...props} />
</FormItem>
);
}
export { type InputProps } from 'antd';