deno.land / x / netzo@0.5.16 / components / input-otp.tsx
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364// @deno-types="npm:@types/react@18.2.60"import * as React from "react";
import { OTPInput, SlotProps } from "../deps/input-otp.ts";
import { cn } from "./utils.ts";
const InputOTP = React.forwardRef< React.ElementRef<typeof OTPInput>, React.ComponentPropsWithoutRef<typeof OTPInput>>(({ className, ...props }, ref) => ( <OTPInput ref={ref} containerClassName={cn("flex items-center gap-2", className)} {...props} />));InputOTP.displayName = "InputOTP";
const InputOTPGroup = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div">>(({ className, ...props }, ref) => ( <div ref={ref} className={cn("flex items-center", className)} {...props} />));InputOTPGroup.displayName = "InputOTPGroup";
const InputOTPSlot = React.forwardRef< React.ElementRef<"div">, SlotProps & React.ComponentPropsWithoutRef<"div">>(({ char, hasFakeCaret, isActive, className, ...props }, ref) => { return ( <div ref={ref} className={cn( "relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md", isActive && "z-10 ring-1 ring-ring", className, )} {...props} > {char} {hasFakeCaret && ( <div className="pointer-events-none absolute inset-0 flex items-center justify-center"> <div className="animate-caret-blink h-4 w-px bg-foreground duration-1000" /> </div> )} </div> );});InputOTPSlot.displayName = "InputOTPSlot";
const InputOTPSeparator = React.forwardRef< React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div">>(({ ...props }, ref) => ( <div ref={ref} role="separator" {...props}> <i className="mdi-minus" /> </div>));InputOTPSeparator.displayName = "InputOTPSeparator";
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
Version Info