import { forwardRef, InputHTMLAttributes, ReactNode } from 'react' import clsx from 'clsx' export interface InputProps extends InputHTMLAttributes { label?: string error?: string helperText?: string leftIcon?: ReactNode rightIcon?: ReactNode fullWidth?: boolean } const Input = forwardRef( ( { className, label, error, helperText, leftIcon, rightIcon, fullWidth = true, type = 'text', id, ...props }, ref ) => { const inputId = id || label?.toLowerCase().replace(/\s+/g, '-') return (
{label && ( )}
{leftIcon && (
{leftIcon}
)} {rightIcon && (
{rightIcon}
)}
{error &&

{error}

} {helperText && !error && (

{helperText}

)}
) } ) Input.displayName = 'Input' export default Input // Textarea component export interface TextareaProps extends React.TextareaHTMLAttributes { label?: string error?: string helperText?: string fullWidth?: boolean } export const Textarea = forwardRef( ( { className, label, error, helperText, fullWidth = true, id, ...props }, ref ) => { const inputId = id || label?.toLowerCase().replace(/\s+/g, '-') return (
{label && ( )}