@harnessio/forms 0.1.2 → 0.1.3

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,21 +1,21 @@
1
1
  var ne = Object.defineProperty;
2
2
  var se = (r, e, n) => e in r ? ne(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var q = (r, e, n) => se(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { isEmpty as j, cloneDeep as x, set as g, get as b, forOwn as G, isArray as E, isObject as H, merge as C, isUndefined as P, pick as ae, unset as ue, isNull as Q, omitBy as X, isNil as oe, isString as ie, capitalize as ce } from "lodash-es";
5
- import fe, { createContext as de, useContext as le, useMemo as M, useRef as F, useEffect as S, useCallback as me, forwardRef as he, Fragment as pe } from "react";
6
- import { useFormContext as ye, useForm as ge, FormProvider as be, appendErrors as ve } from "react-hook-form";
3
+ var P = (r, e, n) => se(r, typeof e != "symbol" ? e + "" : e, n);
4
+ import { isEmpty as j, cloneDeep as x, set as g, get as b, forOwn as G, isArray as E, isObject as H, merge as C, isUndefined as q, pick as ae, unset as ue, isNull as Q, omitBy as X, isNil as oe, isString as ie, capitalize as ce } from "lodash-es";
5
+ import fe, { createContext as le, useContext as de, useMemo as B, useRef as F, useEffect as S, useCallback as me, forwardRef as he, Fragment as pe } from "react";
6
+ import { useFormContext as ye, useForm as ge, FormProvider as be, appendErrors as ve, useController as _e } from "react-hook-form";
7
7
  export * from "react-hook-form";
8
8
  import * as m from "zod";
9
- import { toNestErrors as _e } from "@hookform/resolvers";
10
- class Ee extends Error {
9
+ import { toNestErrors as Ee } from "@hookform/resolvers";
10
+ class Re extends Error {
11
11
  constructor(e) {
12
12
  super(`Input component '${e}' is already registered.`);
13
13
  }
14
14
  }
15
15
  class Y {
16
16
  constructor(e) {
17
- q(this, "componentBank");
18
- q(this, "allowOverride");
17
+ P(this, "componentBank");
18
+ P(this, "allowOverride");
19
19
  this.allowOverride = (e == null ? void 0 : e.allowOverride) ?? !1, this.componentBank = /* @__PURE__ */ new Map();
20
20
  }
21
21
  /**
@@ -26,7 +26,7 @@ class Y {
26
26
  */
27
27
  registerComponent(e) {
28
28
  if (!this.allowOverride && this.getComponent(e.internalType))
29
- throw new Ee(e.internalType);
29
+ throw new Re(e.internalType);
30
30
  this.componentBank.set(e.internalType, e);
31
31
  }
32
32
  getComponent(e) {
@@ -61,10 +61,10 @@ object-assign
61
61
  (c) Sindre Sorhus
62
62
  @license MIT
63
63
  */
64
- var k, B;
65
- function Re() {
66
- if (B) return k;
67
- B = 1;
64
+ var k, M;
65
+ function Oe() {
66
+ if (M) return k;
67
+ M = 1;
68
68
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
69
69
  function t(s) {
70
70
  if (s == null)
@@ -96,12 +96,12 @@ function Re() {
96
96
  return k = 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
- for (var d in u)
100
- e.call(u, d) && (i[d] = u[d]);
99
+ for (var l in u)
100
+ e.call(u, l) && (i[l] = u[l]);
101
101
  if (r) {
102
102
  c = r(u);
103
- for (var l = 0; l < c.length; l++)
104
- n.call(u, c[l]) && (i[c[l]] = u[c[l]]);
103
+ for (var d = 0; d < c.length; d++)
104
+ n.call(u, c[d]) && (i[c[d]] = u[c[d]]);
105
105
  }
106
106
  }
107
107
  return i;
@@ -116,9 +116,9 @@ function Re() {
116
116
  * LICENSE file in the root directory of this source tree.
117
117
  */
118
118
  var $;
119
- function Oe() {
119
+ function Se() {
120
120
  if ($) return _;
121
- $ = 1, Re();
121
+ $ = 1, Oe();
122
122
  var r = fe, e = 60103;
123
123
  if (_.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
124
124
  var n = Symbol.for;
@@ -126,21 +126,21 @@ function Oe() {
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) {
129
- var f, d = {}, l = null, p = null;
130
- c !== void 0 && (l = "" + c), i.key !== void 0 && (l = "" + i.key), i.ref !== void 0 && (p = i.ref);
131
- for (f in i) a.call(i, f) && !s.hasOwnProperty(f) && (d[f] = i[f]);
132
- if (u && u.defaultProps) for (f in i = u.defaultProps, i) d[f] === void 0 && (d[f] = i[f]);
133
- return { $$typeof: e, type: u, key: l, ref: p, props: d, _owner: t.current };
129
+ var f, l = {}, d = null, p = null;
130
+ c !== void 0 && (d = "" + c), i.key !== void 0 && (d = "" + i.key), i.ref !== void 0 && (p = i.ref);
131
+ for (f in i) a.call(i, f) && !s.hasOwnProperty(f) && (l[f] = i[f]);
132
+ if (u && u.defaultProps) for (f in i = u.defaultProps, i) l[f] === void 0 && (l[f] = i[f]);
133
+ return { $$typeof: e, type: u, key: d, ref: p, props: l, _owner: t.current };
134
134
  }
135
135
  return _.jsx = o, _.jsxs = o, _;
136
136
  }
137
137
  var J;
138
- function Se() {
139
- return J || (J = 1, A.exports = Oe()), A.exports;
138
+ function Te() {
139
+ return J || (J = 1, A.exports = Se()), A.exports;
140
140
  }
141
- var h = Se();
142
- const K = de({});
143
- function Te({ children: r, metadata: e }) {
141
+ var h = Te();
142
+ const K = le({});
143
+ function je({ children: r, metadata: e }) {
144
144
  return /* @__PURE__ */ h.jsx(
145
145
  K.Provider,
146
146
  {
@@ -151,15 +151,15 @@ function Te({ children: r, metadata: e }) {
151
151
  }
152
152
  );
153
153
  }
154
- function je() {
155
- const r = le(K);
154
+ function Ie() {
155
+ const r = de(K);
156
156
  return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
157
157
  }
158
158
  const L = ({
159
159
  children: r,
160
160
  withoutWrapper: e = !1
161
161
  }) => e || !r ? r : /* @__PURE__ */ h.jsx("div", { children: r });
162
- function Ie({
162
+ function Ce({
163
163
  path: r,
164
164
  factory: e,
165
165
  onUpdate: n,
@@ -172,7 +172,7 @@ function Ie({
172
172
  const { formState: i, watch: c } = ye(), {
173
173
  fixedValues: f = {}
174
174
  /*getValuesWithDependencies*/
175
- } = {}, { metadata: d } = je(), l = e == null ? void 0 : e.getComponent(o.inputType), p = M(
175
+ } = {}, { metadata: l } = Ie(), d = e == null ? void 0 : e.getComponent(o.inputType), p = B(
176
176
  () => ({
177
177
  path: r,
178
178
  key: r,
@@ -189,23 +189,23 @@ function Ie({
189
189
  const te = f[y];
190
190
  g(v, y, te);
191
191
  });
192
- const O = !o.isVisible || (o == null ? void 0 : o.isVisible(v, d)), I = M(() => O ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
192
+ const O = !o.isVisible || (o == null ? void 0 : o.isVisible(v, l)), I = B(() => O ? /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
193
193
  o.before ? o.before : null,
194
- l == null ? void 0 : l.renderComponent(p),
194
+ d == null ? void 0 : d.renderComponent(p),
195
195
  o.after ? o.after : null
196
- ] }) : null, [p, o.after, o.before, l, O, i.errors]);
197
- return l ? /* @__PURE__ */ h.jsx(L, { withoutWrapper: u, children: I }) : /* @__PURE__ */ h.jsx(L, { withoutWrapper: u, children: /* @__PURE__ */ h.jsxs("p", { children: [
196
+ ] }) : null, [p, o.after, o.before, d, O, i.errors]);
197
+ return d ? /* @__PURE__ */ h.jsx(L, { withoutWrapper: u, children: I }) : /* @__PURE__ */ h.jsx(L, { withoutWrapper: u, children: /* @__PURE__ */ h.jsxs("p", { children: [
198
198
  "Input component not found (internal type: ",
199
199
  o.inputType,
200
200
  ")"
201
201
  ] }) });
202
202
  }
203
- class Be {
203
+ class Je {
204
204
  getType() {
205
205
  return this.internalType;
206
206
  }
207
207
  }
208
- function $e(r) {
208
+ function Le(r) {
209
209
  const {
210
210
  mode: e = "onSubmit",
211
211
  resolver: n,
@@ -222,18 +222,18 @@ function $e(r) {
222
222
  children: c,
223
223
  // fixedValues
224
224
  autoFocusPath: f
225
- } = r, d = ge({
225
+ } = r, l = ge({
226
226
  mode: e ?? "onSubmit",
227
227
  reValidateMode: "onChange",
228
228
  defaultValues: t,
229
229
  shouldFocusError: a,
230
230
  resolver: n
231
- }), l = F(!1);
231
+ }), d = F(!1);
232
232
  S(() => {
233
- d.reset(t, {});
234
- }, [d.reset, t]), S(() => {
233
+ l.reset(t, {});
234
+ }, [l.reset, t]), S(() => {
235
235
  const y = requestIdleCallback(() => {
236
- d.reset({}, {
236
+ l.reset({}, {
237
237
  keepErrors: !0,
238
238
  keepDirty: !0,
239
239
  keepDirtyValues: !0,
@@ -248,13 +248,13 @@ function $e(r) {
248
248
  });
249
249
  return () => cancelIdleCallback(y);
250
250
  }, []);
251
- const { getValues: p, handleSubmit: R } = d, v = p(), O = F(!0);
251
+ const { getValues: p, handleSubmit: R } = l, v = p(), O = F(!0);
252
252
  S(() => {
253
253
  if (O.current) {
254
254
  O.current = !1;
255
255
  return;
256
256
  }
257
- s == null || s({ ...v }), l.current === !0 && d.trigger();
257
+ s == null || s({ ...v }), d.current === !0 && l.trigger();
258
258
  }, [JSON.stringify(v)]);
259
259
  const I = F(!0);
260
260
  return S(() => {
@@ -262,30 +262,30 @@ function $e(r) {
262
262
  I.current = !1;
263
263
  return;
264
264
  }
265
- o == null || o({ isValid: d.formState.isValid, isSubmitted: d.formState.isSubmitted });
266
- }, [d.formState.isValid, d.formState.isSubmitted]), S(() => {
265
+ o == null || o({ isValid: l.formState.isValid, isSubmitted: l.formState.isSubmitted });
266
+ }, [l.formState.isValid, l.formState.isSubmitted]), S(() => {
267
267
  if (f)
268
268
  if ("requestIdleCallback" in window) {
269
269
  const y = requestIdleCallback(() => {
270
- d.setFocus(f);
270
+ l.setFocus(f);
271
271
  });
272
272
  return () => cancelIdleCallback(y);
273
273
  } else {
274
274
  const y = setTimeout(() => {
275
- d.setFocus(f);
275
+ l.setFocus(f);
276
276
  }, 100);
277
277
  return () => clearTimeout(y);
278
278
  }
279
- }, [d]), /* @__PURE__ */ h.jsx(Te, { metadata: i, children: /* @__PURE__ */ h.jsx(be, { ...d, children: typeof c == "function" ? c({
280
- ...d,
279
+ }, [l]), /* @__PURE__ */ h.jsx(je, { metadata: i, children: /* @__PURE__ */ h.jsx(be, { ...l, children: typeof c == "function" ? c({
280
+ ...l,
281
281
  submitForm: async () => {
282
- u && (l.current = !0, R((y) => {
282
+ u && (d.current = !0, R((y) => {
283
283
  u(y);
284
284
  })());
285
285
  }
286
286
  }) : c }) });
287
287
  }
288
- const Je = (r) => {
288
+ const Ue = (r) => {
289
289
  const e = {}, n = (t) => {
290
290
  t.forEach((a) => {
291
291
  const { path: s, default: o, inputType: u, inputs: i } = a;
@@ -294,24 +294,24 @@ const Je = (r) => {
294
294
  };
295
295
  return Array.isArray(r.inputs) && n(r.inputs), e;
296
296
  };
297
- function Le(r, e) {
297
+ function We(r, e) {
298
298
  const n = r.inputs.map((t) => {
299
- const a = Ce(e, t.path);
299
+ const a = Ve(e, t.path);
300
300
  return a || t;
301
301
  });
302
302
  return { ...r, inputs: n };
303
303
  }
304
- function Ce(r, e) {
304
+ function Ve(r, e) {
305
305
  return r.inputs.find((n) => n.path === e);
306
306
  }
307
- const z = "__temp_", Ue = (r) => z + r.split(".").join("__");
308
- function We(r) {
307
+ const z = "__temp_", Ge = (r) => z + r.split(".").join("__");
308
+ function He(r) {
309
309
  const e = { ...r };
310
310
  return G(e, (n, t) => {
311
311
  t.startsWith(z) && delete e[t];
312
312
  }), e;
313
313
  }
314
- const Ve = "Required field";
314
+ const we = "Required field";
315
315
  function T(r) {
316
316
  const e = typeof r == "string" ? JSON.parse(r) : r;
317
317
  if (typeof e == "string")
@@ -321,7 +321,7 @@ function T(r) {
321
321
  const n = e;
322
322
  return H(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
323
323
  }
324
- function we(r, e, n) {
324
+ function xe(r, e, n) {
325
325
  let t = {};
326
326
  if (w(t, r.inputs, e, n), n != null && n.prefix) {
327
327
  const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
@@ -342,18 +342,18 @@ function V(r, e, n) {
342
342
  /*...nestedSchemaObj*/
343
343
  } = r[a];
344
344
  if (i && o && u) {
345
- const d = m.array(m.object(V(o, e, n))).optional(), l = U(f, u, e, n, d);
346
- t[a] = l;
345
+ const l = m.array(m.object(V(o, e, n))).optional(), d = U(f, u, e, n, l);
346
+ t[a] = d;
347
347
  } else if (c && u) {
348
- const d = o != null && o.___array ? V({ ___array: o.___array }, e, n) : { ___array: m.any() }, l = m.array(d.___array).optional(), p = U(f, u, e, n, l);
348
+ const l = o != null && o.___array ? V({ ___array: o.___array }, e, n) : { ___array: m.any() }, d = m.array(l.___array).optional(), p = U(f, u, e, n, d);
349
349
  t[a] = p;
350
350
  } else if (f && u) {
351
- const d = xe(f, u, e, n);
352
- t[a] = d;
351
+ const l = qe(f, u, e, n);
352
+ t[a] = l;
353
353
  } else s && u ? t[a] = D(u, n) : t[a] = m.object(V(r[a], e, n)).optional();
354
354
  }), t;
355
355
  }
356
- function xe(r, e, n, t) {
356
+ function qe(r, e, n, t) {
357
357
  return m.any().optional().superRefine(async (a, s) => {
358
358
  var u, i;
359
359
  if (e.required && !(await D(e, t).safeParseAsync(a)).success)
@@ -375,10 +375,10 @@ function xe(r, e, n, t) {
375
375
  if (o) {
376
376
  const c = await o.safeParseAsync(a);
377
377
  if (!c.success) {
378
- const f = T(c == null ? void 0 : c.error.message), d = f === "Required" ? N(e, t) : f;
378
+ const f = T(c == null ? void 0 : c.error.message), l = f === "Required" ? N(e, t) : f;
379
379
  s.addIssue({
380
380
  code: m.ZodIssueCode.custom,
381
- message: d
381
+ message: l
382
382
  });
383
383
  }
384
384
  }
@@ -386,22 +386,22 @@ function xe(r, e, n, t) {
386
386
  }
387
387
  function U(r, e, n, t, a) {
388
388
  return m.any().optional().superRefine(async (s, o) => {
389
- var f, d;
389
+ var f, l;
390
390
  const i = await D(e, t).safeParseAsync(s);
391
391
  if (e.required && !i.success) {
392
- const l = T(i.error.message);
393
- return o.addIssue({ code: m.ZodIssueCode.custom, message: l, fatal: !0 }), m.NEVER;
392
+ const d = T(i.error.message);
393
+ return o.addIssue({ code: m.ZodIssueCode.custom, message: d, fatal: !0 }), m.NEVER;
394
394
  }
395
395
  if (!e.required && !i.success)
396
396
  return m.NEVER;
397
397
  if ((f = t == null ? void 0 : t.validationConfig) != null && f.globalValidation) {
398
- const l = (d = t == null ? void 0 : t.validationConfig) == null ? void 0 : d.globalValidation(s, e, t.metadata);
399
- if (l.error)
398
+ const d = (l = t == null ? void 0 : t.validationConfig) == null ? void 0 : l.globalValidation(s, e, t.metadata);
399
+ if (d.error)
400
400
  return o.addIssue({
401
401
  code: m.ZodIssueCode.custom,
402
- message: T(l.error)
402
+ message: T(d.error)
403
403
  }), m.NEVER;
404
- if (!l.continue)
404
+ if (!d.continue)
405
405
  return m.NEVER;
406
406
  }
407
407
  if (!E(s))
@@ -411,29 +411,29 @@ function U(r, e, n, t, a) {
411
411
  }), m.NEVER;
412
412
  const c = ee(r, n);
413
413
  if (c) {
414
- const l = await c.safeParseAsync(s);
415
- if (!l.success)
414
+ const d = await c.safeParseAsync(s);
415
+ if (!d.success)
416
416
  return o.addIssue({
417
417
  code: m.ZodIssueCode.custom,
418
- message: T(l.error.message)
418
+ message: T(d.error.message)
419
419
  }), m.NEVER;
420
420
  }
421
421
  }).pipe(a ?? m.any());
422
422
  }
423
423
  function w(r, e, n, t, a) {
424
424
  e.forEach((s) => {
425
- var u, i, c, f, d;
425
+ var u, i, c, f, l;
426
426
  const o = n;
427
427
  if (!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) {
428
- const l = b(r, s.path);
428
+ const d = b(r, s.path);
429
429
  if ((i = s.validation) != null && i.schema ? g(
430
430
  r,
431
431
  s.path,
432
- C(l, {
432
+ C(d, {
433
433
  _schema: (c = s.validation) == null ? void 0 : c.schema,
434
434
  _input: s
435
435
  })
436
- ) : s.required && g(r, s.path, C(l, { _requiredOnly: !0, _input: s })), s.inputs && w(r, s.inputs, n, t), s.inputType === "list") {
436
+ ) : s.required && g(r, s.path, C(d, { _requiredOnly: !0, _input: s })), s.inputs && w(r, s.inputs, n, t), s.inputType === "list") {
437
437
  const p = {};
438
438
  w(
439
439
  p,
@@ -457,9 +457,9 @@ function w(r, e, n, t, a) {
457
457
  ), g(
458
458
  r,
459
459
  s.path,
460
- C(l, {
460
+ C(d, {
461
461
  _schemaObj: p,
462
- _schema: (d = s.validation) == null ? void 0 : d.schema,
462
+ _schema: (l = s.validation) == null ? void 0 : l.schema,
463
463
  _isArrayItem: !0,
464
464
  _input: s
465
465
  })
@@ -470,7 +470,7 @@ function w(r, e, n, t, a) {
470
470
  }
471
471
  function N(r, e) {
472
472
  var n, t, a;
473
- 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) ?? Ve;
473
+ 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) ?? we;
474
474
  }
475
475
  function D(r, e) {
476
476
  var t, a, s, o, u, i;
@@ -483,7 +483,7 @@ function D(r, e) {
483
483
  typeof c == "object" && j(c) && f.addIssue({
484
484
  code: m.ZodIssueCode.custom,
485
485
  message: n
486
- }), (P(c) || c === "") && f.addIssue({
486
+ }), (q(c) || c === "") && f.addIssue({
487
487
  code: m.ZodIssueCode.custom,
488
488
  message: n
489
489
  });
@@ -495,7 +495,7 @@ function ee(r, e) {
495
495
  if (typeof r == "function")
496
496
  return r(e);
497
497
  }
498
- const Pe = (r) => Array.isArray(r == null ? void 0 : r.errors), qe = (r, e) => {
498
+ const Pe = (r) => Array.isArray(r == null ? void 0 : r.errors), Fe = (r, e) => {
499
499
  const n = {};
500
500
  for (; r.length; ) {
501
501
  const t = r[0], { code: a, message: s, path: o } = t, u = o.join(".");
@@ -523,11 +523,11 @@ const Pe = (r) => Array.isArray(r == null ? void 0 : r.errors), qe = (r, e) => {
523
523
  }
524
524
  return n;
525
525
  };
526
- function Ge(r, e) {
526
+ function Qe(r, e) {
527
527
  return me(
528
528
  async (n, t, a) => {
529
529
  try {
530
- return await we(r, n, e).parseAsync(n), {
530
+ return await xe(r, n, e).parseAsync(n), {
531
531
  values: n,
532
532
  // TODO: check this - values does not contains all data
533
533
  errors: {}
@@ -536,7 +536,7 @@ function Ge(r, e) {
536
536
  if (Pe(s))
537
537
  return {
538
538
  values: {},
539
- errors: _e(qe(s.errors, !0), a)
539
+ errors: Ee(Fe(s.errors, !0), a)
540
540
  };
541
541
  throw s;
542
542
  }
@@ -544,7 +544,7 @@ function Ge(r, e) {
544
544
  [r]
545
545
  );
546
546
  }
547
- function He(r, e) {
547
+ function Xe(r, e) {
548
548
  const n = x(r);
549
549
  return e.forEach((t) => {
550
550
  t.inputTransform && (E(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
@@ -553,7 +553,7 @@ function He(r, e) {
553
553
  });
554
554
  }), n;
555
555
  }
556
- function Qe(r, e) {
556
+ function Ye(r, e) {
557
557
  const n = x(r);
558
558
  return e.forEach((t) => {
559
559
  t.outputTransform && (E(t.outputTransform) ? t.outputTransform : [t.outputTransform]).forEach((s) => {
@@ -565,7 +565,7 @@ function Qe(r, e) {
565
565
  function Z(r) {
566
566
  return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...Z(t.inputs)] : [...n, t], []);
567
567
  }
568
- function Xe(r) {
568
+ function Ke(r) {
569
569
  const n = Z(r.inputs).reduce((t, a) => {
570
570
  const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
571
571
  return (a.inputTransform || a.outputTransform) && t.push({
@@ -576,13 +576,13 @@ function Xe(r) {
576
576
  }, []);
577
577
  return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
578
578
  }
579
- function Ye(r, e, n) {
579
+ function ze(r, e, n) {
580
580
  const t = Z(r.inputs), a = x(e);
581
581
  return t.forEach((s) => {
582
582
  s.isVisible && !s.isVisible(e, n) && ue(a, s.path);
583
583
  }), a;
584
584
  }
585
- function Ke(r) {
585
+ function er(r) {
586
586
  const e = {}, n = (t) => {
587
587
  t.forEach((a) => {
588
588
  const { default: s, path: o, inputType: u, inputs: i } = a;
@@ -591,7 +591,7 @@ function Ke(r) {
591
591
  };
592
592
  return Array.isArray(r.inputs) && n(r.inputs), e;
593
593
  }
594
- function ze() {
594
+ function rr() {
595
595
  return function(r, e) {
596
596
  if (!(typeof r > "u"))
597
597
  return r ? {
@@ -599,7 +599,7 @@ function ze() {
599
599
  } : { value: r };
600
600
  };
601
601
  }
602
- function er(r) {
602
+ function tr(r) {
603
603
  return function(e, n) {
604
604
  if (typeof e > "u") return;
605
605
  if (!e) return { value: e };
@@ -609,13 +609,13 @@ function er(r) {
609
609
  return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
610
610
  };
611
611
  }
612
- function rr() {
612
+ function nr() {
613
613
  return function(r, e) {
614
614
  if (!(typeof r > "u"))
615
615
  return E(r) && j(r) ? { value: void 0 } : { value: r };
616
616
  };
617
617
  }
618
- function tr(r) {
618
+ function sr(r) {
619
619
  return function(e, n) {
620
620
  const t = r ? b(n, r) : e;
621
621
  if (!(typeof t > "u")) {
@@ -629,39 +629,39 @@ function tr(r) {
629
629
  }
630
630
  };
631
631
  }
632
- function nr() {
632
+ function ar() {
633
633
  return function(r, e) {
634
634
  if (!(typeof r > "u"))
635
635
  return ie(r) && j(r) ? { value: void 0 } : { value: r };
636
636
  };
637
637
  }
638
- function sr(r) {
638
+ function ur(r) {
639
639
  return function(e, n) {
640
640
  const t = b(n, r);
641
641
  return typeof t == "string" ? { value: t } : { value: e };
642
642
  };
643
643
  }
644
- function ar(r) {
644
+ function or(r) {
645
645
  return function(e, n) {
646
646
  if (typeof e > "u") return;
647
647
  if (!e) return { value: e };
648
648
  const t = b(n, r);
649
649
  if (typeof t == "object") {
650
- const a = Fe(t);
650
+ const a = Ae(t);
651
651
  if (Object.getOwnPropertyNames(a).length === 1)
652
652
  return { value: e, path: r };
653
653
  }
654
654
  return { value: e };
655
655
  };
656
656
  }
657
- function ur(r) {
657
+ function ir(r) {
658
658
  return function(e, n) {
659
659
  if (typeof e > "u") return;
660
660
  const t = b(n, r);
661
661
  return typeof t == "string" ? { value: [t] } : { value: e };
662
662
  };
663
663
  }
664
- function or(r, e) {
664
+ function cr(r, e) {
665
665
  return function(n, t) {
666
666
  if (typeof n > "u") return;
667
667
  if (!n) return { value: n };
@@ -676,15 +676,15 @@ function or(r, e) {
676
676
  };
677
677
  }
678
678
  function re(r) {
679
- return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !re(r[e])) : P(r);
679
+ return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !re(r[e])) : q(r);
680
680
  }
681
- function Fe(r) {
682
- return X(r, (e) => typeof e == "object" ? re(e) : P(e));
681
+ function Ae(r) {
682
+ return X(r, (e) => typeof e == "object" ? re(e) : q(e));
683
683
  }
684
684
  function W(r) {
685
685
  const { items: e, ...n } = r;
686
686
  return /* @__PURE__ */ h.jsx(h.Fragment, { children: e.map((t) => /* @__PURE__ */ h.jsx(
687
- Ie,
687
+ Ce,
688
688
  {
689
689
  input: t,
690
690
  path: t.path,
@@ -694,7 +694,7 @@ function W(r) {
694
694
  `${t.inputType}_${t.path}_${t.label}`
695
695
  )) });
696
696
  }
697
- const Ae = he((r, e) => {
697
+ const ke = he((r, e) => {
698
698
  const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
699
699
  return s ? /* @__PURE__ */ h.jsxs(pe, { children: [
700
700
  n.hero,
@@ -704,45 +704,70 @@ const Ae = he((r, e) => {
704
704
  /* @__PURE__ */ h.jsx(W, { items: n.inputs, factory: a, withoutWrapper: s })
705
705
  ] });
706
706
  });
707
- Ae.displayName = "RenderForm";
708
- function ir(r) {
707
+ ke.displayName = "RenderForm";
708
+ function fr(r) {
709
709
  let e = !0;
710
710
  return G(r, (n) => {
711
- e = e && (n === "" || Q(n) || P(n));
711
+ e = e && (n === "" || Q(n) || q(n));
712
712
  }), e;
713
713
  }
714
- const cr = (r = "") => ce(r.split("_").join(" "));
714
+ const lr = (r = "") => ce(r.split("_").join(" ")), Ne = (r, e = 2) => {
715
+ let n = !1;
716
+ const t = () => {
717
+ requestAnimationFrame(() => {
718
+ n || (e -= 1, e <= 0 ? r() : t());
719
+ });
720
+ };
721
+ return t(), () => {
722
+ n = !0;
723
+ };
724
+ };
725
+ function dr(r) {
726
+ const {
727
+ field: { onBlur: e, ...n },
728
+ ...t
729
+ } = _e(r);
730
+ return {
731
+ ...t,
732
+ field: {
733
+ ...n,
734
+ onBlur: Ne(e)
735
+ }
736
+ };
737
+ }
715
738
  export {
716
- Be as InputComponent,
717
- Ie as InputComponentRenderer,
739
+ Je as InputComponent,
740
+ Ce as InputComponentRenderer,
718
741
  Y as InputFactory,
719
- Ee as InputOverrideError,
720
- Ae as RenderForm,
742
+ Re as InputOverrideError,
743
+ ke as RenderForm,
721
744
  W as RenderInputs,
722
- $e as RootForm,
723
- er as arrayToObjectOutputTransformer,
724
- Ke as collectDefaultValues,
725
- cr as generateReadableLabel,
726
- Je as getDefaultValuesFromFormDefinition,
727
- Ue as getTemporaryPath,
728
- Xe as getTransformers,
729
- we as getValidationSchema,
730
- He as inputTransformValues,
731
- ir as isChildrenEmpty,
732
- ze as objectToArrayInputTransformer,
733
- Qe as outputTransformValues,
734
- Le as overrideFormDefinition,
745
+ Le as RootForm,
746
+ Ne as afterFrames,
747
+ tr as arrayToObjectOutputTransformer,
748
+ er as collectDefaultValues,
749
+ lr as generateReadableLabel,
750
+ Ue as getDefaultValuesFromFormDefinition,
751
+ Ge as getTemporaryPath,
752
+ Ke as getTransformers,
753
+ xe as getValidationSchema,
754
+ Xe as inputTransformValues,
755
+ fr as isChildrenEmpty,
756
+ rr as objectToArrayInputTransformer,
757
+ Ye as outputTransformValues,
758
+ We as overrideFormDefinition,
735
759
  T as processValidationParseResponse,
736
- We as removeTemporaryFieldsValue,
737
- ur as shorthandArrayInputTransformer,
738
- or as shorthandArrayOutputTransformer,
739
- sr as shorthandObjectInputTransformer,
740
- ar as shorthandObjectOutputTransformer,
741
- rr as unsetEmptyArrayOutputTransformer,
742
- tr as unsetEmptyObjectOutputTransformer,
743
- nr as unsetEmptyStringOutputTransformer,
744
- Ye as unsetHiddenInputsValues,
745
- je as useRootFormContext,
746
- Ge as useZodValidationResolver
760
+ He as removeTemporaryFieldsValue,
761
+ ir as shorthandArrayInputTransformer,
762
+ cr as shorthandArrayOutputTransformer,
763
+ ur as shorthandObjectInputTransformer,
764
+ or as shorthandObjectOutputTransformer,
765
+ nr as unsetEmptyArrayOutputTransformer,
766
+ sr as unsetEmptyObjectOutputTransformer,
767
+ ar as unsetEmptyStringOutputTransformer,
768
+ ze as unsetHiddenInputsValues,
769
+ dr as useController,
770
+ Ie as useRootFormContext,
771
+ Qe as useZodValidationResolver
747
772
  };
748
773
  //# sourceMappingURL=index.js.map