@resistdesign/voltra 3.0.0-alpha.32 → 3.0.0-alpha.34

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.
Files changed (54) hide show
  1. package/README.md +72 -2
  2. package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +5 -3
  3. package/api/Indexing/index.d.ts +3 -3
  4. package/api/Indexing/rel/Handlers.d.ts +3 -2
  5. package/api/ORM/drivers/index.d.ts +1 -1
  6. package/api/ORM/index.d.ts +2 -11
  7. package/api/index.js +114 -99
  8. package/app/forms/Engine.d.ts +3 -0
  9. package/app/forms/UI.d.ts +7 -1
  10. package/app/forms/core/createAutoField.d.ts +11 -3
  11. package/app/forms/core/createFormRenderer.d.ts +3 -2
  12. package/app/forms/core/mergeSuites.d.ts +3 -2
  13. package/app/forms/core/resolveSuite.d.ts +2 -1
  14. package/app/forms/core/types.d.ts +20 -9
  15. package/app/forms/index.d.ts +1 -2
  16. package/app/forms/types.d.ts +36 -55
  17. package/app/index.js +22 -14
  18. package/app/utils/ApplicationState.d.ts +1 -1
  19. package/app/utils/Route.d.ts +3 -3
  20. package/build/index.js +4 -4
  21. package/chunk-4PV5LPTT.js +1144 -0
  22. package/chunk-7AMEFPPP.js +78 -0
  23. package/{chunk-FQMZMCXU.js → chunk-RUVFOXCR.js} +1 -1
  24. package/chunk-TJFTWPXQ.js +39 -0
  25. package/{chunk-LGM75I6P.js → chunk-WTD5BBJP.js} +223 -38
  26. package/common/ItemRelationships/ItemRelationshipValidation.d.ts +1 -1
  27. package/common/ItemRelationships/index.d.ts +1 -5
  28. package/common/Logging/Utils.d.ts +0 -9
  29. package/common/TypeInfoORM/index.d.ts +2 -10
  30. package/common/TypeParsing/TypeInfo.d.ts +20 -0
  31. package/common/TypeParsing/Validation.d.ts +152 -22
  32. package/common/index.d.ts +2 -12
  33. package/common/index.js +21 -9
  34. package/iac/packs/auth.d.ts +10 -4
  35. package/iac-packs/index.d.ts +1 -0
  36. package/native/forms/UI.d.ts +8 -2
  37. package/native/forms/createNativeFormRenderer.d.ts +1 -1
  38. package/native/forms/index.d.ts +16 -0
  39. package/native/forms/suite.d.ts +1 -1
  40. package/native/index.js +71 -40
  41. package/native/testing/react-native.d.ts +33 -15
  42. package/native/utils/index.d.ts +13 -1
  43. package/package.json +1 -1
  44. package/web/forms/UI.d.ts +8 -2
  45. package/web/forms/createWebFormRenderer.d.ts +1 -1
  46. package/web/forms/suite.d.ts +1 -1
  47. package/web/index.js +234 -113
  48. package/web/utils/Route.d.ts +9 -3
  49. package/web/utils/index.d.ts +1 -0
  50. package/chunk-G5CLUK4Y.js +0 -621
  51. package/chunk-HVY7POTD.js +0 -22
  52. package/chunk-IWRHGGGH.js +0 -10
  53. package/chunk-MUCSL3UR.js +0 -1
  54. package/chunk-WELZGQDJ.js +0 -456
@@ -10,19 +10,37 @@ export declare const BackHandler: {
10
10
  removeEventListener: (_eventName: "hardwareBackPress", listener: Listener) => void;
11
11
  __triggerHardwareBackPress: () => boolean;
12
12
  };
13
- export declare const View: ({ children, ...props }: Record<string, any>) => React.DOMElement<{
14
- [x: string]: any;
15
- }, Element>;
16
- export declare const Text: ({ children, ...props }: Record<string, any>) => React.DOMElement<{
17
- [x: string]: any;
18
- }, Element>;
19
- export declare const Pressable: ({ children, ...props }: Record<string, any>) => React.DOMElement<{
20
- [x: string]: any;
21
- }, Element>;
22
- export declare const Switch: ({ children, ...props }: Record<string, any>) => React.DOMElement<{
23
- [x: string]: any;
24
- }, Element>;
25
- export declare const TextInput: ({ children, ...props }: Record<string, any>) => React.DOMElement<{
26
- [x: string]: any;
27
- }, Element>;
13
+ type PrimitiveProps = Record<string, any> & {
14
+ children?: React.ReactNode;
15
+ };
16
+ export declare const View: {
17
+ ({ children, ...props }: PrimitiveProps): React.ReactElement<{
18
+ "data-rn": string;
19
+ }, string | React.JSXElementConstructor<any>>;
20
+ displayName: string;
21
+ };
22
+ export declare const Text: {
23
+ ({ children, ...props }: PrimitiveProps): React.ReactElement<{
24
+ "data-rn": string;
25
+ }, string | React.JSXElementConstructor<any>>;
26
+ displayName: string;
27
+ };
28
+ export declare const Pressable: {
29
+ ({ children, ...props }: PrimitiveProps): React.ReactElement<{
30
+ "data-rn": string;
31
+ }, string | React.JSXElementConstructor<any>>;
32
+ displayName: string;
33
+ };
34
+ export declare const Switch: {
35
+ ({ children, ...props }: PrimitiveProps): React.ReactElement<{
36
+ "data-rn": string;
37
+ }, string | React.JSXElementConstructor<any>>;
38
+ displayName: string;
39
+ };
40
+ export declare const TextInput: {
41
+ ({ children, ...props }: PrimitiveProps): React.ReactElement<{
42
+ "data-rn": string;
43
+ }, string | React.JSXElementConstructor<any>>;
44
+ displayName: string;
45
+ };
28
46
  export {};
@@ -1,8 +1,20 @@
1
1
  /**
2
2
  * @packageDocumentation
3
3
  *
4
- * Native (render-agnostic) utilities.
4
+ * Native layout/navigation utilities.
5
+ */
6
+ /**
7
+ * @category native
8
+ * @group Layout and Navigation
5
9
  */
6
10
  export * from "./EasyLayout";
11
+ /**
12
+ * @category native
13
+ * @group Layout and Navigation
14
+ */
7
15
  export * from "./History";
16
+ /**
17
+ * @category native
18
+ * @group Layout and Navigation
19
+ */
8
20
  export * from "./Route";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resistdesign/voltra",
3
- "version": "3.0.0-alpha.32",
3
+ "version": "3.0.0-alpha.34",
4
4
  "description": "With our powers combined!",
5
5
  "homepage": "https://voltra.app",
6
6
  "repository": "git@github.com:resistdesign/voltra.git",
package/web/forms/UI.d.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Web AutoForm wrappers backed by the default web renderer.
5
5
  */
6
- import type { FC } from "react";
7
- import type { AutoFieldProps, CustomTypeActionPayload, FormValues, RelationActionPayload } from "../../app/forms/types";
6
+ import { type FC } from "react";
7
+ import type { AutoFieldProps, CustomValidatorMap, CustomTypeActionPayload, FormValues, RelationActionPayload, TranslateValidationErrorCode } from "../../app/forms/types";
8
8
  import type { TypeInfo, TypeOperation } from "../../common/TypeParsing/TypeInfo";
9
9
  import type { FormController } from "../../app/forms/types";
10
10
  /**
@@ -30,6 +30,8 @@ export interface AutoFormViewProps {
30
30
  onRelationAction?: (payload: RelationActionPayload) => void;
31
31
  /** Optional custom type action handler. */
32
32
  onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
33
+ /** Optional translator for validation error descriptors. */
34
+ translateValidationErrorCode?: TranslateValidationErrorCode;
33
35
  }
34
36
  /**
35
37
  * Render a web form UI from a prepared form controller.
@@ -58,6 +60,10 @@ export interface AutoFormProps {
58
60
  operation?: TypeOperation;
59
61
  /** Disable the submit button when true. */
60
62
  submitDisabled?: boolean;
63
+ /** Optional translator for validation error descriptors. */
64
+ translateValidationErrorCode?: TranslateValidationErrorCode;
65
+ /** Optional custom validators keyed by field name. */
66
+ customValidatorMap?: CustomValidatorMap;
61
67
  }
62
68
  /**
63
69
  * Build a controller from type metadata and render a web auto form.
@@ -16,6 +16,6 @@ import type { ComponentSuite } from "../../app/forms/core/types";
16
16
  export declare const createWebFormRenderer: (options?: {
17
17
  suite?: ComponentSuite<ReactElement>;
18
18
  }) => {
19
- AutoField: (props: import("../../app/forms/core").AutoFieldInput) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
19
+ AutoField: import("react").FC<import("../../app").AutoFieldInput>;
20
20
  suite: import("../../app").ResolvedSuite<ReactElement<any, string | import("react").JSXElementConstructor<any>>>;
21
21
  };
@@ -12,4 +12,4 @@ export declare const webSuite: ComponentSuite<ReactElement>;
12
12
  /**
13
13
  * AutoField renderer backed by the default web suite.
14
14
  */
15
- export declare const webAutoField: (props: import("../../app/forms/core").AutoFieldInput) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
15
+ export declare const webAutoField: import("react").FC<import("../../app").AutoFieldInput>;
package/web/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { createEasyLayout } from '../chunk-FQMZMCXU.js';
2
- import { createFormRenderer, AutoFormView, AutoForm } from '../chunk-WELZGQDJ.js';
3
- import '../chunk-IWRHGGGH.js';
1
+ import { createEasyLayout } from '../chunk-RUVFOXCR.js';
2
+ import { createFormRenderer, AutoFormView, AutoForm, createBrowserRouteAdapter, Route } from '../chunk-4PV5LPTT.js';
3
+ import { ERROR_MESSAGE_CONSTANTS } from '../chunk-WTD5BBJP.js';
4
+ import '../chunk-GYWRAW3Y.js';
4
5
  import { __export, __reExport } from '../chunk-I2KLQ2HA.js';
5
- import { createElement } from 'react';
6
+ import { createElement, useCallback, useRef } from 'react';
6
7
  import * as styledBase from 'styled-components';
7
8
  import styledBase__default from 'styled-components';
8
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -65,9 +66,35 @@ var formatCustomValue = (val) => {
65
66
  if (typeof val === "string" || typeof val === "number") return String(val);
66
67
  return JSON.stringify(val, null, 2);
67
68
  };
68
- var renderRelationSingle = (context) => {
69
- const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
69
+ var renderErrorMessage = (context) => {
70
+ const { error, errors = [], translateValidationErrorCode } = context;
71
+ const descriptors = (errors.length ? errors : error ? [error] : []).filter(
72
+ (descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
73
+ );
74
+ if (!descriptors.length) {
75
+ return null;
76
+ }
77
+ return /* @__PURE__ */ jsx(Fragment, { children: descriptors.map((descriptor, index) => {
78
+ const message = translateValidationErrorCode(descriptor);
79
+ if (!message) {
80
+ return null;
81
+ }
82
+ return /* @__PURE__ */ jsx(ErrorMessage, { children: message }, `${descriptor.code}-${index}`);
83
+ }) });
84
+ };
85
+ var RelationSingleField = (context) => {
86
+ const { field, fieldKey, label, required, disabled, onRelationAction } = context;
70
87
  const id = `field-${fieldKey}`;
88
+ const handleManageRelation = useCallback(() => {
89
+ onRelationAction?.({
90
+ action: "open",
91
+ fieldKey,
92
+ field,
93
+ value: void 0,
94
+ fullPaging: field.tags?.fullPaging,
95
+ onChange: context.onChange
96
+ });
97
+ }, [context.onChange, field, fieldKey, onRelationAction]);
71
98
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
72
99
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
73
100
  label,
@@ -80,23 +107,26 @@ var renderRelationSingle = (context) => {
80
107
  "data-signifier": "manage",
81
108
  type: "button",
82
109
  disabled,
83
- onClick: () => onRelationAction({
84
- action: "open",
85
- fieldKey,
86
- field,
87
- value: void 0,
88
- fullPaging: field.tags?.fullPaging,
89
- onChange: context.onChange
90
- }),
110
+ onClick: handleManageRelation,
91
111
  children: "Manage"
92
112
  }
93
113
  ) : void 0,
94
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
114
+ renderErrorMessage(context)
95
115
  ] });
96
116
  };
97
- var renderRelationArray = (context) => {
98
- const { field, fieldKey, label, required, disabled, error, onRelationAction } = context;
117
+ var RelationArrayField = (context) => {
118
+ const { field, fieldKey, label, required, disabled, onRelationAction } = context;
99
119
  const id = `field-${fieldKey}`;
120
+ const handleManageRelation = useCallback(() => {
121
+ onRelationAction?.({
122
+ action: "open",
123
+ fieldKey,
124
+ field,
125
+ value: void 0,
126
+ fullPaging: field.tags?.fullPaging,
127
+ onChange: context.onChange
128
+ });
129
+ }, [context.onChange, field, fieldKey, onRelationAction]);
100
130
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
101
131
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
102
132
  label,
@@ -109,25 +139,31 @@ var renderRelationArray = (context) => {
109
139
  "data-signifier": "manage-related",
110
140
  type: "button",
111
141
  disabled,
112
- onClick: () => onRelationAction({
113
- action: "open",
114
- fieldKey,
115
- field,
116
- value: void 0,
117
- fullPaging: field.tags?.fullPaging,
118
- onChange: context.onChange
119
- }),
142
+ onClick: handleManageRelation,
120
143
  children: "Manage"
121
144
  }
122
145
  ) : void 0,
123
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
146
+ renderErrorMessage(context)
124
147
  ] });
125
148
  };
126
- var renderCustomSingle = (context) => {
127
- const { field, fieldKey, label, required, disabled, error } = context;
149
+ var CustomSingleField = (context) => {
150
+ const { field, fieldKey, label, required, disabled } = context;
128
151
  const id = `field-${fieldKey}`;
129
152
  const customType = field.tags?.customType;
130
153
  const onCustomTypeAction = context.onCustomTypeAction;
154
+ const handleManageCustomType = useCallback(() => {
155
+ if (!customType) {
156
+ return;
157
+ }
158
+ onCustomTypeAction?.({
159
+ action: "open",
160
+ fieldKey,
161
+ field,
162
+ customType,
163
+ value: context.value,
164
+ onChange: context.onChange
165
+ });
166
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
131
167
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
132
168
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
133
169
  label,
@@ -141,26 +177,76 @@ var renderCustomSingle = (context) => {
141
177
  "data-signifier": "manage",
142
178
  type: "button",
143
179
  disabled,
144
- onClick: () => onCustomTypeAction({
145
- action: "open",
146
- fieldKey,
147
- field,
148
- customType,
149
- value: context.value,
150
- onChange: context.onChange
151
- }),
180
+ onClick: handleManageCustomType,
152
181
  children: "Manage"
153
182
  }
154
183
  ) : void 0,
155
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
184
+ renderErrorMessage(context)
156
185
  ] });
157
186
  };
158
- var renderCustomArray = (context) => {
159
- const { field, fieldKey, label, required, disabled, error } = context;
187
+ var CustomArrayField = (context) => {
188
+ const { field, fieldKey, label, required, disabled } = context;
160
189
  const id = `field-${fieldKey}`;
161
190
  const customType = field.tags?.customType;
162
191
  const onCustomTypeAction = context.onCustomTypeAction;
163
192
  const arrayValue = Array.isArray(context.value) ? context.value : [];
193
+ const handleEditItem = useCallback((event) => {
194
+ if (!customType) {
195
+ return;
196
+ }
197
+ const indexRaw = event.currentTarget.getAttribute("data-array-index");
198
+ if (!indexRaw) {
199
+ return;
200
+ }
201
+ const index = Number(indexRaw);
202
+ if (!Number.isFinite(index)) {
203
+ return;
204
+ }
205
+ onCustomTypeAction?.({
206
+ action: "edit",
207
+ fieldKey,
208
+ field,
209
+ customType,
210
+ value: context.value,
211
+ index,
212
+ onChange: context.onChange
213
+ });
214
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
215
+ const handleRemoveItem = useCallback((event) => {
216
+ if (!customType) {
217
+ return;
218
+ }
219
+ const indexRaw = event.currentTarget.getAttribute("data-array-index");
220
+ if (!indexRaw) {
221
+ return;
222
+ }
223
+ const index = Number(indexRaw);
224
+ if (!Number.isFinite(index)) {
225
+ return;
226
+ }
227
+ onCustomTypeAction?.({
228
+ action: "remove",
229
+ fieldKey,
230
+ field,
231
+ customType,
232
+ value: context.value,
233
+ index,
234
+ onChange: context.onChange
235
+ });
236
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
237
+ const handleAddItem = useCallback(() => {
238
+ if (!customType) {
239
+ return;
240
+ }
241
+ onCustomTypeAction?.({
242
+ action: "add",
243
+ fieldKey,
244
+ field,
245
+ customType,
246
+ value: context.value,
247
+ onChange: context.onChange
248
+ });
249
+ }, [context.onChange, context.value, customType, field, fieldKey, onCustomTypeAction]);
164
250
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
165
251
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
166
252
  label,
@@ -176,17 +262,10 @@ var renderCustomArray = (context) => {
176
262
  "button",
177
263
  {
178
264
  "data-signifier": "manage",
265
+ "data-array-index": String(index),
179
266
  type: "button",
180
267
  disabled,
181
- onClick: () => onCustomTypeAction({
182
- action: "edit",
183
- fieldKey,
184
- field,
185
- customType,
186
- value: context.value,
187
- index,
188
- onChange: context.onChange
189
- }),
268
+ onClick: handleEditItem,
190
269
  children: "Manage"
191
270
  }
192
271
  ) : void 0,
@@ -194,16 +273,9 @@ var renderCustomArray = (context) => {
194
273
  "button",
195
274
  {
196
275
  type: "button",
276
+ "data-array-index": String(index),
197
277
  disabled,
198
- onClick: () => onCustomTypeAction({
199
- action: "remove",
200
- fieldKey,
201
- field,
202
- customType,
203
- value: context.value,
204
- index,
205
- onChange: context.onChange
206
- }),
278
+ onClick: handleRemoveItem,
207
279
  children: "Remove"
208
280
  }
209
281
  ) : void 0
@@ -215,25 +287,38 @@ var renderCustomArray = (context) => {
215
287
  {
216
288
  type: "button",
217
289
  disabled,
218
- onClick: () => onCustomTypeAction({
219
- action: "add",
220
- fieldKey,
221
- field,
222
- customType,
223
- value: context.value,
224
- onChange: context.onChange
225
- }),
290
+ onClick: handleAddItem,
226
291
  children: "Add Item"
227
292
  }
228
293
  ) : void 0,
229
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
294
+ renderErrorMessage(context)
230
295
  ] });
231
296
  };
232
- var renderArray = (context) => {
233
- const { field, fieldKey, label, required, disabled, error } = context;
297
+ var ArrayField = (context) => {
298
+ const { field, fieldKey, label, required, disabled } = context;
234
299
  const id = `field-${fieldKey}`;
235
300
  const itemField = createArrayItemField(field);
236
301
  const arrayValue = Array.isArray(context.value) ? [...context.value] : [];
302
+ const handleRemoveArrayItem = useCallback((event) => {
303
+ const indexRaw = event.currentTarget.getAttribute("data-array-index");
304
+ if (!indexRaw) {
305
+ return;
306
+ }
307
+ const index = Number(indexRaw);
308
+ if (!Number.isFinite(index)) {
309
+ return;
310
+ }
311
+ const newValue = [...arrayValue];
312
+ newValue.splice(index, 1);
313
+ context.onChange(newValue);
314
+ }, [arrayValue, context]);
315
+ const handleAddArrayItem = useCallback(() => {
316
+ const baseValue = Array.isArray(context.value) ? context.value : [];
317
+ const newValue = [...baseValue];
318
+ const newItem = field.type === "number" ? 0 : field.type === "boolean" ? false : "";
319
+ newValue.push(newItem);
320
+ context.onChange(newValue);
321
+ }, [context, field.type]);
237
322
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
238
323
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
239
324
  label,
@@ -251,18 +336,20 @@ var renderArray = (context) => {
251
336
  newValue[index] = newItem;
252
337
  context.onChange(newValue);
253
338
  },
339
+ errors: context.arrayItemErrorMap?.[index] ?? [],
340
+ error: context.arrayItemErrorMap?.[index]?.find(
341
+ (descriptor) => descriptor.code !== ERROR_MESSAGE_CONSTANTS.NONE
342
+ ) ?? void 0,
343
+ translateValidationErrorCode: context.translateValidationErrorCode,
254
344
  disabled
255
345
  }) }),
256
346
  /* @__PURE__ */ jsx(
257
347
  "button",
258
348
  {
259
349
  type: "button",
350
+ "data-array-index": String(index),
260
351
  disabled,
261
- onClick: () => {
262
- const newValue = [...arrayValue];
263
- newValue.splice(index, 1);
264
- context.onChange(newValue);
265
- },
352
+ onClick: handleRemoveArrayItem,
266
353
  children: "Remove"
267
354
  }
268
355
  )
@@ -272,23 +359,20 @@ var renderArray = (context) => {
272
359
  {
273
360
  type: "button",
274
361
  disabled,
275
- onClick: () => {
276
- const baseValue = Array.isArray(context.value) ? context.value : [];
277
- const newValue = [...baseValue];
278
- const newItem = field.type === "number" ? 0 : field.type === "boolean" ? false : "";
279
- newValue.push(newItem);
280
- context.onChange(newValue);
281
- },
362
+ onClick: handleAddArrayItem,
282
363
  children: "Add Item"
283
364
  }
284
365
  )
285
366
  ] }),
286
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
367
+ renderErrorMessage(context)
287
368
  ] });
288
369
  };
289
- var renderString = (context) => {
290
- const { fieldKey, label, required, disabled, error } = context;
370
+ var StringField = (context) => {
371
+ const { fieldKey, label, required, disabled } = context;
291
372
  const id = `field-${fieldKey}`;
373
+ const handleChange = useCallback((event) => {
374
+ context.onChange(event.target.value);
375
+ }, [context]);
292
376
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
293
377
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
294
378
  label,
@@ -301,17 +385,20 @@ var renderString = (context) => {
301
385
  id,
302
386
  type: context.format || "text",
303
387
  value: context.value || "",
304
- onChange: (e) => context.onChange(e.target.value),
388
+ onChange: handleChange,
305
389
  disabled,
306
390
  pattern: context.constraints?.pattern
307
391
  }
308
392
  ),
309
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
393
+ renderErrorMessage(context)
310
394
  ] });
311
395
  };
312
- var renderNumber = (context) => {
313
- const { fieldKey, label, required, disabled, error } = context;
396
+ var NumberField = (context) => {
397
+ const { fieldKey, label, required, disabled } = context;
314
398
  const id = `field-${fieldKey}`;
399
+ const handleChange = useCallback((event) => {
400
+ context.onChange(parseNumberValue(event.target.value));
401
+ }, [context]);
315
402
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
316
403
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
317
404
  label,
@@ -324,19 +411,22 @@ var renderNumber = (context) => {
324
411
  id,
325
412
  type: "number",
326
413
  value: context.value ?? "",
327
- onChange: (e) => context.onChange(parseNumberValue(e.target.value)),
414
+ onChange: handleChange,
328
415
  disabled,
329
416
  min: context.constraints?.min,
330
417
  max: context.constraints?.max,
331
418
  step: context.constraints?.step
332
419
  }
333
420
  ),
334
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
421
+ renderErrorMessage(context)
335
422
  ] });
336
423
  };
337
- var renderBoolean = (context) => {
338
- const { fieldKey, label, disabled, error } = context;
424
+ var BooleanField = (context) => {
425
+ const { fieldKey, label, disabled } = context;
339
426
  const id = `field-${fieldKey}`;
427
+ const handleChange = useCallback((event) => {
428
+ context.onChange(event.target.checked);
429
+ }, [context]);
340
430
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
341
431
  /* @__PURE__ */ jsxs("div", { children: [
342
432
  /* @__PURE__ */ jsx(
@@ -345,7 +435,7 @@ var renderBoolean = (context) => {
345
435
  id,
346
436
  type: "checkbox",
347
437
  checked: !!context.value,
348
- onChange: (e) => context.onChange(e.target.checked),
438
+ onChange: handleChange,
349
439
  disabled
350
440
  }
351
441
  ),
@@ -355,14 +445,30 @@ var renderBoolean = (context) => {
355
445
  " "
356
446
  ] })
357
447
  ] }),
358
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
448
+ renderErrorMessage(context)
359
449
  ] });
360
450
  };
361
- var renderEnumSelect = (context) => {
362
- const { field, fieldKey, label, required, disabled, error } = context;
451
+ var EnumSelectField = (context) => {
452
+ const { field, fieldKey, label, required, disabled } = context;
363
453
  const id = `field-${fieldKey}`;
364
454
  const selectableValues = getSelectableValues(context.possibleValues);
365
455
  const allowCustom = context.allowCustomSelection;
456
+ const handleCustomSelectionChange = useCallback(
457
+ (event) => {
458
+ context.onChange(
459
+ field.type === "number" ? parseNumberValue(event.target.value) : event.target.value
460
+ );
461
+ },
462
+ [context, field.type]
463
+ );
464
+ const handleSelectChange = useCallback(
465
+ (event) => {
466
+ context.onChange(
467
+ field.type === "number" ? parseNumberValue(event.target.value) : event.target.value
468
+ );
469
+ },
470
+ [context, field.type]
471
+ );
366
472
  return /* @__PURE__ */ jsxs(FieldWrapper, { children: [
367
473
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
368
474
  label,
@@ -377,9 +483,7 @@ var renderEnumSelect = (context) => {
377
483
  type: "text",
378
484
  list: `list-${id}`,
379
485
  value: context.value ?? "",
380
- onChange: (e) => context.onChange(
381
- field.type === "number" ? parseNumberValue(e.target.value) : e.target.value
382
- ),
486
+ onChange: handleCustomSelectionChange,
383
487
  placeholder: "Select or type...",
384
488
  disabled
385
489
  }
@@ -391,9 +495,7 @@ var renderEnumSelect = (context) => {
391
495
  {
392
496
  id,
393
497
  value: context.value ?? "",
394
- onChange: (e) => context.onChange(
395
- field.type === "number" ? parseNumberValue(e.target.value) : e.target.value
396
- ),
498
+ onChange: handleSelectChange,
397
499
  disabled,
398
500
  children: [
399
501
  /* @__PURE__ */ jsx("option", { value: "", children: "Select..." }),
@@ -401,7 +503,7 @@ var renderEnumSelect = (context) => {
401
503
  ]
402
504
  }
403
505
  ),
404
- error && /* @__PURE__ */ jsx(ErrorMessage, { children: error })
506
+ renderErrorMessage(context)
405
507
  ] });
406
508
  };
407
509
  var FormRoot = ({
@@ -434,15 +536,15 @@ var SuiteButton = ({
434
536
  };
435
537
  var webSuite = {
436
538
  renderers: {
437
- string: renderString,
438
- number: renderNumber,
439
- boolean: renderBoolean,
440
- enum_select: renderEnumSelect,
441
- array: renderArray,
442
- relation_single: renderRelationSingle,
443
- relation_array: renderRelationArray,
444
- custom_single: renderCustomSingle,
445
- custom_array: renderCustomArray
539
+ string: StringField,
540
+ number: NumberField,
541
+ boolean: BooleanField,
542
+ enum_select: EnumSelectField,
543
+ array: ArrayField,
544
+ relation_single: RelationSingleField,
545
+ relation_array: RelationArrayField,
546
+ custom_single: CustomSingleField,
547
+ custom_array: CustomArrayField
446
548
  },
447
549
  primitives: {
448
550
  FormRoot,
@@ -488,12 +590,15 @@ var createWebFormRenderer = (options) => {
488
590
  };
489
591
  var defaultWebRenderer = createWebFormRenderer();
490
592
  var AutoField = (props) => {
491
- return webAutoField({
593
+ return createElement(webAutoField, {
492
594
  field: props.field,
493
595
  fieldKey: props.fieldKey,
494
596
  value: props.value,
495
597
  onChange: props.onChange,
496
598
  error: props.error,
599
+ errors: props.errors,
600
+ arrayItemErrorMap: props.arrayItemErrorMap,
601
+ translateValidationErrorCode: props.translateValidationErrorCode,
497
602
  disabled: props.disabled,
498
603
  onRelationAction: props.onRelationAction,
499
604
  onCustomTypeAction: props.onCustomTypeAction
@@ -543,5 +648,21 @@ var styledFactory = {
543
648
  var getEasyLayout = (extendFrom, areasExtendFrom, options = {}) => {
544
649
  return createEasyLayout(styledFactory, extendFrom, areasExtendFrom, options);
545
650
  };
651
+ var Route2 = (props) => {
652
+ const hasMatcherProps = typeof props.path !== "undefined" || typeof props.exact !== "undefined" || typeof props.onParamsChange !== "undefined";
653
+ const adapterRef = useRef(null);
654
+ const shouldUseAutoBrowserAdapter = !hasMatcherProps && typeof props.adapter === "undefined" && typeof props.ingress === "undefined";
655
+ const routeProps = props;
656
+ if (shouldUseAutoBrowserAdapter && !adapterRef.current) {
657
+ adapterRef.current = createBrowserRouteAdapter();
658
+ }
659
+ return shouldUseAutoBrowserAdapter ? /* @__PURE__ */ jsx(
660
+ Route,
661
+ {
662
+ ...routeProps,
663
+ adapter: adapterRef.current ?? void 0
664
+ }
665
+ ) : /* @__PURE__ */ jsx(Route, { ...routeProps });
666
+ };
546
667
 
547
- export { ArrayContainer, ArrayItemWrapper, AutoField, AutoForm2 as AutoForm, AutoFormView2 as AutoFormView, ErrorMessage, FieldWrapper, createWebFormRenderer, getEasyLayout, webAutoField, webSuite };
668
+ export { ArrayContainer, ArrayItemWrapper, AutoField, AutoForm2 as AutoForm, AutoFormView2 as AutoFormView, ErrorMessage, FieldWrapper, Route2 as Route, createWebFormRenderer, getEasyLayout, webAutoField, webSuite };