import type { ComponentProps, ReactNode } from "react"; import { forwardRef, memo, useId } from "react"; import cn from "@/helpers/cn"; import { FieldError } from "./Form"; import HelpTooltip from "./HelpTooltip"; interface InputProps extends Omit, "prefix"> { className?: string; error?: boolean; helper?: ReactNode; hideError?: boolean; iconLeft?: ReactNode; iconRight?: ReactNode; label?: ReactNode; prefix?: ReactNode | string; } const Input = forwardRef( ( { className = "", error, helper, hideError = false, iconLeft, iconRight, label, prefix, type = "text", ...props }, ref ) => { const id = useId(); const iconStyles = [ "text-zinc-500 [&>*]:peer-focus:text-gray-500 [&>*]:h-5", { "!text-red-500 [&>*]:peer-focus:!text-red-500": error } ]; return ( ); } ); export default memo(Input);