@harnessio/forms 0.0.8 → 0.0.9

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
- var Y = Object.defineProperty;
2
- var K = (r, e, n) => e in r ? Y(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var x = (r, e, n) => K(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { isEmpty as T, cloneDeep as C, set as b, get as g, isArray as E, isObject as L, merge as I, isUndefined as q, pick as X, unset as z, isNull as U, omitBy as W, isNil as ee, isString as re, forOwn as te, capitalize as ne } from "lodash-es";
5
- import se, { useMemo as Z, useRef as P, useEffect as O, useCallback as ae, forwardRef as ue } from "react";
6
- import { useFormContext as ie, useForm as oe, FormProvider as ce, appendErrors as fe } from "react-hook-form";
1
+ var K = Object.defineProperty;
2
+ var z = (r, e, n) => e in r ? K(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var P = (r, e, n) => z(r, typeof e != "symbol" ? e + "" : e, n);
4
+ import { isEmpty as R, cloneDeep as C, set as b, get as p, forOwn as L, isArray as S, isObject as U, merge as I, isUndefined as q, pick as ee, unset as re, isNull as W, omitBy as G, isNil as te, isString as ne, capitalize as se } from "lodash-es";
5
+ import ae, { useMemo as Z, useRef as x, useEffect as O, useCallback as ue, forwardRef as ie } from "react";
6
+ import { useFormContext as oe, useForm as ce, FormProvider as fe, appendErrors as de } from "react-hook-form";
7
7
  export * from "react-hook-form";
8
8
  import * as m from "zod";
9
- import { toNestErrors as de } from "@hookform/resolvers";
10
- class le extends Error {
9
+ import { toNestErrors as le } from "@hookform/resolvers";
10
+ class me extends Error {
11
11
  constructor(e) {
12
12
  super(`Input component '${e}' is already registered.`);
13
13
  }
14
14
  }
15
15
  class xe {
16
16
  constructor(e) {
17
- x(this, "componentBank");
18
- x(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,23 +26,23 @@ class xe {
26
26
  */
27
27
  registerComponent(e) {
28
28
  if (!this.allowOverride && this.getComponent(e.internalType))
29
- throw new le(e.internalType);
29
+ throw new me(e.internalType);
30
30
  this.componentBank.set(e.internalType, e);
31
31
  }
32
32
  getComponent(e) {
33
- if (e && !T(e))
33
+ if (e && !R(e))
34
34
  return this.componentBank.get(e);
35
35
  }
36
36
  }
37
- var N = { exports: {} }, S = {};
37
+ var N = { exports: {} }, E = {};
38
38
  /*
39
39
  object-assign
40
40
  (c) Sindre Sorhus
41
41
  @license MIT
42
42
  */
43
- var k, $;
44
- function me() {
45
- if ($) return k;
43
+ var F, $;
44
+ function he() {
45
+ if ($) return F;
46
46
  $ = 1;
47
47
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
48
48
  function t(s) {
@@ -72,7 +72,7 @@ function me() {
72
72
  return !1;
73
73
  }
74
74
  }
75
- return k = a() ? Object.assign : function(s, o) {
75
+ return F = a() ? Object.assign : function(s, o) {
76
76
  for (var u, c = t(s), f, i = 1; i < arguments.length; i++) {
77
77
  u = Object(arguments[i]);
78
78
  for (var d in u)
@@ -84,7 +84,7 @@ function me() {
84
84
  }
85
85
  }
86
86
  return c;
87
- }, k;
87
+ }, F;
88
88
  }
89
89
  /** @license React v17.0.2
90
90
  * react-jsx-runtime.production.min.js
@@ -95,13 +95,13 @@ function me() {
95
95
  * LICENSE file in the root directory of this source tree.
96
96
  */
97
97
  var M;
98
- function he() {
99
- if (M) return S;
100
- M = 1, me();
101
- var r = se, e = 60103;
102
- if (S.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
98
+ function ye() {
99
+ if (M) return E;
100
+ M = 1, he();
101
+ var r = ae, e = 60103;
102
+ if (E.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
103
103
  var n = Symbol.for;
104
- e = n("react.element"), S.Fragment = n("react.fragment");
104
+ e = n("react.element"), E.Fragment = n("react.fragment");
105
105
  }
106
106
  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 };
107
107
  function o(u, c, f) {
@@ -111,13 +111,13 @@ function he() {
111
111
  if (u && u.defaultProps) for (i in c = u.defaultProps, c) d[i] === void 0 && (d[i] = c[i]);
112
112
  return { $$typeof: e, type: u, key: l, ref: h, props: d, _owner: t.current };
113
113
  }
114
- return S.jsx = o, S.jsxs = o, S;
114
+ return E.jsx = o, E.jsxs = o, E;
115
115
  }
116
116
  var B;
117
- function ye() {
118
- return B || (B = 1, N.exports = he()), N.exports;
117
+ function pe() {
118
+ return B || (B = 1, N.exports = ye()), N.exports;
119
119
  }
120
- var y = ye();
120
+ var y = pe();
121
121
  function ge({
122
122
  path: r,
123
123
  factory: e,
@@ -127,7 +127,7 @@ function ge({
127
127
  initialValues: s,
128
128
  input: o
129
129
  }) {
130
- const { formState: u, watch: c } = ie(), {
130
+ const { formState: u, watch: c } = oe(), {
131
131
  metadata: f = {},
132
132
  fixedValues: i = {}
133
133
  /*getValuesWithDependencies*/
@@ -142,28 +142,28 @@ function ge({
142
142
  input: o
143
143
  }),
144
144
  [e, s, o, t, n, r, a, u.errors]
145
- ), h = c(), _ = C(h);
146
- i && Object.keys(i).forEach((p) => {
147
- const Q = i[p];
148
- b(_, p, Q);
145
+ ), h = c(), v = C(h);
146
+ i && Object.keys(i).forEach((g) => {
147
+ const Y = i[g];
148
+ b(v, g, Y);
149
149
  });
150
- const v = !o.isVisible || (o == null ? void 0 : o.isVisible(_, f)), j = Z(() => v ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
150
+ const _ = !o.isVisible || (o == null ? void 0 : o.isVisible(v, f)), j = Z(() => _ ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
151
151
  o.before ? o.before : null,
152
152
  d == null ? void 0 : d.renderComponent(l),
153
153
  o.after ? o.after : null
154
- ] }) : null, [l, o.after, o.before, d, v, u.errors]);
155
- return d ? v ? j : null : /* @__PURE__ */ y.jsxs("p", { children: [
154
+ ] }) : null, [l, o.after, o.before, d, _, u.errors]);
155
+ return d ? _ ? j : null : /* @__PURE__ */ y.jsxs("p", { children: [
156
156
  "Input component not found (internal type: ",
157
157
  o.inputType,
158
158
  ")"
159
159
  ] });
160
160
  }
161
- class Pe {
161
+ class Ne {
162
162
  getType() {
163
163
  return this.internalType;
164
164
  }
165
165
  }
166
- function Ne(r) {
166
+ function Fe(r) {
167
167
  const {
168
168
  mode: e = "onSubmit",
169
169
  resolver: n,
@@ -180,17 +180,17 @@ function Ne(r) {
180
180
  children: c,
181
181
  // fixedValues
182
182
  autoFocusPath: f
183
- } = r, i = oe({
183
+ } = r, i = ce({
184
184
  mode: e ?? "onSubmit",
185
185
  reValidateMode: "onChange",
186
186
  defaultValues: t,
187
187
  shouldFocusError: a,
188
188
  resolver: n
189
- }), d = P(!1);
189
+ }), d = x(!1);
190
190
  O(() => {
191
191
  i.reset(t, {});
192
192
  }, [i.reset, t]), O(() => {
193
- const p = requestIdleCallback(() => {
193
+ const g = requestIdleCallback(() => {
194
194
  i.reset({}, {
195
195
  keepErrors: !0,
196
196
  keepDirty: !0,
@@ -204,17 +204,17 @@ function Ne(r) {
204
204
  keepSubmitCount: !0
205
205
  });
206
206
  });
207
- return () => cancelIdleCallback(p);
207
+ return () => cancelIdleCallback(g);
208
208
  }, []);
209
- const { getValues: l, handleSubmit: h } = i, _ = l(), v = P(!0);
209
+ const { getValues: l, handleSubmit: h } = i, v = l(), _ = x(!0);
210
210
  O(() => {
211
- if (v.current) {
212
- v.current = !1;
211
+ if (_.current) {
212
+ _.current = !1;
213
213
  return;
214
214
  }
215
- s == null || s({ ..._ }), d.current === !0 && i.trigger();
216
- }, [JSON.stringify(_)]);
217
- const j = P(!0);
215
+ s == null || s({ ...v }), d.current === !0 && i.trigger();
216
+ }, [JSON.stringify(v)]);
217
+ const j = x(!0);
218
218
  return O(() => {
219
219
  if (j.current) {
220
220
  j.current = !1;
@@ -224,21 +224,21 @@ function Ne(r) {
224
224
  }, [i.formState.isValid, i.formState.isSubmitted]), O(() => {
225
225
  if (f)
226
226
  if ("requestIdleCallback" in window) {
227
- const p = requestIdleCallback(() => {
227
+ const g = requestIdleCallback(() => {
228
228
  i.setFocus(f);
229
229
  });
230
- return () => cancelIdleCallback(p);
230
+ return () => cancelIdleCallback(g);
231
231
  } else {
232
- const p = setTimeout(() => {
232
+ const g = setTimeout(() => {
233
233
  i.setFocus(f);
234
234
  }, 100);
235
- return () => clearTimeout(p);
235
+ return () => clearTimeout(g);
236
236
  }
237
- }, [i]), /* @__PURE__ */ y.jsx(ce, { ...i, children: typeof c == "function" ? c({
237
+ }, [i]), /* @__PURE__ */ y.jsx(fe, { ...i, children: typeof c == "function" ? c({
238
238
  ...i,
239
239
  submitForm: async () => {
240
- u && (d.current = !0, h((p) => {
241
- u(p);
240
+ u && (d.current = !0, h((g) => {
241
+ u(g);
242
242
  })());
243
243
  }
244
244
  }) : c });
@@ -249,29 +249,36 @@ const ke = (r) => {
249
249
  return (n = r == null ? void 0 : r.inputs) == null || n.forEach((t) => {
250
250
  var a;
251
251
  t.inputType === "group" && ((a = t == null ? void 0 : t.inputs) == null || a.forEach((s) => {
252
- typeof g(e, s.path) > "u" && b(e, s.path, s.default);
253
- })), typeof g(e, t.path) > "u" && b(e, t.path, t.default);
252
+ typeof p(e, s.path) > "u" && b(e, s.path, s.default);
253
+ })), typeof p(e, t.path) > "u" && b(e, t.path, t.default);
254
254
  }), e;
255
255
  };
256
- function Fe(r, e) {
256
+ function Ae(r, e) {
257
257
  const n = r.inputs.map((t) => {
258
- const a = pe(e, t.path);
258
+ const a = be(e, t.path);
259
259
  return a || t;
260
260
  });
261
261
  return { ...r, inputs: n };
262
262
  }
263
- function pe(r, e) {
263
+ function be(r, e) {
264
264
  return r.inputs.find((n) => n.path === e);
265
265
  }
266
- const be = "Required field";
267
- function R(r) {
266
+ const H = "__temp_", De = (r) => H + r.split(".").join("__");
267
+ function Ze(r) {
268
+ const e = { ...r };
269
+ return L(e, (n, t) => {
270
+ t.startsWith(H) && delete e[t];
271
+ }), e;
272
+ }
273
+ const _e = "Required field";
274
+ function T(r) {
268
275
  const e = typeof r == "string" ? JSON.parse(r) : r;
269
276
  if (typeof e == "string")
270
277
  return e;
271
- if (E(e))
272
- return R(e[0]);
278
+ if (S(e))
279
+ return T(e[0]);
273
280
  const n = e;
274
- return L(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
281
+ return U(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
275
282
  }
276
283
  function ve(r, e, n) {
277
284
  let t = {};
@@ -300,18 +307,18 @@ function V(r, e, n) {
300
307
  const d = o != null && o.___array ? V({ ___array: o.___array }, e, n) : { ___array: m.any() }, l = m.array(d.___array).optional(), h = J(i, u, e, n, l);
301
308
  t[a] = h;
302
309
  } else if (i && u) {
303
- const d = _e(i, u, e, n);
310
+ const d = Ee(i, u, e, n);
304
311
  t[a] = d;
305
312
  } else s && u ? t[a] = A(u, n) : t[a] = m.object(V(r[a], e, n)).optional();
306
313
  }), t;
307
314
  }
308
- function _e(r, e, n, t) {
315
+ function Ee(r, e, n, t) {
309
316
  return m.any().optional().superRefine(async (a, s) => {
310
317
  var u, c;
311
318
  if (e.required && !(await A(e, t).safeParseAsync(a)).success)
312
319
  return s.addIssue({
313
320
  code: m.ZodIssueCode.custom,
314
- message: F(e, t)
321
+ message: k(e, t)
315
322
  }), m.NEVER;
316
323
  if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
317
324
  const f = (c = t == null ? void 0 : t.validationConfig) == null ? void 0 : c.globalValidation(a, e, t.metadata);
@@ -323,11 +330,11 @@ function _e(r, e, n, t) {
323
330
  if (!f.continue)
324
331
  return !0;
325
332
  }
326
- const o = G(r, n);
333
+ const o = Q(r, n);
327
334
  if (o) {
328
335
  const f = await o.safeParseAsync(a);
329
336
  if (!f.success) {
330
- const i = R(f == null ? void 0 : f.error.message), d = i === "Required" ? F(e, t) : i;
337
+ const i = T(f == null ? void 0 : f.error.message), d = i === "Required" ? k(e, t) : i;
331
338
  s.addIssue({
332
339
  code: m.ZodIssueCode.custom,
333
340
  message: d
@@ -341,7 +348,7 @@ function J(r, e, n, t, a) {
341
348
  var i, d;
342
349
  const c = await A(e, t).safeParseAsync(s);
343
350
  if (e.required && !c.success) {
344
- const l = R(c.error.message);
351
+ const l = T(c.error.message);
345
352
  return o.addIssue({ code: m.ZodIssueCode.custom, message: l, fatal: !0 }), m.NEVER;
346
353
  }
347
354
  if (!e.required && !c.success)
@@ -351,23 +358,23 @@ function J(r, e, n, t, a) {
351
358
  if (l.error)
352
359
  return o.addIssue({
353
360
  code: m.ZodIssueCode.custom,
354
- message: R(l.error)
361
+ message: T(l.error)
355
362
  }), m.NEVER;
356
363
  if (!l.continue)
357
364
  return m.NEVER;
358
365
  }
359
- if (!E(s))
366
+ if (!S(s))
360
367
  return o.addIssue({
361
368
  code: m.ZodIssueCode.custom,
362
369
  message: "'Value is not array'"
363
370
  }), m.NEVER;
364
- const f = G(r, n);
371
+ const f = Q(r, n);
365
372
  if (f) {
366
373
  const l = await f.safeParseAsync(s);
367
374
  if (!l.success)
368
375
  return o.addIssue({
369
376
  code: m.ZodIssueCode.custom,
370
- message: R(l.error.message)
377
+ message: T(l.error.message)
371
378
  }), m.NEVER;
372
379
  }
373
380
  }).pipe(a ?? m.any());
@@ -377,7 +384,7 @@ function w(r, e, n, t, a) {
377
384
  var u, c, f, i, d;
378
385
  const o = n;
379
386
  if (!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) {
380
- const l = g(r, s.path);
387
+ const l = p(r, s.path);
381
388
  if ((c = s.validation) != null && c.schema ? b(
382
389
  r,
383
390
  s.path,
@@ -389,15 +396,15 @@ function w(r, e, n, t, a) {
389
396
  const h = {};
390
397
  w(
391
398
  h,
392
- s.inputConfig.inputs.map((v) => ({
393
- ...v,
394
- path: v.relativePath
399
+ s.inputConfig.inputs.map((_) => ({
400
+ ..._,
401
+ path: _.relativePath
395
402
  })),
396
403
  n,
397
404
  t
398
405
  );
399
- const _ = g(r, s.path);
400
- b(r, s.path, I(_, { _schemaObj: h, _isList: !0, _input: s }));
406
+ const v = p(r, s.path);
407
+ b(r, s.path, I(v, { _schemaObj: h, _isList: !0, _input: s }));
401
408
  }
402
409
  if (!((i = s.validation) != null && i.schema) && s.inputType === "array") {
403
410
  const h = {};
@@ -420,9 +427,9 @@ function w(r, e, n, t, a) {
420
427
  }
421
428
  });
422
429
  }
423
- function F(r, e) {
430
+ function k(r, e) {
424
431
  var n, t, a;
425
- 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) ?? be;
432
+ 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) ?? _e;
426
433
  }
427
434
  function A(r, e) {
428
435
  var t, a, s, o, u, c;
@@ -430,9 +437,9 @@ function A(r, e) {
430
437
  return (o = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : o[r.inputType];
431
438
  if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
432
439
  return (c = e == null ? void 0 : e.validationConfig) == null ? void 0 : c.requiredSchema;
433
- const n = F(r, e);
440
+ const n = k(r, e);
434
441
  return m.any().optional().superRefine((f, i) => {
435
- typeof f == "object" && T(f) && i.addIssue({
442
+ typeof f == "object" && R(f) && i.addIssue({
436
443
  code: m.ZodIssueCode.custom,
437
444
  message: n
438
445
  }), (q(f) || f === "") && i.addIssue({
@@ -441,13 +448,13 @@ function A(r, e) {
441
448
  });
442
449
  });
443
450
  }
444
- function G(r, e) {
451
+ function Q(r, e) {
445
452
  if (r instanceof m.ZodType)
446
453
  return r;
447
454
  if (typeof r == "function")
448
455
  return r(e);
449
456
  }
450
- const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Ee = (r, e) => {
457
+ const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Oe = (r, e) => {
451
458
  const n = {};
452
459
  for (; r.length; ) {
453
460
  const t = r[0], { code: a, message: s, path: o } = t, u = o.join(".");
@@ -463,7 +470,7 @@ const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Ee = (r, e) => {
463
470
  "unionErrors" in t && t.unionErrors.forEach((c) => c.errors.forEach((f) => r.push(f)));
464
471
  {
465
472
  const c = n[u].types, f = c && c[t.code];
466
- n[u] = fe(
473
+ n[u] = de(
467
474
  u,
468
475
  e,
469
476
  n,
@@ -475,8 +482,8 @@ const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Ee = (r, e) => {
475
482
  }
476
483
  return n;
477
484
  };
478
- function Ae(r, e) {
479
- return ae(
485
+ function $e(r, e) {
486
+ return ue(
480
487
  async (n, t, a) => {
481
488
  try {
482
489
  return await ve(r, n, e).parseAsync(n), {
@@ -488,7 +495,7 @@ function Ae(r, e) {
488
495
  if (Se(s))
489
496
  return {
490
497
  values: {},
491
- errors: de(Ee(s.errors, !0), a)
498
+ errors: le(Oe(s.errors, !0), a)
492
499
  };
493
500
  throw s;
494
501
  }
@@ -496,51 +503,45 @@ function Ae(r, e) {
496
503
  [r]
497
504
  );
498
505
  }
499
- function De(r, e) {
506
+ function Me(r, e) {
500
507
  const n = C(r);
501
508
  return e.forEach((t) => {
502
- if (t.inputTransform) {
503
- const a = E(t.inputTransform) ? t.inputTransform : [t.inputTransform], s = g(n, t.path);
504
- a.forEach((o) => {
505
- const u = o(s, n);
506
- u && b(n, u.path ?? t.path, u.value);
507
- });
508
- }
509
+ t.inputTransform && (S(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
510
+ const o = p(n, t.path), u = s(o, n);
511
+ u && b(n, u.path ?? t.path, u.value);
512
+ });
509
513
  }), n;
510
514
  }
511
- function Ze(r, e) {
515
+ function Be(r, e) {
512
516
  const n = C(r);
513
517
  return e.forEach((t) => {
514
- if (t.outputTransform) {
515
- const a = E(t.outputTransform) ? t.outputTransform : [t.outputTransform], s = g(n, t.path);
516
- a.forEach((o) => {
517
- const u = o(s, n);
518
- u && b(n, u.path ?? t.path, u.value);
519
- });
520
- }
518
+ t.outputTransform && (S(t.outputTransform) ? t.outputTransform : [t.outputTransform]).forEach((s) => {
519
+ const o = p(n, t.path), u = s(o, n);
520
+ u && b(n, u.path ?? t.path, u.value);
521
+ });
521
522
  }), n;
522
523
  }
523
524
  function D(r) {
524
525
  return r.reduce((n, t) => t.inputType === "group" && t.inputs ? [...n, t, ...D(t.inputs)] : [...n, t], []);
525
526
  }
526
- function $e(r) {
527
+ function Je(r) {
527
528
  const n = D(r.inputs).reduce((t, a) => {
528
529
  const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
529
530
  return (a.inputTransform || a.outputTransform) && t.push({
530
- ...X(a, "path", "inputTransform", "outputTransform"),
531
+ ...ee(a, "path", "inputTransform", "outputTransform"),
531
532
  level: a.path.split(".").length,
532
533
  isPrimitive: s
533
534
  }), t;
534
535
  }, []);
535
536
  return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
536
537
  }
537
- function Me(r, e, n) {
538
+ function Le(r, e, n) {
538
539
  const t = D(r.inputs), a = C(e);
539
540
  return t.forEach((s) => {
540
- s.isVisible && !s.isVisible(e, n) && z(a, s.path);
541
+ s.isVisible && !s.isVisible(e, n) && re(a, s.path);
541
542
  }), a;
542
543
  }
543
- function Be() {
544
+ function Ue() {
544
545
  return function(r, e) {
545
546
  if (!(typeof r > "u"))
546
547
  return r ? {
@@ -548,7 +549,7 @@ function Be() {
548
549
  } : { value: r };
549
550
  };
550
551
  }
551
- function Je(r) {
552
+ function We(r) {
552
553
  return function(e, n) {
553
554
  if (typeof e > "u") return;
554
555
  if (!e) return { value: e };
@@ -558,64 +559,64 @@ function Je(r) {
558
559
  return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
559
560
  };
560
561
  }
561
- function Le() {
562
+ function Ge() {
562
563
  return function(r, e) {
563
564
  if (!(typeof r > "u"))
564
- return E(r) && T(r) ? { value: void 0 } : { value: r };
565
+ return S(r) && R(r) ? { value: void 0 } : { value: r };
565
566
  };
566
567
  }
567
- function Ue(r) {
568
+ function He(r) {
568
569
  return function(e, n) {
569
- const t = r ? g(n, r) : e;
570
+ const t = r ? p(n, r) : e;
570
571
  if (!(typeof t > "u")) {
571
- if (U(t)) return { value: void 0, path: r };
572
- if (L(t)) {
573
- const a = W(t, ee);
574
- if (T(a))
572
+ if (W(t)) return { value: void 0, path: r };
573
+ if (U(t)) {
574
+ const a = G(t, te);
575
+ if (R(a))
575
576
  return { value: void 0, path: r };
576
577
  }
577
578
  return { value: t, path: r };
578
579
  }
579
580
  };
580
581
  }
581
- function We() {
582
+ function Qe() {
582
583
  return function(r, e) {
583
584
  if (!(typeof r > "u"))
584
- return re(r) && T(r) ? { value: void 0 } : { value: r };
585
+ return ne(r) && R(r) ? { value: void 0 } : { value: r };
585
586
  };
586
587
  }
587
- function Ge(r) {
588
+ function Xe(r) {
588
589
  return function(e, n) {
589
- const t = g(n, r);
590
+ const t = p(n, r);
590
591
  return typeof t == "string" ? { value: t } : { value: e };
591
592
  };
592
593
  }
593
- function He(r) {
594
+ function Ye(r) {
594
595
  return function(e, n) {
595
596
  if (typeof e > "u") return;
596
597
  if (!e) return { value: e };
597
- const t = g(n, r);
598
+ const t = p(n, r);
598
599
  if (typeof t == "object") {
599
- const a = Oe(t);
600
+ const a = Te(t);
600
601
  if (Object.getOwnPropertyNames(a).length === 1)
601
602
  return { value: e, path: r };
602
603
  }
603
604
  return { value: e };
604
605
  };
605
606
  }
606
- function Qe(r) {
607
+ function Ke(r) {
607
608
  return function(e, n) {
608
609
  if (typeof e > "u") return;
609
- const t = g(n, r);
610
+ const t = p(n, r);
610
611
  return typeof t == "string" ? { value: [t] } : { value: e };
611
612
  };
612
613
  }
613
- function Ye(r, e) {
614
+ function ze(r, e) {
614
615
  return function(n, t) {
615
616
  if (typeof n > "u") return;
616
617
  if (!n) return { value: n };
617
- const a = g(t, r);
618
- if (E(a)) {
618
+ const a = p(t, r);
619
+ if (S(a)) {
619
620
  if (a.length === 1)
620
621
  return { value: a[0], path: r };
621
622
  if (a.length === 0 && e != null && e.unsetIfEmpty)
@@ -624,66 +625,68 @@ function Ye(r, e) {
624
625
  return { value: n };
625
626
  };
626
627
  }
627
- function H(r) {
628
- return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !H(r[e])) : q(r);
628
+ function X(r) {
629
+ return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !X(r[e])) : q(r);
629
630
  }
630
- function Oe(r) {
631
- return W(r, (e) => typeof e == "object" ? H(e) : q(e));
631
+ function Te(r) {
632
+ return G(r, (e) => typeof e == "object" ? X(e) : q(e));
632
633
  }
633
634
  function Re({ input: r, factory: e }) {
634
635
  const { prefix: n = "" } = {};
635
636
  return /* @__PURE__ */ y.jsx("div", { children: /* @__PURE__ */ y.jsx(ge, { path: `${n}${r.path}`, factory: e, readonly: !1, input: r }) });
636
637
  }
637
- function Te(r) {
638
+ function je(r) {
638
639
  const { items: e, factory: n } = r;
639
640
  return /* @__PURE__ */ y.jsx(y.Fragment, { children: e.map((t) => {
640
641
  const a = `${t.inputType}_${t.path}_${t.label}`;
641
642
  return /* @__PURE__ */ y.jsx(Re, { input: t, factory: n }, a);
642
643
  }) });
643
644
  }
644
- const je = ue((r, e) => {
645
+ const Ie = ie((r, e) => {
645
646
  const { inputs: n, className: t, factory: a } = r;
646
647
  return /* @__PURE__ */ y.jsxs("div", { className: t, ref: e, children: [
647
648
  n.hero,
648
- /* @__PURE__ */ y.jsx(Te, { items: n.inputs, factory: a })
649
+ /* @__PURE__ */ y.jsx(je, { items: n.inputs, factory: a })
649
650
  ] });
650
651
  });
651
- je.displayName = "RenderForm";
652
- function Ke(r) {
652
+ Ie.displayName = "RenderForm";
653
+ function er(r) {
653
654
  let e = !0;
654
- return te(r, (n) => {
655
- e = e && (n === "" || U(n) || q(n));
655
+ return L(r, (n) => {
656
+ e = e && (n === "" || W(n) || q(n));
656
657
  }), e;
657
658
  }
658
- const Xe = (r = "") => ne(r.split("_").join(" "));
659
+ const rr = (r = "") => se(r.split("_").join(" "));
659
660
  export {
660
- Pe as InputComponent,
661
+ Ne as InputComponent,
661
662
  ge as InputComponentRenderer,
662
663
  xe as InputFactory,
663
- le as InputOverrideError,
664
- je as RenderForm,
665
- Te as RenderInputs,
666
- Ne as RootForm,
664
+ me as InputOverrideError,
665
+ Ie as RenderForm,
666
+ je as RenderInputs,
667
+ Fe as RootForm,
667
668
  Re as Row,
668
- Je as arrayToObjectOutputTransformer,
669
- Xe as generateReadableLabel,
669
+ We as arrayToObjectOutputTransformer,
670
+ rr as generateReadableLabel,
670
671
  ke as getDefaultValuesFromFormDefinition,
671
- $e as getTransformers,
672
+ De as getTemporaryPath,
673
+ Je as getTransformers,
672
674
  ve as getValidationSchema,
673
- De as inputTransformValues,
674
- Ke as isChildrenEmpty,
675
- Be as objectToArrayInputTransformer,
676
- Ze as outputTransformValues,
677
- Fe as overrideFormDefinition,
678
- R as processValidationParseResponse,
679
- Qe as shorthandArrayInputTransformer,
680
- Ye as shorthandArrayOutputTransformer,
681
- Ge as shorthandObjectInputTransformer,
682
- He as shorthandObjectOutputTransformer,
683
- Le as unsetEmptyArrayOutputTransformer,
684
- Ue as unsetEmptyObjectOutputTransformer,
685
- We as unsetEmptyStringOutputTransformer,
686
- Me as unsetHiddenInputsValues,
687
- Ae as useZodValidationResolver
675
+ Me as inputTransformValues,
676
+ er as isChildrenEmpty,
677
+ Ue as objectToArrayInputTransformer,
678
+ Be as outputTransformValues,
679
+ Ae as overrideFormDefinition,
680
+ T as processValidationParseResponse,
681
+ Ze as removeTemporaryFieldsValue,
682
+ Ke as shorthandArrayInputTransformer,
683
+ ze as shorthandArrayOutputTransformer,
684
+ Xe as shorthandObjectInputTransformer,
685
+ Ye as shorthandObjectOutputTransformer,
686
+ Ge as unsetEmptyArrayOutputTransformer,
687
+ He as unsetEmptyObjectOutputTransformer,
688
+ Qe as unsetEmptyStringOutputTransformer,
689
+ Le as unsetHiddenInputsValues,
690
+ $e as useZodValidationResolver
688
691
  };
689
692
  //# sourceMappingURL=index.js.map