"use client" import * as React from "react" import { zodResolver } from "@hookform/resolvers/zod" import { Controller, useForm } from "react-hook-form" import { toast } from "sonner" import * as z from "zod" import { Button } from "@/registry/new-york-v4/ui/button" import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/registry/new-york-v4/ui/card" import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel, } from "@/registry/new-york-v4/ui/field" import { Input } from "@/registry/new-york-v4/ui/input" import { InputGroup, InputGroupAddon, InputGroupText, InputGroupTextarea, } from "@/registry/new-york-v4/ui/input-group" const formSchema = z.object({ title: z .string() .min(5, "Bug title must be at least 5 characters.") .max(32, "Bug title must be at most 32 characters."), description: z .string() .min(20, "Description must be at least 20 characters.") .max(100, "Description must be at most 100 characters."), }) export default function BugReportForm() { const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { title: "", description: "", }, }) function onSubmit(data: z.infer) { toast("You submitted the following values:", { description: (
          {JSON.stringify(data, null, 2)}
        
), position: "bottom-right", classNames: { content: "flex flex-col gap-2", }, style: { "--border-radius": "calc(var(--radius) + 4px)", } as React.CSSProperties, }) } return ( Bug Report Help us improve by reporting bugs you encounter.
( Bug Title {fieldState.invalid && ( )} )} /> ( Description {field.value.length}/100 characters Include steps to reproduce, expected behavior, and what actually happened. {fieldState.invalid && ( )} )} />
) }