"use client" import * as React from "react" import { DashIcon } from "@radix-ui/react-icons" import { OTPInput, OTPInputContext } from "input-otp" import { cn } from "@eloquent/styles" const Root = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, containerClassName, ...props }, ref) => ( )) Root.displayName = "InputOTP.Root" const InputOTPGroup = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div"> >(({ className, ...props }, ref) => (
)) InputOTPGroup.displayName = "InputOTP.Group" const InputOTPSlot = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div"> & { index: number } >(({ index, className, ...props }, ref) => { const inputOTPContext = React.useContext(OTPInputContext) // @ts-ignore const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index] return (
{char} {hasFakeCaret && (
)}
) }) InputOTPSlot.displayName = "InputOTP.Slot" const InputOTPSeparator = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div"> >(({ ...props }, ref) => (
)) InputOTPSeparator.displayName = "InputOTP.Separator" export const InputOTP = { Root, Group: InputOTPGroup, Slot: InputOTPSlot, Separator: InputOTPSeparator }