File size: 1,099 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import type { TextFieldProps } from '@mui/material/TextField';
import TextField from '@mui/material/TextField';
import React from 'react';
import type { FieldProps } from 'uniforms';
import { connectField, filterDOMProps } from 'uniforms';
export type LongTextFieldProps = FieldProps<string, TextFieldProps>;
const LongText = ({
disabled,
error,
errorMessage,
helperText,
inputRef,
label,
name,
onChange,
placeholder,
readOnly,
showInlineError,
type = 'text',
value,
...props
}: LongTextFieldProps) => {
return (
<TextField
disabled={disabled}
error={!!error}
fullWidth
helperText={(error && showInlineError && errorMessage) || helperText}
inputProps={{ readOnly }}
label={label}
margin="dense"
multiline
name={name}
onChange={(event) => disabled || onChange(event.target.value)}
placeholder={placeholder}
ref={inputRef}
type={type}
value={value ?? ''}
{...filterDOMProps(props)}
/>
);
};
export default connectField<LongTextFieldProps>(LongText, { kind: 'leaf' });
|