@harnessio/forms 0.0.9 → 0.0.11
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/core/factory/InputFactory.d.ts +6 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +116 -108
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var K = Object.defineProperty;
|
|
2
2
|
var z = (r, e, n) => e in r ? K(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
3
|
var P = (r, e, n) => z(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { isEmpty as R, cloneDeep as
|
|
5
|
-
import ae, { useMemo as Z, useRef as x, useEffect as
|
|
6
|
-
import { useFormContext as
|
|
4
|
+
import { isEmpty as R, cloneDeep as w, 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";
|
|
7
7
|
export * from "react-hook-form";
|
|
8
8
|
import * as m from "zod";
|
|
9
9
|
import { toNestErrors as le } from "@hookform/resolvers";
|
|
@@ -33,6 +33,14 @@ class xe {
|
|
|
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
|
+
}
|
|
36
44
|
}
|
|
37
45
|
var N = { exports: {} }, E = {};
|
|
38
46
|
/*
|
|
@@ -40,9 +48,9 @@ object-assign
|
|
|
40
48
|
(c) Sindre Sorhus
|
|
41
49
|
@license MIT
|
|
42
50
|
*/
|
|
43
|
-
var
|
|
51
|
+
var k, $;
|
|
44
52
|
function he() {
|
|
45
|
-
if ($) return
|
|
53
|
+
if ($) return k;
|
|
46
54
|
$ = 1;
|
|
47
55
|
var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
|
|
48
56
|
function t(s) {
|
|
@@ -57,24 +65,24 @@ function he() {
|
|
|
57
65
|
var s = new String("abc");
|
|
58
66
|
if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
|
|
59
67
|
return !1;
|
|
60
|
-
for (var
|
|
61
|
-
|
|
62
|
-
var c = Object.getOwnPropertyNames(
|
|
63
|
-
return o
|
|
68
|
+
for (var i = {}, u = 0; u < 10; u++)
|
|
69
|
+
i["_" + String.fromCharCode(u)] = u;
|
|
70
|
+
var c = Object.getOwnPropertyNames(i).map(function(o) {
|
|
71
|
+
return i[o];
|
|
64
72
|
});
|
|
65
73
|
if (c.join("") !== "0123456789")
|
|
66
74
|
return !1;
|
|
67
75
|
var f = {};
|
|
68
|
-
return "abcdefghijklmnopqrst".split("").forEach(function(
|
|
69
|
-
f[
|
|
76
|
+
return "abcdefghijklmnopqrst".split("").forEach(function(o) {
|
|
77
|
+
f[o] = o;
|
|
70
78
|
}), Object.keys(Object.assign({}, f)).join("") === "abcdefghijklmnopqrst";
|
|
71
79
|
} catch {
|
|
72
80
|
return !1;
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
|
-
return
|
|
76
|
-
for (var u, c = t(s), f,
|
|
77
|
-
u = Object(arguments[
|
|
83
|
+
return k = a() ? Object.assign : function(s, i) {
|
|
84
|
+
for (var u, c = t(s), f, o = 1; o < arguments.length; o++) {
|
|
85
|
+
u = Object(arguments[o]);
|
|
78
86
|
for (var d in u)
|
|
79
87
|
e.call(u, d) && (c[d] = u[d]);
|
|
80
88
|
if (r) {
|
|
@@ -84,7 +92,7 @@ function he() {
|
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
return c;
|
|
87
|
-
},
|
|
95
|
+
}, k;
|
|
88
96
|
}
|
|
89
97
|
/** @license React v17.0.2
|
|
90
98
|
* react-jsx-runtime.production.min.js
|
|
@@ -104,14 +112,14 @@ function ye() {
|
|
|
104
112
|
e = n("react.element"), E.Fragment = n("react.fragment");
|
|
105
113
|
}
|
|
106
114
|
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
|
-
function
|
|
108
|
-
var
|
|
115
|
+
function i(u, c, f) {
|
|
116
|
+
var o, d = {}, l = null, h = null;
|
|
109
117
|
f !== void 0 && (l = "" + f), c.key !== void 0 && (l = "" + c.key), c.ref !== void 0 && (h = c.ref);
|
|
110
|
-
for (
|
|
111
|
-
if (u && u.defaultProps) for (
|
|
118
|
+
for (o in c) a.call(c, o) && !s.hasOwnProperty(o) && (d[o] = c[o]);
|
|
119
|
+
if (u && u.defaultProps) for (o in c = u.defaultProps, c) d[o] === void 0 && (d[o] = c[o]);
|
|
112
120
|
return { $$typeof: e, type: u, key: l, ref: h, props: d, _owner: t.current };
|
|
113
121
|
}
|
|
114
|
-
return E.jsx =
|
|
122
|
+
return E.jsx = i, E.jsxs = i, E;
|
|
115
123
|
}
|
|
116
124
|
var B;
|
|
117
125
|
function pe() {
|
|
@@ -125,13 +133,13 @@ function ge({
|
|
|
125
133
|
onChange: t,
|
|
126
134
|
readonly: a,
|
|
127
135
|
initialValues: s,
|
|
128
|
-
input:
|
|
136
|
+
input: i
|
|
129
137
|
}) {
|
|
130
|
-
const { formState: u, watch: c } =
|
|
138
|
+
const { formState: u, watch: c } = ie(), {
|
|
131
139
|
metadata: f = {},
|
|
132
|
-
fixedValues:
|
|
140
|
+
fixedValues: o = {}
|
|
133
141
|
/*getValuesWithDependencies*/
|
|
134
|
-
} = {}, d = e == null ? void 0 : e.getComponent(
|
|
142
|
+
} = {}, d = e == null ? void 0 : e.getComponent(i.inputType), l = Z(
|
|
135
143
|
() => ({
|
|
136
144
|
path: r,
|
|
137
145
|
initialValues: s,
|
|
@@ -139,22 +147,22 @@ function ge({
|
|
|
139
147
|
onChange: t,
|
|
140
148
|
factory: e,
|
|
141
149
|
readonly: a,
|
|
142
|
-
input:
|
|
150
|
+
input: i
|
|
143
151
|
}),
|
|
144
|
-
[e, s,
|
|
145
|
-
), h = c(), v =
|
|
146
|
-
|
|
147
|
-
const Y =
|
|
152
|
+
[e, s, i, t, n, r, a, u.errors]
|
|
153
|
+
), h = c(), v = w(h);
|
|
154
|
+
o && Object.keys(o).forEach((g) => {
|
|
155
|
+
const Y = o[g];
|
|
148
156
|
b(v, g, Y);
|
|
149
157
|
});
|
|
150
|
-
const _ = !
|
|
151
|
-
|
|
158
|
+
const _ = !i.isVisible || (i == null ? void 0 : i.isVisible(v, f)), j = Z(() => _ ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
|
|
159
|
+
i.before ? i.before : null,
|
|
152
160
|
d == null ? void 0 : d.renderComponent(l),
|
|
153
|
-
|
|
154
|
-
] }) : null, [l,
|
|
161
|
+
i.after ? i.after : null
|
|
162
|
+
] }) : null, [l, i.after, i.before, d, _, u.errors]);
|
|
155
163
|
return d ? _ ? j : null : /* @__PURE__ */ y.jsxs("p", { children: [
|
|
156
164
|
"Input component not found (internal type: ",
|
|
157
|
-
|
|
165
|
+
i.inputType,
|
|
158
166
|
")"
|
|
159
167
|
] });
|
|
160
168
|
}
|
|
@@ -163,7 +171,7 @@ class Ne {
|
|
|
163
171
|
return this.internalType;
|
|
164
172
|
}
|
|
165
173
|
}
|
|
166
|
-
function
|
|
174
|
+
function ke(r) {
|
|
167
175
|
const {
|
|
168
176
|
mode: e = "onSubmit",
|
|
169
177
|
resolver: n,
|
|
@@ -171,7 +179,7 @@ function Fe(r) {
|
|
|
171
179
|
shouldFocusError: a,
|
|
172
180
|
// validateAfterFirstSubmit,
|
|
173
181
|
onValuesChange: s,
|
|
174
|
-
onValidationChange:
|
|
182
|
+
onValidationChange: i,
|
|
175
183
|
onSubmit: u,
|
|
176
184
|
// validate,
|
|
177
185
|
// validateDebounceInterval,
|
|
@@ -180,18 +188,18 @@ function Fe(r) {
|
|
|
180
188
|
children: c,
|
|
181
189
|
// fixedValues
|
|
182
190
|
autoFocusPath: f
|
|
183
|
-
} = r,
|
|
191
|
+
} = r, o = ce({
|
|
184
192
|
mode: e ?? "onSubmit",
|
|
185
193
|
reValidateMode: "onChange",
|
|
186
194
|
defaultValues: t,
|
|
187
195
|
shouldFocusError: a,
|
|
188
196
|
resolver: n
|
|
189
197
|
}), d = x(!1);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}, [
|
|
198
|
+
T(() => {
|
|
199
|
+
o.reset(t, {});
|
|
200
|
+
}, [o.reset, t]), T(() => {
|
|
193
201
|
const g = requestIdleCallback(() => {
|
|
194
|
-
|
|
202
|
+
o.reset({}, {
|
|
195
203
|
keepErrors: !0,
|
|
196
204
|
keepDirty: !0,
|
|
197
205
|
keepDirtyValues: !0,
|
|
@@ -206,36 +214,36 @@ function Fe(r) {
|
|
|
206
214
|
});
|
|
207
215
|
return () => cancelIdleCallback(g);
|
|
208
216
|
}, []);
|
|
209
|
-
const { getValues: l, handleSubmit: h } =
|
|
210
|
-
|
|
217
|
+
const { getValues: l, handleSubmit: h } = o, v = l(), _ = x(!0);
|
|
218
|
+
T(() => {
|
|
211
219
|
if (_.current) {
|
|
212
220
|
_.current = !1;
|
|
213
221
|
return;
|
|
214
222
|
}
|
|
215
|
-
s == null || s({ ...v }), d.current === !0 &&
|
|
223
|
+
s == null || s({ ...v }), d.current === !0 && o.trigger();
|
|
216
224
|
}, [JSON.stringify(v)]);
|
|
217
225
|
const j = x(!0);
|
|
218
|
-
return
|
|
226
|
+
return T(() => {
|
|
219
227
|
if (j.current) {
|
|
220
228
|
j.current = !1;
|
|
221
229
|
return;
|
|
222
230
|
}
|
|
223
|
-
|
|
224
|
-
}, [
|
|
231
|
+
i == null || i({ isValid: o.formState.isValid, isSubmitted: o.formState.isSubmitted });
|
|
232
|
+
}, [o.formState.isValid, o.formState.isSubmitted]), T(() => {
|
|
225
233
|
if (f)
|
|
226
234
|
if ("requestIdleCallback" in window) {
|
|
227
235
|
const g = requestIdleCallback(() => {
|
|
228
|
-
|
|
236
|
+
o.setFocus(f);
|
|
229
237
|
});
|
|
230
238
|
return () => cancelIdleCallback(g);
|
|
231
239
|
} else {
|
|
232
240
|
const g = setTimeout(() => {
|
|
233
|
-
|
|
241
|
+
o.setFocus(f);
|
|
234
242
|
}, 100);
|
|
235
243
|
return () => clearTimeout(g);
|
|
236
244
|
}
|
|
237
|
-
}, [
|
|
238
|
-
...
|
|
245
|
+
}, [o]), /* @__PURE__ */ y.jsx(fe, { ...o, children: typeof c == "function" ? c({
|
|
246
|
+
...o,
|
|
239
247
|
submitForm: async () => {
|
|
240
248
|
u && (d.current = !0, h((g) => {
|
|
241
249
|
u(g);
|
|
@@ -243,12 +251,12 @@ function Fe(r) {
|
|
|
243
251
|
}
|
|
244
252
|
}) : c });
|
|
245
253
|
}
|
|
246
|
-
const
|
|
254
|
+
const Fe = (r) => {
|
|
247
255
|
var n;
|
|
248
256
|
const e = {};
|
|
249
257
|
return (n = r == null ? void 0 : r.inputs) == null || n.forEach((t) => {
|
|
250
258
|
var a;
|
|
251
|
-
t.inputType === "group" && ((a = t == null ? void 0 : t.inputs) == null || a.forEach((s) => {
|
|
259
|
+
(t.inputType === "group" || t.inputType === "accordion") && ((a = t == null ? void 0 : t.inputs) == null || a.forEach((s) => {
|
|
252
260
|
typeof p(e, s.path) > "u" && b(e, s.path, s.default);
|
|
253
261
|
})), typeof p(e, t.path) > "u" && b(e, t.path, t.default);
|
|
254
262
|
}), e;
|
|
@@ -271,18 +279,18 @@ function Ze(r) {
|
|
|
271
279
|
}), e;
|
|
272
280
|
}
|
|
273
281
|
const _e = "Required field";
|
|
274
|
-
function
|
|
282
|
+
function O(r) {
|
|
275
283
|
const e = typeof r == "string" ? JSON.parse(r) : r;
|
|
276
284
|
if (typeof e == "string")
|
|
277
285
|
return e;
|
|
278
286
|
if (S(e))
|
|
279
|
-
return
|
|
287
|
+
return O(e[0]);
|
|
280
288
|
const n = e;
|
|
281
289
|
return U(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
|
|
282
290
|
}
|
|
283
291
|
function ve(r, e, n) {
|
|
284
292
|
let t = {};
|
|
285
|
-
if (
|
|
293
|
+
if (C(t, r.inputs, e, n), n != null && n.prefix) {
|
|
286
294
|
const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
|
|
287
295
|
t = b({}, s, t);
|
|
288
296
|
}
|
|
@@ -293,21 +301,21 @@ function V(r, e, n) {
|
|
|
293
301
|
return Object.keys(r).forEach((a) => {
|
|
294
302
|
const {
|
|
295
303
|
_requiredOnly: s,
|
|
296
|
-
_schemaObj:
|
|
304
|
+
_schemaObj: i,
|
|
297
305
|
_input: u,
|
|
298
306
|
_isList: c,
|
|
299
307
|
_isArrayItem: f,
|
|
300
|
-
_schema:
|
|
308
|
+
_schema: o
|
|
301
309
|
/*...nestedSchemaObj*/
|
|
302
310
|
} = r[a];
|
|
303
|
-
if (c &&
|
|
304
|
-
const d = m.array(m.object(V(
|
|
311
|
+
if (c && i && u) {
|
|
312
|
+
const d = m.array(m.object(V(i, e, n))).optional(), l = J(o, u, e, n, d);
|
|
305
313
|
t[a] = l;
|
|
306
314
|
} else if (f && u) {
|
|
307
|
-
const d =
|
|
315
|
+
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);
|
|
308
316
|
t[a] = h;
|
|
309
|
-
} else if (
|
|
310
|
-
const d = Ee(
|
|
317
|
+
} else if (o && u) {
|
|
318
|
+
const d = Ee(o, u, e, n);
|
|
311
319
|
t[a] = d;
|
|
312
320
|
} else s && u ? t[a] = A(u, n) : t[a] = m.object(V(r[a], e, n)).optional();
|
|
313
321
|
}), t;
|
|
@@ -318,7 +326,7 @@ function Ee(r, e, n, t) {
|
|
|
318
326
|
if (e.required && !(await A(e, t).safeParseAsync(a)).success)
|
|
319
327
|
return s.addIssue({
|
|
320
328
|
code: m.ZodIssueCode.custom,
|
|
321
|
-
message:
|
|
329
|
+
message: F(e, t)
|
|
322
330
|
}), m.NEVER;
|
|
323
331
|
if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
|
|
324
332
|
const f = (c = t == null ? void 0 : t.validationConfig) == null ? void 0 : c.globalValidation(a, e, t.metadata);
|
|
@@ -330,11 +338,11 @@ function Ee(r, e, n, t) {
|
|
|
330
338
|
if (!f.continue)
|
|
331
339
|
return !0;
|
|
332
340
|
}
|
|
333
|
-
const
|
|
334
|
-
if (
|
|
335
|
-
const f = await
|
|
341
|
+
const i = Q(r, n);
|
|
342
|
+
if (i) {
|
|
343
|
+
const f = await i.safeParseAsync(a);
|
|
336
344
|
if (!f.success) {
|
|
337
|
-
const
|
|
345
|
+
const o = O(f == null ? void 0 : f.error.message), d = o === "Required" ? F(e, t) : o;
|
|
338
346
|
s.addIssue({
|
|
339
347
|
code: m.ZodIssueCode.custom,
|
|
340
348
|
message: d
|
|
@@ -344,27 +352,27 @@ function Ee(r, e, n, t) {
|
|
|
344
352
|
});
|
|
345
353
|
}
|
|
346
354
|
function J(r, e, n, t, a) {
|
|
347
|
-
return m.any().optional().superRefine(async (s,
|
|
348
|
-
var
|
|
355
|
+
return m.any().optional().superRefine(async (s, i) => {
|
|
356
|
+
var o, d;
|
|
349
357
|
const c = await A(e, t).safeParseAsync(s);
|
|
350
358
|
if (e.required && !c.success) {
|
|
351
|
-
const l =
|
|
352
|
-
return
|
|
359
|
+
const l = O(c.error.message);
|
|
360
|
+
return i.addIssue({ code: m.ZodIssueCode.custom, message: l, fatal: !0 }), m.NEVER;
|
|
353
361
|
}
|
|
354
362
|
if (!e.required && !c.success)
|
|
355
363
|
return m.NEVER;
|
|
356
|
-
if ((
|
|
364
|
+
if ((o = t == null ? void 0 : t.validationConfig) != null && o.globalValidation) {
|
|
357
365
|
const l = (d = t == null ? void 0 : t.validationConfig) == null ? void 0 : d.globalValidation(s, e, t.metadata);
|
|
358
366
|
if (l.error)
|
|
359
|
-
return
|
|
367
|
+
return i.addIssue({
|
|
360
368
|
code: m.ZodIssueCode.custom,
|
|
361
|
-
message:
|
|
369
|
+
message: O(l.error)
|
|
362
370
|
}), m.NEVER;
|
|
363
371
|
if (!l.continue)
|
|
364
372
|
return m.NEVER;
|
|
365
373
|
}
|
|
366
374
|
if (!S(s))
|
|
367
|
-
return
|
|
375
|
+
return i.addIssue({
|
|
368
376
|
code: m.ZodIssueCode.custom,
|
|
369
377
|
message: "'Value is not array'"
|
|
370
378
|
}), m.NEVER;
|
|
@@ -372,18 +380,18 @@ function J(r, e, n, t, a) {
|
|
|
372
380
|
if (f) {
|
|
373
381
|
const l = await f.safeParseAsync(s);
|
|
374
382
|
if (!l.success)
|
|
375
|
-
return
|
|
383
|
+
return i.addIssue({
|
|
376
384
|
code: m.ZodIssueCode.custom,
|
|
377
|
-
message:
|
|
385
|
+
message: O(l.error.message)
|
|
378
386
|
}), m.NEVER;
|
|
379
387
|
}
|
|
380
388
|
}).pipe(a ?? m.any());
|
|
381
389
|
}
|
|
382
|
-
function
|
|
390
|
+
function C(r, e, n, t, a) {
|
|
383
391
|
e.forEach((s) => {
|
|
384
|
-
var u, c, f,
|
|
385
|
-
const
|
|
386
|
-
if (!s.isVisible || (u = s.isVisible) != null && u.call(s,
|
|
392
|
+
var u, c, f, o, d;
|
|
393
|
+
const i = n;
|
|
394
|
+
if (!s.isVisible || (u = s.isVisible) != null && u.call(s, i, t == null ? void 0 : t.metadata)) {
|
|
387
395
|
const l = p(r, s.path);
|
|
388
396
|
if ((c = s.validation) != null && c.schema ? b(
|
|
389
397
|
r,
|
|
@@ -392,9 +400,9 @@ function w(r, e, n, t, a) {
|
|
|
392
400
|
_schema: (f = s.validation) == null ? void 0 : f.schema,
|
|
393
401
|
_input: s
|
|
394
402
|
})
|
|
395
|
-
) : s.required && b(r, s.path, I(l, { _requiredOnly: !0, _input: s })), s.inputs &&
|
|
403
|
+
) : s.required && b(r, s.path, I(l, { _requiredOnly: !0, _input: s })), s.inputs && C(r, s.inputs, n, t), s.inputType === "list") {
|
|
396
404
|
const h = {};
|
|
397
|
-
|
|
405
|
+
C(
|
|
398
406
|
h,
|
|
399
407
|
s.inputConfig.inputs.map((_) => ({
|
|
400
408
|
..._,
|
|
@@ -406,9 +414,9 @@ function w(r, e, n, t, a) {
|
|
|
406
414
|
const v = p(r, s.path);
|
|
407
415
|
b(r, s.path, I(v, { _schemaObj: h, _isList: !0, _input: s }));
|
|
408
416
|
}
|
|
409
|
-
if (!((
|
|
417
|
+
if (!((o = s.validation) != null && o.schema) && s.inputType === "array") {
|
|
410
418
|
const h = {};
|
|
411
|
-
|
|
419
|
+
C(
|
|
412
420
|
h,
|
|
413
421
|
[{ ...s.inputConfig.input, path: "___array" }],
|
|
414
422
|
n,
|
|
@@ -427,22 +435,22 @@ function w(r, e, n, t, a) {
|
|
|
427
435
|
}
|
|
428
436
|
});
|
|
429
437
|
}
|
|
430
|
-
function
|
|
438
|
+
function F(r, e) {
|
|
431
439
|
var n, t, a;
|
|
432
440
|
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
441
|
}
|
|
434
442
|
function A(r, e) {
|
|
435
|
-
var t, a, s,
|
|
443
|
+
var t, a, s, i, u, c;
|
|
436
444
|
if ((a = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredSchemaPerInput) != null && a[r.inputType])
|
|
437
|
-
return (
|
|
445
|
+
return (i = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : i[r.inputType];
|
|
438
446
|
if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
|
|
439
447
|
return (c = e == null ? void 0 : e.validationConfig) == null ? void 0 : c.requiredSchema;
|
|
440
|
-
const n =
|
|
441
|
-
return m.any().optional().superRefine((f,
|
|
442
|
-
typeof f == "object" && R(f) &&
|
|
448
|
+
const n = F(r, e);
|
|
449
|
+
return m.any().optional().superRefine((f, o) => {
|
|
450
|
+
typeof f == "object" && R(f) && o.addIssue({
|
|
443
451
|
code: m.ZodIssueCode.custom,
|
|
444
452
|
message: n
|
|
445
|
-
}), (q(f) || f === "") &&
|
|
453
|
+
}), (q(f) || f === "") && o.addIssue({
|
|
446
454
|
code: m.ZodIssueCode.custom,
|
|
447
455
|
message: n
|
|
448
456
|
});
|
|
@@ -454,10 +462,10 @@ function Q(r, e) {
|
|
|
454
462
|
if (typeof r == "function")
|
|
455
463
|
return r(e);
|
|
456
464
|
}
|
|
457
|
-
const Se = (r) => Array.isArray(r == null ? void 0 : r.errors),
|
|
465
|
+
const Se = (r) => Array.isArray(r == null ? void 0 : r.errors), Te = (r, e) => {
|
|
458
466
|
const n = {};
|
|
459
467
|
for (; r.length; ) {
|
|
460
|
-
const t = r[0], { code: a, message: s, path:
|
|
468
|
+
const t = r[0], { code: a, message: s, path: i } = t, u = i.join(".");
|
|
461
469
|
if (!n[u])
|
|
462
470
|
if ("unionErrors" in t) {
|
|
463
471
|
const c = t.unionErrors[0].errors[0];
|
|
@@ -495,7 +503,7 @@ function $e(r, e) {
|
|
|
495
503
|
if (Se(s))
|
|
496
504
|
return {
|
|
497
505
|
values: {},
|
|
498
|
-
errors: le(
|
|
506
|
+
errors: le(Te(s.errors, !0), a)
|
|
499
507
|
};
|
|
500
508
|
throw s;
|
|
501
509
|
}
|
|
@@ -504,25 +512,25 @@ function $e(r, e) {
|
|
|
504
512
|
);
|
|
505
513
|
}
|
|
506
514
|
function Me(r, e) {
|
|
507
|
-
const n =
|
|
515
|
+
const n = w(r);
|
|
508
516
|
return e.forEach((t) => {
|
|
509
517
|
t.inputTransform && (S(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
|
|
510
|
-
const
|
|
518
|
+
const i = p(n, t.path), u = s(i, n);
|
|
511
519
|
u && b(n, u.path ?? t.path, u.value);
|
|
512
520
|
});
|
|
513
521
|
}), n;
|
|
514
522
|
}
|
|
515
523
|
function Be(r, e) {
|
|
516
|
-
const n =
|
|
524
|
+
const n = w(r);
|
|
517
525
|
return e.forEach((t) => {
|
|
518
526
|
t.outputTransform && (S(t.outputTransform) ? t.outputTransform : [t.outputTransform]).forEach((s) => {
|
|
519
|
-
const
|
|
527
|
+
const i = p(n, t.path), u = s(i, n);
|
|
520
528
|
u && b(n, u.path ?? t.path, u.value);
|
|
521
529
|
});
|
|
522
530
|
}), n;
|
|
523
531
|
}
|
|
524
532
|
function D(r) {
|
|
525
|
-
return r.reduce((n, t) => t.inputType === "group" && t.inputs ? [...n, t, ...D(t.inputs)] : [...n, t], []);
|
|
533
|
+
return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...D(t.inputs)] : [...n, t], []);
|
|
526
534
|
}
|
|
527
535
|
function Je(r) {
|
|
528
536
|
const n = D(r.inputs).reduce((t, a) => {
|
|
@@ -536,7 +544,7 @@ function Je(r) {
|
|
|
536
544
|
return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
|
|
537
545
|
}
|
|
538
546
|
function Le(r, e, n) {
|
|
539
|
-
const t = D(r.inputs), a =
|
|
547
|
+
const t = D(r.inputs), a = w(e);
|
|
540
548
|
return t.forEach((s) => {
|
|
541
549
|
s.isVisible && !s.isVisible(e, n) && re(a, s.path);
|
|
542
550
|
}), a;
|
|
@@ -597,7 +605,7 @@ function Ye(r) {
|
|
|
597
605
|
if (!e) return { value: e };
|
|
598
606
|
const t = p(n, r);
|
|
599
607
|
if (typeof t == "object") {
|
|
600
|
-
const a =
|
|
608
|
+
const a = Oe(t);
|
|
601
609
|
if (Object.getOwnPropertyNames(a).length === 1)
|
|
602
610
|
return { value: e, path: r };
|
|
603
611
|
}
|
|
@@ -628,7 +636,7 @@ function ze(r, e) {
|
|
|
628
636
|
function X(r) {
|
|
629
637
|
return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !X(r[e])) : q(r);
|
|
630
638
|
}
|
|
631
|
-
function
|
|
639
|
+
function Oe(r) {
|
|
632
640
|
return G(r, (e) => typeof e == "object" ? X(e) : q(e));
|
|
633
641
|
}
|
|
634
642
|
function Re({ input: r, factory: e }) {
|
|
@@ -642,7 +650,7 @@ function je(r) {
|
|
|
642
650
|
return /* @__PURE__ */ y.jsx(Re, { input: t, factory: n }, a);
|
|
643
651
|
}) });
|
|
644
652
|
}
|
|
645
|
-
const Ie =
|
|
653
|
+
const Ie = oe((r, e) => {
|
|
646
654
|
const { inputs: n, className: t, factory: a } = r;
|
|
647
655
|
return /* @__PURE__ */ y.jsxs("div", { className: t, ref: e, children: [
|
|
648
656
|
n.hero,
|
|
@@ -664,11 +672,11 @@ export {
|
|
|
664
672
|
me as InputOverrideError,
|
|
665
673
|
Ie as RenderForm,
|
|
666
674
|
je as RenderInputs,
|
|
667
|
-
|
|
675
|
+
ke as RootForm,
|
|
668
676
|
Re as Row,
|
|
669
677
|
We as arrayToObjectOutputTransformer,
|
|
670
678
|
rr as generateReadableLabel,
|
|
671
|
-
|
|
679
|
+
Fe as getDefaultValuesFromFormDefinition,
|
|
672
680
|
De as getTemporaryPath,
|
|
673
681
|
Je as getTransformers,
|
|
674
682
|
ve as getValidationSchema,
|
|
@@ -677,7 +685,7 @@ export {
|
|
|
677
685
|
Ue as objectToArrayInputTransformer,
|
|
678
686
|
Be as outputTransformValues,
|
|
679
687
|
Ae as overrideFormDefinition,
|
|
680
|
-
|
|
688
|
+
O as processValidationParseResponse,
|
|
681
689
|
Ze as removeTemporaryFieldsValue,
|
|
682
690
|
Ke as shorthandArrayInputTransformer,
|
|
683
691
|
ze as shorthandArrayOutputTransformer,
|