From 35dfe5bd79a7c59299065087b128422f6f6587ae Mon Sep 17 00:00:00 2001 From: syc0123 Date: Tue, 3 Mar 2026 18:30:56 +0900 Subject: [PATCH] feat: Update modal validation design and behavior - Changed the modal validation mechanism to focus on the first empty required field and display a toast notification prompting the user to fill it. - Removed the disabling of the save button, ensuring it remains active regardless of validation state. - Enhanced visual feedback with a shake animation for empty fields and a red border to indicate errors. - Updated the documentation to reflect the new validation flow and requirements. Made-with: Cursor --- .../ycshin-node/필수입력항목_자동검증_설계.md | 219 +++++++++-------- frontend/app/globals.css | 42 +--- frontend/components/layout/TabBar.tsx | 5 +- frontend/components/v2/V2Input.tsx | 4 +- frontend/lib/hooks/useDialogAutoValidation.ts | 229 +++++++----------- 5 files changed, 226 insertions(+), 273 deletions(-) diff --git a/docs/ycshin-node/필수입력항목_자동검증_설계.md b/docs/ycshin-node/필수입력항목_자동검증_설계.md index 6f1fc6da..1edb53dd 100644 --- a/docs/ycshin-node/필수입력항목_자동검증_설계.md +++ b/docs/ycshin-node/필수입력항목_자동검증_설계.md @@ -1,10 +1,11 @@ -# 모달 자동 검증 설계 +# 모달 필수 입력 검증 설계 ## 1. 목표 -모든 모달에서 필수 입력값이 있는 경우: -- 빈 필수 필드 아래에 경고 문구 표시 -- 모든 필수 필드가 입력되기 전까지 저장/등록 버튼 비활성화 +모든 모달에서 필수 입력값이 빈 상태로 저장 버튼을 클릭하면: +- 첫 번째 빈 필수 필드로 포커스 이동 + 하이라이트 +- 우측 상단에 토스트 알림 ("○○ 항목을 입력해주세요") +- 버튼은 항상 활성 상태 (비활성화하지 않음) --- @@ -18,35 +19,28 @@ │ │ │ │ ├─ 0단계: 모드 확인 │ │ │ └─ useTabStore.mode === "user" 일 때만 실행 │ -│ │ (관리자 모드에서는 return → 나중에 필요 시 확장) │ │ │ │ │ ├─ 1단계: 필수 필드 탐지 │ │ │ └─ Label 내부 안에 * 문자 존재 여부 │ │ │ (라벨 텍스트 직접 매칭 X → span 태그 안의 * 만 감지) │ │ │ │ -│ ├─ 2단계: 시각적 피드백 │ -│ │ ├─ 빈 필수 필드 → 빨간 테두리 (border-destructive) │ -│ │ └─ 필드 아래 에러 메시지 주입 ("필수 입력 항목입니다") │ -│ │ │ -│ └─ 3단계: 버튼 비활성화 │ +│ └─ 2단계: 저장 버튼 클릭 인터셉트 │ │ │ │ -│ ├─ 기본: 모달 내 모든