* Introduced ButtonCtrl, IconButtonCtrl, NativeSelectCtrl, PasswordInputCtrl, SwitchCtrl, TextAreaCtrl, TextInputCtrl * Updated FormerControllers.types.ts to include SpecialIDProps * Enhanced lib.ts to export new components
32 lines
916 B
TypeScript
32 lines
916 B
TypeScript
import { Textarea, type TextareaProps, Tooltip } from '@mantine/core';
|
|
import { Controller } from 'react-hook-form';
|
|
|
|
import type { FormerControllersProps, SpecialIDProps } from '../FormerControllers.types';
|
|
|
|
const TextAreaCtrl = (props: FormerControllersProps & SpecialIDProps & TextareaProps) => {
|
|
const { control, name, sid, tooltip, ...innerProps } = props;
|
|
return (
|
|
<Controller
|
|
control={control}
|
|
name={name}
|
|
render={({ field, formState }) => (
|
|
<Tooltip label={tooltip ?? ''} withArrow>
|
|
<Textarea
|
|
minRows={4}
|
|
{...innerProps}
|
|
{...field}
|
|
disabled={formState.disabled}
|
|
id={`field_${name}_${sid ?? ''}`}
|
|
key={`field_${name}_${sid ?? ''}`}
|
|
>
|
|
{props.children}
|
|
</Textarea>
|
|
</Tooltip>
|
|
)}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export { TextAreaCtrl };
|
|
export default TextAreaCtrl;
|