@imfusion/web-ui 0.11.1-dev.53.g43897e72 → 0.11.1-dev.54.ge4c44972

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -99,6 +99,9 @@
99
99
  page, `Button` for actions, and `Link` for destinations.
100
100
  - The `imf-web-ui-conventions` `library-boundary` topic reports a native element or local function that duplicates a Web
101
101
  UI component, part, or helper such as `initialsFromName`.
102
+ - Forms use TanStack Form: `imf-web-ui-ux` names it for every form, the `imf-web-ui-conventions` `validation` topic
103
+ validates user input in the form's validators with the Zod schema, and `imf-web-ui-audit` reports a form whose state and
104
+ validation are written by hand.
102
105
  - `web-ui-dev-new-component`, `web-ui-dev-update-component`, and `web-ui-dev-design-component` draft on the shared
103
106
  Web UI Component Drafts canvas: a block per component on its Storybook group's page, one row per fidelity rung.
104
107
  - `web-ui-dev-new-component` and `web-ui-dev-update-component` wait for the user to approve the design on the canvas
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imfusion/web-ui",
3
- "version": "0.11.1-dev.53.g43897e72",
3
+ "version": "0.11.1-dev.54.ge4c44972",
4
4
  "description": "The official Web UI component library for ImFusion web apps",
5
5
  "author": "ImFusion GmbH",
6
6
  "homepage": "https://imfusion.com",
@@ -67,7 +67,9 @@ next action is the add from that topic. A Vite config that reads tsconfig `paths
67
67
  to drop it and give the `#/` alias through `imports` in `package.json`. A major or minor mismatch between the project and Web
68
68
  UI on a package listed under Aligned runtime packages in the `tooling` topic is a Deviation. Report both versions, with
69
69
  `npm install <package>@<Web UI's version>` as the fix. A route file that holds several views inline is a Deviation, and so is
70
- a route whose only view sits alone in its `-` folder. Name the views, with the move as the fix.
70
+ a route whose only view sits alone in its `-` folder. Name the views, with the move as the fix. A form whose state and
71
+ validation are written by hand instead of TanStack Form is a Deviation, however many forms share the pattern. Name each form,
72
+ with TanStack Form and its existing schema as the fix.
71
73
 
72
74
  ## Topics
73
75
 
@@ -25,11 +25,11 @@ a gap or to make a deliberate deviation visible; do not refactor a project just
25
25
  | [styling](topics/styling.md) | Writing CSS or customizing Web UI. |
26
26
  | [tokens](topics/tokens.md) | Choosing an exact token name. |
27
27
  | [class-names](topics/class-names.md) | Mapping variants and `className` to CSS. |
28
- | [validation](topics/validation.md) | Accepting data from outside the frontend. |
28
+ | [validation](topics/validation.md) | Accepting data from outside the frontend, or building a form. |
29
29
  | [data](topics/data.md) | Adding API queries, mutations, or invalidation. |
30
30
  | [project-structure](topics/project-structure.md) | Adding files or routes. |
31
31
  | [testing](topics/testing.md) | Deciding what to test. |
32
- | [tooling](topics/tooling.md) | Adding a dependency or configuring a tool. |
32
+ | [tooling](topics/tooling.md) | Adding a dependency, configuring a tool, or building a form. |
33
33
  | [npm-project](topics/npm-project.md) | Changing `package.json`, scripts, pins, or Node. |
34
34
  | [git](topics/git.md) | Configuring hooks or choosing verification scope. |
35
35
  | [agent-tooling](topics/agent-tooling.md) | Installing skills or lifecycle hooks. |
@@ -81,6 +81,7 @@ sections one to one — change a topic's sections and this file follows in the s
81
81
  - [ ] Schema first, type derived
82
82
  - [ ] TanStack Router search params
83
83
  - [ ] Failure handling
84
+ - [ ] Forms
84
85
 
85
86
  ## Data — `data`
86
87
 
@@ -25,7 +25,8 @@ Use the tool's current documentation rather than memory.
25
25
 
26
26
  Use the library that already owns the problem. Adopt Form for form rules, Query for caching and refetching, Router for URL
27
27
  state, Table for sorting and pagination, and Hotkeys for keyboard shortcuts instead of rebuilding those layers. Web UI only
28
- shows a key; the app binds it. Keep an existing project choice when it works.
28
+ shows a key; the app binds it. Keep an existing project choice when it works. A layer rebuilt by hand, such as form state in
29
+ `useState`, is not a choice to keep.
29
30
 
30
31
  ## Devtools
31
32
 
@@ -54,3 +54,9 @@ Use `.catch()` for malformed values that can safely fall back. Use `.default()`
54
54
  - Use `parse` when invalid data is a contract failure that should reach the normal error boundary.
55
55
  - Use `safeParse` when failure is expected and the caller can show a validation message.
56
56
  - Keep trimming, coercion, transforms, and defaults in the boundary schema.
57
+
58
+ ## Forms
59
+
60
+ Build forms with TanStack Form and validate user input in the form's validators with the Zod schema, so a field error and the
61
+ submitted value's type come from one schema. Field values held in `useState` and checked by hand with `safeParse` are a gap,
62
+ even when the project's other forms do the same.
@@ -1,7 +1,8 @@
1
1
  # Form UX
2
2
 
3
- Read this before building a form with more than two fields. The library supplies controls; the form library owns state and
4
- validation. These rules cover structure and feedback.
3
+ Read this before building a form with more than two fields. Build it with TanStack Form, the form library the
4
+ `imf-web-ui-conventions` tooling topic names: it owns state and validation, and Web UI supplies the controls. These rules
5
+ cover structure and feedback.
5
6
 
6
7
  ## Structure
7
8