{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/form-10","type":"registry:component","title":"Form 10","description":"Comprehensive form with multiple input types in card layout for complex data entry","dependencies":["@hookform/resolvers","lucide-react","react-hook-form","sonner","zod@3.25.76"],"registryDependencies":["alert","button","card","field","input","radio-group","select","textarea"],"files":[{"path":"src/registry/new-york/components/form/form-10.tsx","content":"'use client'\n\nimport * as React from 'react'\n\nimport { CheckCheckIcon } from 'lucide-react'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { Controller, useForm } from 'react-hook-form'\nimport { toast } from 'sonner'\nimport * as z from 'zod'\n\nimport { Alert, AlertTitle } from '@/registry/new-york/ui/alert'\nimport { Button } from '@/registry/new-york/ui/button'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/registry/new-york/ui/card'\nimport { Field, FieldError, FieldLabel, FieldLegend, FieldSet } from '@/registry/new-york/ui/field'\nimport { Input } from '@/registry/new-york/ui/input'\nimport { RadioGroup, RadioGroupItem } from '@/registry/new-york/ui/radio-group'\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/registry/new-york/ui/select'\nimport { Textarea } from '@/registry/new-york/ui/textarea'\n\n// Define the form schema\nconst formSchema = z.object({\n  email: z.string().min(1, 'Email is required').email({ message: 'Please enter a valid email address.' }),\n  issue: z.string().min(1, {\n    message: 'Kindly select an issue.'\n  }),\n  selectedOption: z.enum(['replace', 'refund', 'support'], {\n    required_error: 'Selection of an option is required.'\n  }),\n  message: z.string().min(50, 'Describe your issue using at least 50 characters.')\n})\n\ntype FormValues = z.infer<typeof formSchema>\n\nconst ContactUSFormDemo = () => {\n  const form = useForm<FormValues>({\n    resolver: zodResolver(formSchema),\n    defaultValues: {\n      email: '',\n      issue: '',\n      selectedOption: undefined,\n      message: ''\n    }\n  })\n\n  function onSubmit() {\n    toast.custom(() => (\n      <Alert className='border-green-600 text-green-600 sm:w-122 dark:border-green-400 dark:text-green-400'>\n        <CheckCheckIcon />\n        <AlertTitle>Issue submitted successfully! Our team will reach out to you shortly.</AlertTitle>\n      </Alert>\n    ))\n  }\n\n  return (\n    <Card className='w-full max-w-sm shadow-none'>\n      <CardHeader>\n        <CardTitle>Report Issue</CardTitle>\n        <CardDescription>Describe the issue you&apos;re facing; our team will help you.</CardDescription>\n      </CardHeader>\n      <CardContent>\n        <form onSubmit={form.handleSubmit(onSubmit)} className='w-full max-w-xs space-y-6'>\n          {/* Email Field */}\n          <Controller\n            name='email'\n            control={form.control}\n            render={({ field, fieldState }) => (\n              <Field data-invalid={fieldState.invalid} className='gap-2!'>\n                <FieldLabel htmlFor={field.name}>Email</FieldLabel>\n                <Input\n                  {...field}\n                  id={field.name}\n                  type='email'\n                  aria-invalid={fieldState.invalid}\n                  placeholder='Email address'\n                  autoComplete='email'\n                />\n                {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n              </Field>\n            )}\n          />\n\n          {/* Issue Select Field */}\n          <Controller\n            name='issue'\n            control={form.control}\n            render={({ field, fieldState }) => (\n              <Field data-invalid={fieldState.invalid} className='gap-2!'>\n                <FieldLabel htmlFor='issue'>Issue</FieldLabel>\n                <Select name={field.name} value={field.value} onValueChange={field.onChange}>\n                  <SelectTrigger id='issue' className='w-full' aria-invalid={fieldState.invalid}>\n                    <SelectValue placeholder='Issue you are facing' />\n                  </SelectTrigger>\n                  <SelectContent>\n                    <SelectItem value='damaged'>Product is Damaged</SelectItem>\n                    <SelectItem value='got-different'>Received wrong product</SelectItem>\n                    <SelectItem value='not-like'>Not as expectation</SelectItem>\n                    <SelectItem value='other'>Other</SelectItem>\n                  </SelectContent>\n                </Select>\n                {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n              </Field>\n            )}\n          />\n\n          {/* Radio Group Field */}\n          <Controller\n            name='selectedOption'\n            control={form.control}\n            render={({ field, fieldState }) => (\n              <FieldSet>\n                <FieldLegend variant='label'>How can we help you?</FieldLegend>\n                <RadioGroup name={field.name} value={field.value} onValueChange={field.onChange}>\n                  <Field orientation='horizontal' data-invalid={fieldState.invalid}>\n                    <RadioGroupItem value='replace' id='want-replace' aria-invalid={fieldState.invalid} />\n                    <FieldLabel htmlFor='want-replace' className='font-normal'>\n                      Need a product replacement\n                    </FieldLabel>\n                  </Field>\n                  <Field orientation='horizontal' data-invalid={fieldState.invalid}>\n                    <RadioGroupItem value='refund' id='want-refund' aria-invalid={fieldState.invalid} />\n                    <FieldLabel htmlFor='want-refund' className='font-normal'>\n                      Need a refund\n                    </FieldLabel>\n                  </Field>\n                  <Field orientation='horizontal' data-invalid={fieldState.invalid}>\n                    <RadioGroupItem value='support' id='want-support' aria-invalid={fieldState.invalid} />\n                    <FieldLabel htmlFor='want-support' className='font-normal'>\n                      Need guidance or support\n                    </FieldLabel>\n                  </Field>\n                </RadioGroup>\n                {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n              </FieldSet>\n            )}\n          />\n\n          {/* Message Textarea Field */}\n          <Controller\n            name='message'\n            control={form.control}\n            render={({ field, fieldState }) => (\n              <Field data-invalid={fieldState.invalid} className='gap-2!'>\n                <FieldLabel htmlFor={field.name}>Please describe your issue</FieldLabel>\n                <Textarea\n                  {...field}\n                  id={field.name}\n                  aria-invalid={fieldState.invalid}\n                  placeholder='Provide detailed information about your issue'\n                  className='min-h-30 resize-none'\n                />\n                {fieldState.invalid && <FieldError errors={[fieldState.error]} />}\n              </Field>\n            )}\n          />\n\n          <Button type='submit'>Submit</Button>\n        </form>\n      </CardContent>\n    </Card>\n  )\n}\n\nexport default ContactUSFormDemo\n","type":"registry:component","target":"components/shadcn-studio/form/form-10.tsx"}]}