@zod-to-form/vite 0.4.3 → 0.4.5
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/dist/virtual-types.d.ts +22 -2
- package/package.json +3 -3
package/dist/virtual-types.d.ts
CHANGED
|
@@ -24,7 +24,17 @@ declare module '*?z2f' {
|
|
|
24
24
|
* input data (matching React Hook Form's `useForm` semantics).
|
|
25
25
|
*/
|
|
26
26
|
export interface Z2FFormProps<TData = unknown> extends FormHTMLAttributes<HTMLFormElement> {
|
|
27
|
-
onSubmit
|
|
27
|
+
// Submit-mode forms call `onSubmit` from a real form submission and
|
|
28
|
+
// require it. Auto-save mode forms (config.mode === 'auto-save') have no
|
|
29
|
+
// submit button at all — they call `onValueChange` on every RHF
|
|
30
|
+
// `watch()` tick instead, matching the per-file interface the codegen
|
|
31
|
+
// actually emits (see packages/codegen/src/generate.ts's `propsLines`).
|
|
32
|
+
// This ambient fallback type is what TypeScript sees at the `?z2f`
|
|
33
|
+
// import site before the real transform runs, so both must be optional
|
|
34
|
+
// here — which one is actually required/called depends on the
|
|
35
|
+
// consumer's configured `mode`.
|
|
36
|
+
onSubmit?: (data: TData) => void | Promise<void>;
|
|
37
|
+
onValueChange?: (data: TData) => void;
|
|
28
38
|
defaultValues?: Partial<TData>;
|
|
29
39
|
values?: TData;
|
|
30
40
|
fieldProps?: Record<string, Record<string, unknown>>;
|
|
@@ -49,7 +59,17 @@ declare module '*?z2f=*' {
|
|
|
49
59
|
import type { ComponentType, FormHTMLAttributes, ReactNode } from 'react';
|
|
50
60
|
|
|
51
61
|
export interface Z2FFormProps<TData = unknown> extends FormHTMLAttributes<HTMLFormElement> {
|
|
52
|
-
onSubmit
|
|
62
|
+
// Submit-mode forms call `onSubmit` from a real form submission and
|
|
63
|
+
// require it. Auto-save mode forms (config.mode === 'auto-save') have no
|
|
64
|
+
// submit button at all — they call `onValueChange` on every RHF
|
|
65
|
+
// `watch()` tick instead, matching the per-file interface the codegen
|
|
66
|
+
// actually emits (see packages/codegen/src/generate.ts's `propsLines`).
|
|
67
|
+
// This ambient fallback type is what TypeScript sees at the `?z2f`
|
|
68
|
+
// import site before the real transform runs, so both must be optional
|
|
69
|
+
// here — which one is actually required/called depends on the
|
|
70
|
+
// consumer's configured `mode`.
|
|
71
|
+
onSubmit?: (data: TData) => void | Promise<void>;
|
|
72
|
+
onValueChange?: (data: TData) => void;
|
|
53
73
|
defaultValues?: Partial<TData>;
|
|
54
74
|
values?: TData;
|
|
55
75
|
fieldProps?: Record<string, Record<string, unknown>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zod-to-form/vite",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Vite plugin for zod-to-form — transforms ?z2f imports into generated form components and optionally replaces <ZodForm> JSX call sites with generated components at build time",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/pradeepmouli/zod-to-form#readme",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@babel/types": "^7.29.0",
|
|
51
51
|
"magic-string": "^0.30.21",
|
|
52
52
|
"pathe": "^2.0.3",
|
|
53
|
-
"@zod-to-form/codegen": "0.10.
|
|
54
|
-
"@zod-to-form/core": "0.11.
|
|
53
|
+
"@zod-to-form/codegen": "0.10.1",
|
|
54
|
+
"@zod-to-form/core": "0.11.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/babel__traverse": "^7.28.0",
|