@harnessio/forms 0.11.1 → 0.11.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,10 +1,10 @@
1
1
  var Ie = Object.defineProperty;
2
- var we = (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) => we(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { isEmpty as k, set as E, get as T, forOwn as me, isArray as I, isObject as he, merge as M, isUndefined as B, cloneDeep as H, unset as pe, pick as je, isPlainObject as Oe, isNull as ye, 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 V, useEffect as C, useCallback as De, forwardRef as Me, Fragment as $e } from "react";
6
- import { useFormContext as Ze, get as Be, useForm as We, FormProvider as Ue, appendErrors as Je, useController as Le } from "react-hook-form";
7
- import { Controller as Jr, 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";
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";
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
+ 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";
9
9
  import { toNestErrors as He } from "@hookform/resolvers";
10
10
  class Ge extends Error {
@@ -55,15 +55,15 @@ class be {
55
55
  }), e;
56
56
  }
57
57
  }
58
- var W = { exports: {} }, O = {};
58
+ var W = { exports: {} }, V = {};
59
59
  /*
60
60
  object-assign
61
61
  (c) Sindre Sorhus
62
62
  @license MIT
63
63
  */
64
- var U, oe;
64
+ var J, oe;
65
65
  function Ke() {
66
- if (oe) return U;
66
+ if (oe) return J;
67
67
  oe = 1;
68
68
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
69
69
  function t(s) {
@@ -93,7 +93,7 @@ function Ke() {
93
93
  return !1;
94
94
  }
95
95
  }
96
- return U = a() ? Object.assign : function(s, o) {
96
+ return J = a() ? Object.assign : function(s, o) {
97
97
  for (var u, i = t(s), c, f = 1; f < arguments.length; f++) {
98
98
  u = Object(arguments[f]);
99
99
  for (var m in u)
@@ -105,7 +105,7 @@ function Ke() {
105
105
  }
106
106
  }
107
107
  return i;
108
- }, U;
108
+ }, J;
109
109
  }
110
110
  /** @license React v17.0.2
111
111
  * react-jsx-runtime.production.min.js
@@ -117,12 +117,12 @@ function Ke() {
117
117
  */
118
118
  var ue;
119
119
  function Qe() {
120
- if (ue) return O;
120
+ if (ue) return V;
121
121
  ue = 1, Ke();
122
122
  var r = Pe, e = 60103;
123
- if (O.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
123
+ if (V.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
124
124
  var n = Symbol.for;
125
- e = n("react.element"), O.Fragment = n("react.fragment");
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
128
  function o(u, i, c) {
@@ -132,13 +132,13 @@ function Qe() {
132
132
  if (u && u.defaultProps) for (f in i = u.defaultProps, i) m[f] === void 0 && (m[f] = i[f]);
133
133
  return { $$typeof: e, type: u, key: l, ref: h, props: m, _owner: t.current };
134
134
  }
135
- return O.jsx = o, O.jsxs = o, O;
135
+ return V.jsx = o, V.jsxs = o, V;
136
136
  }
137
137
  var ie;
138
138
  function Xe() {
139
139
  return ie || (ie = 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,13 +181,13 @@ 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,
@@ -197,19 +197,19 @@ const ce = ({
197
197
  withoutWrapper: u = !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), b = !!(o.isVisible || typeof o.disabled == "function" || typeof ((Y = o.validation) == null ? void 0 : Y.schema) == "function" || typeof ((z = o.warning) == null ? void 0 : z.schema) == "function"), S = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), v = b ? i.watch() : {}, w = S ? b ? Be(v, o.path) : i.watch(o.path) : void 0, j = $(() => {
201
- if (!b) return {};
202
- let F = v;
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 = $(() => {
201
+ if (!g) return {};
202
+ let F = E;
203
203
  return f && Object.keys(f).forEach((N) => {
204
204
  const P = f[N];
205
- F = E(F, N, P);
205
+ F = S(F, N, P);
206
206
  }), F;
207
- }, [b, v, f]), g = !o.isVisible || o.isVisible(j, m), R = l || o.readonly, _ = typeof o.disabled == "function" ? o.disabled(j, m) : o.disabled, x = (te = o.warning) == null ? void 0 : te.schema, Q = $(() => {
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 = $(() => {
208
208
  var se, ae;
209
- if (!g || typeof x > "u") return;
210
- const F = typeof x == "function" ? x(j) : x, { success: N, error: P } = F.safeParse(w), ne = (ae = (se = P == null ? void 0 : P.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
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;
211
211
  return !N && ne ? ne : void 0;
212
- }, [o.path, w, x, g]), X = $(
212
+ }, [o.path, R, v, I]), X = $(
213
213
  () => ({
214
214
  path: e,
215
215
  key: e,
@@ -217,24 +217,24 @@ const ce = ({
217
217
  onUpdate: t,
218
218
  onChange: a,
219
219
  factory: n,
220
- readonly: R,
220
+ readonly: b,
221
221
  input: o,
222
222
  disabled: _,
223
223
  warning: Q
224
224
  }),
225
- [n, s, o, a, t, e, R, c.errors, _, Q]
226
- ), Ce = $(() => g ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
225
+ [n, s, o, a, t, e, b, c.errors, _, Q]
226
+ ), Ce = $(() => I ? /* @__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, [g, 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, [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: [
232
232
  "Input component not found (internal type: ",
233
233
  o.inputType,
234
234
  ")"
235
235
  ] }) });
236
236
  });
237
- class _r {
237
+ class Tr {
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 Sr(r) {
258
+ function _r(r) {
259
259
  const {
260
260
  mode: e = "onSubmit",
261
261
  resolver: n,
@@ -280,11 +280,11 @@ function Sr(r) {
280
280
  defaultValues: t,
281
281
  shouldFocusError: a,
282
282
  resolver: n
283
- }), y = V(!1);
284
- C(() => {
285
- h.reset(t, {});
286
- }, [h.reset, t]), C(() => {
287
- const g = fe(), R = le(), _ = g(() => {
283
+ }), p = w(!1), g = w(JSON.stringify(t ?? {}));
284
+ O(() => {
285
+ g.current = JSON.stringify(t ?? {}), h.reset(t, {});
286
+ }, [h.reset, t]), O(() => {
287
+ const b = fe(), _ = le(), v = b(() => {
288
288
  h.reset({}, {
289
289
  keepErrors: !0,
290
290
  keepDirty: !0,
@@ -298,48 +298,48 @@ function Sr(r) {
298
298
  keepSubmitCount: !0
299
299
  });
300
300
  });
301
- return () => R(_);
301
+ return () => _(v);
302
302
  }, []);
303
- const { handleSubmit: b } = h, S = V(s);
304
- C(() => {
305
- S.current = s;
303
+ const { handleSubmit: x } = h, E = w(s);
304
+ O(() => {
305
+ E.current = s;
306
306
  }, [s]);
307
- const v = V(o);
308
- C(() => {
309
- v.current = o;
307
+ const R = w(o);
308
+ O(() => {
309
+ R.current = o;
310
310
  }, [o]);
311
- const w = V(!1);
312
- C(() => {
313
- const g = h.watch((R) => {
314
- var _;
315
- w.current || ((_ = S.current) == null || _.call(S, { ...R }), y.current === !0 && (w.current = !0, h.trigger().finally(() => {
316
- w.current = !1;
311
+ const C = w(!1);
312
+ O(() => {
313
+ const b = h.watch((_) => {
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(() => {
316
+ C.current = !1;
317
317
  })));
318
318
  });
319
319
  return () => {
320
- g.unsubscribe();
320
+ b.unsubscribe();
321
321
  };
322
322
  }, [h]);
323
- const j = V(!0);
324
- return C(() => {
325
- var g;
326
- if (j.current) {
327
- j.current = !1;
323
+ const I = w(!0);
324
+ return O(() => {
325
+ var b;
326
+ if (I.current) {
327
+ I.current = !1;
328
328
  return;
329
329
  }
330
- (g = v.current) == null || g.call(v, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
331
- }, [h.formState.isValid, h.formState.isSubmitted]), C(() => {
330
+ (b = R.current) == null || b.call(R, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
331
+ }, [h.formState.isValid, h.formState.isSubmitted]), O(() => {
332
332
  if (m) {
333
- const g = fe(), R = le(), _ = g(() => {
333
+ const b = fe(), _ = le(), v = b(() => {
334
334
  h.setFocus(m);
335
335
  });
336
- return () => R(_);
336
+ return () => _(v);
337
337
  }
338
- }, [h, m]), /* @__PURE__ */ p.jsx(Ye, { metadata: c, readonly: l, inputErrorHandler: i, children: /* @__PURE__ */ p.jsx(Ue, { ...h, children: typeof f == "function" ? f({
338
+ }, [h, m]), /* @__PURE__ */ y.jsx(Ye, { metadata: c, readonly: l, inputErrorHandler: i, children: /* @__PURE__ */ y.jsx(Je, { ...h, children: typeof f == "function" ? f({
339
339
  ...h,
340
340
  submitForm: async () => {
341
- u && (y.current = !0, b((g) => {
342
- u(g);
341
+ u && (p.current = !0, x((b) => {
342
+ u(b);
343
343
  })());
344
344
  }
345
345
  }) : f }) });
@@ -348,7 +348,7 @@ const Rr = (r) => {
348
348
  const e = {}, n = (t) => {
349
349
  t.forEach((a) => {
350
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 && E(e, s, o);
351
+ (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : T(e, s) === void 0 && S(e, s, o);
352
352
  });
353
353
  };
354
354
  return Array.isArray(r.inputs) && n(r.inputs), e;
@@ -383,7 +383,7 @@ function q(r) {
383
383
  e = r;
384
384
  if (typeof e == "string")
385
385
  return e;
386
- if (I(e))
386
+ if (j(e))
387
387
  return q(e[0]);
388
388
  const n = e;
389
389
  return he(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
@@ -392,7 +392,7 @@ function ar(r, e, n) {
392
392
  let t = {};
393
393
  if (Z(t, r.inputs, e, n), n != null && n.prefix) {
394
394
  const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
395
- t = E({}, s, t);
395
+ t = S({}, s, t);
396
396
  }
397
397
  return d.object(A(t, e, n));
398
398
  }
@@ -431,19 +431,19 @@ function A(r, e, n) {
431
431
  if (i && o && u) {
432
432
  const l = d.object(A(o, e, n)), h = d.union([
433
433
  d.array(l).optional(),
434
- Te(u, n)
435
- ]), y = de(m, u, e, n, h);
436
- t[a] = y;
434
+ Se(u, n)
435
+ ]), p = de(m, u, e, n, h);
436
+ t[a] = p;
437
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;
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);
439
+ t[a] = p;
440
440
  } else if (m && u) {
441
441
  const l = ir(m, u, e, n);
442
442
  t[a] = l;
443
443
  } else s && u ? t[a] = G(u, n) : t[a] = d.object(A(r[a], e, n)).optional();
444
444
  }), t;
445
445
  }
446
- function Te(r, e) {
446
+ function Se(r, e) {
447
447
  return d.string().superRefine((n, t) => {
448
448
  var a;
449
449
  if ((a = e == null ? void 0 : e.validationConfig) != null && a.globalValidation) {
@@ -460,7 +460,7 @@ function Te(r, e) {
460
460
  });
461
461
  }
462
462
  function ur(r, e, n) {
463
- return d.union([d.array(r.___array).optional(), Te(e, n)]);
463
+ return d.union([d.array(r.___array).optional(), Se(e, n)]);
464
464
  }
465
465
  function ir(r, e, n, t) {
466
466
  return d.any().optional().superRefine(async (a, s) => {
@@ -468,7 +468,7 @@ function ir(r, e, n, t) {
468
468
  if (e.required && !(await G(e, t).safeParseAsync(a)).success)
469
469
  return s.addIssue({
470
470
  code: d.ZodIssueCode.custom,
471
- message: J(e, t)
471
+ message: U(e, t)
472
472
  }), d.NEVER;
473
473
  if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
474
474
  const c = (i = t == null ? void 0 : t.validationConfig) == null ? void 0 : i.globalValidation(a, e, t.metadata);
@@ -480,11 +480,11 @@ function ir(r, e, n, t) {
480
480
  if (!c.continue)
481
481
  return !0;
482
482
  }
483
- const o = _e(r, n);
483
+ const o = Te(r, n);
484
484
  if (o) {
485
485
  const c = await o.safeParseAsync(a);
486
486
  if (!c.success) {
487
- const f = q(c == null ? void 0 : c.error.message), m = f === "Required" ? J(e, t) : f;
487
+ const f = q(c == null ? void 0 : c.error.message), m = f === "Required" ? U(e, t) : f;
488
488
  s.addIssue({
489
489
  code: d.ZodIssueCode.custom,
490
490
  message: m
@@ -513,12 +513,12 @@ function de(r, e, n, t, a) {
513
513
  if (!l.continue)
514
514
  return !0;
515
515
  }
516
- if (!I(s))
516
+ if (!j(s))
517
517
  return o.addIssue({
518
518
  code: d.ZodIssueCode.custom,
519
519
  message: "'Value is not array'"
520
520
  }), d.NEVER;
521
- const c = _e(r, n);
521
+ const c = Te(r, n);
522
522
  if (c) {
523
523
  const l = await c.safeParseAsync(s);
524
524
  if (!l.success)
@@ -534,40 +534,40 @@ function Z(r, e, n, t, a) {
534
534
  var u, i, c, f, m, l, h;
535
535
  const o = n;
536
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 ? E(
537
+ const p = T(r, s.path);
538
+ if ((i = s.validation) != null && i.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 && E(r, s.path, M(y, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
546
- const b = {};
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
+ const g = {};
547
547
  Z(
548
- b,
549
- (m = (f = s.inputConfig) == null ? void 0 : f.inputs) == null ? void 0 : m.map((v) => ({
550
- ...v,
551
- path: v.relativePath
548
+ g,
549
+ (m = (f = s.inputConfig) == null ? void 0 : f.inputs) == null ? void 0 : m.map((E) => ({
550
+ ...E,
551
+ path: E.relativePath
552
552
  })),
553
553
  n,
554
554
  t
555
555
  );
556
- const S = T(r, s.path);
557
- E(r, s.path, M(S, { _schemaObj: b, _isList: !0, _input: s }));
556
+ const x = T(r, s.path);
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") {
560
- const b = {};
560
+ const g = {};
561
561
  Z(
562
- b,
562
+ g,
563
563
  [{ ...s.inputConfig.input, path: "___array" }],
564
564
  n,
565
565
  t
566
- ), E(
566
+ ), S(
567
567
  r,
568
568
  s.path,
569
- M(y, {
570
- _schemaObj: b,
569
+ M(p, {
570
+ _schemaObj: g,
571
571
  _schema: (h = s.validation) == null ? void 0 : h.schema,
572
572
  _isArrayItem: !0,
573
573
  _input: s
@@ -589,7 +589,7 @@ function Z(r, e, n, t, a) {
589
589
  }
590
590
  });
591
591
  }
592
- function J(r, e) {
592
+ function U(r, e) {
593
593
  var n, t, a;
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
  }
@@ -599,7 +599,7 @@ function G(r, e) {
599
599
  return (o = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : o[r.inputType];
600
600
  if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
601
601
  return (i = e == null ? void 0 : e.validationConfig) == null ? void 0 : i.requiredSchema;
602
- const n = J(r, e);
602
+ const n = U(r, e);
603
603
  return d.any().optional().superRefine((c, f) => {
604
604
  typeof c == "object" && k(c) && f.addIssue({
605
605
  code: d.ZodIssueCode.custom,
@@ -610,7 +610,7 @@ function G(r, e) {
610
610
  });
611
611
  });
612
612
  }
613
- function _e(r, e) {
613
+ function Te(r, e) {
614
614
  if (r instanceof d.ZodType)
615
615
  return r;
616
616
  if (typeof r == "function")
@@ -632,7 +632,7 @@ const cr = (r) => Array.isArray(r == null ? void 0 : r.errors), fr = (r, e) => {
632
632
  "unionErrors" in t && t.unionErrors.forEach((i) => i.errors.forEach((c) => r.push(c)));
633
633
  {
634
634
  const i = n[u].types, c = i && i[t.code];
635
- n[u] = Je(
635
+ n[u] = Ue(
636
636
  u,
637
637
  e,
638
638
  n,
@@ -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 wr(r, e) {
647
+ function Or(r, e) {
648
648
  return De(
649
649
  async (n, t, a) => {
650
650
  try {
@@ -667,31 +667,31 @@ function wr(r, e) {
667
667
  function lr(r, e) {
668
668
  const n = H(r);
669
669
  return e.forEach((t) => {
670
- t.inputTransform && (I(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
670
+ t.inputTransform && (j(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
671
671
  const o = T(n, t.path), u = s(o, n);
672
- u && E(n, u.path ?? t.path, u.value);
672
+ u && S(n, u.path ?? t.path, u.value);
673
673
  });
674
674
  }), n;
675
675
  }
676
676
  function dr(r, e) {
677
677
  const n = [], t = H(r);
678
678
  return e.forEach((a) => {
679
- a.outputTransform && (I(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
679
+ a.outputTransform && (j(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
680
680
  const u = T(t, a.path), i = o(u, t);
681
- i && (i.path ? (E(t, i.path, i.value), i.unset && n.push(a.path)) : E(t, a.path, i.value));
681
+ i && (i.path ? (S(t, i.path, i.value), i.unset && n.push(a.path)) : S(t, a.path, i.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
688
  return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...K(t.inputs)] : [...n, t], []);
689
689
  }
690
- function Se(r) {
690
+ function _e(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
- ...je(a, "path", "inputTransform", "outputTransform"),
694
+ ...we(a, "path", "inputTransform", "outputTransform"),
695
695
  level: a.path.split(".").length,
696
696
  isPrimitive: s
697
697
  }), t;
@@ -701,15 +701,15 @@ function Se(r) {
701
701
  function mr(r, e, n, t = {}) {
702
702
  const { preserve: a } = t, s = K(r.inputs), o = H(e);
703
703
  return s.forEach((u) => {
704
- a && a.includes(u.path) || u.isVisible && !u.isVisible(e, n) && pe(o, u.path);
704
+ a && a.includes(u.path) || u.isVisible && !u.isVisible(e, n) && ye(o, u.path);
705
705
  }), o;
706
706
  }
707
- function jr(r, e) {
708
- const n = Se(e);
707
+ function wr(r, e) {
708
+ const n = _e(e);
709
709
  return lr(r, n);
710
710
  }
711
- function Or(r, e, n, t = {}) {
712
- const a = Se(e);
711
+ function jr(r, e, n, t = {}) {
712
+ const a = _e(e);
713
713
  let s = mr(e, r, n, t);
714
714
  return s = dr(s, a), s = nr(s), s;
715
715
  }
@@ -717,7 +717,7 @@ function Vr(r) {
717
717
  const e = {}, n = (t) => {
718
718
  t.forEach((a) => {
719
719
  const { default: s, path: o, inputType: u, inputs: i } = a;
720
- (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : s !== void 0 && E(e, o, s);
720
+ (u === "group" || u === "accordion") && 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;
@@ -725,7 +725,7 @@ function Vr(r) {
725
725
  function xr() {
726
726
  return function(r, e) {
727
727
  if (!(typeof r > "u"))
728
- return !r || !Oe(r) ? { value: r } : {
728
+ return !r || !je(r) ? { value: r } : {
729
729
  value: Object.getOwnPropertyNames(r).map((n) => ({ key: n, value: r[n] }))
730
730
  };
731
731
  };
@@ -733,7 +733,7 @@ function xr() {
733
733
  function Fr(r) {
734
734
  return function(e, n) {
735
735
  if (typeof e > "u") return;
736
- if (!e || !I(e)) return { value: e };
736
+ if (!e || !j(e)) return { value: e };
737
737
  const t = {
738
738
  value: e.reduce((a, s) => ({
739
739
  ...a,
@@ -746,14 +746,14 @@ function Fr(r) {
746
746
  function Pr() {
747
747
  return function(r, e) {
748
748
  if (!(typeof r > "u"))
749
- return I(r) && k(r) ? { value: void 0 } : { value: r };
749
+ return j(r) && k(r) ? { value: void 0 } : { value: r };
750
750
  };
751
751
  }
752
752
  function qr(r) {
753
753
  return function(e, n) {
754
754
  const t = r ? T(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))
@@ -800,7 +800,7 @@ function Mr(r, e) {
800
800
  if (typeof n > "u") return;
801
801
  if (!n) return { value: n };
802
802
  const a = T(t, r);
803
- if (I(a)) {
803
+ if (j(a)) {
804
804
  if (a.length === 1)
805
805
  return { value: a[0], path: r };
806
806
  if (a.length === 0 && e != null && e.unsetIfEmpty)
@@ -817,7 +817,7 @@ function hr(r) {
817
817
  }
818
818
  function L(r) {
819
819
  const { items: e, ...n } = r;
820
- return /* @__PURE__ */ p.jsx(p.Fragment, { children: e.map((t) => /* @__PURE__ */ p.jsx(
820
+ return /* @__PURE__ */ y.jsx(y.Fragment, { children: e.map((t) => /* @__PURE__ */ y.jsx(
821
821
  rr,
822
822
  {
823
823
  input: t,
@@ -828,24 +828,24 @@ function L(r) {
828
828
  )) });
829
829
  }
830
830
  L.displayName = "RenderInputs";
831
- const pr = Me((r, e) => {
831
+ const yr = Me((r, e) => {
832
832
  const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
833
- return s ? /* @__PURE__ */ p.jsxs($e, { children: [
833
+ return s ? /* @__PURE__ */ y.jsxs($e, { children: [
834
834
  n.hero,
835
- /* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
836
- ] }) : /* @__PURE__ */ p.jsxs("div", { className: t, ref: e, children: [
835
+ /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
836
+ ] }) : /* @__PURE__ */ y.jsxs("div", { className: t, ref: e, children: [
837
837
  n.hero,
838
- /* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
838
+ /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
839
839
  ] });
840
840
  });
841
- pr.displayName = "RenderForm";
841
+ yr.displayName = "RenderForm";
842
842
  function $r(r) {
843
843
  let e = !0;
844
844
  return me(r, (n) => {
845
- e = e && (n === "" || ye(n) || B(n));
845
+ e = e && (n === "" || pe(n) || B(n));
846
846
  }), e;
847
847
  }
848
- const Zr = (r = "") => Fe(r.split("_").join(" ")), yr = (r, e = 2, n, t = 1e3) => {
848
+ const Zr = (r = "") => Fe(r.split("_").join(" ")), pr = (r, e = 2, n, t = 1e3) => {
849
849
  let a = !1;
850
850
  const s = () => {
851
851
  requestAnimationFrame(() => {
@@ -861,36 +861,36 @@ function Br(r) {
861
861
  const {
862
862
  field: { onBlur: e, ...n },
863
863
  ...t
864
- } = Le(r), a = V(Date.now());
864
+ } = Le(r), a = w(Date.now());
865
865
  return {
866
866
  ...t,
867
867
  field: {
868
868
  ...n,
869
- onBlur: yr(e, 2, a.current)
869
+ onBlur: pr(e, 2, a.current)
870
870
  }
871
871
  };
872
872
  }
873
873
  export {
874
- Jr as Controller,
874
+ Ur as Controller,
875
875
  Lr as Form,
876
876
  Hr as FormProvider,
877
- _r as InputComponent,
877
+ Tr as InputComponent,
878
878
  rr as InputComponentRenderer,
879
879
  be as InputFactory,
880
880
  Ge as InputOverrideError,
881
- pr as RenderForm,
881
+ yr as RenderForm,
882
882
  L as RenderInputs,
883
- Sr as RootForm,
884
- yr as afterFrames,
883
+ _r as RootForm,
884
+ pr as afterFrames,
885
885
  Fr as arrayToObjectOutputTransformer,
886
886
  Vr as collectDefaultValues,
887
- jr as convertDataToFormModel,
888
- Or as convertFormModelToData,
887
+ wr as convertDataToFormModel,
888
+ jr as convertFormModelToData,
889
889
  Zr as generateReadableLabel,
890
890
  Gr as get,
891
891
  Rr as getDefaultValuesFromFormDefinition,
892
892
  Ir as getTemporaryPath,
893
- Se as getTransformers,
893
+ _e as getTransformers,
894
894
  ar as getValidationSchema,
895
895
  lr as inputTransformValues,
896
896
  $r as isChildrenEmpty,
@@ -915,6 +915,6 @@ export {
915
915
  zr as useFormState,
916
916
  ze as useRootFormContext,
917
917
  et as useWatch,
918
- wr as useZodValidationResolver
918
+ Or as useZodValidationResolver
919
919
  };
920
920
  //# sourceMappingURL=index.js.map