2026-07-16 00:36:53 -05:00
|
|
|
import * as React from "react";
|
2026-07-16 01:18:57 -05:00
|
|
|
import { cva, type VariantProps } from "class-variance-authority";
|
2026-07-16 00:36:53 -05:00
|
|
|
import { cn } from "../lib/cn";
|
|
|
|
|
|
2026-07-16 01:18:57 -05:00
|
|
|
const inputVariants = cva(
|
|
|
|
|
"flex w-full rounded border border-border bg-bg/40 text-text placeholder:text-muted " +
|
|
|
|
|
"transition-shadow duration-base ease-out focus-visible:outline-none focus-visible:ring-2 " +
|
|
|
|
|
"focus-visible:ring-ring/60 focus-visible:border-brand/60 disabled:cursor-not-allowed disabled:opacity-50",
|
|
|
|
|
{
|
|
|
|
|
variants: { size: { sm: "h-8 px-2.5 py-1 text-sm", md: "h-10 px-3 py-2 text-sm" } },
|
|
|
|
|
defaultVariants: { size: "md" },
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export interface InputProps
|
|
|
|
|
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">,
|
|
|
|
|
VariantProps<typeof inputVariants> {}
|
|
|
|
|
|
|
|
|
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
|
|
({ className, size, type, ...props }, ref) => (
|
|
|
|
|
<input type={type} ref={ref} className={cn(inputVariants({ size }), className)} {...props} />
|
2026-07-16 00:36:53 -05:00
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
Input.displayName = "Input";
|
2026-07-16 01:18:57 -05:00
|
|
|
export { inputVariants };
|