"use client"; import { CheckCircleIcon } from "@heroicons/react/24/solid"; import { clsx } from "clsx"; import { ChangeEvent, DetailedHTMLProps, forwardRef, InputHTMLAttributes, ReactNode } from "react"; import { getComponentRoundness } from "@/lib/theme"; export type TextInputProps = DetailedHTMLProps, HTMLInputElement> & { label: string; suffix?: string; placeholder?: string; defaultValue?: string; error?: string | ReactNode; success?: string | ReactNode; disabled?: boolean; onChange?: (value: ChangeEvent) => void; onBlur?: (value: ChangeEvent) => void; roundness?: string; // Allow override via props }; const styles = (error: boolean, disabled: boolean, roundnessClasses: string = "rounded-md") => clsx( { "h-[40px] mb-[2px] p-[7px] bg-input-light-background dark:bg-input-dark-background transition-colors duration-300 grow": true, "border border-input-light-border dark:border-input-dark-border hover:border-black hover:dark:border-white focus:border-primary-light-500 focus:dark:border-primary-dark-500": true, "focus:outline-none focus:ring-0 text-base text-black dark:text-white placeholder:italic placeholder-gray-700 dark:placeholder-gray-700": true, "border border-warn-light-500 dark:border-warn-dark-500 hover:border-warn-light-500 hover:dark:border-warn-dark-500 focus:border-warn-light-500 focus:dark:border-warn-dark-500": error, "pointer-events-none text-gray-500 dark:text-gray-800 border border-input-light-border dark:border-input-dark-border hover:border-light-hoverborder hover:dark:border-hoverborder cursor-default": disabled, }, roundnessClasses, // Apply the full roundness classes directly ); // Helper function to get default input roundness from theme function getDefaultInputRoundness(): string { return getComponentRoundness("input"); } // eslint-disable-next-line react/display-name export const TextInput = forwardRef( ( { label, placeholder, defaultValue, suffix, required = false, error, disabled, success, onChange, onBlur, roundness, ...props }, ref, ) => { // Use theme-based roundness if not explicitly provided const actualRoundness = roundness || getDefaultInputRoundness(); return ( ); }, );