import React, { ReactNode } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { AlertCircle } from 'lucide-react'; interface FormFieldWrapperProps { id: string; label: string; icon?: ReactNode; error?: string; isFilled: boolean; isFocused: boolean; disabled?: boolean; children: ReactNode; } export function FormFieldWrapper({ id, label, icon, error, isFilled, isFocused, disabled, children, }: FormFieldWrapperProps) { const isFloated = isFocused || isFilled; const hasError = !!error; return (
{/* Icon (if provided) */} {icon && (
{icon}
)} {/* Floating Label */} {label} {/* Input Container with Border & Focus Effect */}
{children}
{/* Error Message */} {hasError && ( {error} )}
); }