"use client"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { toast } from "@/hooks/use-toast"; import { Button } from "@/components/ui/button"; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, } from "@/components/ui/form"; import { InputOTP, InputOTPGroup, InputOTPSlot, } from "@/components/ui/input-otp"; import { SubmitButton } from "../submit-button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "../ui/card"; import { cn } from "@/lib/utils"; const FormSchema = z.object({ pin: z.string().min(6, { message: "Your one-time password must be 6 characters.", }), }); interface InputOTPFormProps { className?: string; [key: string]: any; } export function InputOTPForm({ className, ...props }: InputOTPFormProps) { const form = useForm>({ resolver: zodResolver(FormSchema), defaultValues: { pin: "", }, }); function onSubmit(data: z.infer) { toast({ title: "You submitted the following values:", description: (
          {JSON.stringify(data, null, 2)}
        
), }); } return (
One-Time Password One time password is a security feature that helps protect your data
( {[...Array(6)].map((_, index) => ( ))} Please enter the one-time password sent to your phone. )} />
Submit
By clicking continue, you agree to our Terms of Service{" "} and Privacy Policy.
); }