'use client' import { forwardRef, useState } from 'react' import { motion } from 'framer-motion' import { cn } from '@/lib/utils' export interface InputProps extends React.InputHTMLAttributes { label?: string error?: string icon?: React.ReactNode } const Input = forwardRef( ({ className, label, error, icon, type, ...props }, ref) => { const [isFocused, setIsFocused] = useState(false) const [hasValue, setHasValue] = useState(false) return (
{icon && (
{icon}
)} setIsFocused(true)} onBlur={(e) => { setIsFocused(false) setHasValue(!!e.target.value) }} onChange={(e) => setHasValue(!!e.target.value)} {...props} /> {label && ( {label} )}
{error && ( {error} )}
) } ) Input.displayName = 'Input' export { Input }