mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-11 03:54:23 +01:00
feat: add react-hook-form dependency and update FormInput component to use its types
This commit is contained in:
parent
63d0c301a0
commit
55f67212d5
3 changed files with 25 additions and 2 deletions
|
|
@ -72,6 +72,7 @@
|
|||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"react-hook-form": "^7.60.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"rollup": "^4.0.0",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.4",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue