import { InputHTMLAttributes, forwardRef, TextareaHTMLAttributes } from 'react';
interface InputProps extends InputHTMLAttributes {
label?: string;
error?: string;
}
interface TextareaProps extends TextareaHTMLAttributes {
label?: string;
error?: string;
}
const Input = forwardRef(
({ label, error, className = '', ...props }, ref) => {
const baseClasses = 'w-full px-3 py-2 border rounded-lg theme-card theme-text theme-border focus:outline-none focus:ring-2 focus:ring-theme-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed';
return (
{label && (
)}
{error && (
{error}
)}
);
}
);
Input.displayName = 'Input';
const Textarea = forwardRef(
({ label, error, className = '', rows = 4, ...props }, ref) => {
const baseClasses = 'w-full px-3 py-2 border rounded-lg theme-card theme-text theme-border focus:outline-none focus:ring-2 focus:ring-theme-accent focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed resize-vertical';
return (
{label && (
)}
{error && (
{error}
)}
);
}
);
Textarea.displayName = 'Textarea';
export { Input, Textarea };