react-form-dto 1.0.1 → 1.0.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.
@@ -1,65 +1,65 @@
1
- import G, { useState as W, useImperativeHandle as de } from "react";
2
- import { FormControl as J, InputLabel as pe, Select as be, MenuItem as fe, Typography as R, TextField as k, FormControlLabel as X, Checkbox as he, FormHelperText as H, Autocomplete as Z, FormLabel as xe, RadioGroup as ve, Radio as ge, Box as Ee, Grid as V } from "@mui/material";
3
- var S = { exports: {} }, _ = {};
4
- var M;
5
- function _e() {
6
- if (M) return _;
7
- M = 1;
8
- var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
9
- function n(u, o, a) {
10
- var s = null;
11
- if (a !== void 0 && (s = "" + a), o.key !== void 0 && (s = "" + o.key), "key" in o) {
12
- a = {};
1
+ import J, { useState as V, useImperativeHandle as pe } from "react";
2
+ import { FormControl as X, InputLabel as fe, Select as be, MenuItem as he, Typography as _, TextField as A, FormControlLabel as H, Checkbox as ve, FormHelperText as Z, Autocomplete as Q, FormLabel as xe, RadioGroup as ge, Radio as Ee, Box as je, Grid as M } from "@mui/material";
3
+ var S = { exports: {} }, j = {};
4
+ var B;
5
+ function ye() {
6
+ if (B) return j;
7
+ B = 1;
8
+ var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
9
+ function t(a, o, s) {
10
+ var u = null;
11
+ if (s !== void 0 && (u = "" + s), o.key !== void 0 && (u = "" + o.key), "key" in o) {
12
+ s = {};
13
13
  for (var c in o)
14
- c !== "key" && (a[c] = o[c]);
15
- } else a = o;
16
- return o = a.ref, {
14
+ c !== "key" && (s[c] = o[c]);
15
+ } else s = o;
16
+ return o = s.ref, {
17
17
  $$typeof: e,
18
- type: u,
19
- key: s,
18
+ type: a,
19
+ key: u,
20
20
  ref: o !== void 0 ? o : null,
21
- props: a
21
+ props: s
22
22
  };
23
23
  }
24
- return _.Fragment = t, _.jsx = n, _.jsxs = n, _;
24
+ return j.Fragment = n, j.jsx = t, j.jsxs = t, j;
25
25
  }
26
- var j = {};
27
- var B;
28
- function je() {
29
- return B || (B = 1, process.env.NODE_ENV !== "production" && (function() {
26
+ var y = {};
27
+ var U;
28
+ function _e() {
29
+ return U || (U = 1, process.env.NODE_ENV !== "production" && (function() {
30
30
  function e(r) {
31
31
  if (r == null) return null;
32
32
  if (typeof r == "function")
33
- return r.$$typeof === ie ? null : r.displayName || r.name || null;
33
+ return r.$$typeof === ce ? null : r.displayName || r.name || null;
34
34
  if (typeof r == "string") return r;
35
35
  switch (r) {
36
36
  case $:
37
37
  return "Fragment";
38
- case re:
38
+ case te:
39
39
  return "Profiler";
40
- case ee:
40
+ case re:
41
41
  return "StrictMode";
42
42
  case oe:
43
43
  return "Suspense";
44
- case se:
44
+ case ue:
45
45
  return "SuspenseList";
46
- case le:
46
+ case ie:
47
47
  return "Activity";
48
48
  }
49
49
  if (typeof r == "object")
50
50
  switch (typeof r.tag == "number" && console.error(
51
51
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
52
52
  ), r.$$typeof) {
53
- case K:
53
+ case ee:
54
54
  return "Portal";
55
- case ne:
55
+ case ae:
56
56
  return r.displayName || "Context";
57
- case te:
57
+ case ne:
58
58
  return (r._context.displayName || "Context") + ".Consumer";
59
- case ae:
59
+ case se:
60
60
  var i = r.render;
61
61
  return r = r.displayName, r || (r = i.displayName || i.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
62
- case ue:
62
+ case le:
63
63
  return i = r.displayName || null, i !== null ? i : e(r.type) || "Memo";
64
64
  case w:
65
65
  i = r._payload, r = r._init;
@@ -70,12 +70,12 @@ function je() {
70
70
  }
71
71
  return null;
72
72
  }
73
- function t(r) {
73
+ function n(r) {
74
74
  return "" + r;
75
75
  }
76
- function n(r) {
76
+ function t(r) {
77
77
  try {
78
- t(r);
78
+ n(r);
79
79
  var i = !1;
80
80
  } catch {
81
81
  i = !0;
@@ -87,10 +87,10 @@ function je() {
87
87
  i,
88
88
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
89
  d
90
- ), t(r);
90
+ ), n(r);
91
91
  }
92
92
  }
93
- function u(r) {
93
+ function a(r) {
94
94
  if (r === $) return "<>";
95
95
  if (typeof r == "object" && r !== null && r.$$typeof === w)
96
96
  return "<...>";
@@ -105,11 +105,11 @@ function je() {
105
105
  var r = O.A;
106
106
  return r === null ? null : r.getOwner();
107
107
  }
108
- function a() {
108
+ function s() {
109
109
  return Error("react-stack-top-frame");
110
110
  }
111
- function s(r) {
112
- if (I.call(r, "key")) {
111
+ function u(r) {
112
+ if (N.call(r, "key")) {
113
113
  var i = Object.getOwnPropertyDescriptor(r, "key").get;
114
114
  if (i && i.isReactWarning) return !1;
115
115
  }
@@ -117,7 +117,7 @@ function je() {
117
117
  }
118
118
  function c(r, i) {
119
119
  function m() {
120
- N || (N = !0, console.error(
120
+ D || (D = !0, console.error(
121
121
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
122
122
  i
123
123
  ));
@@ -129,11 +129,11 @@ function je() {
129
129
  }
130
130
  function h() {
131
131
  var r = e(this.type);
132
- return D[r] || (D[r] = !0, console.error(
132
+ return q[r] || (q[r] = !0, console.error(
133
133
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
134
134
  )), r = this.props.ref, r !== void 0 ? r : null;
135
135
  }
136
- function f(r, i, m, d, T, P) {
136
+ function b(r, i, m, d, T, P) {
137
137
  var p = m.ref;
138
138
  return r = {
139
139
  $$typeof: L,
@@ -170,21 +170,21 @@ function je() {
170
170
  var p = i.children;
171
171
  if (p !== void 0)
172
172
  if (d)
173
- if (ce(p)) {
173
+ if (me(p)) {
174
174
  for (d = 0; d < p.length; d++)
175
- v(p[d]);
175
+ x(p[d]);
176
176
  Object.freeze && Object.freeze(p);
177
177
  } else
178
178
  console.error(
179
179
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
180
180
  );
181
- else v(p);
182
- if (I.call(i, "key")) {
181
+ else x(p);
182
+ if (N.call(i, "key")) {
183
183
  p = e(r);
184
- var E = Object.keys(i).filter(function(me) {
185
- return me !== "key";
184
+ var E = Object.keys(i).filter(function(de) {
185
+ return de !== "key";
186
186
  });
187
- d = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", q[p + d] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ d = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", W[p + d] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
188
188
  `A props object containing a "key" prop is being spread into JSX:
189
189
  let props = %s;
190
190
  <%s {...props} />
@@ -195,9 +195,9 @@ React keys must be passed directly to JSX without using spread:
195
195
  p,
196
196
  E,
197
197
  p
198
- ), q[p + d] = !0);
198
+ ), W[p + d] = !0);
199
199
  }
200
- if (p = null, m !== void 0 && (n(m), p = "" + m), s(i) && (n(i.key), p = "" + i.key), "key" in i) {
200
+ if (p = null, m !== void 0 && (t(m), p = "" + m), u(i) && (t(i.key), p = "" + i.key), "key" in i) {
201
201
  m = {};
202
202
  for (var C in i)
203
203
  C !== "key" && (m[C] = i[C]);
@@ -205,7 +205,7 @@ React keys must be passed directly to JSX without using spread:
205
205
  return p && c(
206
206
  m,
207
207
  typeof r == "function" ? r.displayName || r.name || "Unknown" : r
208
- ), f(
208
+ ), b(
209
209
  r,
210
210
  p,
211
211
  m,
@@ -214,25 +214,25 @@ React keys must be passed directly to JSX without using spread:
214
214
  P
215
215
  );
216
216
  }
217
- function v(r) {
218
- y(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === w && (r._payload.status === "fulfilled" ? y(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
217
+ function x(r) {
218
+ R(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === w && (r._payload.status === "fulfilled" ? R(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
219
219
  }
220
- function y(r) {
220
+ function R(r) {
221
221
  return typeof r == "object" && r !== null && r.$$typeof === L;
222
222
  }
223
- var x = G, L = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), $ = Symbol.for("react.fragment"), ee = Symbol.for("react.strict_mode"), re = Symbol.for("react.profiler"), te = Symbol.for("react.consumer"), ne = Symbol.for("react.context"), ae = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), se = Symbol.for("react.suspense_list"), ue = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), le = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), O = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, ce = Array.isArray, F = console.createTask ? console.createTask : function() {
223
+ var v = J, L = Symbol.for("react.transitional.element"), ee = Symbol.for("react.portal"), $ = Symbol.for("react.fragment"), re = Symbol.for("react.strict_mode"), te = Symbol.for("react.profiler"), ne = Symbol.for("react.consumer"), ae = Symbol.for("react.context"), se = Symbol.for("react.forward_ref"), oe = Symbol.for("react.suspense"), ue = Symbol.for("react.suspense_list"), le = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), ie = Symbol.for("react.activity"), ce = Symbol.for("react.client.reference"), O = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, me = Array.isArray, F = console.createTask ? console.createTask : function() {
224
224
  return null;
225
225
  };
226
- x = {
226
+ v = {
227
227
  react_stack_bottom_frame: function(r) {
228
228
  return r();
229
229
  }
230
230
  };
231
- var N, D = {}, z = x.react_stack_bottom_frame.bind(
232
- x,
233
- a
234
- )(), Y = F(u(a)), q = {};
235
- j.Fragment = $, j.jsx = function(r, i, m) {
231
+ var D, q = {}, z = v.react_stack_bottom_frame.bind(
232
+ v,
233
+ s
234
+ )(), Y = F(a(s)), W = {};
235
+ y.Fragment = $, y.jsx = function(r, i, m) {
236
236
  var d = 1e4 > O.recentlyCreatedOwnerStacks++;
237
237
  return g(
238
238
  r,
@@ -240,9 +240,9 @@ React keys must be passed directly to JSX without using spread:
240
240
  m,
241
241
  !1,
242
242
  d ? Error("react-stack-top-frame") : z,
243
- d ? F(u(r)) : Y
243
+ d ? F(a(r)) : Y
244
244
  );
245
- }, j.jsxs = function(r, i, m) {
245
+ }, y.jsxs = function(r, i, m) {
246
246
  var d = 1e4 > O.recentlyCreatedOwnerStacks++;
247
247
  return g(
248
248
  r,
@@ -250,67 +250,67 @@ React keys must be passed directly to JSX without using spread:
250
250
  m,
251
251
  !0,
252
252
  d ? Error("react-stack-top-frame") : z,
253
- d ? F(u(r)) : Y
253
+ d ? F(a(r)) : Y
254
254
  );
255
255
  };
256
- })()), j;
256
+ })()), y;
257
257
  }
258
- var U;
258
+ var G;
259
259
  function Re() {
260
- return U || (U = 1, process.env.NODE_ENV === "production" ? S.exports = _e() : S.exports = je()), S.exports;
260
+ return G || (G = 1, process.env.NODE_ENV === "production" ? S.exports = ye() : S.exports = _e()), S.exports;
261
261
  }
262
262
  var l = Re();
263
- function b(e, t = "en") {
264
- return e ? typeof e == "string" ? e : e[t] || e.en || Object.values(e)[0] || "" : "";
263
+ function f(e, n = "en") {
264
+ return e ? typeof e == "string" ? e : e[n] || e.en || Object.values(e)[0] || "" : "";
265
265
  }
266
- function A(e, t = "en") {
267
- return e ? e.map((n) => typeof n == "string" ? { value: n, label: n } : {
268
- value: n.value,
269
- label: b(n.label, t)
266
+ function k(e, n = "en") {
267
+ return e ? e.map((t) => typeof t == "string" ? { value: t, label: t } : {
268
+ value: t.value,
269
+ label: f(t.label, n)
270
270
  }) : [];
271
271
  }
272
- function ye({
272
+ function Te({
273
273
  field: e,
274
- value: t,
275
- onChange: n,
276
- error: u,
274
+ value: n,
275
+ onChange: t,
276
+ error: a,
277
277
  locale: o = "en"
278
278
  }) {
279
- const a = A(e.options || [], o);
280
- return /* @__PURE__ */ l.jsxs(J, { fullWidth: !0, children: [
281
- /* @__PURE__ */ l.jsx(pe, { id: `${e.id}-label`, children: b(e.label, o) }),
279
+ const s = k(e.options || [], o);
280
+ return /* @__PURE__ */ l.jsxs(X, { fullWidth: !0, children: [
281
+ /* @__PURE__ */ l.jsx(fe, { id: `${e.id}-label`, children: f(e.label, o) }),
282
282
  /* @__PURE__ */ l.jsx(
283
283
  be,
284
284
  {
285
285
  labelId: `${e.id}-label`,
286
- value: t,
286
+ value: n,
287
287
  id: e.id,
288
288
  name: e.id,
289
- onChange: (s) => n(s.target.value),
290
- label: b(e.label, o),
291
- error: !!u,
292
- children: a?.map((s) => /* @__PURE__ */ l.jsx(fe, { value: s.value, children: s.label }, s.label))
289
+ onChange: (u) => t(u.target.value),
290
+ label: f(e.label, o),
291
+ error: !!a,
292
+ children: s?.map((u) => /* @__PURE__ */ l.jsx(he, { value: u.value, children: u.label }, u.label))
293
293
  }
294
294
  ),
295
- u && /* @__PURE__ */ l.jsx(R, { variant: "caption", color: "error", children: u })
295
+ a && /* @__PURE__ */ l.jsx(_, { variant: "caption", color: "error", children: a })
296
296
  ] });
297
297
  }
298
- function Te({
298
+ function Se({
299
299
  field: e,
300
- value: t,
301
- onChange: n,
302
- error: u,
300
+ value: n,
301
+ onChange: t,
302
+ error: a,
303
303
  locale: o
304
304
  }) {
305
- return console.log("error", u), /* @__PURE__ */ l.jsx(
306
- k,
305
+ return console.log("error", a), /* @__PURE__ */ l.jsx(
306
+ A,
307
307
  {
308
308
  fullWidth: !0,
309
- label: b(e.label, o),
310
- placeholder: b(e.placeholder || "", o),
311
- value: t || "",
309
+ label: f(e.label, o),
310
+ placeholder: f(e.placeholder || "", o),
311
+ value: n || "",
312
312
  name: e.id,
313
- onChange: (a) => n(a.target.value),
313
+ onChange: (s) => t(s.target.value),
314
314
  disabled: e.disabled,
315
315
  type: e.type,
316
316
  slotProps: {
@@ -318,161 +318,161 @@ function Te({
318
318
  shrink: e.type === "date" ? !0 : void 0
319
319
  }
320
320
  },
321
- error: !!u,
322
- helperText: u
321
+ error: !!a,
322
+ helperText: a
323
323
  }
324
324
  );
325
325
  }
326
- function Se({
326
+ function Ae({
327
327
  field: e,
328
- value: t,
329
- onChange: n,
330
- error: u,
328
+ value: n,
329
+ onChange: t,
330
+ error: a,
331
331
  locale: o
332
332
  }) {
333
333
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
334
334
  /* @__PURE__ */ l.jsx(
335
- X,
335
+ H,
336
336
  {
337
337
  name: e.id,
338
338
  control: /* @__PURE__ */ l.jsx(
339
- he,
339
+ ve,
340
340
  {
341
- checked: !!t,
342
- onChange: (a) => n(a.target.checked),
341
+ checked: !!n,
342
+ onChange: (s) => t(s.target.checked),
343
343
  disabled: e.disabled
344
344
  }
345
345
  ),
346
- label: b(e.label, o)
346
+ label: f(e.label, o)
347
347
  }
348
348
  ),
349
- u && /* @__PURE__ */ l.jsx(H, { children: u })
349
+ a && /* @__PURE__ */ l.jsx(Z, { children: a })
350
350
  ] });
351
351
  }
352
352
  const ke = ({
353
353
  field: e,
354
- value: t,
355
- onChange: n,
356
- error: u,
354
+ value: n,
355
+ onChange: t,
356
+ error: a,
357
357
  locale: o
358
358
  }) => {
359
- const a = A(e.options || [], o);
359
+ const s = k(e.options || [], o);
360
360
  return /* @__PURE__ */ l.jsx(
361
- Z,
361
+ Q,
362
362
  {
363
363
  fullWidth: !0,
364
- options: a || [],
365
- value: t || null,
366
- onChange: (s, c) => n(c),
367
- renderInput: (s) => /* @__PURE__ */ l.jsx(
368
- k,
364
+ options: s || [],
365
+ value: n || null,
366
+ onChange: (u, c) => t(c),
367
+ renderInput: (u) => /* @__PURE__ */ l.jsx(
368
+ A,
369
369
  {
370
- ...s,
370
+ ...u,
371
371
  name: e.id,
372
- label: b(e.label, o),
373
- placeholder: b(
372
+ label: f(e.label, o),
373
+ placeholder: f(
374
374
  e.placeholder || "",
375
375
  o
376
376
  ),
377
377
  disabled: e.disabled,
378
- error: !!u,
379
- helperText: u
378
+ error: !!a,
379
+ helperText: a
380
380
  }
381
381
  )
382
382
  }
383
383
  );
384
- }, Ae = ({
384
+ }, $e = ({
385
385
  field: e,
386
- value: t,
387
- onChange: n,
388
- error: u,
386
+ value: n,
387
+ onChange: t,
388
+ error: a,
389
389
  locale: o
390
390
  }) => {
391
- const a = A(e.options || [], o);
391
+ const s = k(e.options || [], o);
392
392
  return /* @__PURE__ */ l.jsx(
393
- Z,
393
+ Q,
394
394
  {
395
395
  multiple: !0,
396
396
  fullWidth: !0,
397
- options: a || [],
398
- value: t || [],
399
- onChange: (s, c) => n(c),
400
- renderInput: (s) => /* @__PURE__ */ l.jsx(
401
- k,
397
+ options: s || [],
398
+ value: n || [],
399
+ onChange: (u, c) => t(c),
400
+ renderInput: (u) => /* @__PURE__ */ l.jsx(
401
+ A,
402
402
  {
403
- ...s,
403
+ ...u,
404
404
  name: e.id,
405
- label: b(e.label, o),
406
- placeholder: b(
405
+ label: f(e.label, o),
406
+ placeholder: f(
407
407
  e.placeholder || "",
408
408
  o
409
409
  ),
410
410
  disabled: e.disabled,
411
- error: !!u,
412
- helperText: u
411
+ error: !!a,
412
+ helperText: a
413
413
  }
414
414
  )
415
415
  }
416
416
  );
417
- }, $e = ({
417
+ }, we = ({
418
418
  field: e,
419
- value: t,
420
- onChange: n,
421
- error: u,
419
+ value: n,
420
+ onChange: t,
421
+ error: a,
422
422
  locale: o = "en"
423
423
  }) => /* @__PURE__ */ l.jsx(
424
- k,
424
+ A,
425
425
  {
426
426
  fullWidth: !0,
427
427
  multiline: !0,
428
428
  rows: e.rows || 4,
429
- label: b(e.label, o),
430
- placeholder: b(e.placeholder || "", o),
431
- value: t || "",
432
- onChange: (a) => n(a.target.value),
429
+ label: f(e.label, o),
430
+ placeholder: f(e.placeholder || "", o),
431
+ value: n || "",
432
+ onChange: (s) => t(s.target.value),
433
433
  required: !!e.validations?.required,
434
434
  disabled: e.disabled,
435
- error: !!u,
436
- helperText: u
435
+ error: !!a,
436
+ helperText: a
437
437
  }
438
- ), we = ({
438
+ ), Oe = ({
439
439
  field: e,
440
- value: t,
441
- onChange: n,
442
- error: u,
440
+ value: n,
441
+ onChange: t,
442
+ error: a,
443
443
  locale: o = "en"
444
444
  }) => {
445
- const a = A(e.options || [], o);
446
- return /* @__PURE__ */ l.jsxs(J, { component: "fieldset", fullWidth: !0, error: !!u, children: [
445
+ const s = k(e.options || [], o);
446
+ return /* @__PURE__ */ l.jsxs(X, { component: "fieldset", fullWidth: !0, error: !!a, children: [
447
447
  /* @__PURE__ */ l.jsxs(xe, { component: "legend", children: [
448
- b(e.label, o),
448
+ f(e.label, o),
449
449
  e.validations?.required ? " *" : ""
450
450
  ] }),
451
451
  /* @__PURE__ */ l.jsx(
452
- ve,
452
+ ge,
453
453
  {
454
454
  row: e.layout?.direction === "row" || !1,
455
- value: t || "",
456
- onChange: (s) => n(s.target.value),
457
- children: (a || []).map((s) => /* @__PURE__ */ l.jsx(
458
- X,
455
+ value: n || "",
456
+ onChange: (u) => t(u.target.value),
457
+ children: (s || []).map((u) => /* @__PURE__ */ l.jsx(
458
+ H,
459
459
  {
460
- value: s,
461
- control: /* @__PURE__ */ l.jsx(ge, {}),
462
- label: s.label,
460
+ value: u,
461
+ control: /* @__PURE__ */ l.jsx(Ee, {}),
462
+ label: u.label,
463
463
  disabled: e.disabled
464
464
  },
465
- s.label
465
+ u.label
466
466
  ))
467
467
  }
468
468
  ),
469
- u && /* @__PURE__ */ l.jsx(H, { children: u })
469
+ a && /* @__PURE__ */ l.jsx(Z, { children: a })
470
470
  ] });
471
- }, Oe = ({
471
+ }, Fe = ({
472
472
  field: e,
473
- value: t,
474
- onChange: n,
475
- error: u,
473
+ value: n,
474
+ onChange: t,
475
+ error: a,
476
476
  locale: o = "en"
477
477
  }) => {
478
478
  switch (e.type) {
@@ -482,23 +482,23 @@ const ke = ({
482
482
  case "password":
483
483
  case "number":
484
484
  return /* @__PURE__ */ l.jsx(
485
- Te,
485
+ Se,
486
486
  {
487
487
  field: e,
488
- value: t,
489
- onChange: n,
490
- error: u,
488
+ value: n,
489
+ onChange: t,
490
+ error: a,
491
491
  locale: o
492
492
  }
493
493
  );
494
494
  case "select":
495
495
  return /* @__PURE__ */ l.jsx(
496
- ye,
496
+ Te,
497
497
  {
498
498
  field: e,
499
- value: t,
500
- onChange: n,
501
- error: u,
499
+ value: n,
500
+ onChange: t,
501
+ error: a,
502
502
  locale: o
503
503
  }
504
504
  );
@@ -507,53 +507,53 @@ const ke = ({
507
507
  ke,
508
508
  {
509
509
  field: e,
510
- value: t,
511
- onChange: n,
512
- error: u,
510
+ value: n,
511
+ onChange: t,
512
+ error: a,
513
513
  locale: o
514
514
  }
515
515
  );
516
516
  case "multi-autocomplete":
517
517
  return /* @__PURE__ */ l.jsx(
518
- Ae,
518
+ $e,
519
519
  {
520
520
  field: e,
521
- value: t,
522
- onChange: n,
523
- error: u,
521
+ value: n,
522
+ onChange: t,
523
+ error: a,
524
524
  locale: o
525
525
  }
526
526
  );
527
527
  case "checkbox":
528
528
  return /* @__PURE__ */ l.jsx(
529
- Se,
529
+ Ae,
530
530
  {
531
531
  field: e,
532
- value: t,
533
- onChange: n,
534
- error: u,
532
+ value: n,
533
+ onChange: t,
534
+ error: a,
535
535
  locale: o
536
536
  }
537
537
  );
538
538
  case "textarea":
539
539
  return /* @__PURE__ */ l.jsx(
540
- $e,
540
+ we,
541
541
  {
542
542
  field: e,
543
- value: t,
544
- onChange: n,
545
- error: u,
543
+ value: n,
544
+ onChange: t,
545
+ error: a,
546
546
  locale: o
547
547
  }
548
548
  );
549
549
  case "radio":
550
550
  return /* @__PURE__ */ l.jsx(
551
- we,
551
+ Oe,
552
552
  {
553
553
  field: e,
554
- value: t,
555
- onChange: n,
556
- error: u,
554
+ value: n,
555
+ onChange: t,
556
+ error: a,
557
557
  locale: o
558
558
  }
559
559
  );
@@ -563,152 +563,102 @@ const ke = ({
563
563
  e.type
564
564
  ] });
565
565
  }
566
- }, Fe = ({
566
+ }, Pe = ({
567
567
  field: e,
568
- value: t,
569
- onChange: n,
570
- error: u,
568
+ value: n,
569
+ onChange: t,
570
+ error: a,
571
571
  renderers: o = {},
572
- locale: a = "en"
572
+ locale: s = "en"
573
573
  }) => {
574
- const s = o[e.type] || Oe;
574
+ const u = o[e.type] || Fe;
575
575
  return /* @__PURE__ */ l.jsx(
576
- s,
576
+ u,
577
577
  {
578
578
  field: e,
579
- value: t,
580
- onChange: n,
581
- error: u,
582
- locale: a
579
+ value: n,
580
+ onChange: t,
581
+ error: a,
582
+ locale: s
583
583
  }
584
584
  );
585
585
  };
586
- function Pe(e) {
587
- const t = e ?? 12;
586
+ function Ce(e) {
587
+ const n = e ?? 12;
588
588
  return {
589
589
  xs: 12,
590
590
  // always full width on mobile
591
- sm: t,
591
+ sm: n,
592
592
  // use span for tablet
593
- md: t,
593
+ md: n,
594
594
  // use span for desktop
595
- lg: t,
595
+ lg: n,
596
596
  // use span for large screens
597
- xl: t
597
+ xl: n
598
598
  };
599
599
  }
600
- const Ce = ({
601
- section: e,
602
- values: t,
603
- onChange: n,
604
- renderers: u,
605
- validateField: o,
606
- locale: a = "en"
607
- }) => /* @__PURE__ */ l.jsxs(Ee, { mb: 2, children: [
608
- e.heading && /* @__PURE__ */ l.jsx(
609
- R,
610
- {
611
- variant: "h6",
612
- sx: {
613
- fontSize: e.headingFontSize ? `${e.headingFontSize}rem` : "1.25rem"
614
- },
615
- gutterBottom: !0,
616
- color: "black",
617
- children: b(e.heading, a)
618
- }
619
- ),
620
- e.description && /* @__PURE__ */ l.jsx(
621
- R,
622
- {
623
- variant: "body2",
624
- sx: {
625
- fontSize: e.descriptionFontSize ? `${e.descriptionFontSize}rem` : "inherit"
626
- },
627
- color: "textSecondary",
628
- gutterBottom: !0,
629
- children: b(e.description, a)
630
- }
631
- ),
632
- /* @__PURE__ */ l.jsx(V, { container: !0, spacing: 2, children: e.fields.map((s) => /* @__PURE__ */ l.jsx(
633
- V,
634
- {
635
- size: Pe(s.layout?.cols),
636
- children: /* @__PURE__ */ l.jsx(
637
- Fe,
638
- {
639
- field: s,
640
- value: t[s.id],
641
- onChange: (c) => n(s.id, c),
642
- renderers: u,
643
- error: o(s.id)?.join(","),
644
- locale: a
645
- }
646
- )
647
- },
648
- s.id
649
- )) })
650
- ] }), ze = {
600
+ const ze = {
651
601
  /**
652
602
  * Validates that a required field has a value.
653
603
  * @param field - The field definition
654
604
  * @param value - The field value to validate
655
605
  * @returns Error message if validation fails, null otherwise
656
606
  */
657
- required: (e, t) => e.required && (t == null || t === "") ? `${e.label} is required` : null,
607
+ required: (e, n) => e.required && (n == null || n === "") ? `${e.label} is required` : null,
658
608
  /**
659
609
  * Validates that a number field meets the minimum value requirement.
660
610
  * @param field - The field definition
661
611
  * @param value - The field value to validate
662
612
  * @returns Error message if validation fails, null otherwise
663
613
  */
664
- min: (e, t) => e.type === "number" && e.min !== void 0 && t < e.min ? `${e.label} must be at least ${e.min}` : null,
614
+ min: (e, n) => e.type === "number" && e.min !== void 0 && n < e.min ? `${e.label} must be at least ${e.min}` : null,
665
615
  /**
666
616
  * Validates that a number field does not exceed the maximum value.
667
617
  * @param field - The field definition
668
618
  * @param value - The field value to validate
669
619
  * @returns Error message if validation fails, null otherwise
670
620
  */
671
- max: (e, t) => e.type === "number" && e.max !== void 0 && t > e.max ? `${e.label} must be at most ${e.max}` : null,
621
+ max: (e, n) => e.type === "number" && e.max !== void 0 && n > e.max ? `${e.label} must be at most ${e.max}` : null,
672
622
  /**
673
623
  * Validates that a string field meets the minimum length requirement.
674
624
  * @param field - The field definition
675
625
  * @param value - The field value to validate
676
626
  * @returns Error message if validation fails, null otherwise
677
627
  */
678
- minLength: (e, t) => typeof t == "string" && e.minLength !== void 0 && t.length < e.minLength ? `${e.label} must be at least ${e.minLength} characters` : null,
628
+ minLength: (e, n) => typeof n == "string" && e.minLength !== void 0 && n.length < e.minLength ? `${e.label} must be at least ${e.minLength} characters` : null,
679
629
  /**
680
630
  * Validates that a string field does not exceed the maximum length.
681
631
  * @param field - The field definition
682
632
  * @param value - The field value to validate
683
633
  * @returns Error message if validation fails, null otherwise
684
634
  */
685
- maxLength: (e, t) => typeof t == "string" && e.maxLength !== void 0 && t.length > e.maxLength ? `${e.label} must be at most ${e.maxLength} characters` : null,
635
+ maxLength: (e, n) => typeof n == "string" && e.maxLength !== void 0 && n.length > e.maxLength ? `${e.label} must be at most ${e.maxLength} characters` : null,
686
636
  /**
687
637
  * Validates that a string field matches the specified regex pattern.
688
638
  * @param field - The field definition
689
639
  * @param value - The field value to validate
690
640
  * @returns Error message if validation fails, null otherwise
691
641
  */
692
- pattern: (e, t) => e.pattern && typeof t == "string" && !e.pattern.test(t) ? `${e.label} is invalid` : null,
642
+ pattern: (e, n) => e.pattern && typeof n == "string" && !e.pattern.test(n) ? `${e.label} is invalid` : null,
693
643
  /**
694
644
  * Validates that a select field value is one of the allowed options.
695
645
  * @param field - The field definition
696
646
  * @param value - The field value to validate
697
647
  * @returns Error message if validation fails, null otherwise
698
648
  */
699
- options: (e, t) => e.type === "select" && e.options && !e.options.includes(t) ? `${e.label} must be one of: ${e.options.join(", ")}` : null,
649
+ options: (e, n) => e.type === "select" && e.options && !e.options.includes(n) ? `${e.label} must be one of: ${e.options.join(", ")}` : null,
700
650
  /**
701
651
  * Validates that a date field falls within the specified date range.
702
652
  * @param field - The field definition
703
653
  * @param value - The field value to validate
704
654
  * @returns Error message if validation fails, null otherwise
705
655
  */
706
- dateRange: (e, t) => {
707
- if (e.type === "date" && t) {
708
- const n = new Date(t);
709
- if (e.minDate && n < new Date(e.minDate))
656
+ dateRange: (e, n) => {
657
+ if (e.type === "date" && n) {
658
+ const t = new Date(n);
659
+ if (e.minDate && t < new Date(e.minDate))
710
660
  return `${e.label} must be after ${e.minDate}`;
711
- if (e.maxDate && n > new Date(e.maxDate))
661
+ if (e.maxDate && t > new Date(e.maxDate))
712
662
  return `${e.label} must be before ${e.maxDate}`;
713
663
  }
714
664
  return null;
@@ -719,70 +669,142 @@ const Ce = ({
719
669
  * @param value - The field value to validate
720
670
  * @returns Error message if validation fails, null otherwise
721
671
  */
722
- customValidator: (e, t) => {
672
+ customValidator: (e, n) => {
723
673
  if (e.customValidator && typeof e.customValidator == "function") {
724
- const n = e.customValidator(t);
725
- if (typeof n == "string")
726
- return n;
674
+ const t = e.customValidator(n);
675
+ if (typeof t == "string")
676
+ return t;
727
677
  }
728
678
  return null;
729
679
  }
730
- }, Le = (e, t, n = "en") => {
731
- const u = {};
680
+ }, Ie = (e, n, t = "en") => {
681
+ const a = {};
732
682
  return e.sections.forEach((o) => {
733
- o.fields.forEach((a) => {
734
- const s = Q(e, t, a.id);
735
- s.length > 0 && (u[a.id] = s);
683
+ o.fields.forEach((s) => {
684
+ const u = K(e, n, s.id);
685
+ u.length > 0 && (a[s.id] = u);
736
686
  });
737
- }), u;
738
- }, Q = (e, t, n, u = "en") => {
739
- const o = e.sections.flatMap((f) => f.fields).find((f) => f.id === n);
687
+ }), a;
688
+ }, K = (e, n, t, a = "en") => {
689
+ const o = e.sections.flatMap((b) => b.fields).find((b) => b.id === t);
740
690
  if (!o) return [];
741
- const a = o.validations || {}, s = t[n], c = [], h = b(o.label, u);
742
- if (a.required && (s == null || s === "") && c.push(
743
- typeof a.required == "string" ? a.required : `${h} is required`
744
- ), a.min !== void 0 && typeof s == "number" && s < a.min && c.push(`${h} must be at least ${a.min}`), a.max !== void 0 && typeof s == "number" && s > a.max && c.push(`${h} must be at most ${a.max}`), a.minLength !== void 0 && typeof s == "string" && s.length < a.minLength && c.push(`${h} must be at least ${a.minLength} characters`), a.maxLength !== void 0 && typeof s == "string" && s.length > a.maxLength && c.push(`${h} must be at most ${a.maxLength} characters`), a.pattern && typeof s == "string" && !a.pattern.test(s) && c.push(`${h} is invalid`), a.validate) {
745
- const f = a.validate(s);
746
- f && c.push(b(f, u));
691
+ const s = o.validations || {}, u = n[t], c = [], h = f(o.label, a);
692
+ if (s.required && (u == null || u === "") && c.push(
693
+ typeof s.required == "string" ? s.required : `${h} is required`
694
+ ), s.min !== void 0 && typeof u == "number" && u < s.min && c.push(`${h} must be at least ${s.min}`), s.max !== void 0 && typeof u == "number" && u > s.max && c.push(`${h} must be at most ${s.max}`), s.minLength !== void 0 && typeof u == "string" && u.length < s.minLength && c.push(`${h} must be at least ${s.minLength} characters`), s.maxLength !== void 0 && typeof u == "string" && u.length > s.maxLength && c.push(`${h} must be at most ${s.maxLength} characters`), s.pattern && typeof u == "string" && !s.pattern.test(u) && c.push(`${h} is invalid`), s.validate) {
695
+ const b = s.validate(u);
696
+ b && c.push(f(b, a));
747
697
  }
748
698
  return c;
749
699
  };
750
- function Ie(e, t = "en") {
751
- const [n, u] = W({}), [o, a] = W({});
700
+ function I(e, n) {
701
+ if (!e)
702
+ return !0;
703
+ if ("field" in e) {
704
+ let t = n[e.field] ?? "";
705
+ return Array.isArray(t) ? t = t.map((a) => a.value ?? "") : typeof t == "object" && t !== null && (t = t.value ?? ""), e.equals !== void 0 ? t === e.equals : e.notEquals !== void 0 ? t !== e.notEquals : e.in !== void 0 ? Array.isArray(t) ? e.in ? t.some((a) => e.in.includes(a)) : !1 : e.in.includes(t) : e.notIn !== void 0 ? Array.isArray(t) ? t.every((a) => !e.notIn.includes(a)) : !e.notIn.includes(t) : e.greaterThan !== void 0 ? t > e.greaterThan : e.lessThan !== void 0 ? t < e.lessThan : !0;
706
+ }
707
+ if ("operator" in e) {
708
+ if (e.operator === "AND")
709
+ return e.conditions.every(
710
+ (a) => I(a, n)
711
+ );
712
+ if (e.operator === "OR")
713
+ return e.conditions.some(
714
+ (t) => I(t, n)
715
+ );
716
+ }
717
+ return !1;
718
+ }
719
+ const Le = ({
720
+ section: e,
721
+ values: n,
722
+ onChange: t,
723
+ renderers: a,
724
+ validateField: o,
725
+ locale: s = "en"
726
+ }) => /* @__PURE__ */ l.jsxs(je, { mb: 2, children: [
727
+ e.heading && /* @__PURE__ */ l.jsx(
728
+ _,
729
+ {
730
+ variant: "h6",
731
+ sx: {
732
+ fontSize: e.headingFontSize ? `${e.headingFontSize}rem` : "1.25rem"
733
+ },
734
+ gutterBottom: !0,
735
+ color: "black",
736
+ children: f(e.heading, s)
737
+ }
738
+ ),
739
+ e.description && /* @__PURE__ */ l.jsx(
740
+ _,
741
+ {
742
+ variant: "body2",
743
+ sx: {
744
+ fontSize: e.descriptionFontSize ? `${e.descriptionFontSize}rem` : "inherit"
745
+ },
746
+ color: "textSecondary",
747
+ gutterBottom: !0,
748
+ children: f(e.description, s)
749
+ }
750
+ ),
751
+ /* @__PURE__ */ l.jsx(M, { container: !0, spacing: 2, children: e.fields.map(
752
+ (u) => I(u.visibleWhen, n) && /* @__PURE__ */ l.jsx(
753
+ M,
754
+ {
755
+ size: Ce(u.layout?.cols),
756
+ children: /* @__PURE__ */ l.jsx(
757
+ Pe,
758
+ {
759
+ field: u,
760
+ value: n[u.id],
761
+ onChange: (c) => t(u.id, c),
762
+ renderers: a,
763
+ error: o(u.id)?.join(","),
764
+ locale: s
765
+ }
766
+ )
767
+ },
768
+ u.id
769
+ )
770
+ ) })
771
+ ] });
772
+ function Ne(e, n = "en") {
773
+ const [t, a] = V({}), [o, s] = V({});
752
774
  return {
753
775
  /** Current form values for all fields */
754
- values: n,
776
+ values: t,
755
777
  /** Function to update a field value */
756
- handleChange: (v, y) => {
757
- u((x) => ({ ...x, [v]: y })), a((x) => ({ ...x, [v]: null }));
778
+ handleChange: (x, R) => {
779
+ a((v) => ({ ...v, [x]: R })), s((v) => ({ ...v, [x]: null }));
758
780
  },
759
781
  /** Function to validate all fields */
760
- validateAll: () => Le(e, n, t),
782
+ validateAll: () => Ie(e, t, n),
761
783
  /** Function to get all current form values */
762
- getValues: () => n,
784
+ getValues: () => t,
763
785
  /** Function to get all current form errors */
764
786
  getErrors: () => o,
765
787
  /** Function to validate a specific field */
766
- validateField: (v) => Q(e, n, v, t)
788
+ validateField: (x) => K(e, t, x, n)
767
789
  };
768
790
  }
769
- const Ye = G.forwardRef(({ dto: e, renderers: t, locale: n = "en" }, u) => {
791
+ const Ye = J.forwardRef(({ dto: e, renderers: n, locale: t = "en" }, a) => {
770
792
  const {
771
793
  values: o,
772
- handleChange: a,
773
- getValues: s,
794
+ handleChange: s,
795
+ getValues: u,
774
796
  getErrors: c,
775
797
  validateAll: h,
776
- validateField: f
777
- } = Ie(e, n);
778
- return de(u, () => ({
779
- getValues: s,
798
+ validateField: b
799
+ } = Ne(e, t);
800
+ return pe(a, () => ({
801
+ getValues: u,
780
802
  getErrors: c,
781
803
  validateAll: h,
782
- validateField: f
804
+ validateField: b
783
805
  })), /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
784
806
  e.title && /* @__PURE__ */ l.jsx(
785
- R,
807
+ _,
786
808
  {
787
809
  variant: "h5",
788
810
  color: "black",
@@ -791,11 +813,11 @@ const Ye = G.forwardRef(({ dto: e, renderers: t, locale: n = "en" }, u) => {
791
813
  fontWeight: "bold"
792
814
  },
793
815
  gutterBottom: !0,
794
- children: b(e.title, n)
816
+ children: f(e.title, t)
795
817
  }
796
818
  ),
797
819
  e.description && /* @__PURE__ */ l.jsx(
798
- R,
820
+ _,
799
821
  {
800
822
  component: "p",
801
823
  sx: {
@@ -803,18 +825,18 @@ const Ye = G.forwardRef(({ dto: e, renderers: t, locale: n = "en" }, u) => {
803
825
  },
804
826
  color: "textSecondary",
805
827
  gutterBottom: !0,
806
- children: b(e.description, n)
828
+ children: f(e.description, t)
807
829
  }
808
830
  ),
809
831
  e.sections.map((g) => /* @__PURE__ */ l.jsx(
810
- Ce,
832
+ Le,
811
833
  {
812
834
  section: g,
813
835
  values: o,
814
- onChange: a,
815
- renderers: t,
816
- validateField: f,
817
- locale: n
836
+ onChange: s,
837
+ renderers: n,
838
+ validateField: b,
839
+ locale: t
818
840
  },
819
841
  g.id
820
842
  ))
@@ -822,17 +844,17 @@ const Ye = G.forwardRef(({ dto: e, renderers: t, locale: n = "en" }, u) => {
822
844
  });
823
845
  export {
824
846
  ke as AutoCompleteField,
825
- Se as CheckBoxInput,
826
- Fe as Field,
847
+ Ae as CheckBoxInput,
848
+ Pe as Field,
827
849
  Ye as FormBuilder,
828
- Ae as MultiAutoCompleteField,
829
- we as RadioInput,
830
- Ce as Section,
831
- ye as SelectInput,
832
- $e as TextAreaInput,
833
- Te as TextInput,
834
- Ie as useFormBuilder,
835
- Le as validateAll,
836
- Q as validateField,
850
+ $e as MultiAutoCompleteField,
851
+ Oe as RadioInput,
852
+ Le as Section,
853
+ Te as SelectInput,
854
+ we as TextAreaInput,
855
+ Se as TextInput,
856
+ Ne as useFormBuilder,
857
+ Ie as validateAll,
858
+ K as validateField,
837
859
  ze as validationRules
838
860
  };