@harnessio/forms 0.12.0 → 0.12.2

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,8 +1,8 @@
1
- var Ie = Object.defineProperty;
2
- var Oe = (r, e, n) => e in r ? Ie(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var D = (r, e, n) => Oe(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { isEmpty as k, set as S, get as T, forOwn as me, isArray as j, isObject as he, merge as M, isUndefined as B, cloneDeep as H, unset as ye, pick as we, isPlainObject as je, isNull as pe, omitBy as ge, isNil as Ve, isString as xe, capitalize as Fe } from "lodash-es";
5
- import Pe, { createContext as qe, useContext as Ae, Component as ke, memo as Ne, useMemo as $, useRef as w, useEffect as O, useCallback as De, forwardRef as Me, Fragment as $e } from "react";
1
+ var we = Object.defineProperty;
2
+ var Ie = (r, e, n) => e in r ? we(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 S, get as _, forOwn as me, isArray as j, isObject as he, merge as M, isUndefined as B, cloneDeep as H, unset as ye, pick as Oe, isPlainObject as je, isNull as pe, omitBy as ge, isNil as Ve, isString as xe, capitalize as Fe } from "lodash-es";
5
+ import Pe, { createContext as qe, useContext as Ae, Component as ke, memo as Ne, useMemo as $, useRef as O, useEffect as I, useCallback as De, forwardRef as Me, Fragment as $e } from "react";
6
6
  import { useFormContext as Ze, get as Be, useForm as We, FormProvider as Je, appendErrors as Ue, useController as Le } from "react-hook-form";
7
7
  import { Controller as Ur, Form as Lr, FormProvider as Hr, get as Gr, set as Kr, useFieldArray as Qr, useForm as Xr, useFormContext as Yr, useFormState as zr, useWatch as et } from "react-hook-form";
8
8
  import * as d from "zod";
@@ -78,12 +78,12 @@ function Ke() {
78
78
  var s = new String("abc");
79
79
  if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
80
80
  return !1;
81
- for (var o = {}, u = 0; u < 10; u++)
82
- o["_" + String.fromCharCode(u)] = u;
83
- var i = Object.getOwnPropertyNames(o).map(function(f) {
81
+ for (var o = {}, i = 0; i < 10; i++)
82
+ o["_" + String.fromCharCode(i)] = i;
83
+ var u = Object.getOwnPropertyNames(o).map(function(f) {
84
84
  return o[f];
85
85
  });
86
- if (i.join("") !== "0123456789")
86
+ if (u.join("") !== "0123456789")
87
87
  return !1;
88
88
  var c = {};
89
89
  return "abcdefghijklmnopqrst".split("").forEach(function(f) {
@@ -94,17 +94,17 @@ function Ke() {
94
94
  }
95
95
  }
96
96
  return J = a() ? Object.assign : function(s, o) {
97
- for (var u, i = t(s), c, f = 1; f < arguments.length; f++) {
98
- u = Object(arguments[f]);
99
- for (var m in u)
100
- e.call(u, m) && (i[m] = u[m]);
97
+ for (var i, u = t(s), c, f = 1; f < arguments.length; f++) {
98
+ i = Object(arguments[f]);
99
+ for (var m in i)
100
+ e.call(i, m) && (u[m] = i[m]);
101
101
  if (r) {
102
- c = r(u);
102
+ c = r(i);
103
103
  for (var l = 0; l < c.length; l++)
104
- n.call(u, c[l]) && (i[c[l]] = u[c[l]]);
104
+ n.call(i, c[l]) && (u[c[l]] = i[c[l]]);
105
105
  }
106
106
  }
107
- return i;
107
+ return u;
108
108
  }, J;
109
109
  }
110
110
  /** @license React v17.0.2
@@ -115,28 +115,28 @@ function Ke() {
115
115
  * This source code is licensed under the MIT license found in the
116
116
  * LICENSE file in the root directory of this source tree.
117
117
  */
118
- var ue;
118
+ var ie;
119
119
  function Qe() {
120
- if (ue) return V;
121
- ue = 1, Ke();
120
+ if (ie) return V;
121
+ ie = 1, Ke();
122
122
  var r = Pe, e = 60103;
123
123
  if (V.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
124
124
  var n = Symbol.for;
125
125
  e = n("react.element"), V.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
- function o(u, i, c) {
128
+ function o(i, u, c) {
129
129
  var f, m = {}, l = null, h = null;
130
- c !== void 0 && (l = "" + c), i.key !== void 0 && (l = "" + i.key), i.ref !== void 0 && (h = i.ref);
131
- for (f in i) a.call(i, f) && !s.hasOwnProperty(f) && (m[f] = i[f]);
132
- if (u && u.defaultProps) for (f in i = u.defaultProps, i) m[f] === void 0 && (m[f] = i[f]);
133
- return { $$typeof: e, type: u, key: l, ref: h, props: m, _owner: t.current };
130
+ c !== void 0 && (l = "" + c), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (h = u.ref);
131
+ for (f in u) a.call(u, f) && !s.hasOwnProperty(f) && (m[f] = u[f]);
132
+ if (i && i.defaultProps) for (f in u = i.defaultProps, u) m[f] === void 0 && (m[f] = u[f]);
133
+ return { $$typeof: e, type: i, key: l, ref: h, props: m, _owner: t.current };
134
134
  }
135
135
  return V.jsx = o, V.jsxs = o, V;
136
136
  }
137
- var ie;
137
+ var ue;
138
138
  function Xe() {
139
- return ie || (ie = 1, W.exports = Qe()), W.exports;
139
+ return ue || (ue = 1, W.exports = Qe()), W.exports;
140
140
  }
141
141
  var y = Xe();
142
142
  const ve = qe({});
@@ -194,22 +194,22 @@ const ce = ({
194
194
  onChange: a,
195
195
  initialValues: s,
196
196
  input: o,
197
- withoutWrapper: u = !1
197
+ withoutWrapper: i = !1
198
198
  }) {
199
199
  var Y, z, ee, re, te;
200
- const i = Ze(), { formState: c } = i, { fixedValues: f = {} } = {}, { metadata: m, readonly: l, inputErrorHandler: h } = ze(), p = 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"), x = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), E = g ? i.watch() : {}, R = x ? g ? Be(E, o.path) : i.watch(o.path) : void 0, C = $(() => {
200
+ const u = Ze(), { formState: c } = u, { fixedValues: f = {} } = {}, { metadata: m, readonly: l, inputErrorHandler: h } = ze(), p = 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"), x = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), E = g ? u.watch() : {}, T = x ? g ? Be(E, o.path) : u.watch(o.path) : void 0, C = $(() => {
201
201
  if (!g) return {};
202
202
  let F = E;
203
203
  return f && Object.keys(f).forEach((N) => {
204
204
  const P = f[N];
205
205
  F = S(F, N, P);
206
206
  }), F;
207
- }, [g, E, f]), I = !o.isVisible || o.isVisible(C, m), b = l || o.readonly, _ = typeof o.disabled == "function" ? o.disabled(C, m) : o.disabled, v = (te = o.warning) == null ? void 0 : te.schema, Q = $(() => {
207
+ }, [g, E, f]), w = !o.isVisible || o.isVisible(C, m), b = l || o.readonly, R = typeof o.disabled == "function" ? o.disabled(C, m) : o.disabled, v = (te = o.warning) == null ? void 0 : te.schema, Q = $(() => {
208
208
  var se, ae;
209
- if (!I || typeof v > "u") return;
210
- const F = typeof v == "function" ? v(C) : v, { success: N, error: P } = F.safeParse(R), ne = (ae = (se = P == null ? void 0 : P.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
209
+ if (!w || typeof v > "u") return;
210
+ const F = typeof v == "function" ? v(C) : v, { success: N, error: P } = F.safeParse(T), ne = (ae = (se = P == null ? void 0 : P.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
211
211
  return !N && ne ? ne : void 0;
212
- }, [o.path, R, v, I]), X = $(
212
+ }, [o.path, T, v, w]), X = $(
213
213
  () => ({
214
214
  path: e,
215
215
  key: e,
@@ -219,22 +219,22 @@ const ce = ({
219
219
  factory: n,
220
220
  readonly: b,
221
221
  input: o,
222
- disabled: _,
222
+ disabled: R,
223
223
  warning: Q
224
224
  }),
225
- [n, s, o, a, t, e, b, c.errors, _, Q]
226
- ), Ce = $(() => I ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
225
+ [n, s, o, a, t, e, b, c.errors, R, Q]
226
+ ), Ce = $(() => w ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
227
227
  o.before ? o.before : null,
228
228
  /* @__PURE__ */ y.jsx(er, { path: e, inputType: o.inputType, inputErrorHandler: h, children: p == null ? void 0 : p.renderComponent(X) }),
229
229
  o.after ? o.after : null
230
- ] }) : null, [I, o.before, o.inputType, o.after, e, p, X, c.errors]);
231
- return p ? /* @__PURE__ */ y.jsx(ce, { withoutWrapper: u, children: Ce }) : /* @__PURE__ */ y.jsx(ce, { withoutWrapper: u, children: /* @__PURE__ */ y.jsxs("p", { children: [
230
+ ] }) : null, [w, o.before, o.inputType, o.after, e, p, X, c.errors]);
231
+ return p ? /* @__PURE__ */ y.jsx(ce, { withoutWrapper: i, children: Ce }) : /* @__PURE__ */ y.jsx(ce, { withoutWrapper: i, children: /* @__PURE__ */ y.jsxs("p", { children: [
232
232
  "Input component not found (internal type: ",
233
233
  o.inputType,
234
234
  ")"
235
235
  ] }) });
236
236
  });
237
- class Tr {
237
+ class _r {
238
238
  getType() {
239
239
  return this.internalType;
240
240
  }
@@ -255,7 +255,7 @@ function fe() {
255
255
  function le() {
256
256
  return typeof window < "u" && "cancelIdleCallback" in window ? window.cancelIdleCallback : clearTimeout;
257
257
  }
258
- function _r(r) {
258
+ function Rr(r) {
259
259
  const {
260
260
  mode: e = "onSubmit",
261
261
  resolver: n,
@@ -264,8 +264,8 @@ function _r(r) {
264
264
  // validateAfterFirstSubmit,
265
265
  onValuesChange: s,
266
266
  onValidationChange: o,
267
- onSubmit: u,
268
- onInputRenderError: i,
267
+ onSubmit: i,
268
+ onInputRenderError: u,
269
269
  // validate,
270
270
  // validateDebounceInterval,
271
271
  // validationConfig,
@@ -280,11 +280,11 @@ function _r(r) {
280
280
  defaultValues: t,
281
281
  shouldFocusError: a,
282
282
  resolver: n
283
- }), p = w(!1), g = w(JSON.stringify(t ?? {}));
284
- O(() => {
283
+ }), p = O(!1), g = O(JSON.stringify(t ?? {}));
284
+ I(() => {
285
285
  g.current = JSON.stringify(t ?? {}), h.reset(t, {});
286
- }, [h.reset, t]), O(() => {
287
- const b = fe(), _ = le(), v = b(() => {
286
+ }, [h.reset, t]), I(() => {
287
+ const b = fe(), R = le(), v = b(() => {
288
288
  h.reset({}, {
289
289
  keepErrors: !0,
290
290
  keepDirty: !0,
@@ -298,21 +298,21 @@ function _r(r) {
298
298
  keepSubmitCount: !0
299
299
  });
300
300
  });
301
- return () => _(v);
301
+ return () => R(v);
302
302
  }, []);
303
- const { handleSubmit: x } = h, E = w(s);
304
- O(() => {
303
+ const { handleSubmit: x } = h, E = O(s);
304
+ I(() => {
305
305
  E.current = s;
306
306
  }, [s]);
307
- const R = w(o);
308
- O(() => {
309
- R.current = o;
307
+ const T = O(o);
308
+ I(() => {
309
+ T.current = o;
310
310
  }, [o]);
311
- const C = w(!1);
312
- O(() => {
313
- const b = h.watch((_) => {
311
+ const C = O(!1);
312
+ I(() => {
313
+ const b = h.watch((R) => {
314
314
  var v;
315
- C.current || JSON.stringify(_ ?? {}) !== g.current && ((v = E.current) == null || v.call(E, { ..._ }), p.current === !0 && (C.current = !0, h.trigger().finally(() => {
315
+ C.current || JSON.stringify(R ?? {}) !== g.current && ((v = E.current) == null || v.call(E, { ...R }), p.current === !0 && (C.current = !0, h.trigger().finally(() => {
316
316
  C.current = !1;
317
317
  })));
318
318
  });
@@ -320,35 +320,35 @@ function _r(r) {
320
320
  b.unsubscribe();
321
321
  };
322
322
  }, [h]);
323
- const I = w(!0);
324
- return O(() => {
323
+ const w = O(!0);
324
+ return I(() => {
325
325
  var b;
326
- if (I.current) {
327
- I.current = !1;
326
+ if (w.current) {
327
+ w.current = !1;
328
328
  return;
329
329
  }
330
- (b = R.current) == null || b.call(R, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
331
- }, [h.formState.isValid, h.formState.isSubmitted]), O(() => {
330
+ (b = T.current) == null || b.call(T, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
331
+ }, [h.formState.isValid, h.formState.isSubmitted]), I(() => {
332
332
  if (m) {
333
- const b = fe(), _ = le(), v = b(() => {
333
+ const b = fe(), R = le(), v = b(() => {
334
334
  h.setFocus(m);
335
335
  });
336
- return () => _(v);
336
+ return () => R(v);
337
337
  }
338
- }, [h, m]), /* @__PURE__ */ y.jsx(Ye, { metadata: c, readonly: l, inputErrorHandler: i, children: /* @__PURE__ */ y.jsx(Je, { ...h, children: typeof f == "function" ? f({
338
+ }, [h, m]), /* @__PURE__ */ y.jsx(Ye, { metadata: c, readonly: l, inputErrorHandler: u, children: /* @__PURE__ */ y.jsx(Je, { ...h, children: typeof f == "function" ? f({
339
339
  ...h,
340
340
  submitForm: async () => {
341
- u && (p.current = !0, x((b) => {
342
- u(b);
341
+ i && (p.current = !0, x((b) => {
342
+ i(b);
343
343
  })());
344
344
  }
345
345
  }) : f }) });
346
346
  }
347
- const Rr = (r) => {
347
+ const Tr = (r) => {
348
348
  const e = {}, n = (t) => {
349
349
  t.forEach((a) => {
350
- const { path: s, default: o, inputType: u, inputs: i } = a;
351
- (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : T(e, s) === void 0 && S(e, s, o);
350
+ const { path: s, default: o, inputs: i } = a;
351
+ Array.isArray(i) ? n(i) : _(e, s) === void 0 && S(e, s, o);
352
352
  });
353
353
  };
354
354
  return Array.isArray(r.inputs) && n(r.inputs), e;
@@ -363,7 +363,7 @@ function Cr(r, e) {
363
363
  function tr(r, e) {
364
364
  return r.inputs.find((n) => n.path === e);
365
365
  }
366
- const Ee = "__temp_", Ir = (r) => Ee + r.split(".").join("__");
366
+ const Ee = "__temp_", wr = (r) => Ee + r.split(".").join("__");
367
367
  function nr(r) {
368
368
  const e = { ...r };
369
369
  return me(e, (n, t) => {
@@ -397,13 +397,13 @@ function ar(r, e, n) {
397
397
  return d.object(A(t, e, n));
398
398
  }
399
399
  function or(r, e, n) {
400
- const t = Object.keys(r).filter((o) => /^\d+$/.test(o) && !o.startsWith("_")).map((o) => parseInt(o, 10)).sort((o, u) => o - u);
400
+ const t = Object.keys(r).filter((o) => /^\d+$/.test(o) && !o.startsWith("_")).map((o) => parseInt(o, 10)).sort((o, i) => o - i);
401
401
  if (t.length === 0) return null;
402
402
  const a = Math.max(...t), s = [];
403
403
  for (let o = 0; o <= a; o++)
404
404
  if (t.includes(o)) {
405
- const u = r[o], i = A({ item: u }, e, n);
406
- s.push(i.item || d.any().optional());
405
+ const i = r[o], u = A({ item: i }, e, n);
406
+ s.push(u.item || d.any().optional());
407
407
  } else
408
408
  s.push(d.any().optional());
409
409
  return d.tuple(s).rest(d.any()).optional();
@@ -414,33 +414,33 @@ function A(r, e, n) {
414
414
  const {
415
415
  _requiredOnly: s,
416
416
  _schemaObj: o,
417
- _input: u,
418
- _isList: i,
417
+ _input: i,
418
+ _isList: u,
419
419
  _isArrayItem: c,
420
420
  _isTuple: f,
421
421
  _schema: m
422
422
  /*...nestedSchemaObj*/
423
423
  } = r[a];
424
- if (f && !i && !c) {
424
+ if (f && !u && !c) {
425
425
  const l = or(r[a], e, n);
426
426
  if (l) {
427
427
  t[a] = l;
428
428
  return;
429
429
  }
430
430
  }
431
- if (i && o && u) {
431
+ if (u && o && i) {
432
432
  const l = d.object(A(o, e, n)), h = d.union([
433
433
  d.array(l).optional(),
434
- Se(u, n)
435
- ]), p = de(m, u, e, n, h);
434
+ Se(i, n)
435
+ ]), p = de(m, i, e, n, h);
436
436
  t[a] = p;
437
- } else if (c && u) {
438
- const l = o != null && o.___array ? A({ ___array: o.___array }, e, n) : { ___array: d.any() }, h = ur(l, u, n), p = de(m, u, e, n, h);
437
+ } else if (c && i) {
438
+ const l = o != null && o.___array ? A({ ___array: o.___array }, e, n) : { ___array: d.any() }, h = ir(l, i, n), p = de(m, i, e, n, h);
439
439
  t[a] = p;
440
- } else if (m && u) {
441
- const l = ir(m, u, e, n);
440
+ } else if (m && i) {
441
+ const l = ur(m, i, e, n);
442
442
  t[a] = l;
443
- } else s && u ? t[a] = G(u, n) : t[a] = d.object(A(r[a], e, n)).optional();
443
+ } else s && i ? t[a] = G(i, n) : t[a] = d.object(A(r[a], e, n)).optional();
444
444
  }), t;
445
445
  }
446
446
  function Se(r, e) {
@@ -459,19 +459,19 @@ function Se(r, e) {
459
459
  return !0;
460
460
  });
461
461
  }
462
- function ur(r, e, n) {
462
+ function ir(r, e, n) {
463
463
  return d.union([d.array(r.___array).optional(), Se(e, n)]);
464
464
  }
465
- function ir(r, e, n, t) {
465
+ function ur(r, e, n, t) {
466
466
  return d.any().optional().superRefine(async (a, s) => {
467
- var u, i;
467
+ var i, u;
468
468
  if (e.required && !(await G(e, t).safeParseAsync(a)).success)
469
469
  return s.addIssue({
470
470
  code: d.ZodIssueCode.custom,
471
471
  message: U(e, t)
472
472
  }), d.NEVER;
473
- if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
474
- const c = (i = t == null ? void 0 : t.validationConfig) == null ? void 0 : i.globalValidation(a, e, t.metadata);
473
+ if ((i = t == null ? void 0 : t.validationConfig) != null && i.globalValidation) {
474
+ const c = (u = t == null ? void 0 : t.validationConfig) == null ? void 0 : u.globalValidation(a, e, t.metadata);
475
475
  if (c.error)
476
476
  return s.addIssue({
477
477
  code: d.ZodIssueCode.custom,
@@ -480,7 +480,7 @@ function ir(r, e, n, t) {
480
480
  if (!c.continue)
481
481
  return !0;
482
482
  }
483
- const o = Te(r, n);
483
+ const o = _e(r, n);
484
484
  if (o) {
485
485
  const c = await o.safeParseAsync(a);
486
486
  if (!c.success) {
@@ -496,12 +496,12 @@ function ir(r, e, n, t) {
496
496
  function de(r, e, n, t, a) {
497
497
  return d.any().optional().superRefine(async (s, o) => {
498
498
  var f, m;
499
- const i = await G(e, t).safeParseAsync(s);
500
- if (e.required && !i.success) {
501
- const l = q(i.error.message);
499
+ const u = await G(e, t).safeParseAsync(s);
500
+ if (e.required && !u.success) {
501
+ const l = q(u.error.message);
502
502
  return o.addIssue({ code: d.ZodIssueCode.custom, message: l, fatal: !0 }), d.NEVER;
503
503
  }
504
- if (!e.required && !i.success)
504
+ if (!e.required && !u.success)
505
505
  return d.NEVER;
506
506
  if ((f = t == null ? void 0 : t.validationConfig) != null && f.globalValidation) {
507
507
  const l = (m = t == null ? void 0 : t.validationConfig) == null ? void 0 : m.globalValidation(s, e, t.metadata);
@@ -518,7 +518,7 @@ function de(r, e, n, t, a) {
518
518
  code: d.ZodIssueCode.custom,
519
519
  message: "'Value is not array'"
520
520
  }), d.NEVER;
521
- const c = Te(r, n);
521
+ const c = _e(r, n);
522
522
  if (c) {
523
523
  const l = await c.safeParseAsync(s);
524
524
  if (!l.success)
@@ -531,11 +531,11 @@ function de(r, e, n, t, a) {
531
531
  }
532
532
  function Z(r, e, n, t, a) {
533
533
  e.forEach((s) => {
534
- var u, i, c, f, m, l, h;
534
+ var i, u, c, f, m, l, h;
535
535
  const o = n;
536
- if (!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) {
537
- const p = T(r, s.path);
538
- if ((i = s.validation) != null && i.schema ? S(
536
+ if (!s.isVisible || (i = s.isVisible) != null && i.call(s, o, t == null ? void 0 : t.metadata)) {
537
+ const p = _(r, s.path);
538
+ if ((u = s.validation) != null && u.schema ? S(
539
539
  r,
540
540
  s.path,
541
541
  M(p, {
@@ -553,7 +553,7 @@ function Z(r, e, n, t, a) {
553
553
  n,
554
554
  t
555
555
  );
556
- const x = T(r, s.path);
556
+ const x = _(r, s.path);
557
557
  S(r, s.path, M(x, { _schemaObj: g, _isList: !0, _input: s }));
558
558
  }
559
559
  if (!((l = s.validation) != null && l.schema) && s.inputType === "array") {
@@ -576,13 +576,13 @@ function Z(r, e, n, t, a) {
576
576
  }
577
577
  }
578
578
  }), e.forEach((s) => {
579
- var u;
579
+ var i;
580
580
  const o = n;
581
- if ((!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) && s.path) {
582
- const i = s.path.split(".");
583
- i.forEach((c, f) => {
581
+ if ((!s.isVisible || (i = s.isVisible) != null && i.call(s, o, t == null ? void 0 : t.metadata)) && s.path) {
582
+ const u = s.path.split(".");
583
+ u.forEach((c, f) => {
584
584
  if (f > 0 && /^\d+$/.test(c)) {
585
- const m = i.slice(0, f).join("."), l = m ? T(r, m) : r;
585
+ const m = u.slice(0, f).join("."), l = m ? _(r, m) : r;
586
586
  l && typeof l == "object" && (l._isTuple = !0);
587
587
  }
588
588
  });
@@ -594,11 +594,11 @@ function U(r, e) {
594
594
  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) ?? sr;
595
595
  }
596
596
  function G(r, e) {
597
- var t, a, s, o, u, i;
597
+ var t, a, s, o, i, u;
598
598
  if ((a = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredSchemaPerInput) != null && a[r.inputType])
599
599
  return (o = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : o[r.inputType];
600
- if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
601
- return (i = e == null ? void 0 : e.validationConfig) == null ? void 0 : i.requiredSchema;
600
+ if ((i = e == null ? void 0 : e.validationConfig) != null && i.requiredSchema)
601
+ return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
602
602
  const n = U(r, e);
603
603
  return d.any().optional().superRefine((c, f) => {
604
604
  typeof c == "object" && k(c) && f.addIssue({
@@ -610,7 +610,7 @@ function G(r, e) {
610
610
  });
611
611
  });
612
612
  }
613
- function Te(r, e) {
613
+ function _e(r, e) {
614
614
  if (r instanceof d.ZodType)
615
615
  return r;
616
616
  if (typeof r == "function")
@@ -619,21 +619,21 @@ function Te(r, e) {
619
619
  const cr = (r) => Array.isArray(r == null ? void 0 : r.errors), fr = (r, e) => {
620
620
  const n = {};
621
621
  for (; r.length; ) {
622
- const t = r[0], { code: a, message: s, path: o } = t, u = o.join(".");
623
- if (!n[u])
622
+ const t = r[0], { code: a, message: s, path: o } = t, i = o.join(".");
623
+ if (!n[i])
624
624
  if ("unionErrors" in t) {
625
- const i = t.unionErrors[0].errors[0];
626
- n[u] = {
627
- message: i.message,
628
- type: i.code
625
+ const u = t.unionErrors[0].errors[0];
626
+ n[i] = {
627
+ message: u.message,
628
+ type: u.code
629
629
  };
630
630
  } else
631
- n[u] = { message: s, type: a };
632
- "unionErrors" in t && t.unionErrors.forEach((i) => i.errors.forEach((c) => r.push(c)));
631
+ n[i] = { message: s, type: a };
632
+ "unionErrors" in t && t.unionErrors.forEach((u) => u.errors.forEach((c) => r.push(c)));
633
633
  {
634
- const i = n[u].types, c = i && i[t.code];
635
- n[u] = Ue(
636
- u,
634
+ const u = n[i].types, c = u && u[t.code];
635
+ n[i] = Ue(
636
+ i,
637
637
  e,
638
638
  n,
639
639
  a,
@@ -644,7 +644,7 @@ const cr = (r) => Array.isArray(r == null ? void 0 : r.errors), fr = (r, e) => {
644
644
  }
645
645
  return n;
646
646
  };
647
- function Or(r, e) {
647
+ function Ir(r, e) {
648
648
  return De(
649
649
  async (n, t, a) => {
650
650
  try {
@@ -668,8 +668,8 @@ function lr(r, e) {
668
668
  const n = H(r);
669
669
  return e.forEach((t) => {
670
670
  t.inputTransform && (j(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
671
- const o = T(n, t.path), u = s(o, n);
672
- u && S(n, u.path ?? t.path, u.value);
671
+ const o = _(n, t.path), i = s(o, n);
672
+ i && S(n, i.path ?? t.path, i.value);
673
673
  });
674
674
  }), n;
675
675
  }
@@ -677,21 +677,21 @@ function dr(r, e) {
677
677
  const n = [], t = H(r);
678
678
  return e.forEach((a) => {
679
679
  a.outputTransform && (j(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
680
- const u = T(t, a.path), i = o(u, t);
681
- i && (i.path ? (S(t, i.path, i.value), i.unset && n.push(a.path)) : S(t, a.path, i.value));
680
+ const i = _(t, a.path), u = o(i, t);
681
+ u && (u.path ? (S(t, u.path, u.value), u.unset && n.push(a.path)) : S(t, a.path, u.value));
682
682
  });
683
683
  }), n.forEach((a) => {
684
684
  ye(t, a);
685
685
  }), t;
686
686
  }
687
687
  function K(r) {
688
- return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...K(t.inputs)] : [...n, t], []);
688
+ return r.reduce((n, t) => Array.isArray(t.inputs) ? [...n, t, ...K(t.inputs)] : [...n, t], []);
689
689
  }
690
- function _e(r) {
690
+ function Re(r) {
691
691
  const n = K(r.inputs).reduce((t, a) => {
692
692
  const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
693
693
  return (a.inputTransform || a.outputTransform) && t.push({
694
- ...we(a, "path", "inputTransform", "outputTransform"),
694
+ ...Oe(a, "path", "inputTransform", "outputTransform"),
695
695
  level: a.path.split(".").length,
696
696
  isPrimitive: s
697
697
  }), t;
@@ -700,24 +700,24 @@ function _e(r) {
700
700
  }
701
701
  function mr(r, e, n, t = {}) {
702
702
  const { preserve: a } = t, s = K(r.inputs), o = H(e);
703
- return s.forEach((u) => {
704
- a && a.includes(u.path) || u.isVisible && !u.isVisible(e, n) && ye(o, u.path);
703
+ return s.forEach((i) => {
704
+ a && a.includes(i.path) || i.isVisible && !i.isVisible(e, n) && ye(o, i.path);
705
705
  }), o;
706
706
  }
707
- function wr(r, e) {
708
- const n = _e(e);
707
+ function Or(r, e) {
708
+ const n = Re(e);
709
709
  return lr(r, n);
710
710
  }
711
711
  function jr(r, e, n, t = {}) {
712
- const a = _e(e);
712
+ const a = Re(e);
713
713
  let s = mr(e, r, n, t);
714
714
  return s = dr(s, a), s = nr(s), s;
715
715
  }
716
716
  function Vr(r) {
717
717
  const e = {}, n = (t) => {
718
718
  t.forEach((a) => {
719
- const { default: s, path: o, inputType: u, inputs: i } = a;
720
- (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : s !== void 0 && S(e, o, s);
719
+ const { default: s, path: o, inputs: i } = a;
720
+ Array.isArray(i) ? n(i) : s !== void 0 && S(e, o, s);
721
721
  });
722
722
  };
723
723
  return Array.isArray(r.inputs) && n(r.inputs), e;
@@ -751,7 +751,7 @@ function Pr() {
751
751
  }
752
752
  function qr(r) {
753
753
  return function(e, n) {
754
- const t = r ? T(n, r) : e;
754
+ const t = r ? _(n, r) : e;
755
755
  if (!(typeof t > "u")) {
756
756
  if (pe(t)) return { value: void 0, path: r };
757
757
  if (he(t)) {
@@ -771,7 +771,7 @@ function Ar() {
771
771
  }
772
772
  function kr(r) {
773
773
  return function(e, n) {
774
- const t = T(n, r);
774
+ const t = _(n, r);
775
775
  return typeof t == "string" ? { value: t } : { value: e };
776
776
  };
777
777
  }
@@ -779,7 +779,7 @@ function Nr(r) {
779
779
  return function(e, n) {
780
780
  if (typeof e > "u") return;
781
781
  if (!e) return { value: e };
782
- const t = T(n, r);
782
+ const t = _(n, r);
783
783
  if (typeof t == "object") {
784
784
  const a = hr(t);
785
785
  if (Object.getOwnPropertyNames(a).length === 1)
@@ -791,7 +791,7 @@ function Nr(r) {
791
791
  function Dr(r) {
792
792
  return function(e, n) {
793
793
  if (typeof e > "u") return;
794
- const t = T(n, r);
794
+ const t = _(n, r);
795
795
  return typeof t == "string" ? { value: [t] } : { value: e };
796
796
  };
797
797
  }
@@ -799,7 +799,7 @@ function Mr(r, e) {
799
799
  return function(n, t) {
800
800
  if (typeof n > "u") return;
801
801
  if (!n) return { value: n };
802
- const a = T(t, r);
802
+ const a = _(t, r);
803
803
  if (j(a)) {
804
804
  if (a.length === 1)
805
805
  return { value: a[0], path: r };
@@ -809,33 +809,25 @@ function Mr(r, e) {
809
809
  return { value: n };
810
810
  };
811
811
  }
812
- function Re(r) {
813
- return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !Re(r[e])) : B(r);
812
+ function Te(r) {
813
+ return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !Te(r[e])) : B(r);
814
814
  }
815
815
  function hr(r) {
816
- return ge(r, (e) => typeof e == "object" ? Re(e) : B(e));
816
+ return ge(r, (e) => typeof e == "object" ? Te(e) : B(e));
817
817
  }
818
818
  function L(r) {
819
- const { items: e, ...n } = r;
820
- return /* @__PURE__ */ y.jsx(y.Fragment, { children: e.map((t) => /* @__PURE__ */ y.jsx(
821
- rr,
822
- {
823
- input: t,
824
- path: t.path,
825
- ...n
826
- },
827
- `${t.inputType}_${t.path}`
828
- )) });
819
+ const { items: e, className: n, withoutWrapper: t = !0, ...a } = r, s = e.map((o) => /* @__PURE__ */ y.jsx(rr, { input: o, path: o.path, ...a }, `${o.inputType}_${o.path}`));
820
+ return t ? /* @__PURE__ */ y.jsx(y.Fragment, { children: s }) : /* @__PURE__ */ y.jsx("div", { className: n, children: s });
829
821
  }
830
822
  L.displayName = "RenderInputs";
831
823
  const yr = Me((r, e) => {
832
824
  const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
833
825
  return s ? /* @__PURE__ */ y.jsxs($e, { children: [
834
826
  n.hero,
835
- /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
827
+ /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a })
836
828
  ] }) : /* @__PURE__ */ y.jsxs("div", { className: t, ref: e, children: [
837
829
  n.hero,
838
- /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
830
+ /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a })
839
831
  ] });
840
832
  });
841
833
  yr.displayName = "RenderForm";
@@ -861,7 +853,7 @@ function Br(r) {
861
853
  const {
862
854
  field: { onBlur: e, ...n },
863
855
  ...t
864
- } = Le(r), a = w(Date.now());
856
+ } = Le(r), a = O(Date.now());
865
857
  return {
866
858
  ...t,
867
859
  field: {
@@ -874,23 +866,23 @@ export {
874
866
  Ur as Controller,
875
867
  Lr as Form,
876
868
  Hr as FormProvider,
877
- Tr as InputComponent,
869
+ _r as InputComponent,
878
870
  rr as InputComponentRenderer,
879
871
  be as InputFactory,
880
872
  Ge as InputOverrideError,
881
873
  yr as RenderForm,
882
874
  L as RenderInputs,
883
- _r as RootForm,
875
+ Rr as RootForm,
884
876
  pr as afterFrames,
885
877
  Fr as arrayToObjectOutputTransformer,
886
878
  Vr as collectDefaultValues,
887
- wr as convertDataToFormModel,
879
+ Or as convertDataToFormModel,
888
880
  jr as convertFormModelToData,
889
881
  Zr as generateReadableLabel,
890
882
  Gr as get,
891
- Rr as getDefaultValuesFromFormDefinition,
892
- Ir as getTemporaryPath,
893
- _e as getTransformers,
883
+ Tr as getDefaultValuesFromFormDefinition,
884
+ wr as getTemporaryPath,
885
+ Re as getTransformers,
894
886
  ar as getValidationSchema,
895
887
  lr as inputTransformValues,
896
888
  $r as isChildrenEmpty,
@@ -915,6 +907,6 @@ export {
915
907
  zr as useFormState,
916
908
  ze as useRootFormContext,
917
909
  et as useWatch,
918
- Or as useZodValidationResolver
910
+ Ir as useZodValidationResolver
919
911
  };
920
912
  //# sourceMappingURL=index.js.map