@beignet/react-hook-form 0.0.51 → 0.0.53

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +9 -11
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @beignet/react-hook-form
2
2
 
3
+ ## 0.0.53
4
+
5
+ ### Patch Changes
6
+
7
+ - a05562d: Align form and provider documentation with the generated starter's contracts, cache invalidation, and existing server wiring.
8
+
9
+ ## 0.0.52
10
+
11
+ ### Patch Changes
12
+
13
+ - b39bb6e: Clarify that Beignet applications require Node.js 22.12 or newer and can use
14
+ npm, pnpm, Yarn, or Bun for package management and framework commands.
15
+
3
16
  ## 0.0.51
4
17
 
5
18
  ## 0.0.50
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # @beignet/react-hook-form
2
2
 
3
- > **Runtime:** Beignet requires Node.js 22.12 or newer. Bun 1.3.14 or newer is
4
- > supported for Beignet commands.
3
+ > **Runtime:** Beignet requires Node.js 22.12 or newer. Bun is optional.
5
4
 
6
5
  > React Hook Form integration for Beignet
7
6
 
@@ -36,6 +35,10 @@ boundaries, or field/server error mapping in a Beignet app.
36
35
 
37
36
  ### Basic form
38
37
 
38
+ These examples use the Todos contracts from the Beignet starter. Create accepts
39
+ `title`; completion belongs to the update contract. For a working form with
40
+ verification steps, follow the [form guide](https://beignetjs.com/react-hook-form).
41
+
39
42
  ```tsx
40
43
  "use client";
41
44
 
@@ -49,12 +52,11 @@ function CreateTodoForm() {
49
52
  const form = useForm({
50
53
  defaultValues: {
51
54
  title: "",
52
- completed: false,
53
55
  },
54
56
  });
55
57
 
56
58
  const onSubmit = form.handleSubmit((values) => {
57
- // values is the parsed schema output: { title: string; completed?: boolean }
59
+ // values is the parsed schema output: { title: string }
58
60
  console.log("Creating todo:", values);
59
61
  });
60
62
 
@@ -68,11 +70,6 @@ function CreateTodoForm() {
68
70
  <p className="error">{form.formState.errors.title.message}</p>
69
71
  )}
70
72
 
71
- <label>
72
- <input type="checkbox" {...form.register("completed")} />
73
- Completed
74
- </label>
75
-
76
73
  <button type="submit" disabled={form.formState.isSubmitting}>
77
74
  Create Todo
78
75
  </button>
@@ -89,7 +86,7 @@ function CreateTodoForm() {
89
86
  import { createReactHookForm, rootFormError } from "@beignet/react-hook-form";
90
87
  import { useMutation } from "@tanstack/react-query";
91
88
  import { rq } from "@/client";
92
- import { createTodo } from "@/features/todos/contracts";
89
+ import { createTodo, listTodos } from "@/features/todos/contracts";
93
90
 
94
91
  const rhf = createReactHookForm();
95
92
 
@@ -101,6 +98,7 @@ function CreateTodoForm() {
101
98
 
102
99
  const mutation = useMutation(
103
100
  rq(createTodo).mutationOptions({
101
+ invalidates: () => [rq(listTodos).contractFilter()],
104
102
  onSuccess: () => form.reset(),
105
103
  onError: (error) => {
106
104
  form.setError("root", rootFormError(error, "Could not create the todo."));
@@ -115,7 +113,7 @@ function CreateTodoForm() {
115
113
 
116
114
  return (
117
115
  <form onSubmit={onSubmit}>
118
- <input {...form.register("title")} placeholder="Title" />
116
+ <input {...form.register("title")} placeholder="Title" readOnly={mutation.isPending} />
119
117
  {form.formState.errors.title && (
120
118
  <p>{form.formState.errors.title.message}</p>
121
119
  )}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beignet/react-hook-form",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "type": "module",
5
5
  "description": "React Hook Form integration for Beignet with Standard Schema support",
6
6
  "main": "./dist/index.js",
@@ -66,7 +66,7 @@
66
66
  "@hookform/resolvers": "^5.2.2",
67
67
  "@testing-library/dom": "^9.3.4",
68
68
  "@testing-library/react": "^14.3.1",
69
- "@types/bun": "^1.3.13",
69
+ "@types/bun": "^1.4.0",
70
70
  "@types/node": "^22.0.0",
71
71
  "@types/react": "^18.2.0",
72
72
  "happy-dom": "^20.8.9",