import * as React from "react";

import { cn } from "@/lib/utils";

export type InputProps = React.ComponentProps<"input">;

const INPUT_BASE_CLASS =
  "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground h-9 w-full min-w-0 rounded-lg border border-input bg-white dark:bg-white/5 px-3 py-1 text-base outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm";
const INPUT_FOCUS_CLASS = "focus-visible:border-[#428B4D] focus-visible:outline-none";
const INPUT_INVALID_CLASS = "aria-invalid:border-destructive";

function Input({ className, type, ...props }: InputProps) {
  return (
    <input
      type={type}
      data-slot="input"
      className={cn(INPUT_BASE_CLASS, INPUT_FOCUS_CLASS, INPUT_INVALID_CLASS, className)}
      {...props}
    />
  );
}

export { Input };
