@harnessio/forms 0.12.1 → 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,7 +1,7 @@
1
1
  var we = Object.defineProperty;
2
2
  var Ie = (r, e, n) => e in r ? we(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
3
  var D = (r, e, n) => Ie(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 pe, pick as Oe, isPlainObject as je, isNull as ye, omitBy as ge, isNil as Ve, isString as xe, capitalize as Fe } from "lodash-es";
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
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";
@@ -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,30 +115,30 @@ 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
- var p = Xe();
141
+ var y = Xe();
142
142
  const ve = qe({});
143
143
  function Ye({
144
144
  children: r,
@@ -146,7 +146,7 @@ function Ye({
146
146
  inputErrorHandler: n,
147
147
  readonly: t
148
148
  }) {
149
- return /* @__PURE__ */ p.jsx(
149
+ return /* @__PURE__ */ y.jsx(
150
150
  ve.Provider,
151
151
  {
152
152
  value: {
@@ -181,35 +181,35 @@ class er extends ke {
181
181
  (o = (s = this.props).inputErrorHandler) == null || o.call(s, a);
182
182
  }
183
183
  render() {
184
- return this.state.hasError ? /* @__PURE__ */ p.jsx(p.Fragment, {}) : this.props.children;
184
+ return this.state.hasError ? /* @__PURE__ */ y.jsx(y.Fragment, {}) : this.props.children;
185
185
  }
186
186
  }
187
187
  const ce = ({
188
188
  children: r,
189
189
  withoutWrapper: e = !1
190
- }) => e || !r ? r : /* @__PURE__ */ p.jsx("div", { children: r }), rr = Ne(function({
190
+ }) => e || !r ? r : /* @__PURE__ */ y.jsx("div", { children: r }), rr = Ne(function({
191
191
  path: e,
192
192
  factory: n,
193
193
  onUpdate: t,
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(), 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"), 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]), w = !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
209
  if (!w || 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;
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, w]), 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 = $(() => w ? /* @__PURE__ */ p.jsxs(p.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
- /* @__PURE__ */ p.jsx(er, { path: e, inputType: o.inputType, inputErrorHandler: h, children: y == null ? void 0 : y.renderComponent(X) }),
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, [w, o.before, o.inputType, o.after, e, y, X, c.errors]);
231
- return y ? /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: Ce }) : /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: /* @__PURE__ */ p.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
- }), y = O(!1), g = O(JSON.stringify(t ?? {}));
283
+ }), p = O(!1), g = O(JSON.stringify(t ?? {}));
284
284
  I(() => {
285
285
  g.current = JSON.stringify(t ?? {}), h.reset(t, {});
286
286
  }, [h.reset, t]), I(() => {
287
- const b = fe(), _ = le(), v = b(() => {
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
303
  const { handleSubmit: x } = h, E = O(s);
304
304
  I(() => {
305
305
  E.current = s;
306
306
  }, [s]);
307
- const R = O(o);
307
+ const T = O(o);
308
308
  I(() => {
309
- R.current = o;
309
+ T.current = o;
310
310
  }, [o]);
311
311
  const C = O(!1);
312
312
  I(() => {
313
- const b = h.watch((_) => {
313
+ const b = h.watch((R) => {
314
314
  var v;
315
- C.current || JSON.stringify(_ ?? {}) !== g.current && ((v = E.current) == null || v.call(E, { ..._ }), y.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
  });
@@ -327,28 +327,28 @@ function _r(r) {
327
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 });
330
+ (b = T.current) == null || b.call(T, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
331
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__ */ p.jsx(Ye, { metadata: c, readonly: l, inputErrorHandler: i, children: /* @__PURE__ */ p.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 && (y.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;
@@ -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
- ]), y = de(m, u, e, n, h);
436
- t[a] = y;
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), y = de(m, u, e, n, h);
439
- t[a] = y;
440
- } else if (m && u) {
441
- const l = ir(m, u, e, n);
434
+ Se(i, n)
435
+ ]), p = de(m, i, e, n, h);
436
+ t[a] = p;
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
+ t[a] = p;
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,18 +531,18 @@ 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 y = 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
- M(y, {
541
+ M(p, {
542
542
  _schema: (c = s.validation) == null ? void 0 : c.schema,
543
543
  _input: s
544
544
  })
545
- ) : s.required && S(r, s.path, M(y, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
545
+ ) : s.required && S(r, s.path, M(p, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
546
546
  const g = {};
547
547
  Z(
548
548
  g,
@@ -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") {
@@ -566,7 +566,7 @@ function Z(r, e, n, t, a) {
566
566
  ), S(
567
567
  r,
568
568
  s.path,
569
- M(y, {
569
+ M(p, {
570
570
  _schemaObj: g,
571
571
  _schema: (h = s.validation) == null ? void 0 : h.schema,
572
572
  _isArrayItem: !0,
@@ -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,
@@ -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,17 +677,17 @@ 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
- pe(t, a);
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({
@@ -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) && pe(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
707
  function Or(r, e) {
708
- const n = _e(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,9 +751,9 @@ 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
- if (ye(t)) return { value: void 0, path: r };
756
+ if (pe(t)) return { value: void 0, path: r };
757
757
  if (he(t)) {
758
758
  const a = ge(t, Ve);
759
759
  if (k(a))
@@ -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,35 +809,35 @@ 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, className: n, withoutWrapper: t = !0, ...a } = r, s = e.map((o) => /* @__PURE__ */ p.jsx(rr, { input: o, path: o.path, ...a }, `${o.inputType}_${o.path}`));
820
- return t ? /* @__PURE__ */ p.jsx(p.Fragment, { children: s }) : /* @__PURE__ */ p.jsx("div", { className: n, children: s });
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 });
821
821
  }
822
822
  L.displayName = "RenderInputs";
823
- const pr = Me((r, e) => {
823
+ const yr = Me((r, e) => {
824
824
  const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
825
- return s ? /* @__PURE__ */ p.jsxs($e, { children: [
825
+ return s ? /* @__PURE__ */ y.jsxs($e, { children: [
826
826
  n.hero,
827
- /* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a })
828
- ] }) : /* @__PURE__ */ p.jsxs("div", { className: t, ref: e, children: [
827
+ /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a })
828
+ ] }) : /* @__PURE__ */ y.jsxs("div", { className: t, ref: e, children: [
829
829
  n.hero,
830
- /* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a })
830
+ /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a })
831
831
  ] });
832
832
  });
833
- pr.displayName = "RenderForm";
833
+ yr.displayName = "RenderForm";
834
834
  function $r(r) {
835
835
  let e = !0;
836
836
  return me(r, (n) => {
837
- e = e && (n === "" || ye(n) || B(n));
837
+ e = e && (n === "" || pe(n) || B(n));
838
838
  }), e;
839
839
  }
840
- const Zr = (r = "") => Fe(r.split("_").join(" ")), yr = (r, e = 2, n, t = 1e3) => {
840
+ const Zr = (r = "") => Fe(r.split("_").join(" ")), pr = (r, e = 2, n, t = 1e3) => {
841
841
  let a = !1;
842
842
  const s = () => {
843
843
  requestAnimationFrame(() => {
@@ -858,7 +858,7 @@ function Br(r) {
858
858
  ...t,
859
859
  field: {
860
860
  ...n,
861
- onBlur: yr(e, 2, a.current)
861
+ onBlur: pr(e, 2, a.current)
862
862
  }
863
863
  };
864
864
  }
@@ -866,23 +866,23 @@ export {
866
866
  Ur as Controller,
867
867
  Lr as Form,
868
868
  Hr as FormProvider,
869
- Tr as InputComponent,
869
+ _r as InputComponent,
870
870
  rr as InputComponentRenderer,
871
871
  be as InputFactory,
872
872
  Ge as InputOverrideError,
873
- pr as RenderForm,
873
+ yr as RenderForm,
874
874
  L as RenderInputs,
875
- _r as RootForm,
876
- yr as afterFrames,
875
+ Rr as RootForm,
876
+ pr as afterFrames,
877
877
  Fr as arrayToObjectOutputTransformer,
878
878
  Vr as collectDefaultValues,
879
879
  Or as convertDataToFormModel,
880
880
  jr as convertFormModelToData,
881
881
  Zr as generateReadableLabel,
882
882
  Gr as get,
883
- Rr as getDefaultValuesFromFormDefinition,
883
+ Tr as getDefaultValuesFromFormDefinition,
884
884
  wr as getTemporaryPath,
885
- _e as getTransformers,
885
+ Re as getTransformers,
886
886
  ar as getValidationSchema,
887
887
  lr as inputTransformValues,
888
888
  $r as isChildrenEmpty,