refactor: simplify FloatingInput and Textarea components by removing unnecessary forwardRef usage 🔨

This commit is contained in:
2025-07-13 22:49:11 +05:00
parent b90a4afc73
commit 5809e26593
4 changed files with 126 additions and 117 deletions

View File

@ -3,9 +3,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { cn } from '@/lib/utils';
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> { }
const FloatingInput = React.forwardRef<HTMLInputElement, InputProps>(
const FloatingInput = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>(
({ className, ...props }, ref) => {
return <Input placeholder=" " className={cn('peer', className)} ref={ref} {...props} />;
},
@ -29,7 +27,7 @@ const FloatingLabel = React.forwardRef<
});
FloatingLabel.displayName = 'FloatingLabel';
type FloatingLabelInputProps = InputProps & { label?: string };
type FloatingLabelInputProps = React.InputHTMLAttributes<HTMLInputElement> & { label?: string };
const FloatingLabelInput = React.forwardRef<
React.ElementRef<typeof FloatingInput>,