mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-18 18:51:32 +10:00
release: v4.1.0
This commit is contained in:
@ -3,12 +3,10 @@ import { Slot } from "@radix-ui/react-slot";
|
||||
import { FormFieldContext, FormItemContext, useFormField } from "@reactive-resume/hooks";
|
||||
import { cn } from "@reactive-resume/utils";
|
||||
import { forwardRef, useId } from "react";
|
||||
import { Controller, ControllerProps, FieldPath, FieldValues, FormProvider } from "react-hook-form";
|
||||
import { Controller, ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
||||
|
||||
import { Label } from "./label";
|
||||
|
||||
export const Form = FormProvider;
|
||||
|
||||
export const FormField = <
|
||||
TFieldValues extends FieldValues = FieldValues,
|
||||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
||||
@ -63,7 +61,7 @@ export const FormControl = forwardRef<
|
||||
ref={ref}
|
||||
id={formItemId}
|
||||
aria-invalid={!!error}
|
||||
aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}
|
||||
aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
@ -94,7 +92,7 @@ export const FormMessage = forwardRef<
|
||||
React.HTMLAttributes<HTMLParagraphElement>
|
||||
>(({ className, children, ...props }, ref) => {
|
||||
const { error, formMessageId } = useFormField();
|
||||
const body = error ? String(error?.message) : children;
|
||||
const body = error ? String(error.message) : children;
|
||||
|
||||
if (!body) {
|
||||
return null;
|
||||
@ -113,3 +111,5 @@ export const FormMessage = forwardRef<
|
||||
});
|
||||
|
||||
FormMessage.displayName = "FormMessage";
|
||||
|
||||
export { FormProvider as Form } from "react-hook-form";
|
||||
|
||||
Reference in New Issue
Block a user