"use client"; import * as React from "react"; import { OTPInput, OTPInputContext } from "input-otp"; import { Dot } from "lucide-react"; import { cn } from "@app/lib/cn"; const InputOTP = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { obscured?: boolean } >(({ className, containerClassName, obscured = false, ...props }, ref) => ( )); InputOTP.displayName = "InputOTP"; const InputOTPGroup = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div"> >(({ className, ...props }, ref) => (
)); InputOTPGroup.displayName = "InputOTPGroup"; const InputOTPSlot = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div"> & { index: number; obscured?: boolean } >(({ index, className, obscured = false, ...props }, ref) => { const inputOTPContext = React.useContext(OTPInputContext); const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]; return (
{char && obscured ? "•" : char} {hasFakeCaret && (
)}
); }); InputOTPSlot.displayName = "InputOTPSlot"; const InputOTPSeparator = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div"> >(({ ...props }, ref) => (
)); InputOTPSeparator.displayName = "InputOTPSeparator"; export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };