import { forwardRef, type InputHTMLAttributes } from "react";
import { cn } from "src/lib/utils";

type InputProps = InputHTMLAttributes<HTMLInputElement>;

const Input = forwardRef<HTMLInputElement, InputProps>(
	({ className, type, ...props }, ref) => {
		return (
			<input
				ref={ref}
				type={type}
				{...props}
				className={cn(
					`h-10 w-full rounded-lg border border-border bg-card px-3 py-2 font-medium text-primary shadow-xs outline-hidden`,
					`transition-all duration-200 file:border-0 file:bg-transparent file:font-medium file:text-sm`,
					`placeholder:text-muted-foreground/50 hover:border-muted-foreground focus:border-foreground focus:ring-foreground`,
					`disabled:cursor-not-allowed disabled:opacity-50 dark:border-input dark:bg-input/30 dark:hover:border-muted-foreground`,
					`dark:hover:bg-input/50`,
					className,
				)}
			/>
		);
	},
);
Input.displayName = "Input";

export default Input;
