import { forwardRef, type InputHTMLAttributes, type ReactNode } from "react";
import "@shared/components/Input.css";
export type InputSize = "sm" | "md";
export interface InputProps extends Omit<
InputHTMLAttributes,
"size"
> {
/** Visual size. Distinct from the HTML `size` attribute (which is for character width). */
inputSize?: InputSize;
leadingIcon?: ReactNode;
trailingIcon?: ReactNode;
/** Force the error tone independently of FormField. */
invalid?: boolean;
}
export const Input = forwardRef(function Input(
{ inputSize = "md", leadingIcon, trailingIcon, invalid, className, ...rest },
ref,
) {
return (
{leadingIcon && (
{leadingIcon}
)}
{trailingIcon && (
{trailingIcon}
)}
);
});