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