"use client" import { Input as AriaInput, Label as AriaLabel, Text, TextField, } from "react-aria-components" import { Controller, useFormContext } from "react-hook-form" import { CheckIcon, InfoCircleIcon } from "@/components/Icons" import Label from "@/components/TempDesignSystem/Form/Label" import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import styles from "./input.module.css" import type { HTMLAttributes, WheelEvent } from "react" import type { InputProps } from "./input" export default function Input({ "aria-label": ariaLabel, disabled = false, helpText = "", label, name, placeholder = "", registerOptions = {}, type = "text", }: InputProps) { const { control } = useFormContext() let numberAttributes: HTMLAttributes = {} if (type === "number") { numberAttributes.onWheel = function (evt: WheelEvent) { evt.currentTarget.blur() } } return ( ( {helpText && !fieldState.error ? ( {helpText} ) : null} {fieldState.error ? ( {fieldState.error.message} ) : null} )} /> ) }