@teamnovu/kit-vue-forms 0.0.4 → 0.0.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.
@@ -0,0 +1,36 @@
1
+ import { Form } from '../types/form.ts';
2
+ import { Paths, PickProps } from '../types/util.ts';
3
+ import { UseFieldOptions } from '../composables/useField.ts';
4
+ import { VNodeProps, AllowedComponentProps, ComponentCustomProps, PublicProps, ShallowUnwrapRef, Ref, VNode } from 'vue';
5
+ import { ValidationErrors, ErrorMessage } from '../index.js';
6
+ export interface FieldProps<TPath extends string, TData extends object> extends UseFieldOptions<PickProps<TData, TPath>, TPath> {
7
+ form: Form<TData>;
8
+ }
9
+ declare const _default: <TPath extends Paths<TData>, TData extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
10
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>, never> & FieldProps<TPath, TData> & Partial<{}>> & PublicProps;
11
+ expose(exposed: ShallowUnwrapRef<{}>): void;
12
+ attrs: any;
13
+ slots: {
14
+ default?(_: {
15
+ data: Ref<PickProps<TData, TPath>, PickProps<TData, TPath>>;
16
+ path: Ref<TPath, TPath>;
17
+ initialValue: Readonly< Ref<PickProps<TData, TPath>, PickProps<TData, TPath>>>;
18
+ errors: Ref<ValidationErrors>;
19
+ touched: Ref<boolean>;
20
+ dirty: Ref<boolean>;
21
+ setData: (newData: PickProps<TData, TPath>) => void;
22
+ onBlur: () => void;
23
+ onFocus: () => void;
24
+ reset: () => void;
25
+ setErrors: (newErrors: ErrorMessage[]) => void;
26
+ clearErrors: () => void;
27
+ }): any;
28
+ };
29
+ emit: {};
30
+ }>) => VNode & {
31
+ __ctx?: Awaited<typeof __VLS_setup>;
32
+ };
33
+ export default _default;
34
+ type __VLS_PrettifyLocal<T> = {
35
+ [K in keyof T]: T[K];
36
+ } & {};
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export type { ValidationStrategy, ValidationErrorMessage as ErrorMessage, Valida
6
6
  export type { DeepPartial } from './utils/type-helpers';
7
7
  export type { Form, FormField } from './types/form';
8
8
  export type { SplitPath, Paths, PickProps } from './types/util';
9
+ export { default as Field } from './components/Field.vue';
package/dist/index.mjs CHANGED
@@ -1,69 +1,69 @@
1
- var W = Object.defineProperty;
2
- var $ = (t, r, e) => r in t ? W(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
- var R = (t, r, e) => $(t, typeof r != "symbol" ? r + "" : r, e);
4
- import { toValue as I, toRaw as J, computed as d, unref as c, reactive as j, watch as E, toRefs as P, toRef as D, ref as A, isRef as N, getCurrentScope as T, onBeforeUnmount as B } from "vue";
1
+ var q = Object.defineProperty;
2
+ var x = (e, r, t) => r in e ? q(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var R = (e, r, t) => x(e, typeof r != "symbol" ? r + "" : r, t);
4
+ import { toValue as K, toRaw as W, computed as d, unref as c, reactive as b, watch as F, toRefs as O, toRef as S, ref as A, isRef as _, getCurrentScope as I, onBeforeUnmount as J, defineComponent as T, renderSlot as B, normalizeProps as G, guardReactiveProps as L } from "vue";
5
5
  import "zod";
6
- function y(t) {
7
- const r = I(t), e = J(r);
8
- return structuredClone(e);
6
+ function y(e) {
7
+ const r = K(e), t = W(r);
8
+ return structuredClone(t);
9
9
  }
10
- function M(t) {
11
- return t === "" ? [] : t.split(/\s*\.\s*/).filter(Boolean);
10
+ function N(e) {
11
+ return e === "" ? [] : e.split(/\s*\.\s*/).filter(Boolean);
12
12
  }
13
- function m(t, r) {
14
- return (Array.isArray(r) ? r : M(r)).reduce(
13
+ function m(e, r) {
14
+ return (Array.isArray(r) ? r : N(r)).reduce(
15
15
  (a, s) => a == null ? void 0 : a[s],
16
- t
16
+ e
17
17
  );
18
18
  }
19
- function G(t, r, e) {
20
- const a = Array.isArray(r) ? r : M(r);
19
+ function U(e, r, t) {
20
+ const a = Array.isArray(r) ? r : N(r);
21
21
  if (a.length === 0)
22
22
  throw new Error("Path cannot be empty");
23
23
  const s = a.at(-1), n = a.slice(0, -1).reduce(
24
24
  (u, v) => u[v],
25
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- t
26
+ e
27
27
  );
28
- n[s] = e;
28
+ n[s] = t;
29
29
  }
30
- const x = (t, r) => d({
30
+ const z = (e, r) => d({
31
31
  get() {
32
- return m(c(t), c(r));
32
+ return m(c(e), c(r));
33
33
  },
34
- set(e) {
35
- G(c(t), c(r), e);
34
+ set(t) {
35
+ U(c(e), c(r), t);
36
36
  }
37
37
  });
38
- function F(t, r) {
39
- return !t && !r ? "" : !t && r ? r : !r && t ? t : `${t}.${r}`;
38
+ function E(e, r) {
39
+ return !e && !r ? "" : !e && r ? r : !r && e ? e : `${e}.${r}`;
40
40
  }
41
- function L(t, r) {
41
+ function Z(e, r) {
42
42
  if (!r)
43
- return t;
44
- const e = `${r}.`, a = Object.fromEntries(
45
- Object.entries(t.propertyErrors).filter(([s]) => s.startsWith(e)).map(
46
- ([s, n]) => [s.slice(e.length), n]
43
+ return e;
44
+ const t = `${r}.`, a = Object.fromEntries(
45
+ Object.entries(e.propertyErrors).filter(([s]) => s.startsWith(t)).map(
46
+ ([s, n]) => [s.slice(t.length), n]
47
47
  )
48
48
  );
49
49
  return {
50
- general: t.general,
50
+ general: e.general,
51
51
  // Keep general errors
52
52
  propertyErrors: a
53
53
  };
54
54
  }
55
- function U(t) {
56
- const r = j({
57
- value: t.value,
58
- path: t.path,
59
- initialValue: d(() => Object.freeze(y(t.initialValue))),
60
- errors: c(t.errors) || [],
55
+ function k(e) {
56
+ const r = b({
57
+ value: e.value,
58
+ path: e.path,
59
+ initialValue: d(() => Object.freeze(y(e.initialValue))),
60
+ errors: c(e.errors) || [],
61
61
  touched: !1
62
62
  });
63
- E(() => c(t.errors), (f) => {
63
+ F(() => c(e.errors), (f) => {
64
64
  r.errors = f || [];
65
65
  });
66
- const e = d(() => JSON.stringify(r.value) !== JSON.stringify(r.initialValue)), a = (f) => {
66
+ const t = d(() => JSON.stringify(r.value) !== JSON.stringify(r.initialValue)), a = (f) => {
67
67
  r.value = f;
68
68
  }, s = () => {
69
69
  r.touched = !0;
@@ -74,14 +74,14 @@ function U(t) {
74
74
  r.errors = f;
75
75
  }, o = () => {
76
76
  r.errors = [];
77
- }, l = P(r);
77
+ }, l = O(r);
78
78
  return {
79
79
  data: l.value,
80
80
  path: l.path,
81
81
  initialValue: l.initialValue,
82
82
  errors: l.errors,
83
83
  touched: l.touched,
84
- dirty: e,
84
+ dirty: t,
85
85
  setData: a,
86
86
  onBlur: s,
87
87
  onFocus: n,
@@ -90,8 +90,8 @@ function U(t) {
90
90
  clearErrors: o
91
91
  };
92
92
  }
93
- function Z(t) {
94
- const r = {}, e = (u) => {
93
+ function H(e) {
94
+ const r = {}, t = (u) => {
95
95
  const v = c(u.path);
96
96
  r[v] = u;
97
97
  };
@@ -99,73 +99,73 @@ function Z(t) {
99
99
  fields: r,
100
100
  getField: (u) => r[u],
101
101
  getFields: () => Object.values(r),
102
- registerField: e,
102
+ registerField: t,
103
103
  defineField: (u) => {
104
- const v = U({
104
+ const v = k({
105
105
  ...u,
106
- value: x(D(t, "data"), u.path),
107
- initialValue: d(() => m(t.initialData, c(u.path)))
106
+ value: z(S(e, "data"), u.path),
107
+ initialValue: d(() => m(e.initialData, c(u.path)))
108
108
  });
109
- return e(v), v;
109
+ return t(v), v;
110
110
  }
111
111
  };
112
112
  }
113
- function _(t) {
114
- const r = d(() => t.getFields().some((a) => c(a.dirty))), e = d(() => t.getFields().some((a) => c(a.touched)));
113
+ function Q(e) {
114
+ const r = d(() => e.getFields().some((a) => c(a.dirty))), t = d(() => e.getFields().some((a) => c(a.touched)));
115
115
  return {
116
116
  isDirty: r,
117
- isTouched: e
117
+ isTouched: t
118
118
  };
119
119
  }
120
- function k(t) {
121
- return t.filter(
122
- (r, e, a) => a.indexOf(r) === e
120
+ function X(e) {
121
+ return e.filter(
122
+ (r, t, a) => a.indexOf(r) === t
123
123
  );
124
124
  }
125
- function z(...t) {
126
- return t.slice(1).reduce((r, e) => {
127
- if (!r && !e)
125
+ function C(...e) {
126
+ return e.slice(1).reduce((r, t) => {
127
+ if (!r && !t)
128
128
  return;
129
- const a = ((e == null ? void 0 : e.length) ?? 0) > 0;
130
- if (!r && ((e == null ? void 0 : e.length) ?? 0) > 0)
131
- return e;
129
+ const a = ((t == null ? void 0 : t.length) ?? 0) > 0;
130
+ if (!r && ((t == null ? void 0 : t.length) ?? 0) > 0)
131
+ return t;
132
132
  if (!a)
133
133
  return r;
134
- const s = (r ?? []).concat(e);
135
- return k(s);
136
- }, t[0]);
134
+ const s = (r ?? []).concat(t);
135
+ return X(s);
136
+ }, e[0]);
137
137
  }
138
- function q(...t) {
139
- return t.map((e) => Object.keys(e)).flat().reduce((e, a) => {
140
- const s = t.map((n) => n[a]).filter(Boolean);
138
+ function Y(...e) {
139
+ return e.map((t) => Object.keys(t)).flat().reduce((t, a) => {
140
+ const s = e.map((n) => n[a]).filter(Boolean);
141
141
  return {
142
- ...e,
143
- [a]: z(...s)
142
+ ...t,
143
+ [a]: C(...s)
144
144
  };
145
145
  }, {});
146
146
  }
147
- function S(...t) {
148
- if (!t.length)
147
+ function D(...e) {
148
+ if (!e.length)
149
149
  return {
150
150
  general: [],
151
151
  propertyErrors: {}
152
152
  };
153
- const r = t[0];
154
- return t.length === 1 ? r : t.slice(1).reduce(
155
- (e, a) => ({
156
- general: z(e.general, a.general),
157
- propertyErrors: q(e.propertyErrors ?? {}, a.propertyErrors ?? {})
153
+ const r = e[0];
154
+ return e.length === 1 ? r : e.slice(1).reduce(
155
+ (t, a) => ({
156
+ general: C(t.general, a.general),
157
+ propertyErrors: Y(t.propertyErrors ?? {}, a.propertyErrors ?? {})
158
158
  }),
159
159
  r
160
160
  );
161
161
  }
162
- function O(t) {
162
+ function j(e) {
163
163
  var a;
164
- const r = (((a = t.general) == null ? void 0 : a.length) ?? 0) > 0, e = Object.entries(t.propertyErrors).filter(([, s]) => s == null ? void 0 : s.length).length > 0;
165
- return r || e;
164
+ const r = (((a = e.general) == null ? void 0 : a.length) ?? 0) > 0, t = Object.entries(e.propertyErrors).filter(([, s]) => s == null ? void 0 : s.length).length > 0;
165
+ return r || t;
166
166
  }
167
- function H(t) {
168
- const r = t.issues.filter((a) => a.path.length === 0).map((a) => a.message), e = t.issues.filter((a) => a.path.length > 0).reduce((a, s) => {
167
+ function rr(e) {
168
+ const r = e.issues.filter((a) => a.path.length === 0).map((a) => a.message), t = e.issues.filter((a) => a.path.length > 0).reduce((a, s) => {
169
169
  const n = s.path.join(".");
170
170
  return {
171
171
  ...a,
@@ -174,27 +174,27 @@ function H(t) {
174
174
  }, {});
175
175
  return {
176
176
  general: r,
177
- propertyErrors: e
177
+ propertyErrors: t
178
178
  };
179
179
  }
180
- const p = {
180
+ const V = {
181
181
  isValid: !0,
182
182
  errors: {
183
183
  general: [],
184
184
  propertyErrors: {}
185
185
  }
186
186
  };
187
- class Q {
187
+ class er {
188
188
  constructor(r) {
189
189
  this.schema = r;
190
190
  }
191
191
  async validate(r) {
192
192
  if (!this.schema)
193
- return p;
194
- const e = await this.schema.safeParseAsync(r);
195
- if (e.success)
196
- return p;
197
- const a = H(e.error);
193
+ return V;
194
+ const t = await this.schema.safeParseAsync(r);
195
+ if (t.success)
196
+ return V;
197
+ const a = rr(t.error);
198
198
  return {
199
199
  isValid: !1,
200
200
  errors: {
@@ -204,89 +204,89 @@ class Q {
204
204
  };
205
205
  }
206
206
  }
207
- class X {
207
+ class tr {
208
208
  constructor(r) {
209
209
  this.validateFn = r;
210
210
  }
211
211
  async validate(r) {
212
212
  if (!this.validateFn)
213
- return p;
213
+ return V;
214
214
  try {
215
- const e = await this.validateFn(r);
216
- return e.isValid ? p : e;
217
- } catch (e) {
215
+ const t = await this.validateFn(r);
216
+ return t.isValid ? V : t;
217
+ } catch (t) {
218
218
  return {
219
219
  isValid: !1,
220
220
  errors: {
221
- general: [e.message || "Validation error"],
221
+ general: [t.message || "Validation error"],
222
222
  propertyErrors: {}
223
223
  }
224
224
  };
225
225
  }
226
226
  }
227
227
  }
228
- class Y {
229
- constructor(r, e) {
228
+ class ar {
229
+ constructor(r, t) {
230
230
  R(this, "schemaValidator");
231
231
  R(this, "functionValidator");
232
- this.schema = r, this.validateFn = e, this.schemaValidator = new Q(this.schema), this.functionValidator = new X(this.validateFn);
232
+ this.schema = r, this.validateFn = t, this.schemaValidator = new er(this.schema), this.functionValidator = new tr(this.validateFn);
233
233
  }
234
234
  async validate(r) {
235
- const [e, a] = await Promise.all([
235
+ const [t, a] = await Promise.all([
236
236
  this.schemaValidator.validate(r),
237
237
  this.functionValidator.validate(r)
238
238
  ]);
239
239
  return {
240
- isValid: e.isValid && a.isValid,
241
- errors: S(e.errors, a.errors)
240
+ isValid: t.isValid && a.isValid,
241
+ errors: D(t.errors, a.errors)
242
242
  };
243
243
  }
244
244
  }
245
- function b(t) {
246
- return d(() => new Y(
247
- c(t.schema),
248
- c(t.validateFn)
245
+ function P(e) {
246
+ return d(() => new ar(
247
+ c(e.schema),
248
+ c(e.validateFn)
249
249
  ));
250
250
  }
251
- function rr(t, r) {
252
- const e = j({
253
- validators: A([b(r)]),
251
+ function sr(e, r) {
252
+ const t = b({
253
+ validators: A([P(r)]),
254
254
  isValidated: !1,
255
- errors: c(r.errors) ?? p.errors
255
+ errors: c(r.errors) ?? V.errors
256
256
  });
257
- E(() => c(r.errors), async () => {
257
+ F(() => c(r.errors), async () => {
258
258
  const o = await s();
259
259
  n(o.errors);
260
- }, { immediate: !0 }), E(
261
- [() => e.validators],
260
+ }, { immediate: !0 }), F(
261
+ [() => t.validators],
262
262
  async (o) => {
263
- if (e.isValidated)
263
+ if (t.isValidated)
264
264
  if (o) {
265
265
  const l = await s();
266
- e.errors = l.errors;
266
+ t.errors = l.errors;
267
267
  } else
268
- e.errors = p.errors;
268
+ t.errors = V.errors;
269
269
  },
270
270
  { immediate: !0 }
271
- ), E(() => t.data, () => {
272
- e.isValidated && u();
271
+ ), F(() => e.data, () => {
272
+ t.isValidated && u();
273
273
  });
274
274
  const a = (o) => {
275
- const l = N(o) ? o : b(o);
276
- return e.validators.push(l), T() && B(() => {
277
- e.validators = e.validators.filter(
275
+ const l = _(o) ? o : P(o);
276
+ return t.validators.push(l), I() && J(() => {
277
+ t.validators = t.validators.filter(
278
278
  (f) => f !== l
279
279
  );
280
280
  }), l;
281
281
  };
282
282
  async function s() {
283
283
  const o = await Promise.all(
284
- e.validators.filter((V) => c(V) !== void 0).map((V) => c(V).validate(t.data))
285
- ), l = o.every((V) => V.isValid);
286
- let { errors: f } = p;
284
+ t.validators.filter((p) => c(p) !== void 0).map((p) => c(p).validate(e.data))
285
+ ), l = o.every((p) => p.isValid);
286
+ let { errors: f } = V;
287
287
  if (!l) {
288
- const V = o.map((w) => w.errors);
289
- f = S(...V);
288
+ const p = o.map((w) => w.errors);
289
+ f = D(...p);
290
290
  }
291
291
  return {
292
292
  errors: f,
@@ -294,37 +294,37 @@ function rr(t, r) {
294
294
  };
295
295
  }
296
296
  const n = (o) => {
297
- e.errors = S(c(r.errors) ?? p.errors, o);
297
+ t.errors = D(c(r.errors) ?? V.errors, o);
298
298
  }, u = async () => {
299
299
  const o = await s();
300
- return n(o.errors), e.isValidated = !0, {
301
- isValid: !O(o.errors),
302
- errors: e.errors
300
+ return n(o.errors), t.isValidated = !0, {
301
+ isValid: !j(o.errors),
302
+ errors: t.errors
303
303
  };
304
- }, v = d(() => !O(e.errors));
304
+ }, v = d(() => !j(t.errors));
305
305
  return {
306
- ...P(e),
306
+ ...O(t),
307
307
  validateForm: u,
308
308
  defineValidator: a,
309
309
  isValid: v
310
310
  };
311
311
  }
312
- class tr {
313
- constructor(r, e) {
314
- this.path = r, this.validator = e;
312
+ class ir {
313
+ constructor(r, t) {
314
+ this.path = r, this.validator = t;
315
315
  }
316
316
  async validate(r) {
317
- const e = m(r, this.path);
317
+ const t = m(r, this.path);
318
318
  if (!this.validator)
319
- return p;
320
- const a = await this.validator.validate(e);
319
+ return V;
320
+ const a = await this.validator.validate(t);
321
321
  return {
322
322
  isValid: a.isValid,
323
323
  errors: {
324
324
  general: a.errors.general || [],
325
325
  propertyErrors: a.errors.propertyErrors ? Object.fromEntries(
326
326
  Object.entries(a.errors.propertyErrors).map(([s, n]) => [
327
- F(this.path, s),
327
+ E(this.path, s),
328
328
  n
329
329
  ])
330
330
  ) : {}
@@ -332,30 +332,30 @@ class tr {
332
332
  };
333
333
  }
334
334
  }
335
- function er(t, r, e) {
336
- const a = x(t.data, r), s = d(() => m(t.initialData.value, r)), n = (i) => ({
335
+ function nr(e, r, t) {
336
+ const a = z(e.data, r), s = d(() => m(e.initialData.value, r)), n = (i) => ({
337
337
  ...i,
338
338
  path: d(() => c(i.path).replace(r + ".", "")),
339
339
  setData: (h) => {
340
340
  i.setData(h);
341
341
  }
342
342
  }), u = (i) => {
343
- const h = F(r, i), g = t.getField(h);
343
+ const h = E(r, i), g = e.getField(h);
344
344
  if (g)
345
345
  return n(g);
346
346
  }, v = (i) => {
347
- const h = F(r, i.path), g = t.defineField({
347
+ const h = E(r, i.path), g = e.defineField({
348
348
  ...i,
349
349
  path: h
350
350
  });
351
351
  return n(g);
352
- }, o = () => t.getFields().filter((i) => {
352
+ }, o = () => e.getFields().filter((i) => {
353
353
  const h = i.path.value;
354
354
  return h.startsWith(r + ".") || h === r;
355
- }).map((i) => n(i)), l = () => t.getFields().filter((i) => {
355
+ }).map((i) => n(i)), l = () => e.getFields().filter((i) => {
356
356
  const h = i.path.value;
357
357
  return h.startsWith(r + ".") || h === r;
358
- }), f = d(() => l().some((i) => i.dirty.value)), V = d(() => l().some((i) => i.touched.value)), w = d(() => t.isValid.value), C = d(() => t.isValidated.value), K = d(() => L(c(t.errors), r));
358
+ }), f = d(() => l().some((i) => i.dirty.value)), p = d(() => l().some((i) => i.touched.value)), w = d(() => e.isValid.value), M = d(() => e.isValidated.value), $ = d(() => Z(c(e.errors), r));
359
359
  return {
360
360
  data: a,
361
361
  initialData: s,
@@ -363,36 +363,36 @@ function er(t, r, e) {
363
363
  getField: u,
364
364
  getFields: o,
365
365
  isDirty: f,
366
- isTouched: V,
366
+ isTouched: p,
367
367
  isValid: w,
368
- isValidated: C,
369
- errors: K,
368
+ isValidated: M,
369
+ errors: $,
370
370
  defineValidator: (i) => {
371
- const h = N(i) ? i : b(i), g = d(
372
- () => new tr(r, c(h))
371
+ const h = _(i) ? i : P(i), g = d(
372
+ () => new ir(r, c(h))
373
373
  );
374
- return t.defineValidator(g), h;
374
+ return e.defineValidator(g), h;
375
375
  },
376
376
  reset: () => l().forEach((i) => i.reset()),
377
- validateForm: () => t.validateForm(),
377
+ validateForm: () => e.validateForm(),
378
378
  getSubForm: (i, h) => {
379
- const g = F(r, i);
380
- return t.getSubForm(
379
+ const g = E(r, i);
380
+ return e.getSubForm(
381
381
  g,
382
382
  h
383
383
  );
384
384
  }
385
385
  };
386
386
  }
387
- function ur(t) {
388
- const r = d(() => Object.freeze(y(t.initialData))), e = A(y(r)), a = j({
387
+ function vr(e) {
388
+ const r = d(() => Object.freeze(y(e.initialData))), t = A(y(r)), a = b({
389
389
  initialData: r,
390
- data: e
391
- }), s = Z(a), n = rr(a, t), u = _(s), v = () => {
392
- e.value = y(r), s.getFields().forEach((f) => f.reset());
390
+ data: t
391
+ }), s = H(a), n = sr(a, e), u = Q(s), v = () => {
392
+ t.value = y(r), s.getFields().forEach((f) => f.reset());
393
393
  };
394
- function o(f, V) {
395
- return er(l, f);
394
+ function o(f, p) {
395
+ return nr(l, f);
396
396
  }
397
397
  const l = {
398
398
  ...s,
@@ -400,12 +400,32 @@ function ur(t) {
400
400
  ...u,
401
401
  reset: v,
402
402
  getSubForm: o,
403
- initialData: D(a, "initialData"),
404
- data: D(a, "data")
403
+ initialData: S(a, "initialData"),
404
+ data: S(a, "data")
405
405
  };
406
406
  return l;
407
407
  }
408
+ const pr = /* @__PURE__ */ T({
409
+ __name: "Field",
410
+ props: {
411
+ form: {},
412
+ value: {},
413
+ initialValue: {},
414
+ type: {},
415
+ required: {},
416
+ path: {},
417
+ errors: {}
418
+ },
419
+ setup(e) {
420
+ const r = e, t = r.form.defineField({
421
+ path: r.path,
422
+ required: r.required
423
+ });
424
+ return (a, s) => B(a.$slots, "default", G(L(c(t))));
425
+ }
426
+ });
408
427
  export {
409
- U as useField,
410
- ur as useForm
428
+ pr as Field,
429
+ k as useField,
430
+ vr as useForm
411
431
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-vue-forms",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {
package/src/index.ts CHANGED
@@ -12,3 +12,5 @@ export type { DeepPartial } from './utils/type-helpers'
12
12
 
13
13
  export type { Form, FormField } from './types/form'
14
14
  export type { SplitPath, Paths, PickProps } from './types/util'
15
+
16
+ export { default as Field } from './components/Field.vue'