Files
oranguru/src/FormerControllers/Inputs/PasswordInputCtrl.tsx
Hein 9df2f3b504 feat(controllers): add new input and button components
* Introduced ButtonCtrl, IconButtonCtrl, NativeSelectCtrl, PasswordInputCtrl, SwitchCtrl, TextAreaCtrl, TextInputCtrl
* Updated FormerControllers.types.ts to include SpecialIDProps
* Enhanced lib.ts to export new components
2026-01-14 22:42:17 +02:00

31 lines
930 B
TypeScript

import { PasswordInput, type PasswordInputProps, Tooltip } from '@mantine/core';
import { Controller } from 'react-hook-form';
import type { FormerControllersProps, SpecialIDProps } from '../FormerControllers.types';
const PasswordInputCtrl = (props: FormerControllersProps & PasswordInputProps & SpecialIDProps) => {
const { control, name, sid, tooltip, ...textProps } = props;
return (
<Controller
control={control}
name={name}
render={({ field, formState }) => (
<Tooltip label={tooltip ?? ''} withArrow>
<PasswordInput
{...textProps}
{...field}
disabled={formState.disabled}
id={`field_${name}_${sid ?? ''}`}
key={`field_${name}_${sid ?? ''}`}
>
{props.children}
</PasswordInput>
</Tooltip>
)}
/>
);
};
export { PasswordInputCtrl };
export default PasswordInputCtrl;