"use client" /* eslint-disable no-restricted-syntax */ import type { ComponentPropsWithoutRef, ReactNode } from "react" import { type As, type InputProps, type MergeWithAs, Input } from "@heroui/react" import type { Field } from "soda-tanstack-form" import { getFieldProps } from "../utils/getFieldProps" export type FormInputProps = MergeWithAs< ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef, InputProps, AsComponent > & { field: Field component?: ( props: MergeWithAs, ComponentPropsWithoutRef, InputProps, AsComponent>, ) => ReactNode } export function FormInput({ field, component: Input2 = Input, ...rest }: FormInputProps): ReactNode { return ( value={field.state.value ?? ""} onValueChange={field.handleChange as (value: string) => void} {...getFieldProps(field)} {...rest} /> ) }