import React, { useState } from "react"; import { cn } from "../../utils/cn"; import { CopyIcon, CheckIcon, AlertCircle } from "lucide-react"; export const Input = React.forwardRef( ({ className, type = "text", error, label, ...props }, ref) => { const [focused, setFocused] = useState(false); return (
{/* Input Wrapper */}
{/* Floating Label */} {label && ( )} { setFocused(true); props.onFocus?.(e); }} onBlur={(e) => { setFocused(false); props.onBlur?.(e); }} className={cn( "flex w-full bg-transparent p-1 shadow-sm placeholder:opacity-0 focus:outline-none focus:placeholder:opacity-100 disabled:cursor-not-allowed", "text-foreground placeholder:text-muted-foreground", )} {...props} />
{/* Error Validation Feedback */} {error && (
{error}
)}
); } ); Input.displayName = "Input";