From 14b8cacad15003ca76dd1c872bd17a2597959504 Mon Sep 17 00:00:00 2001
From: bntvllnt <32437578+bntvllnt@users.noreply.github.com>
Date: Sat, 25 Apr 2026 03:20:52 +0200
Subject: [PATCH 1/7] feat(ui): upgrade form with validation context
---
packages/ui/package.json | 10 +-
packages/ui/src/components/form/form.mdx | 52 ++-
.../ui/src/components/form/form.stories.tsx | 130 +++++--
packages/ui/src/components/form/form.test.tsx | 275 +++++++-------
packages/ui/src/components/form/form.tsx | 349 ++++++++++--------
.../components/form/form.visual.fixture.tsx | 59 +++
.../ui/src/components/form/form.visual.tsx | 27 +-
packages/ui/src/components/form/index.ts | 2 +
packages/ui/src/components/index.ts | 2 +
pnpm-lock.yaml | 129 +++++--
10 files changed, 629 insertions(+), 406 deletions(-)
create mode 100644 packages/ui/src/components/form/form.visual.fixture.tsx
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 3eaedd2..33adf72 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -90,11 +90,14 @@
"check:stories": "tsx scripts/check-story-coverage.ts"
},
"peerDependencies": {
+ "@hookform/resolvers": ">=5.0.0",
"next": ">=14.0.0",
"next-themes": ">=0.4.0",
"react": ">=18.0.0",
"react-dom": ">=18.0.0",
- "tailwindcss": ">=3.0.0"
+ "react-hook-form": ">=7.55.0",
+ "tailwindcss": ">=3.0.0",
+ "zod": ">=4.0.0"
},
"peerDependenciesMeta": {
"next": {
@@ -171,6 +174,7 @@
"jsdom": "^26.1.0",
"playwright": "^1.57.0",
"postcss": "^8.5.6",
+ "react-hook-form": "^7.73.1",
"remark-gfm": "^4.0.1",
"storybook": "^10.2.17",
"tailwindcss": "^3.4.17",
@@ -178,6 +182,8 @@
"tsup": "^8.5.0",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
- "vitest": "^4.0.16"
+ "vitest": "^4.0.16",
+ "zod": "^4.3.6",
+ "@hookform/resolvers": "^5.2.2"
}
}
diff --git a/packages/ui/src/components/form/form.mdx b/packages/ui/src/components/form/form.mdx
index d4203e1..f3250a6 100644
--- a/packages/ui/src/components/form/form.mdx
+++ b/packages/ui/src/components/form/form.mdx
@@ -5,7 +5,7 @@ import * as Stories from './form.stories'
# Form
-A lightweight validation wrapper for composing labels, descriptions, controls, and messages with consistent ARIA wiring.
+A react-hook-form powered validation wrapper that keeps labels, descriptions, controls, and field errors in sync with accessible ARIA wiring.