@harnessio/forms 0.1.1 → 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 N, B;
65
- function Re() {
66
- if (B) return N;
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)
@@ -93,19 +93,19 @@ function Re() {
93
93
  return !1;
94
94
  }
95
95
  }
96
- return N = a() ? Object.assign : function(s, o) {
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;
108
- }, N;
108
+ }, k;
109
109
  }
110
110
  /** @license React v17.0.2
111
111
  * react-jsx-runtime.production.min.js
@@ -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,9 +172,10 @@ 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
+ key: r,
178
179
  initialValues: s,
179
180
  onUpdate: n,
180
181
  onChange: t,
@@ -188,23 +189,23 @@ function Ie({
188
189
  const te = f[y];
189
190
  g(v, y, te);
190
191
  });
191
- 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: [
192
193
  o.before ? o.before : null,
193
- l == null ? void 0 : l.renderComponent(p),
194
+ d == null ? void 0 : d.renderComponent(p),
194
195
  o.after ? o.after : null
195
- ] }) : null, [p, o.after, o.before, l, O, i.errors]);
196
- 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: [
197
198
  "Input component not found (internal type: ",
198
199
  o.inputType,
199
200
  ")"
200
201
  ] }) });
201
202
  }
202
- class Be {
203
+ class Je {
203
204
  getType() {
204
205
  return this.internalType;
205
206
  }
206
207
  }
207
- function $e(r) {
208
+ function Le(r) {
208
209
  const {
209
210
  mode: e = "onSubmit",
210
211
  resolver: n,
@@ -221,18 +222,18 @@ function $e(r) {
221
222
  children: c,
222
223
  // fixedValues
223
224
  autoFocusPath: f
224
- } = r, d = ge({
225
+ } = r, l = ge({
225
226
  mode: e ?? "onSubmit",
226
227
  reValidateMode: "onChange",
227
228
  defaultValues: t,
228
229
  shouldFocusError: a,
229
230
  resolver: n
230
- }), l = F(!1);
231
+ }), d = F(!1);
231
232
  S(() => {
232
- d.reset(t, {});
233
- }, [d.reset, t]), S(() => {
233
+ l.reset(t, {});
234
+ }, [l.reset, t]), S(() => {
234
235
  const y = requestIdleCallback(() => {
235
- d.reset({}, {
236
+ l.reset({}, {
236
237
  keepErrors: !0,
237
238
  keepDirty: !0,
238
239
  keepDirtyValues: !0,
@@ -247,13 +248,13 @@ function $e(r) {
247
248
  });
248
249
  return () => cancelIdleCallback(y);
249
250
  }, []);
250
- const { getValues: p, handleSubmit: R } = d, v = p(), O = F(!0);
251
+ const { getValues: p, handleSubmit: R } = l, v = p(), O = F(!0);
251
252
  S(() => {
252
253
  if (O.current) {
253
254
  O.current = !1;
254
255
  return;
255
256
  }
256
- s == null || s({ ...v }), l.current === !0 && d.trigger();
257
+ s == null || s({ ...v }), d.current === !0 && l.trigger();
257
258
  }, [JSON.stringify(v)]);
258
259
  const I = F(!0);
259
260
  return S(() => {
@@ -261,30 +262,30 @@ function $e(r) {
261
262
  I.current = !1;
262
263
  return;
263
264
  }
264
- o == null || o({ isValid: d.formState.isValid, isSubmitted: d.formState.isSubmitted });
265
- }, [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(() => {
266
267
  if (f)
267
268
  if ("requestIdleCallback" in window) {
268
269
  const y = requestIdleCallback(() => {
269
- d.setFocus(f);
270
+ l.setFocus(f);
270
271
  });
271
272
  return () => cancelIdleCallback(y);
272
273
  } else {
273
274
  const y = setTimeout(() => {
274
- d.setFocus(f);
275
+ l.setFocus(f);
275
276
  }, 100);
276
277
  return () => clearTimeout(y);
277
278
  }
278
- }, [d]), /* @__PURE__ */ h.jsx(Te, { metadata: i, children: /* @__PURE__ */ h.jsx(be, { ...d, children: typeof c == "function" ? c({
279
- ...d,
279
+ }, [l]), /* @__PURE__ */ h.jsx(je, { metadata: i, children: /* @__PURE__ */ h.jsx(be, { ...l, children: typeof c == "function" ? c({
280
+ ...l,
280
281
  submitForm: async () => {
281
- u && (l.current = !0, R((y) => {
282
+ u && (d.current = !0, R((y) => {
282
283
  u(y);
283
284
  })());
284
285
  }
285
286
  }) : c }) });
286
287
  }
287
- const Je = (r) => {
288
+ const Ue = (r) => {
288
289
  const e = {}, n = (t) => {
289
290
  t.forEach((a) => {
290
291
  const { path: s, default: o, inputType: u, inputs: i } = a;
@@ -293,24 +294,24 @@ const Je = (r) => {
293
294
  };
294
295
  return Array.isArray(r.inputs) && n(r.inputs), e;
295
296
  };
296
- function Le(r, e) {
297
+ function We(r, e) {
297
298
  const n = r.inputs.map((t) => {
298
- const a = Ce(e, t.path);
299
+ const a = Ve(e, t.path);
299
300
  return a || t;
300
301
  });
301
302
  return { ...r, inputs: n };
302
303
  }
303
- function Ce(r, e) {
304
+ function Ve(r, e) {
304
305
  return r.inputs.find((n) => n.path === e);
305
306
  }
306
- const z = "__temp_", Ue = (r) => z + r.split(".").join("__");
307
- function We(r) {
307
+ const z = "__temp_", Ge = (r) => z + r.split(".").join("__");
308
+ function He(r) {
308
309
  const e = { ...r };
309
310
  return G(e, (n, t) => {
310
311
  t.startsWith(z) && delete e[t];
311
312
  }), e;
312
313
  }
313
- const Ve = "Required field";
314
+ const we = "Required field";
314
315
  function T(r) {
315
316
  const e = typeof r == "string" ? JSON.parse(r) : r;
316
317
  if (typeof e == "string")
@@ -320,7 +321,7 @@ function T(r) {
320
321
  const n = e;
321
322
  return H(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
322
323
  }
323
- function we(r, e, n) {
324
+ function xe(r, e, n) {
324
325
  let t = {};
325
326
  if (w(t, r.inputs, e, n), n != null && n.prefix) {
326
327
  const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
@@ -341,24 +342,24 @@ function V(r, e, n) {
341
342
  /*...nestedSchemaObj*/
342
343
  } = r[a];
343
344
  if (i && o && u) {
344
- const d = m.array(m.object(V(o, e, n))).optional(), l = U(f, u, e, n, d);
345
- 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;
346
347
  } else if (c && u) {
347
- 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);
348
349
  t[a] = p;
349
350
  } else if (f && u) {
350
- const d = xe(f, u, e, n);
351
- t[a] = d;
351
+ const l = qe(f, u, e, n);
352
+ t[a] = l;
352
353
  } else s && u ? t[a] = D(u, n) : t[a] = m.object(V(r[a], e, n)).optional();
353
354
  }), t;
354
355
  }
355
- function xe(r, e, n, t) {
356
+ function qe(r, e, n, t) {
356
357
  return m.any().optional().superRefine(async (a, s) => {
357
358
  var u, i;
358
359
  if (e.required && !(await D(e, t).safeParseAsync(a)).success)
359
360
  return s.addIssue({
360
361
  code: m.ZodIssueCode.custom,
361
- message: k(e, t)
362
+ message: N(e, t)
362
363
  }), m.NEVER;
363
364
  if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
364
365
  const c = (i = t == null ? void 0 : t.validationConfig) == null ? void 0 : i.globalValidation(a, e, t.metadata);
@@ -374,10 +375,10 @@ function xe(r, e, n, t) {
374
375
  if (o) {
375
376
  const c = await o.safeParseAsync(a);
376
377
  if (!c.success) {
377
- const f = T(c == null ? void 0 : c.error.message), d = f === "Required" ? k(e, t) : f;
378
+ const f = T(c == null ? void 0 : c.error.message), l = f === "Required" ? N(e, t) : f;
378
379
  s.addIssue({
379
380
  code: m.ZodIssueCode.custom,
380
- message: d
381
+ message: l
381
382
  });
382
383
  }
383
384
  }
@@ -385,22 +386,22 @@ function xe(r, e, n, t) {
385
386
  }
386
387
  function U(r, e, n, t, a) {
387
388
  return m.any().optional().superRefine(async (s, o) => {
388
- var f, d;
389
+ var f, l;
389
390
  const i = await D(e, t).safeParseAsync(s);
390
391
  if (e.required && !i.success) {
391
- const l = T(i.error.message);
392
- 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;
393
394
  }
394
395
  if (!e.required && !i.success)
395
396
  return m.NEVER;
396
397
  if ((f = t == null ? void 0 : t.validationConfig) != null && f.globalValidation) {
397
- const l = (d = t == null ? void 0 : t.validationConfig) == null ? void 0 : d.globalValidation(s, e, t.metadata);
398
- 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)
399
400
  return o.addIssue({
400
401
  code: m.ZodIssueCode.custom,
401
- message: T(l.error)
402
+ message: T(d.error)
402
403
  }), m.NEVER;
403
- if (!l.continue)
404
+ if (!d.continue)
404
405
  return m.NEVER;
405
406
  }
406
407
  if (!E(s))
@@ -410,29 +411,29 @@ function U(r, e, n, t, a) {
410
411
  }), m.NEVER;
411
412
  const c = ee(r, n);
412
413
  if (c) {
413
- const l = await c.safeParseAsync(s);
414
- if (!l.success)
414
+ const d = await c.safeParseAsync(s);
415
+ if (!d.success)
415
416
  return o.addIssue({
416
417
  code: m.ZodIssueCode.custom,
417
- message: T(l.error.message)
418
+ message: T(d.error.message)
418
419
  }), m.NEVER;
419
420
  }
420
421
  }).pipe(a ?? m.any());
421
422
  }
422
423
  function w(r, e, n, t, a) {
423
424
  e.forEach((s) => {
424
- var u, i, c, f, d;
425
+ var u, i, c, f, l;
425
426
  const o = n;
426
427
  if (!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) {
427
- const l = b(r, s.path);
428
+ const d = b(r, s.path);
428
429
  if ((i = s.validation) != null && i.schema ? g(
429
430
  r,
430
431
  s.path,
431
- C(l, {
432
+ C(d, {
432
433
  _schema: (c = s.validation) == null ? void 0 : c.schema,
433
434
  _input: s
434
435
  })
435
- ) : 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") {
436
437
  const p = {};
437
438
  w(
438
439
  p,
@@ -456,9 +457,9 @@ function w(r, e, n, t, a) {
456
457
  ), g(
457
458
  r,
458
459
  s.path,
459
- C(l, {
460
+ C(d, {
460
461
  _schemaObj: p,
461
- _schema: (d = s.validation) == null ? void 0 : d.schema,
462
+ _schema: (l = s.validation) == null ? void 0 : l.schema,
462
463
  _isArrayItem: !0,
463
464
  _input: s
464
465
  })
@@ -467,9 +468,9 @@ function w(r, e, n, t, a) {
467
468
  }
468
469
  });
469
470
  }
470
- function k(r, e) {
471
+ function N(r, e) {
471
472
  var n, t, a;
472
- 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;
473
474
  }
474
475
  function D(r, e) {
475
476
  var t, a, s, o, u, i;
@@ -477,12 +478,12 @@ function D(r, e) {
477
478
  return (o = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : o[r.inputType];
478
479
  if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
479
480
  return (i = e == null ? void 0 : e.validationConfig) == null ? void 0 : i.requiredSchema;
480
- const n = k(r, e);
481
+ const n = N(r, e);
481
482
  return m.any().optional().superRefine((c, f) => {
482
483
  typeof c == "object" && j(c) && f.addIssue({
483
484
  code: m.ZodIssueCode.custom,
484
485
  message: n
485
- }), (P(c) || c === "") && f.addIssue({
486
+ }), (q(c) || c === "") && f.addIssue({
486
487
  code: m.ZodIssueCode.custom,
487
488
  message: n
488
489
  });
@@ -494,7 +495,7 @@ function ee(r, e) {
494
495
  if (typeof r == "function")
495
496
  return r(e);
496
497
  }
497
- 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) => {
498
499
  const n = {};
499
500
  for (; r.length; ) {
500
501
  const t = r[0], { code: a, message: s, path: o } = t, u = o.join(".");
@@ -522,11 +523,11 @@ const Pe = (r) => Array.isArray(r == null ? void 0 : r.errors), qe = (r, e) => {
522
523
  }
523
524
  return n;
524
525
  };
525
- function Ge(r, e) {
526
+ function Qe(r, e) {
526
527
  return me(
527
528
  async (n, t, a) => {
528
529
  try {
529
- return await we(r, n, e).parseAsync(n), {
530
+ return await xe(r, n, e).parseAsync(n), {
530
531
  values: n,
531
532
  // TODO: check this - values does not contains all data
532
533
  errors: {}
@@ -535,7 +536,7 @@ function Ge(r, e) {
535
536
  if (Pe(s))
536
537
  return {
537
538
  values: {},
538
- errors: _e(qe(s.errors, !0), a)
539
+ errors: Ee(Fe(s.errors, !0), a)
539
540
  };
540
541
  throw s;
541
542
  }
@@ -543,7 +544,7 @@ function Ge(r, e) {
543
544
  [r]
544
545
  );
545
546
  }
546
- function He(r, e) {
547
+ function Xe(r, e) {
547
548
  const n = x(r);
548
549
  return e.forEach((t) => {
549
550
  t.inputTransform && (E(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
@@ -552,7 +553,7 @@ function He(r, e) {
552
553
  });
553
554
  }), n;
554
555
  }
555
- function Qe(r, e) {
556
+ function Ye(r, e) {
556
557
  const n = x(r);
557
558
  return e.forEach((t) => {
558
559
  t.outputTransform && (E(t.outputTransform) ? t.outputTransform : [t.outputTransform]).forEach((s) => {
@@ -564,7 +565,7 @@ function Qe(r, e) {
564
565
  function Z(r) {
565
566
  return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...Z(t.inputs)] : [...n, t], []);
566
567
  }
567
- function Xe(r) {
568
+ function Ke(r) {
568
569
  const n = Z(r.inputs).reduce((t, a) => {
569
570
  const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
570
571
  return (a.inputTransform || a.outputTransform) && t.push({
@@ -575,13 +576,13 @@ function Xe(r) {
575
576
  }, []);
576
577
  return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
577
578
  }
578
- function Ye(r, e, n) {
579
+ function ze(r, e, n) {
579
580
  const t = Z(r.inputs), a = x(e);
580
581
  return t.forEach((s) => {
581
582
  s.isVisible && !s.isVisible(e, n) && ue(a, s.path);
582
583
  }), a;
583
584
  }
584
- function Ke(r) {
585
+ function er(r) {
585
586
  const e = {}, n = (t) => {
586
587
  t.forEach((a) => {
587
588
  const { default: s, path: o, inputType: u, inputs: i } = a;
@@ -590,7 +591,7 @@ function Ke(r) {
590
591
  };
591
592
  return Array.isArray(r.inputs) && n(r.inputs), e;
592
593
  }
593
- function ze() {
594
+ function rr() {
594
595
  return function(r, e) {
595
596
  if (!(typeof r > "u"))
596
597
  return r ? {
@@ -598,7 +599,7 @@ function ze() {
598
599
  } : { value: r };
599
600
  };
600
601
  }
601
- function er(r) {
602
+ function tr(r) {
602
603
  return function(e, n) {
603
604
  if (typeof e > "u") return;
604
605
  if (!e) return { value: e };
@@ -608,13 +609,13 @@ function er(r) {
608
609
  return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
609
610
  };
610
611
  }
611
- function rr() {
612
+ function nr() {
612
613
  return function(r, e) {
613
614
  if (!(typeof r > "u"))
614
615
  return E(r) && j(r) ? { value: void 0 } : { value: r };
615
616
  };
616
617
  }
617
- function tr(r) {
618
+ function sr(r) {
618
619
  return function(e, n) {
619
620
  const t = r ? b(n, r) : e;
620
621
  if (!(typeof t > "u")) {
@@ -628,39 +629,39 @@ function tr(r) {
628
629
  }
629
630
  };
630
631
  }
631
- function nr() {
632
+ function ar() {
632
633
  return function(r, e) {
633
634
  if (!(typeof r > "u"))
634
635
  return ie(r) && j(r) ? { value: void 0 } : { value: r };
635
636
  };
636
637
  }
637
- function sr(r) {
638
+ function ur(r) {
638
639
  return function(e, n) {
639
640
  const t = b(n, r);
640
641
  return typeof t == "string" ? { value: t } : { value: e };
641
642
  };
642
643
  }
643
- function ar(r) {
644
+ function or(r) {
644
645
  return function(e, n) {
645
646
  if (typeof e > "u") return;
646
647
  if (!e) return { value: e };
647
648
  const t = b(n, r);
648
649
  if (typeof t == "object") {
649
- const a = Fe(t);
650
+ const a = Ae(t);
650
651
  if (Object.getOwnPropertyNames(a).length === 1)
651
652
  return { value: e, path: r };
652
653
  }
653
654
  return { value: e };
654
655
  };
655
656
  }
656
- function ur(r) {
657
+ function ir(r) {
657
658
  return function(e, n) {
658
659
  if (typeof e > "u") return;
659
660
  const t = b(n, r);
660
661
  return typeof t == "string" ? { value: [t] } : { value: e };
661
662
  };
662
663
  }
663
- function or(r, e) {
664
+ function cr(r, e) {
664
665
  return function(n, t) {
665
666
  if (typeof n > "u") return;
666
667
  if (!n) return { value: n };
@@ -675,15 +676,15 @@ function or(r, e) {
675
676
  };
676
677
  }
677
678
  function re(r) {
678
- 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);
679
680
  }
680
- function Fe(r) {
681
- 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));
682
683
  }
683
684
  function W(r) {
684
685
  const { items: e, ...n } = r;
685
686
  return /* @__PURE__ */ h.jsx(h.Fragment, { children: e.map((t) => /* @__PURE__ */ h.jsx(
686
- Ie,
687
+ Ce,
687
688
  {
688
689
  input: t,
689
690
  path: t.path,
@@ -693,7 +694,7 @@ function W(r) {
693
694
  `${t.inputType}_${t.path}_${t.label}`
694
695
  )) });
695
696
  }
696
- const Ae = he((r, e) => {
697
+ const ke = he((r, e) => {
697
698
  const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
698
699
  return s ? /* @__PURE__ */ h.jsxs(pe, { children: [
699
700
  n.hero,
@@ -703,45 +704,70 @@ const Ae = he((r, e) => {
703
704
  /* @__PURE__ */ h.jsx(W, { items: n.inputs, factory: a, withoutWrapper: s })
704
705
  ] });
705
706
  });
706
- Ae.displayName = "RenderForm";
707
- function ir(r) {
707
+ ke.displayName = "RenderForm";
708
+ function fr(r) {
708
709
  let e = !0;
709
710
  return G(r, (n) => {
710
- e = e && (n === "" || Q(n) || P(n));
711
+ e = e && (n === "" || Q(n) || q(n));
711
712
  }), e;
712
713
  }
713
- 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
+ }
714
738
  export {
715
- Be as InputComponent,
716
- Ie as InputComponentRenderer,
739
+ Je as InputComponent,
740
+ Ce as InputComponentRenderer,
717
741
  Y as InputFactory,
718
- Ee as InputOverrideError,
719
- Ae as RenderForm,
742
+ Re as InputOverrideError,
743
+ ke as RenderForm,
720
744
  W as RenderInputs,
721
- $e as RootForm,
722
- er as arrayToObjectOutputTransformer,
723
- Ke as collectDefaultValues,
724
- cr as generateReadableLabel,
725
- Je as getDefaultValuesFromFormDefinition,
726
- Ue as getTemporaryPath,
727
- Xe as getTransformers,
728
- we as getValidationSchema,
729
- He as inputTransformValues,
730
- ir as isChildrenEmpty,
731
- ze as objectToArrayInputTransformer,
732
- Qe as outputTransformValues,
733
- 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,
734
759
  T as processValidationParseResponse,
735
- We as removeTemporaryFieldsValue,
736
- ur as shorthandArrayInputTransformer,
737
- or as shorthandArrayOutputTransformer,
738
- sr as shorthandObjectInputTransformer,
739
- ar as shorthandObjectOutputTransformer,
740
- rr as unsetEmptyArrayOutputTransformer,
741
- tr as unsetEmptyObjectOutputTransformer,
742
- nr as unsetEmptyStringOutputTransformer,
743
- Ye as unsetHiddenInputsValues,
744
- je as useRootFormContext,
745
- 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
746
772
  };
747
773
  //# sourceMappingURL=index.js.map