import React, { useState } from "react"; import { cn } from "@/lib/utils/cn"; interface InputProps extends React.InputHTMLAttributes { label?: string; error?: string; } export const Input: React.FC = ({ label, error, className, ...props }) => { const [focused, setFocused] = useState(false); const hasValue = props.value !== undefined && props.value !== ""; return (
{label && ( )}
setFocused(true)} onBlur={() => setFocused(false)} {...props} /> {(focused || hasValue) && !error && (
)}
{error && (

{error}

)}
); };