"use client"; import { forwardRef, InputHTMLAttributes, useId } from "react"; import { clsx } from "clsx"; import { designSystem } from "@/lib/design-system"; const { mobile } = designSystem; // colors/radius/spacing/typography reserved // ============================================================================= // Input Types // ============================================================================= export interface InputProps extends InputHTMLAttributes { label?: string; error?: string; hint?: string; leftIcon?: React.ReactNode; rightIcon?: React.ReactNode; fullWidth?: boolean; } // ============================================================================= // SharedInput Component // ============================================================================= export const SharedInput = forwardRef( ( { label, error, hint, leftIcon, rightIcon, fullWidth: _fullWidth = true, id: providedId, className, disabled, type = "text", ...props }, ref, ) => { const generatedId = useId(); const inputId = providedId ?? generatedId; const messageId = `${inputId}-message`; const hasIcon = leftIcon || rightIcon; const inputPadding = hasIcon ? "pl-10 pr-10" : "px-4"; return (
{label && ( )}
{leftIcon && (
{leftIcon}
)} {rightIcon && (
{rightIcon}
)}
{error && ( )} {hint && !error && (

{hint}

)}
); }, ); SharedInput.displayName = "SharedInput"; // ============================================================================= // Convenience Input Components // ============================================================================= // Search input with icon export function SearchInput({ placeholder = "Search...", className, ...props }: Omit) { return ( ); } // Textarea variant export function SharedTextarea({ label, error, hint, className, rows = 4, ...props }: { label?: string; error?: string; hint?: string; className?: string; rows?: number; } & Omit, "type" | "leftIcon" | "rightIcon">) { const generatedId = useId(); const textareaId = props.id ?? generatedId; const messageId = `${textareaId}-message`; return (
{label && ( )}