@harnessio/forms 0.10.0 → 0.10.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/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- var Ie = Object.defineProperty;
2
- var Ce = (r, e, n) => e in r ? Ie(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var N = (r, e, n) => Ce(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { isEmpty as k, set as b, get as v, forOwn as me, isArray as C, isObject as he, merge as D, isUndefined as B, cloneDeep as H, unset as pe, pick as we, isNull as ye, omitBy as ge, isNil as je, isString as Oe, capitalize as Ve } from "lodash-es";
5
- import xe, { createContext as Fe, useContext as Pe, Component as qe, memo as ke, useMemo as M, useRef as $, useEffect as F, useCallback as Ae, forwardRef as Ne, Fragment as De } from "react";
6
- import { useFormContext as Me, get as $e, useForm as Ze, FormProvider as Be, appendErrors as We, useController as Je } from "react-hook-form";
7
- import { Controller as Wr, Form as Jr, FormProvider as Ur, get as Lr, set as Hr, useFieldArray as Kr, useForm as Gr, useFormContext as Qr, useFormState as Xr, useWatch as Yr } from "react-hook-form";
1
+ var Ce = Object.defineProperty;
2
+ var Ie = (r, e, n) => e in r ? Ce(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var D = (r, e, n) => Ie(r, typeof e != "symbol" ? e + "" : e, n);
4
+ import { isEmpty as k, set as E, get as T, forOwn as me, isArray as V, isObject as he, merge as M, isUndefined as B, cloneDeep as H, unset as pe, pick as we, isNull as ye, omitBy as ge, isNil as je, isString as Oe, capitalize as Ve } from "lodash-es";
5
+ import xe, { createContext as Fe, useContext as Pe, Component as qe, memo as Ae, useMemo as $, useRef as O, useEffect as C, useCallback as ke, forwardRef as Ne, Fragment as De } from "react";
6
+ import { useFormContext as Me, get as $e, useForm as Ze, FormProvider as Be, appendErrors as We, useController as Ue } from "react-hook-form";
7
+ import { Controller as Wr, Form as Ur, FormProvider as Jr, get as Lr, set as Hr, useFieldArray as Kr, useForm as Gr, useFormContext as Qr, useFormState as Xr, useWatch as Yr } from "react-hook-form";
8
8
  import * as d from "zod";
9
- import { toNestErrors as Ue } from "@hookform/resolvers";
9
+ import { toNestErrors as Je } from "@hookform/resolvers";
10
10
  class Le extends Error {
11
11
  constructor(e) {
12
12
  super(`Input component '${e}' is already registered.`);
@@ -14,8 +14,8 @@ class Le extends Error {
14
14
  }
15
15
  class be {
16
16
  constructor(e) {
17
- N(this, "componentBank");
18
- N(this, "allowOverride");
17
+ D(this, "componentBank");
18
+ D(this, "allowOverride");
19
19
  this.allowOverride = (e == null ? void 0 : e.allowOverride) ?? !1, this.componentBank = /* @__PURE__ */ new Map();
20
20
  }
21
21
  /**
@@ -55,15 +55,15 @@ class be {
55
55
  }), e;
56
56
  }
57
57
  }
58
- var W = { exports: {} }, I = {};
58
+ var W = { exports: {} }, j = {};
59
59
  /*
60
60
  object-assign
61
61
  (c) Sindre Sorhus
62
62
  @license MIT
63
63
  */
64
- var J, oe;
64
+ var U, oe;
65
65
  function He() {
66
- if (oe) return J;
66
+ if (oe) return U;
67
67
  oe = 1;
68
68
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
69
69
  function t(s) {
@@ -93,7 +93,7 @@ function He() {
93
93
  return !1;
94
94
  }
95
95
  }
96
- return J = a() ? Object.assign : function(s, o) {
96
+ return U = a() ? Object.assign : function(s, o) {
97
97
  for (var u, i = t(s), c, f = 1; f < arguments.length; f++) {
98
98
  u = Object(arguments[f]);
99
99
  for (var m in u)
@@ -105,7 +105,7 @@ function He() {
105
105
  }
106
106
  }
107
107
  return i;
108
- }, J;
108
+ }, U;
109
109
  }
110
110
  /** @license React v17.0.2
111
111
  * react-jsx-runtime.production.min.js
@@ -117,12 +117,12 @@ function He() {
117
117
  */
118
118
  var ue;
119
119
  function Ke() {
120
- if (ue) return I;
120
+ if (ue) return j;
121
121
  ue = 1, He();
122
122
  var r = xe, e = 60103;
123
- if (I.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
123
+ if (j.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
124
124
  var n = Symbol.for;
125
- e = n("react.element"), I.Fragment = n("react.fragment");
125
+ e = n("react.element"), j.Fragment = n("react.fragment");
126
126
  }
127
127
  var t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
128
128
  function o(u, i, c) {
@@ -132,7 +132,7 @@ function Ke() {
132
132
  if (u && u.defaultProps) for (f in i = u.defaultProps, i) m[f] === void 0 && (m[f] = i[f]);
133
133
  return { $$typeof: e, type: u, key: l, ref: h, props: m, _owner: t.current };
134
134
  }
135
- return I.jsx = o, I.jsxs = o, I;
135
+ return j.jsx = o, j.jsxs = o, j;
136
136
  }
137
137
  var ie;
138
138
  function Ge() {
@@ -165,7 +165,7 @@ function Xe() {
165
165
  class Ye extends qe {
166
166
  constructor() {
167
167
  super(...arguments);
168
- N(this, "state", {
168
+ D(this, "state", {
169
169
  hasError: !1
170
170
  });
171
171
  }
@@ -187,7 +187,7 @@ class Ye extends qe {
187
187
  const ce = ({
188
188
  children: r,
189
189
  withoutWrapper: e = !1
190
- }) => e || !r ? r : /* @__PURE__ */ p.jsx("div", { children: r }), ze = ke(function({
190
+ }) => e || !r ? r : /* @__PURE__ */ p.jsx("div", { children: r }), ze = Ae(function({
191
191
  path: e,
192
192
  factory: n,
193
193
  onUpdate: t,
@@ -197,19 +197,19 @@ const ce = ({
197
197
  withoutWrapper: u = !1
198
198
  }) {
199
199
  var Y, z, ee, re, te;
200
- const i = Me(), { formState: c } = i, { fixedValues: f = {} } = {}, { metadata: m, readonly: l, inputErrorHandler: h } = Xe(), y = n == null ? void 0 : n.getComponent(o.inputType), g = !!(o.isVisible || typeof o.disabled == "function" || typeof ((Y = o.validation) == null ? void 0 : Y.schema) == "function" || typeof ((z = o.warning) == null ? void 0 : z.schema) == "function"), w = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), T = g ? i.watch() : {}, j = w ? g ? $e(T, o.path) : i.watch(o.path) : void 0, _ = M(() => {
201
- if (!g) return {};
202
- let V = T;
203
- return f && Object.keys(f).forEach((A) => {
204
- const x = f[A];
205
- V = b(V, A, x);
206
- }), V;
207
- }, [g, T, f]), E = !o.isVisible || o.isVisible(_, m), R = l || o.readonly, S = typeof o.disabled == "function" ? o.disabled(_, m) : o.disabled, O = (te = o.warning) == null ? void 0 : te.schema, Q = M(() => {
200
+ const i = Me(), { formState: c } = i, { fixedValues: f = {} } = {}, { metadata: m, readonly: l, inputErrorHandler: h } = Xe(), g = n == null ? void 0 : n.getComponent(o.inputType), b = !!(o.isVisible || typeof o.disabled == "function" || typeof ((Y = o.validation) == null ? void 0 : Y.schema) == "function" || typeof ((z = o.warning) == null ? void 0 : z.schema) == "function"), R = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), v = b ? i.watch() : {}, I = R ? b ? $e(v, o.path) : i.watch(o.path) : void 0, w = $(() => {
201
+ if (!b) return {};
202
+ let F = v;
203
+ return f && Object.keys(f).forEach((N) => {
204
+ const P = f[N];
205
+ F = E(F, N, P);
206
+ }), F;
207
+ }, [b, v, f]), y = !o.isVisible || o.isVisible(w, m), S = l || o.readonly, _ = typeof o.disabled == "function" ? o.disabled(w, m) : o.disabled, x = (te = o.warning) == null ? void 0 : te.schema, Q = $(() => {
208
208
  var se, ae;
209
- if (!E || typeof O > "u") return;
210
- const V = typeof O == "function" ? O(_) : O, { success: A, error: x } = V.safeParse(j), ne = (ae = (se = x == null ? void 0 : x.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
211
- return !A && ne ? ne : void 0;
212
- }, [o.path, j, O, E]), X = M(
209
+ if (!y || typeof x > "u") return;
210
+ const F = typeof x == "function" ? x(w) : x, { success: N, error: P } = F.safeParse(I), ne = (ae = (se = P == null ? void 0 : P.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
211
+ return !N && ne ? ne : void 0;
212
+ }, [o.path, I, x, y]), X = $(
213
213
  () => ({
214
214
  path: e,
215
215
  key: e,
@@ -217,18 +217,18 @@ const ce = ({
217
217
  onUpdate: t,
218
218
  onChange: a,
219
219
  factory: n,
220
- readonly: R,
220
+ readonly: S,
221
221
  input: o,
222
- disabled: S,
222
+ disabled: _,
223
223
  warning: Q
224
224
  }),
225
- [n, s, o, a, t, e, R, c.errors, S, Q]
226
- ), Se = M(() => E ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
225
+ [n, s, o, a, t, e, S, c.errors, _, Q]
226
+ ), Se = $(() => y ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
227
227
  o.before ? o.before : null,
228
- /* @__PURE__ */ p.jsx(Ye, { path: e, inputType: o.inputType, inputErrorHandler: h, children: y == null ? void 0 : y.renderComponent(X) }),
228
+ /* @__PURE__ */ p.jsx(Ye, { path: e, inputType: o.inputType, inputErrorHandler: h, children: g == null ? void 0 : g.renderComponent(X) }),
229
229
  o.after ? o.after : null
230
- ] }) : null, [E, o.before, o.inputType, o.after, e, y, X, c.errors]);
231
- return y ? /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: Se }) : /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: /* @__PURE__ */ p.jsxs("p", { children: [
230
+ ] }) : null, [y, o.before, o.inputType, o.after, e, g, X, c.errors]);
231
+ return g ? /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: Se }) : /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: /* @__PURE__ */ p.jsxs("p", { children: [
232
232
  "Input component not found (internal type: ",
233
233
  o.inputType,
234
234
  ")"
@@ -275,16 +275,16 @@ function Tr(r) {
275
275
  autoFocusPath: m,
276
276
  readonly: l
277
277
  } = r, h = Ze({
278
- mode: e ?? "onSubmit",
278
+ mode: e,
279
279
  reValidateMode: "onChange",
280
280
  defaultValues: t,
281
281
  shouldFocusError: a,
282
282
  resolver: n
283
- }), y = $(!1);
284
- F(() => {
283
+ }), g = O(!1);
284
+ C(() => {
285
285
  h.reset(t, {});
286
- }, [h.reset, t]), F(() => {
287
- const E = fe(), R = le(), S = E(() => {
286
+ }, [h.reset, t]), C(() => {
287
+ const y = fe(), S = le(), _ = y(() => {
288
288
  h.reset({}, {
289
289
  keepErrors: !0,
290
290
  keepDirty: !0,
@@ -298,35 +298,48 @@ function Tr(r) {
298
298
  keepSubmitCount: !0
299
299
  });
300
300
  });
301
- return () => R(S);
301
+ return () => S(_);
302
302
  }, []);
303
- const { getValues: g, handleSubmit: w } = h, T = g(), j = $(!0);
304
- F(() => {
305
- if (j.current) {
306
- j.current = !1;
307
- return;
308
- }
309
- s == null || s({ ...T }), y.current === !0 && h.trigger();
310
- }, [JSON.stringify(T)]);
311
- const _ = $(!0);
312
- return F(() => {
313
- if (_.current) {
314
- _.current = !1;
303
+ const { handleSubmit: b } = h, R = O(s);
304
+ C(() => {
305
+ R.current = s;
306
+ }, [s]);
307
+ const v = O(o);
308
+ C(() => {
309
+ v.current = o;
310
+ }, [o]);
311
+ const I = O(!1);
312
+ C(() => {
313
+ const y = h.watch((S) => {
314
+ var _;
315
+ I.current || ((_ = R.current) == null || _.call(R, { ...S }), g.current === !0 && (I.current = !0, h.trigger().finally(() => {
316
+ I.current = !1;
317
+ })));
318
+ });
319
+ return () => {
320
+ y.unsubscribe();
321
+ };
322
+ }, [h]);
323
+ const w = O(!0);
324
+ return C(() => {
325
+ var y;
326
+ if (w.current) {
327
+ w.current = !1;
315
328
  return;
316
329
  }
317
- o == null || o({ isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
318
- }, [h.formState.isValid, h.formState.isSubmitted]), F(() => {
330
+ (y = v.current) == null || y.call(v, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
331
+ }, [h.formState.isValid, h.formState.isSubmitted]), C(() => {
319
332
  if (m) {
320
- const E = fe(), R = le(), S = E(() => {
333
+ const y = fe(), S = le(), _ = y(() => {
321
334
  h.setFocus(m);
322
335
  });
323
- return () => R(S);
336
+ return () => S(_);
324
337
  }
325
- }, [h]), /* @__PURE__ */ p.jsx(Qe, { metadata: c, readonly: l, inputErrorHandler: i, children: /* @__PURE__ */ p.jsx(Be, { ...h, children: typeof f == "function" ? f({
338
+ }, [h, m]), /* @__PURE__ */ p.jsx(Qe, { metadata: c, readonly: l, inputErrorHandler: i, children: /* @__PURE__ */ p.jsx(Be, { ...h, children: typeof f == "function" ? f({
326
339
  ...h,
327
340
  submitForm: async () => {
328
- u && (y.current = !0, w((E) => {
329
- u(E);
341
+ u && (g.current = !0, b((y) => {
342
+ u(y);
330
343
  })());
331
344
  }
332
345
  }) : f }) });
@@ -335,7 +348,7 @@ const _r = (r) => {
335
348
  const e = {}, n = (t) => {
336
349
  t.forEach((a) => {
337
350
  const { path: s, default: o, inputType: u, inputs: i } = a;
338
- (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : v(e, s) === void 0 && b(e, s, o);
351
+ (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : T(e, s) === void 0 && E(e, s, o);
339
352
  });
340
353
  };
341
354
  return Array.isArray(r.inputs) && n(r.inputs), e;
@@ -358,7 +371,7 @@ function rr(r) {
358
371
  }), e;
359
372
  }
360
373
  const tr = "Required field";
361
- function P(r) {
374
+ function q(r) {
362
375
  let e;
363
376
  if (typeof r == "string")
364
377
  try {
@@ -370,8 +383,8 @@ function P(r) {
370
383
  e = r;
371
384
  if (typeof e == "string")
372
385
  return e;
373
- if (C(e))
374
- return P(e[0]);
386
+ if (V(e))
387
+ return q(e[0]);
375
388
  const n = e;
376
389
  return he(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
377
390
  }
@@ -379,9 +392,9 @@ function nr(r, e, n) {
379
392
  let t = {};
380
393
  if (Z(t, r.inputs, e, n), n != null && n.prefix) {
381
394
  const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
382
- t = b({}, s, t);
395
+ t = E({}, s, t);
383
396
  }
384
- return d.object(q(t, e, n));
397
+ return d.object(A(t, e, n));
385
398
  }
386
399
  function sr(r, e, n) {
387
400
  const t = Object.keys(r).filter((o) => /^\d+$/.test(o) && !o.startsWith("_")).map((o) => parseInt(o, 10)).sort((o, u) => o - u);
@@ -389,13 +402,13 @@ function sr(r, e, n) {
389
402
  const a = Math.max(...t), s = [];
390
403
  for (let o = 0; o <= a; o++)
391
404
  if (t.includes(o)) {
392
- const u = r[o], i = q({ item: u }, e, n);
405
+ const u = r[o], i = A({ item: u }, e, n);
393
406
  s.push(i.item || d.any().optional());
394
407
  } else
395
408
  s.push(d.any().optional());
396
409
  return d.tuple(s).rest(d.any()).optional();
397
410
  }
398
- function q(r, e, n) {
411
+ function A(r, e, n) {
399
412
  const t = {};
400
413
  return Object.keys(r).forEach((a) => {
401
414
  const {
@@ -416,15 +429,15 @@ function q(r, e, n) {
416
429
  }
417
430
  }
418
431
  if (i && o && u) {
419
- const l = d.array(d.object(q(o, e, n))).optional(), h = de(m, u, e, n, l);
432
+ const l = d.array(d.object(A(o, e, n))).optional(), h = de(m, u, e, n, l);
420
433
  t[a] = h;
421
434
  } else if (c && u) {
422
- const l = o != null && o.___array ? q({ ___array: o.___array }, e, n) : { ___array: d.any() }, h = ar(l, u, n), y = de(m, u, e, n, h);
423
- t[a] = y;
435
+ const l = o != null && o.___array ? A({ ___array: o.___array }, e, n) : { ___array: d.any() }, h = ar(l, u, n), g = de(m, u, e, n, h);
436
+ t[a] = g;
424
437
  } else if (m && u) {
425
438
  const l = or(m, u, e, n);
426
439
  t[a] = l;
427
- } else s && u ? t[a] = K(u, n) : t[a] = d.object(q(r[a], e, n)).optional();
440
+ } else s && u ? t[a] = K(u, n) : t[a] = d.object(A(r[a], e, n)).optional();
428
441
  }), t;
429
442
  }
430
443
  function ar(r, e, n) {
@@ -452,7 +465,7 @@ function or(r, e, n, t) {
452
465
  if (e.required && !(await K(e, t).safeParseAsync(a)).success)
453
466
  return s.addIssue({
454
467
  code: d.ZodIssueCode.custom,
455
- message: U(e, t)
468
+ message: J(e, t)
456
469
  }), d.NEVER;
457
470
  if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
458
471
  const c = (i = t == null ? void 0 : t.validationConfig) == null ? void 0 : i.globalValidation(a, e, t.metadata);
@@ -468,7 +481,7 @@ function or(r, e, n, t) {
468
481
  if (o) {
469
482
  const c = await o.safeParseAsync(a);
470
483
  if (!c.success) {
471
- const f = P(c == null ? void 0 : c.error.message), m = f === "Required" ? U(e, t) : f;
484
+ const f = q(c == null ? void 0 : c.error.message), m = f === "Required" ? J(e, t) : f;
472
485
  s.addIssue({
473
486
  code: d.ZodIssueCode.custom,
474
487
  message: m
@@ -482,7 +495,7 @@ function de(r, e, n, t, a) {
482
495
  var f, m;
483
496
  const i = await K(e, t).safeParseAsync(s);
484
497
  if (e.required && !i.success) {
485
- const l = P(i.error.message);
498
+ const l = q(i.error.message);
486
499
  return o.addIssue({ code: d.ZodIssueCode.custom, message: l, fatal: !0 }), d.NEVER;
487
500
  }
488
501
  if (!e.required && !i.success)
@@ -492,12 +505,12 @@ function de(r, e, n, t, a) {
492
505
  if (l.error)
493
506
  return o.addIssue({
494
507
  code: d.ZodIssueCode.custom,
495
- message: P(l.error)
508
+ message: q(l.error)
496
509
  }), d.NEVER;
497
510
  if (!l.continue)
498
511
  return d.NEVER;
499
512
  }
500
- if (!C(s))
513
+ if (!V(s))
501
514
  return o.addIssue({
502
515
  code: d.ZodIssueCode.custom,
503
516
  message: "'Value is not array'"
@@ -508,7 +521,7 @@ function de(r, e, n, t, a) {
508
521
  if (!l.success)
509
522
  return o.addIssue({
510
523
  code: d.ZodIssueCode.custom,
511
- message: P(l.error.message)
524
+ message: q(l.error.message)
512
525
  }), d.NEVER;
513
526
  }
514
527
  }).pipe(a ?? d.any());
@@ -518,40 +531,40 @@ function Z(r, e, n, t, a) {
518
531
  var u, i, c, f, m, l, h;
519
532
  const o = n;
520
533
  if (!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) {
521
- const y = v(r, s.path);
522
- if ((i = s.validation) != null && i.schema ? b(
534
+ const g = T(r, s.path);
535
+ if ((i = s.validation) != null && i.schema ? E(
523
536
  r,
524
537
  s.path,
525
- D(y, {
538
+ M(g, {
526
539
  _schema: (c = s.validation) == null ? void 0 : c.schema,
527
540
  _input: s
528
541
  })
529
- ) : s.required && b(r, s.path, D(y, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
530
- const g = {};
542
+ ) : s.required && E(r, s.path, M(g, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
543
+ const b = {};
531
544
  Z(
532
- g,
533
- (m = (f = s.inputConfig) == null ? void 0 : f.inputs) == null ? void 0 : m.map((T) => ({
534
- ...T,
535
- path: T.relativePath
545
+ b,
546
+ (m = (f = s.inputConfig) == null ? void 0 : f.inputs) == null ? void 0 : m.map((v) => ({
547
+ ...v,
548
+ path: v.relativePath
536
549
  })),
537
550
  n,
538
551
  t
539
552
  );
540
- const w = v(r, s.path);
541
- b(r, s.path, D(w, { _schemaObj: g, _isList: !0, _input: s }));
553
+ const R = T(r, s.path);
554
+ E(r, s.path, M(R, { _schemaObj: b, _isList: !0, _input: s }));
542
555
  }
543
556
  if (!((l = s.validation) != null && l.schema) && s.inputType === "array") {
544
- const g = {};
557
+ const b = {};
545
558
  Z(
546
- g,
559
+ b,
547
560
  [{ ...s.inputConfig.input, path: "___array" }],
548
561
  n,
549
562
  t
550
- ), b(
563
+ ), E(
551
564
  r,
552
565
  s.path,
553
- D(y, {
554
- _schemaObj: g,
566
+ M(g, {
567
+ _schemaObj: b,
555
568
  _schema: (h = s.validation) == null ? void 0 : h.schema,
556
569
  _isArrayItem: !0,
557
570
  _input: s
@@ -566,14 +579,14 @@ function Z(r, e, n, t, a) {
566
579
  const i = s.path.split(".");
567
580
  i.forEach((c, f) => {
568
581
  if (f > 0 && /^\d+$/.test(c)) {
569
- const m = i.slice(0, f).join("."), l = m ? v(r, m) : r;
582
+ const m = i.slice(0, f).join("."), l = m ? T(r, m) : r;
570
583
  l && typeof l == "object" && (l._isTuple = !0);
571
584
  }
572
585
  });
573
586
  }
574
587
  });
575
588
  }
576
- function U(r, e) {
589
+ function J(r, e) {
577
590
  var n, t, a;
578
591
  return ((t = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredMessagePerInput) == null ? void 0 : t[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ?? tr;
579
592
  }
@@ -583,7 +596,7 @@ function K(r, e) {
583
596
  return (o = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : o[r.inputType];
584
597
  if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
585
598
  return (i = e == null ? void 0 : e.validationConfig) == null ? void 0 : i.requiredSchema;
586
- const n = U(r, e);
599
+ const n = J(r, e);
587
600
  return d.any().optional().superRefine((c, f) => {
588
601
  typeof c == "object" && k(c) && f.addIssue({
589
602
  code: d.ZodIssueCode.custom,
@@ -628,8 +641,8 @@ const ur = (r) => Array.isArray(r == null ? void 0 : r.errors), ir = (r, e) => {
628
641
  }
629
642
  return n;
630
643
  };
631
- function Ir(r, e) {
632
- return Ae(
644
+ function Cr(r, e) {
645
+ return ke(
633
646
  async (n, t, a) => {
634
647
  try {
635
648
  return await nr(r, n, e).parseAsync(n), {
@@ -640,7 +653,7 @@ function Ir(r, e) {
640
653
  if (ur(s))
641
654
  return {
642
655
  values: {},
643
- errors: Ue(ir(s.errors, !0), a)
656
+ errors: Je(ir(s.errors, !0), a)
644
657
  };
645
658
  throw s;
646
659
  }
@@ -651,18 +664,18 @@ function Ir(r, e) {
651
664
  function cr(r, e) {
652
665
  const n = H(r);
653
666
  return e.forEach((t) => {
654
- t.inputTransform && (C(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
655
- const o = v(n, t.path), u = s(o, n);
656
- u && b(n, u.path ?? t.path, u.value);
667
+ t.inputTransform && (V(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
668
+ const o = T(n, t.path), u = s(o, n);
669
+ u && E(n, u.path ?? t.path, u.value);
657
670
  });
658
671
  }), n;
659
672
  }
660
673
  function fr(r, e) {
661
674
  const n = [], t = H(r);
662
675
  return e.forEach((a) => {
663
- a.outputTransform && (C(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
664
- const u = v(t, a.path), i = o(u, t);
665
- i && (i.path ? (b(t, i.path, i.value), i.unset && n.push(a.path)) : b(t, a.path, i.value));
676
+ a.outputTransform && (V(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
677
+ const u = T(t, a.path), i = o(u, t);
678
+ i && (i.path ? (E(t, i.path, i.value), i.unset && n.push(a.path)) : E(t, a.path, i.value));
666
679
  });
667
680
  }), n.forEach((a) => {
668
681
  pe(t, a);
@@ -688,7 +701,7 @@ function lr(r, e, n, t = {}) {
688
701
  a && a.includes(u.path) || u.isVisible && !u.isVisible(e, n) && pe(o, u.path);
689
702
  }), o;
690
703
  }
691
- function Cr(r, e) {
704
+ function Ir(r, e) {
692
705
  const n = _e(e);
693
706
  return cr(r, n);
694
707
  }
@@ -701,7 +714,7 @@ function jr(r) {
701
714
  const e = {}, n = (t) => {
702
715
  t.forEach((a) => {
703
716
  const { default: s, path: o, inputType: u, inputs: i } = a;
704
- (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : s !== void 0 && b(e, o, s);
717
+ (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : s !== void 0 && E(e, o, s);
705
718
  });
706
719
  };
707
720
  return Array.isArray(r.inputs) && n(r.inputs), e;
@@ -730,12 +743,12 @@ function Vr(r) {
730
743
  function xr() {
731
744
  return function(r, e) {
732
745
  if (!(typeof r > "u"))
733
- return C(r) && k(r) ? { value: void 0 } : { value: r };
746
+ return V(r) && k(r) ? { value: void 0 } : { value: r };
734
747
  };
735
748
  }
736
749
  function Fr(r) {
737
750
  return function(e, n) {
738
- const t = r ? v(n, r) : e;
751
+ const t = r ? T(n, r) : e;
739
752
  if (!(typeof t > "u")) {
740
753
  if (ye(t)) return { value: void 0, path: r };
741
754
  if (he(t)) {
@@ -755,15 +768,15 @@ function Pr() {
755
768
  }
756
769
  function qr(r) {
757
770
  return function(e, n) {
758
- const t = v(n, r);
771
+ const t = T(n, r);
759
772
  return typeof t == "string" ? { value: t } : { value: e };
760
773
  };
761
774
  }
762
- function kr(r) {
775
+ function Ar(r) {
763
776
  return function(e, n) {
764
777
  if (typeof e > "u") return;
765
778
  if (!e) return { value: e };
766
- const t = v(n, r);
779
+ const t = T(n, r);
767
780
  if (typeof t == "object") {
768
781
  const a = dr(t);
769
782
  if (Object.getOwnPropertyNames(a).length === 1)
@@ -772,10 +785,10 @@ function kr(r) {
772
785
  return { value: e };
773
786
  };
774
787
  }
775
- function Ar(r) {
788
+ function kr(r) {
776
789
  return function(e, n) {
777
790
  if (typeof e > "u") return;
778
- const t = v(n, r);
791
+ const t = T(n, r);
779
792
  return typeof t == "string" ? { value: [t] } : { value: e };
780
793
  };
781
794
  }
@@ -783,8 +796,8 @@ function Nr(r, e) {
783
796
  return function(n, t) {
784
797
  if (typeof n > "u") return;
785
798
  if (!n) return { value: n };
786
- const a = v(t, r);
787
- if (C(a)) {
799
+ const a = T(t, r);
800
+ if (V(a)) {
788
801
  if (a.length === 1)
789
802
  return { value: a[0], path: r };
790
803
  if (a.length === 0 && e != null && e.unsetIfEmpty)
@@ -845,7 +858,7 @@ function $r(r) {
845
858
  const {
846
859
  field: { onBlur: e, ...n },
847
860
  ...t
848
- } = Je(r), a = $(Date.now());
861
+ } = Ue(r), a = O(Date.now());
849
862
  return {
850
863
  ...t,
851
864
  field: {
@@ -856,8 +869,8 @@ function $r(r) {
856
869
  }
857
870
  export {
858
871
  Wr as Controller,
859
- Jr as Form,
860
- Ur as FormProvider,
872
+ Ur as Form,
873
+ Jr as FormProvider,
861
874
  Er as InputComponent,
862
875
  ze as InputComponentRenderer,
863
876
  be as InputFactory,
@@ -868,7 +881,7 @@ export {
868
881
  hr as afterFrames,
869
882
  Vr as arrayToObjectOutputTransformer,
870
883
  jr as collectDefaultValues,
871
- Cr as convertDataToFormModel,
884
+ Ir as convertDataToFormModel,
872
885
  wr as convertFormModelToData,
873
886
  Mr as generateReadableLabel,
874
887
  Lr as get,
@@ -881,13 +894,13 @@ export {
881
894
  Or as objectToArrayInputTransformer,
882
895
  fr as outputTransformValues,
883
896
  Rr as overrideFormDefinition,
884
- P as processValidationParseResponse,
897
+ q as processValidationParseResponse,
885
898
  rr as removeTemporaryFieldsValue,
886
899
  Hr as set,
887
- Ar as shorthandArrayInputTransformer,
900
+ kr as shorthandArrayInputTransformer,
888
901
  Nr as shorthandArrayOutputTransformer,
889
902
  qr as shorthandObjectInputTransformer,
890
- kr as shorthandObjectOutputTransformer,
903
+ Ar as shorthandObjectOutputTransformer,
891
904
  xr as unsetEmptyArrayOutputTransformer,
892
905
  Fr as unsetEmptyObjectOutputTransformer,
893
906
  Pr as unsetEmptyStringOutputTransformer,
@@ -899,6 +912,6 @@ export {
899
912
  Xr as useFormState,
900
913
  Xe as useRootFormContext,
901
914
  Yr as useWatch,
902
- Ir as useZodValidationResolver
915
+ Cr as useZodValidationResolver
903
916
  };
904
917
  //# sourceMappingURL=index.js.map