diff --git a/src/components/Input/index.tsx b/src/components/Input/index.tsx new file mode 100644 index 0000000..5a6c390 --- /dev/null +++ b/src/components/Input/index.tsx @@ -0,0 +1,118 @@ +import { Eye, EyeOff, type LucideIcon } from "lucide-react"; +import { useId, useState } from "react"; +import type { ComponentPropsWithoutRef } from "react"; +import { twMerge } from "tailwind-merge"; + +interface InputProps extends ComponentPropsWithoutRef<"input"> { + type?: "text" | "password" | "number" | "email"; + error?: boolean; + id?: string; + Icon?: LucideIcon; + containerStyle?: string; + innerStyle?: string; +} + +/** + * + * 사용자 입력을 받는 기본 입력 컴포넌트입니다. + * Tailwind 스타일이 적용되어 있으며, + * 에러 상태, 아이콘 표시, 컨테이너/내부 커스텀 스타일 등을 지원합니다. + * + * @component + * + * @example + * ```tsx + * import {User} from "lucide-react"; + * + * + * ``` + * + * @param {object} props - Input 컴포넌트의 속성 + * @param {"text" | "password" | "number" | "email"} [props.type="text"] + * 입력 타입 (기본값: `"text"`) + * @param {boolean} [props.error=false] + * 에러 상태 여부. `true`일 경우 테두리가 빨간색으로 표시됩니다. + * @param {string} [props.id] + * 입력 필드의 고유 ID. 없을 경우 `useId()`로 자동 생성됩니다. + * @param {React.ComponentType>} [props.Icon] + * 아이콘 컴포넌트 (예: Lucide 아이콘). 왼쪽에 표시됩니다. + * @param {string} [props.containerStyle] + * 상위 `