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