feat: add react-hook-form dependency and update FormInput component to use its types

This commit is contained in:
Danny Avila 2025-07-16 00:46:05 -04:00 committed by Marco Beretta
parent 63d0c301a0
commit 55f67212d5
No known key found for this signature in database
GPG key ID: D918033D8E74CC11
3 changed files with 25 additions and 2 deletions

View file

@ -1,9 +1,13 @@
import React from 'react';
import type { ControllerRenderProps, FieldValues, FieldPath } from 'react-hook-form';
import { Label } from './Label';
import { Input } from './Input';
import { cn } from '~/utils';
export default function FormInput({
export default function FormInput<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
>({
field,
label,
labelClass,
@ -13,7 +17,7 @@ export default function FormInput({
placeholder = '',
type = 'string',
}: {
field: any;
field: ControllerRenderProps<TFieldValues, TName>;
label: string;
labelClass?: string;
inputClass?: string;