release: v4.1.0

This commit is contained in:
Amruth Pillai
2024-05-05 14:55:06 +02:00
parent 68252c35fc
commit e87b05a93a
282 changed files with 11461 additions and 10713 deletions

View File

@ -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";