@harnessio/forms 0.0.10 → 0.0.12

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