@volverjs/form-vue 1.0.0 → 1.1.0-beta.1

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/README.md CHANGED
@@ -44,7 +44,7 @@ npm install @volverjs/form-vue --save
44
44
  ```typescript
45
45
  import { createApp } from 'vue'
46
46
  import { createForm } from '@volverjs/form-vue'
47
- import { z } from 'zod'
47
+ import { z } from 'zod/v3'
48
48
 
49
49
  const schema = z.object({
50
50
  firstName: z.string(),
@@ -153,7 +153,7 @@ The **default settings** are **inherited** from the plugin (if it's installed).
153
153
  ```vue
154
154
  <script lang="ts" setup>
155
155
  import { useForm } from '@volverjs/form-vue'
156
- import { z } from 'zod'
156
+ import { z } from 'zod/v3'
157
157
 
158
158
  const schema = z.object({
159
159
  firstName: z.string(),
@@ -184,7 +184,7 @@ const { VvForm, VvFormWrapper, VvFormField } = useForm(schema, {
184
184
 
185
185
  ```ts
186
186
  import { useForm } from '@volverjs/form-vue'
187
- import { z } from 'zod'
187
+ import { z } from 'zod/v3'
188
188
 
189
189
  const schema = z.object({
190
190
  firstName: z.string(),
@@ -464,7 +464,7 @@ Forms can also be created using a template. A template is an **array of objects*
464
464
  ```vue
465
465
  <script lang="ts" setup>
466
466
  import { useForm } from '@volverjs/form-vue'
467
- import { z } from 'zod'
467
+ import { z } from 'zod/v3'
468
468
 
469
469
  const schema = z.object({
470
470
  firstName: z.string(),
@@ -542,7 +542,7 @@ Conditional rendering can be achieved using the `vvIf` and `vvElseIf` properties
542
542
  ```vue
543
543
  <script lang="ts" setup>
544
544
  import { useForm } from '@volverjs/form-vue'
545
- import { z } from 'zod'
545
+ import { z } from 'zod/v3'
546
546
 
547
547
  const schema = z.object({
548
548
  firstName: z.string(),
@@ -652,13 +652,13 @@ const templateSchema = [
652
652
  ]
653
653
  ```
654
654
 
655
- ## Default Object by Zod Object Schema
655
+ ## Default Object by Zod Schema
656
656
 
657
657
  `defaultObjectBySchema` creates an object by a [Zod Object Schema](https://zod.dev/?id=objects).
658
658
  It can be useful to create a **default object** for a **form**. The default object is created by the default values of the schema and can be merged with an other object passed as parameter.
659
659
 
660
660
  ```ts
661
- import { z } from 'zod'
661
+ import { z } from 'zod/v3'
662
662
  import { defaultObjectBySchema } from '@volverjs/form-vue'
663
663
 
664
664
  const schema = z.object({
@@ -676,7 +676,7 @@ const defaultObject = defaultObjectBySchema(schema, { name: 'Jane' })
676
676
  `defaultObjectBySchema` can be used with nested objects.
677
677
 
678
678
  ```ts
679
- import { z } from 'zod'
679
+ import { z } from 'zod/v3'
680
680
  import { defaultObjectBySchema } from '@volverjs/form-vue'
681
681
 
682
682
  const schema = z.object({
@@ -695,7 +695,7 @@ const defaultObject = defaultObjectBySchema(schema)
695
695
  Other Zod methods are also supported: [`z.nullable()`](https://github.com/colinhacks/zod#nullable), [`z.coerce`](https://github.com/colinhacks/zod#coercion-for-primitives) and [`z.passthrough()`](https://github.com/colinhacks/zod#passthrough).
696
696
 
697
697
  ```ts
698
- import { z } from 'zod'
698
+ import { z } from 'zod/v3'
699
699
  import { defaultObjectBySchema } from '@volverjs/form-vue'
700
700
 
701
701
  const schema = z
@@ -719,6 +719,30 @@ const defaultObject = defaultObjectBySchema(schema, {
719
719
  // defaultObject = { firstName: 'John', lastName: 'Doe', address: { street: 'Main Street', number: 1 }, age: null, height: 1.9, weight: 80, email: 'john.doe@test.com' }
720
720
  ```
721
721
 
722
+ ## Zod 4
723
+ `@volverjs/form-vue` supports Zod 4 from `zod@3.25.x` and `zod@4.x.x`. All features and methods are compatible and the usage remains the same, the library automatically detects the Zod version and adapts accordingly.
724
+
725
+ ```typescript
726
+ import * as z from 'zod/v4'
727
+ import { createForm, useForm, defaultObjectBySchema } from '@volverjs/form-vue'
728
+
729
+ const schema = z.object({
730
+ firstName: z.string(),
731
+ lastName: z.string()
732
+ })
733
+
734
+ // Plugin
735
+ const form = createForm({
736
+ schema
737
+ })
738
+
739
+ // Composable
740
+ const { VvForm, VvFormWrapper, VvFormField } = useForm(schema)
741
+
742
+ // Default Object by Zod Schema
743
+ const defaultObject = defaultObjectBySchema(schema, { firstName: 'Jane' })
744
+ ```
745
+
722
746
  ## License
723
747
 
724
748
  [MIT](http://opensource.org/licenses/MIT)
package/dist/VvForm.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import { Component, InjectionKey, PropType, SlotsType, UnwrapRef } from 'vue';
2
- import { RefinementCtx, z } from 'zod';
3
- import { FormComponentOptions, FormSchema, FormTemplate, InjectedFormData, InjectedFormWrapperData, Path } from './types';
2
+ import { FormComponentOptions, FormSchema, FormTemplate, InjectedFormData, InjectedFormWrapperData, Path, InferSchema, InferFormattedError, RefinementCtx } from './types';
4
3
  import { FormStatus } from './enums';
5
4
  export declare function defineForm<Schema extends FormSchema, Type, FormTemplateComponent extends Component>(schema: Schema, provideKey: InjectionKey<InjectedFormData<Schema, Type>>, options: FormComponentOptions<Schema, Type>, VvFormTemplate: FormTemplateComponent, wrappers: Map<string, InjectedFormWrapperData<Schema>>): {
6
5
  clear: () => void;
7
- errors: import('vue').Ref<z.inferFormattedError<Schema, string> | undefined, z.inferFormattedError<Schema, string> | undefined>;
8
- formData: import('vue').Ref<(undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined>;
6
+ errors: import('vue').Ref<InferFormattedError<Schema> | undefined, InferFormattedError<Schema> | undefined>;
7
+ formData: import('vue').Ref<(undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined>;
9
8
  ignoreUpdates: import('@vueuse/core').IgnoredUpdater;
10
9
  invalid: import('vue').ComputedRef<boolean>;
11
10
  readonly: import('vue').Ref<boolean, boolean>;
@@ -14,12 +13,12 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
14
13
  wrappers: Map<string, InjectedFormWrapperData<Schema>>;
15
14
  stopUpdatesWatch: import('vue').WatchStopHandle;
16
15
  submit: (options?: {
17
- fields?: Set<Path<z.infer<Schema>>>;
18
- superRefine?: (arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>;
16
+ fields?: Set<Path<InferSchema<Schema>>>;
17
+ superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>;
19
18
  }) => Promise<boolean>;
20
- validate: (value?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, options?: {
21
- fields?: Set<Path<z.infer<Schema>>>;
22
- superRefine?: (arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>;
19
+ validate: (value?: (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, options?: {
20
+ fields?: Set<Path<InferSchema<Schema>>>;
21
+ superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>;
23
22
  }) => Promise<boolean>;
24
23
  VvForm: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
25
24
  continuousValidation: {
@@ -32,7 +31,7 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
32
31
  };
33
32
  readonly: {
34
33
  type: BooleanConstructor;
35
- default: boolean;
34
+ default: boolean | undefined;
36
35
  };
37
36
  tag: {
38
37
  type: StringConstructor;
@@ -43,17 +42,17 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
43
42
  default: undefined;
44
43
  };
45
44
  superRefine: {
46
- type: PropType<(arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>>;
45
+ type: PropType<(arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>>;
47
46
  default: undefined;
48
47
  };
49
48
  validateFields: {
50
- type: PropType<Path<z.infer<Schema>>[]>;
49
+ type: PropType<Path<InferSchema<Schema>>[]>;
51
50
  default: undefined;
52
51
  };
53
52
  }>, {
54
53
  clear: () => void;
55
- errors: Readonly<import('vue').Ref<import('vue').DeepReadonly<z.inferFormattedError<Schema, string>> | undefined, import('vue').DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>>;
56
- formData: import('vue').Ref<(undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined>;
54
+ errors: Readonly<import('vue').Ref<import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined, import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined>>;
55
+ formData: import('vue').Ref<(undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined>;
57
56
  ignoreUpdates: import('@vueuse/core').IgnoredUpdater;
58
57
  invalid: import('vue').ComputedRef<boolean>;
59
58
  isReadonly: import('vue').Ref<boolean, boolean>;
@@ -61,9 +60,9 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
61
60
  status: Readonly<import('vue').Ref<FormStatus | undefined, FormStatus | undefined>>;
62
61
  stopUpdatesWatch: import('vue').WatchStopHandle;
63
62
  submit: () => Promise<boolean>;
64
- validate: (value?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, options?: {
65
- fields?: Set<Path<z.infer<Schema>>>;
66
- superRefine?: (arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>;
63
+ validate: (value?: (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, options?: {
64
+ fields?: Set<Path<InferSchema<Schema>>>;
65
+ superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>;
67
66
  }) => Promise<boolean>;
68
67
  wrappers: Map<string, InjectedFormWrapperData<Schema>>;
69
68
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("invalid" | "valid" | "reset" | "submit" | "update:modelValue" | "update:readonly")[], "invalid" | "valid" | "reset" | "submit" | "update:modelValue" | "update:readonly", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
@@ -77,7 +76,7 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
77
76
  };
78
77
  readonly: {
79
78
  type: BooleanConstructor;
80
- default: boolean;
79
+ default: boolean | undefined;
81
80
  };
82
81
  tag: {
83
82
  type: StringConstructor;
@@ -88,11 +87,11 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
88
87
  default: undefined;
89
88
  };
90
89
  superRefine: {
91
- type: PropType<(arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>>;
90
+ type: PropType<(arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>>;
92
91
  default: undefined;
93
92
  };
94
93
  validateFields: {
95
- type: PropType<Path<z.infer<Schema>>[]>;
94
+ type: PropType<Path<InferSchema<Schema>>[]>;
96
95
  default: undefined;
97
96
  };
98
97
  }>> & Readonly<{
@@ -103,17 +102,17 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
103
102
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
104
103
  "onUpdate:readonly"?: ((...args: any[]) => any) | undefined;
105
104
  }>, {
106
- superRefine: (arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>;
107
105
  readonly: boolean;
106
+ superRefine: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>;
108
107
  tag: string;
109
108
  template: FormTemplate<Schema, Type>;
110
109
  continuousValidation: boolean;
111
110
  modelValue: Record<string, any>;
112
- validateFields: Path<z.TypeOf<Schema>>[];
111
+ validateFields: Path<InferSchema<Schema>>[];
113
112
  }, SlotsType<{
114
113
  default: {
115
- errors: UnwrapRef<Readonly<import('vue').Ref<import('vue').DeepReadonly<z.inferFormattedError<Schema, string>> | undefined, import('vue').DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>>>;
116
- formData: UnwrapRef<import('vue').Ref<(undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined>>;
114
+ errors: UnwrapRef<Readonly<import('vue').Ref<import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined, import('vue').DeepReadonly<InferFormattedError<Schema>> | undefined>>>;
115
+ formData: UnwrapRef<import('vue').Ref<(undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined>>;
117
116
  invalid: UnwrapRef<import('vue').ComputedRef<boolean>>;
118
117
  readonly: UnwrapRef<import('vue').Ref<boolean, boolean>>;
119
118
  status: UnwrapRef<Readonly<import('vue').Ref<FormStatus | undefined, FormStatus | undefined>>>;
@@ -123,13 +122,13 @@ export declare function defineForm<Schema extends FormSchema, Type, FormTemplate
123
122
  reset: () => void;
124
123
  stopUpdatesWatch: import('vue').WatchStopHandle;
125
124
  submit: (options?: {
126
- fields?: Set<Path<z.infer<Schema>>>;
127
- superRefine?: (arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>;
125
+ fields?: Set<Path<InferSchema<Schema>>>;
126
+ superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>;
128
127
  }) => Promise<boolean>;
129
- validate: (value?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, options?: {
130
- fields?: Set<Path<z.infer<Schema>>>;
131
- superRefine?: (arg: z.infer<Schema>, ctx: RefinementCtx) => void | Promise<void>;
128
+ validate: (value?: (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, options?: {
129
+ fields?: Set<Path<InferSchema<Schema>>>;
130
+ superRefine?: (arg: InferSchema<Schema>, ctx: RefinementCtx<Schema>) => void | Promise<void>;
132
131
  }) => Promise<boolean>;
133
132
  };
134
- }>, {}, {}, "invalid" | "valid" | "reset" | "status" | "readonly" | "clear" | "submit" | "errors" | "tag" | "template" | "validate", import('vue').ComponentProvideOptions, true, {}, any>;
133
+ }>, {}, {}, "invalid" | "valid" | "reset" | "status" | "readonly" | "clear" | "validate" | "submit" | "errors" | "tag" | "template", import('vue').ComponentProvideOptions, true, {}, any>;
135
134
  };
@@ -1,6 +1,5 @@
1
1
  import { Component, ConcreteComponent, DeepReadonly, InjectionKey, PropType, Ref, SlotsType } from 'vue';
2
- import { z } from 'zod';
3
- import { FormFieldComponentOptions, FormSchema, InjectedFormData, InjectedFormFieldData, InjectedFormWrapperData, Path } from './types';
2
+ import { FormFieldComponentOptions, FormSchema, InjectedFormData, InjectedFormFieldData, InjectedFormWrapperData, Path, InferSchema, InferFormattedError } from './types';
4
3
  import { FormFieldType } from './enums';
5
4
  export declare function defineFormField<Schema extends FormSchema, Type = undefined>(formProvideKey: InjectionKey<InjectedFormData<Schema, Type>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldInjectionKey: InjectionKey<InjectedFormFieldData<Schema>>, options?: FormFieldComponentOptions): import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
5
  type: {
@@ -13,11 +12,11 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
13
12
  default: undefined;
14
13
  };
15
14
  name: {
16
- type: PropType<Path<z.infer<Schema>>>;
15
+ type: PropType<Path<InferSchema<Schema>>>;
17
16
  required: true;
18
17
  };
19
18
  props: {
20
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
19
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
21
20
  default: () => {};
22
21
  };
23
22
  showValid: {
@@ -25,7 +24,7 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
25
24
  default: boolean;
26
25
  };
27
26
  defaultValue: {
28
- type: (ObjectConstructor | ArrayConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
27
+ type: (ArrayConstructor | NumberConstructor | ObjectConstructor | BooleanConstructor | StringConstructor)[];
29
28
  default: undefined;
30
29
  };
31
30
  lazyLoad: {
@@ -45,10 +44,10 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
45
44
  } | ConcreteComponent>;
46
45
  hasProps: import('vue').ComputedRef<{
47
46
  name: {} | ([{
48
- type: PropType<Path<z.infer<Schema>>>;
47
+ type: PropType<Path<InferSchema<Schema>>>;
49
48
  required: true;
50
49
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
51
- type: PropType<Path<z.infer<Schema>>>;
50
+ type: PropType<Path<InferSchema<Schema>>>;
52
51
  required: true;
53
52
  });
54
53
  invalid: boolean;
@@ -71,11 +70,11 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
71
70
  default: undefined;
72
71
  };
73
72
  name: {
74
- type: PropType<Path<z.infer<Schema>>>;
73
+ type: PropType<Path<InferSchema<Schema>>>;
75
74
  required: true;
76
75
  };
77
76
  props: {
78
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
77
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
79
78
  default: () => {};
80
79
  };
81
80
  showValid: {
@@ -83,7 +82,7 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
83
82
  default: boolean;
84
83
  };
85
84
  defaultValue: {
86
- type: (ObjectConstructor | ArrayConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
85
+ type: (ArrayConstructor | NumberConstructor | ObjectConstructor | BooleanConstructor | StringConstructor)[];
87
86
  default: undefined;
88
87
  };
89
88
  lazyLoad: {
@@ -103,10 +102,10 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
103
102
  type: "number" | "text" | "email" | "password" | "tel" | "url" | "search" | "date" | "time" | "datetime-local" | "month" | "week" | "color" | "select" | "checkbox" | "radio" | "textarea" | "radioGroup" | "checkboxGroup" | "combobox" | "custom";
104
103
  readonly: boolean;
105
104
  props: [{
106
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
105
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
107
106
  default: () => {};
108
107
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
109
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
108
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
110
109
  default: () => {};
111
110
  };
112
111
  is: string | Component;
@@ -116,9 +115,9 @@ export declare function defineFormField<Schema extends FormSchema, Type = undefi
116
115
  }, SlotsType<{
117
116
  [key: string]: any;
118
117
  default: {
119
- errors: DeepReadonly<z.inferFormattedError<Schema>>;
120
- formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
121
- formErrors?: DeepReadonly<z.inferFormattedError<Schema, string>>;
118
+ errors: DeepReadonly<InferFormattedError<Schema>>;
119
+ formData?: undefined extends Type ? Partial<InferSchema<Schema>> : Type;
120
+ formErrors?: DeepReadonly<InferFormattedError<Schema>>;
122
121
  invalid: boolean;
123
122
  invalidLabel?: string[];
124
123
  modelValue: any;
@@ -1,17 +1,16 @@
1
1
  import { Component, DeepReadonly, InjectionKey, PropType, Ref, SlotsType } from 'vue';
2
- import { z } from 'zod';
3
- import { FormSchema, InjectedFormData, InjectedFormFieldsGroupData, InjectedFormWrapperData, Path } from './types';
2
+ import { FormSchema, InjectedFormData, InjectedFormFieldsGroupData, InjectedFormWrapperData, Path, InferSchema, InferFormattedError } from './types';
4
3
  export declare function defineFormFieldsGroup<Schema extends FormSchema, Type = undefined>(formProvideKey: InjectionKey<InjectedFormData<Schema, Type>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>, formFieldsGroupInjectionKey: InjectionKey<InjectedFormFieldsGroupData<Schema>>): import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
4
  is: {
6
5
  type: PropType<Component | string>;
7
6
  default: undefined;
8
7
  };
9
8
  names: {
10
- type: PropType<Path<z.infer<Schema>>[] | Record<string, Path<z.infer<Schema>>>>;
9
+ type: PropType<Path<InferSchema<Schema>>[] | Record<string, Path<InferSchema<Schema>>>>;
11
10
  required: true;
12
11
  };
13
12
  props: {
14
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
13
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
15
14
  default: () => {};
16
15
  };
17
16
  showValid: {
@@ -19,7 +18,7 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
19
18
  default: boolean;
20
19
  };
21
20
  defaultValues: {
22
- type: PropType<Record<Path<z.infer<Schema>>, any>>;
21
+ type: PropType<Record<Path<InferSchema<Schema>>, any>>;
23
22
  default: undefined;
24
23
  };
25
24
  readonly: {
@@ -48,11 +47,11 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
48
47
  default: undefined;
49
48
  };
50
49
  names: {
51
- type: PropType<Path<z.infer<Schema>>[] | Record<string, Path<z.infer<Schema>>>>;
50
+ type: PropType<Path<InferSchema<Schema>>[] | Record<string, Path<InferSchema<Schema>>>>;
52
51
  required: true;
53
52
  };
54
53
  props: {
55
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
54
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
56
55
  default: () => {};
57
56
  };
58
57
  showValid: {
@@ -60,7 +59,7 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
60
59
  default: boolean;
61
60
  };
62
61
  defaultValues: {
63
- type: PropType<Record<Path<z.infer<Schema>>, any>>;
62
+ type: PropType<Record<Path<InferSchema<Schema>>, any>>;
64
63
  default: undefined;
65
64
  };
66
65
  readonly: {
@@ -75,27 +74,27 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
75
74
  }>, {
76
75
  readonly: boolean;
77
76
  props: [{
78
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
77
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
79
78
  default: () => {};
80
79
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
81
- type: PropType<Partial<z.infer<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<z.infer<Schema>> | undefined)>>;
80
+ type: PropType<Partial<InferSchema<Schema> | undefined | ((formData?: Ref<ObjectConstructor>) => Partial<InferSchema<Schema>> | undefined)>>;
82
81
  default: () => {};
83
82
  };
84
83
  is: string | Component;
85
84
  showValid: boolean;
86
85
  defaultValues: [{
87
- type: PropType<Record<Path<z.infer<Schema>>, any>>;
86
+ type: PropType<Record<Path<InferSchema<Schema>>, any>>;
88
87
  default: undefined;
89
88
  }] extends [import('vue').Prop<infer V, infer D>] ? unknown extends V ? keyof V extends never ? import('@vue/shared').IfAny<V, V, D> : V : V : {
90
- type: PropType<Record<Path<z.infer<Schema>>, any>>;
89
+ type: PropType<Record<Path<InferSchema<Schema>>, any>>;
91
90
  default: undefined;
92
91
  };
93
92
  }, SlotsType<{
94
93
  [key: string]: any;
95
94
  default: {
96
- errors?: Record<Path<z.infer<Schema>>, z.inferFormattedError<Schema>>;
97
- formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
98
- formErrors?: DeepReadonly<z.inferFormattedError<Schema>>;
95
+ errors?: Record<Path<InferSchema<Schema>>, InferFormattedError<Schema>>;
96
+ formData?: undefined extends Type ? Partial<InferSchema<Schema>> : Type;
97
+ formErrors?: DeepReadonly<InferFormattedError<Schema>>;
99
98
  invalid: boolean;
100
99
  invalids: Record<string, boolean>;
101
100
  invalidLabels?: Record<string, string[]>;
@@ -1,6 +1,5 @@
1
1
  import { Component, DeepReadonly, InjectionKey, PropType, SlotsType, VNode } from 'vue';
2
- import { FormSchema, InjectedFormData, FormTemplate } from './types';
3
- import { z } from 'zod';
2
+ import { FormSchema, InjectedFormData, FormTemplate, InferFormattedError, InferSchema } from './types';
4
3
  import { FormStatus } from './enums';
5
4
  export declare function defineFormTemplate<Schema extends FormSchema, Type = undefined>(formProvideKey: InjectionKey<InjectedFormData<Schema, Type>>, VvFormField: Component): import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
5
  schema: {
@@ -28,8 +27,8 @@ export declare function defineFormTemplate<Schema extends FormSchema, Type = und
28
27
  scope: Record<string, unknown>;
29
28
  }, SlotsType<{
30
29
  default: {
31
- errors?: DeepReadonly<z.inferFormattedError<Schema>>;
32
- formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
30
+ errors?: DeepReadonly<InferFormattedError<Schema>>;
31
+ formData?: undefined extends Type ? Partial<InferSchema<Schema>> : Type;
33
32
  invalid: boolean;
34
33
  status?: FormStatus;
35
34
  submit?: InjectedFormData<Schema, Type>["submit"];
@@ -1,6 +1,5 @@
1
1
  import { DeepReadonly, InjectionKey, Ref, SlotsType } from 'vue';
2
- import { z } from 'zod';
3
- import { FormSchema, InjectedFormData, InjectedFormWrapperData, Path } from './types';
2
+ import { FormSchema, InjectedFormData, InjectedFormWrapperData, Path, InferFormattedError, InferSchema } from './types';
4
3
  export declare function defineFormWrapper<Schema extends FormSchema, Type = undefined>(formProvideKey: InjectionKey<InjectedFormData<Schema, Type>>, wrapperProvideKey: InjectionKey<InjectedFormWrapperData<Schema>>): import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
4
  name: {
6
5
  type: StringConstructor;
@@ -15,18 +14,18 @@ export declare function defineFormWrapper<Schema extends FormSchema, Type = unde
15
14
  default: boolean;
16
15
  };
17
16
  }>, {
18
- errors: Readonly<Ref<DeepReadonly<z.inferFormattedError<Schema, string>> | undefined, DeepReadonly<z.inferFormattedError<Schema, string>> | undefined>> | undefined;
19
- fields: Ref<Map<string, Path<z.TypeOf<Schema>>>, Map<string, Path<z.TypeOf<Schema>>>>;
20
- fieldsErrors: Ref<Map<string, z.inferFormattedError<Schema, string>>, Map<string, z.inferFormattedError<Schema, string>>>;
21
- formData: Ref<(undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined> | undefined;
17
+ errors: Readonly<Ref<DeepReadonly<InferFormattedError<Schema>> | undefined, DeepReadonly<InferFormattedError<Schema>> | undefined>> | undefined;
18
+ fields: Ref<Map<string, Path<InferSchema<Schema>>>, Map<string, Path<InferSchema<Schema>>>>;
19
+ fieldsErrors: Ref<Map<string, InferFormattedError<Schema>>, Map<string, InferFormattedError<Schema>>>;
20
+ formData: Ref<(undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined> | undefined;
22
21
  invalid: import('vue').ComputedRef<boolean>;
23
22
  readonly: import('vue').ComputedRef<boolean>;
24
23
  clear: (() => void) | undefined;
25
24
  reset: (() => void) | undefined;
26
25
  submit: (() => Promise<boolean>) | undefined;
27
- validate: ((formData?: (undefined extends Type ? Partial<z.TypeOf<Schema>> : Type) | undefined, options?: {
28
- fields?: Set<Path<z.TypeOf<Schema>>> | undefined;
29
- superRefine?: ((arg: z.TypeOf<Schema>, ctx: z.RefinementCtx) => void | Promise<void>) | undefined;
26
+ validate: ((formData?: (undefined extends Type ? Partial<InferSchema<Schema>> : Type) | undefined, options?: {
27
+ fields?: Set<Path<InferSchema<Schema>>> | undefined;
28
+ superRefine?: ((arg: InferSchema<Schema>, ctx: import('./types').RefinementCtx<Schema>) => void | Promise<void>) | undefined;
30
29
  } | undefined) => Promise<boolean>) | undefined;
31
30
  validateWrapper: () => Promise<boolean>;
32
31
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("invalid" | "valid")[], "invalid" | "valid", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
@@ -50,10 +49,10 @@ export declare function defineFormWrapper<Schema extends FormSchema, Type = unde
50
49
  tag: string;
51
50
  }, SlotsType<{
52
51
  default: {
53
- errors?: DeepReadonly<z.inferFormattedError<Schema>>;
54
- fieldsErrors: Map<string, z.inferFormattedError<Schema>>;
55
- formData?: undefined extends Type ? Partial<z.infer<Schema>> : Type;
56
- formErrors?: DeepReadonly<z.inferFormattedError<Schema>>;
52
+ errors?: DeepReadonly<InferFormattedError<Schema>>;
53
+ fieldsErrors: Map<string, InferFormattedError<Schema>>;
54
+ formData?: undefined extends Type ? Partial<InferSchema<Schema>> : Type;
55
+ formErrors?: DeepReadonly<InferFormattedError<Schema>>;
57
56
  invalid: boolean;
58
57
  readonly: boolean;
59
58
  clear?: InjectedFormData<Schema, Type>["clear"];
@@ -62,4 +61,4 @@ export declare function defineFormWrapper<Schema extends FormSchema, Type = unde
62
61
  validate?: InjectedFormData<Schema, Type>["validate"];
63
62
  validateWrapper?: () => Promise<boolean>;
64
63
  };
65
- }>, {}, {}, "invalid" | "reset" | "readonly" | "clear" | "submit" | "errors" | "tag" | "validate" | "formData" | "fields" | "fieldsErrors" | "validateWrapper", import('vue').ComponentProvideOptions, true, {}, any>;
64
+ }>, {}, {}, "invalid" | "reset" | "readonly" | "clear" | "validate" | "submit" | "errors" | "tag" | "formData" | "fields" | "fieldsErrors" | "validateWrapper", import('vue').ComponentProvideOptions, true, {}, any>;