@middag-io/react 0.48.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/base/shell/BasicShell.d.ts.map +1 -1
- package/dist-lib/base/shell/BasicShell.js +21 -9
- package/dist-lib/contracts/block-data/form.d.ts +13 -18
- package/dist-lib/contracts/block-data/form.d.ts.map +1 -1
- package/dist-lib/contracts/generated/index.d.ts +2 -2
- package/dist-lib/contracts/generated/schemas.d.ts +94 -51
- package/dist-lib/contracts/generated/schemas.d.ts.map +1 -1
- package/dist-lib/contracts/generated/types.d.ts +25 -24
- package/dist-lib/contracts/generated/types.d.ts.map +1 -1
- package/dist-lib/contracts/page-contract.d.ts +2 -5
- package/dist-lib/contracts/page-contract.d.ts.map +1 -1
- package/dist-lib/index.d.ts +2 -3
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/middag-react.js +4931 -4920
- package/docs/public/schemas/ai-contract-manifest.json +0 -7
- package/docs/public/schemas/fragment.json +53 -60
- package/docs/public/schemas/manifest.json +0 -8
- package/docs/public/schemas/page-contract.json +53 -60
- package/docs/public/schemas/shared-props.json +53 -60
- package/package.json +5 -2
- package/src/base/blocks/FormPanelBlock.tsx +3 -3
- package/src/base/shell/BasicShell.tsx +15 -1
- package/src/contracts/block-data/form.ts +22 -18
- package/src/contracts/generated/index.ts +2 -2
- package/src/contracts/generated/schemas.ts +13 -22
- package/src/contracts/generated/types.ts +25 -24
- package/src/contracts/page-contract.ts +1 -6
- package/dist-lib/contracts/connectors.d.ts +0 -50
- package/dist-lib/contracts/connectors.d.ts.map +0 -1
- package/docs/public/schemas/connectors.json +0 -97
- package/src/contracts/connectors.ts +0 -60
|
@@ -67,13 +67,6 @@
|
|
|
67
67
|
"url": "https://ui-docs.middag.io/schemas/shared-props.json",
|
|
68
68
|
"description": "Inertia shared props sent on every request: auth (user + capabilities), theme (strings + appearance), flash (success/error/info/warning messages), errors, csrf_token, locale, scope (extension data), navigation.",
|
|
69
69
|
"x-ai-purpose": "Global data available on every page. AI agents can assume these props exist when generating pages. Auth capabilities drive <Can>/<Cannot> gates."
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"id": "connectors",
|
|
73
|
-
"title": "Connectors Contract",
|
|
74
|
-
"url": "https://ui-docs.middag.io/schemas/connectors.json",
|
|
75
|
-
"description": "Connector management types: ConnectorStatus (5 lifecycle states), CredentialField (form schema), HealthCheckResult, ConnectorListItem, ConnectorDetail, ConnectorTypeInfo.",
|
|
76
|
-
"x-ai-purpose": "Use when building connector management pages. ConnectorStatus maps to semantic colors for badges. CredentialField drives dynamic configuration forms."
|
|
77
70
|
}
|
|
78
71
|
],
|
|
79
72
|
"systemOverview": {
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"layout": {
|
|
28
28
|
"$ref": "#/$defs/LayoutDescriptor"
|
|
29
29
|
},
|
|
30
|
-
"resources": {
|
|
31
|
-
"$ref": "#/$defs/PageResources"
|
|
32
|
-
},
|
|
33
30
|
"notifications": {
|
|
34
31
|
"type": "array",
|
|
35
32
|
"items": {
|
|
@@ -68,9 +65,6 @@
|
|
|
68
65
|
"$ref": "#/$defs/Notification"
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
|
-
"resources": {
|
|
72
|
-
"$ref": "#/$defs/ResourcePatch"
|
|
73
|
-
},
|
|
74
68
|
"customType": {
|
|
75
69
|
"type": "string"
|
|
76
70
|
}
|
|
@@ -462,24 +456,6 @@
|
|
|
462
456
|
},
|
|
463
457
|
"additionalProperties": false
|
|
464
458
|
},
|
|
465
|
-
"PageResources": {
|
|
466
|
-
"type": "object",
|
|
467
|
-
"required": [
|
|
468
|
-
"featureFlags"
|
|
469
|
-
],
|
|
470
|
-
"properties": {
|
|
471
|
-
"featureFlags": {
|
|
472
|
-
"type": "object",
|
|
473
|
-
"additionalProperties": {
|
|
474
|
-
"type": "boolean"
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
"branding": {
|
|
478
|
-
"$ref": "#/$defs/Branding"
|
|
479
|
-
}
|
|
480
|
-
},
|
|
481
|
-
"additionalProperties": false
|
|
482
|
-
},
|
|
483
459
|
"Identity": {
|
|
484
460
|
"type": "object",
|
|
485
461
|
"required": [
|
|
@@ -508,24 +484,6 @@
|
|
|
508
484
|
},
|
|
509
485
|
"additionalProperties": false
|
|
510
486
|
},
|
|
511
|
-
"Branding": {
|
|
512
|
-
"type": "object",
|
|
513
|
-
"required": [
|
|
514
|
-
"appName"
|
|
515
|
-
],
|
|
516
|
-
"properties": {
|
|
517
|
-
"appName": {
|
|
518
|
-
"type": "string"
|
|
519
|
-
},
|
|
520
|
-
"logoUrl": {
|
|
521
|
-
"type": "string"
|
|
522
|
-
},
|
|
523
|
-
"logoCompactUrl": {
|
|
524
|
-
"type": "string"
|
|
525
|
-
}
|
|
526
|
-
},
|
|
527
|
-
"additionalProperties": false
|
|
528
|
-
},
|
|
529
487
|
"NavigationNode": {
|
|
530
488
|
"type": "object",
|
|
531
489
|
"required": [
|
|
@@ -620,7 +578,15 @@
|
|
|
620
578
|
"$ref": "#/$defs/FlashMessages"
|
|
621
579
|
},
|
|
622
580
|
"errors": {
|
|
623
|
-
"
|
|
581
|
+
"description": "Validation errors of the current request: a FormErrors map or, when the request carried the X-Inertia-Error-Bag header, a FormErrorBags map of bag name to FormErrors. The wire is not self-describing: the reader that sent the header reads errors[bag]; any other reader treats the map as flat.",
|
|
582
|
+
"anyOf": [
|
|
583
|
+
{
|
|
584
|
+
"$ref": "#/$defs/FormErrors"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"$ref": "#/$defs/FormErrorBags"
|
|
588
|
+
}
|
|
589
|
+
]
|
|
624
590
|
},
|
|
625
591
|
"csrf_token": {
|
|
626
592
|
"type": "string"
|
|
@@ -1048,18 +1014,60 @@
|
|
|
1048
1014
|
{
|
|
1049
1015
|
"type": "array",
|
|
1050
1016
|
"items": {
|
|
1051
|
-
"
|
|
1017
|
+
"oneOf": [
|
|
1018
|
+
{
|
|
1019
|
+
"type": "string"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
"$ref": "#/$defs/FieldMessage"
|
|
1023
|
+
}
|
|
1024
|
+
]
|
|
1052
1025
|
}
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"$ref": "#/$defs/FieldMessage"
|
|
1053
1029
|
}
|
|
1054
1030
|
]
|
|
1055
1031
|
},
|
|
1032
|
+
"FieldMessage": {
|
|
1033
|
+
"type": "object",
|
|
1034
|
+
"description": "A structured validation message: the server-resolved message plus the translation key, domain and optional params.",
|
|
1035
|
+
"required": [
|
|
1036
|
+
"message",
|
|
1037
|
+
"key",
|
|
1038
|
+
"domain"
|
|
1039
|
+
],
|
|
1040
|
+
"properties": {
|
|
1041
|
+
"message": {
|
|
1042
|
+
"type": "string"
|
|
1043
|
+
},
|
|
1044
|
+
"key": {
|
|
1045
|
+
"type": "string"
|
|
1046
|
+
},
|
|
1047
|
+
"domain": {
|
|
1048
|
+
"type": "string"
|
|
1049
|
+
},
|
|
1050
|
+
"params": {
|
|
1051
|
+
"type": "object",
|
|
1052
|
+
"additionalProperties": true
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
"additionalProperties": false
|
|
1056
|
+
},
|
|
1056
1057
|
"FormErrors": {
|
|
1057
1058
|
"type": "object",
|
|
1058
|
-
"description": "Validation errors keyed by field name. The reserved key \"_\" carries form-level errors; dotted keys target nested fields.",
|
|
1059
|
+
"description": "Validation errors keyed by field name. Each value is a message, a structured message (FieldMessage) or a list of either. The reserved key \"_\" carries form-level errors; dotted keys target nested fields.",
|
|
1059
1060
|
"additionalProperties": {
|
|
1060
1061
|
"$ref": "#/$defs/FieldError"
|
|
1061
1062
|
}
|
|
1062
1063
|
},
|
|
1064
|
+
"FormErrorBags": {
|
|
1065
|
+
"type": "object",
|
|
1066
|
+
"description": "Validation errors scoped to error bags: bag name to FormErrors.",
|
|
1067
|
+
"additionalProperties": {
|
|
1068
|
+
"$ref": "#/$defs/FormErrors"
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1063
1071
|
"FormSchemaNode": {
|
|
1064
1072
|
"oneOf": [
|
|
1065
1073
|
{
|
|
@@ -2222,21 +2230,6 @@
|
|
|
2222
2230
|
"items": {
|
|
2223
2231
|
"$ref": "#/$defs/Fragment"
|
|
2224
2232
|
}
|
|
2225
|
-
},
|
|
2226
|
-
"resources": {
|
|
2227
|
-
"$ref": "#/$defs/ResourcePatch"
|
|
2228
|
-
}
|
|
2229
|
-
},
|
|
2230
|
-
"additionalProperties": false
|
|
2231
|
-
},
|
|
2232
|
-
"ResourcePatch": {
|
|
2233
|
-
"type": "object",
|
|
2234
|
-
"properties": {
|
|
2235
|
-
"featureFlags": {
|
|
2236
|
-
"type": "object",
|
|
2237
|
-
"additionalProperties": {
|
|
2238
|
-
"type": "boolean"
|
|
2239
|
-
}
|
|
2240
2233
|
}
|
|
2241
2234
|
},
|
|
2242
2235
|
"additionalProperties": false
|
|
@@ -52,14 +52,6 @@
|
|
|
52
52
|
"url": "https://ui-docs.middag.io/schemas/shared-props.json",
|
|
53
53
|
"usage": "Understand global data available on every page via usePage<SharedProps>().props."
|
|
54
54
|
},
|
|
55
|
-
{
|
|
56
|
-
"id": "connectors",
|
|
57
|
-
"title": "Connectors Contract",
|
|
58
|
-
"description": "Connector management types (ConnectorStatus, CredentialField, ConnectorDetail). Separate subsystem.",
|
|
59
|
-
"path": "connectors.json",
|
|
60
|
-
"url": "https://ui-docs.middag.io/schemas/connectors.json",
|
|
61
|
-
"usage": "Understand connector data shapes when building connector management pages."
|
|
62
|
-
},
|
|
63
55
|
{
|
|
64
56
|
"id": "ai-contract-manifest",
|
|
65
57
|
"title": "AI Contract Manifest",
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"layout": {
|
|
28
28
|
"$ref": "#/$defs/LayoutDescriptor"
|
|
29
29
|
},
|
|
30
|
-
"resources": {
|
|
31
|
-
"$ref": "#/$defs/PageResources"
|
|
32
|
-
},
|
|
33
30
|
"notifications": {
|
|
34
31
|
"type": "array",
|
|
35
32
|
"items": {
|
|
@@ -68,9 +65,6 @@
|
|
|
68
65
|
"$ref": "#/$defs/Notification"
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
|
-
"resources": {
|
|
72
|
-
"$ref": "#/$defs/ResourcePatch"
|
|
73
|
-
},
|
|
74
68
|
"customType": {
|
|
75
69
|
"type": "string"
|
|
76
70
|
}
|
|
@@ -462,24 +456,6 @@
|
|
|
462
456
|
},
|
|
463
457
|
"additionalProperties": false
|
|
464
458
|
},
|
|
465
|
-
"PageResources": {
|
|
466
|
-
"type": "object",
|
|
467
|
-
"required": [
|
|
468
|
-
"featureFlags"
|
|
469
|
-
],
|
|
470
|
-
"properties": {
|
|
471
|
-
"featureFlags": {
|
|
472
|
-
"type": "object",
|
|
473
|
-
"additionalProperties": {
|
|
474
|
-
"type": "boolean"
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
"branding": {
|
|
478
|
-
"$ref": "#/$defs/Branding"
|
|
479
|
-
}
|
|
480
|
-
},
|
|
481
|
-
"additionalProperties": false
|
|
482
|
-
},
|
|
483
459
|
"Identity": {
|
|
484
460
|
"type": "object",
|
|
485
461
|
"required": [
|
|
@@ -508,24 +484,6 @@
|
|
|
508
484
|
},
|
|
509
485
|
"additionalProperties": false
|
|
510
486
|
},
|
|
511
|
-
"Branding": {
|
|
512
|
-
"type": "object",
|
|
513
|
-
"required": [
|
|
514
|
-
"appName"
|
|
515
|
-
],
|
|
516
|
-
"properties": {
|
|
517
|
-
"appName": {
|
|
518
|
-
"type": "string"
|
|
519
|
-
},
|
|
520
|
-
"logoUrl": {
|
|
521
|
-
"type": "string"
|
|
522
|
-
},
|
|
523
|
-
"logoCompactUrl": {
|
|
524
|
-
"type": "string"
|
|
525
|
-
}
|
|
526
|
-
},
|
|
527
|
-
"additionalProperties": false
|
|
528
|
-
},
|
|
529
487
|
"NavigationNode": {
|
|
530
488
|
"type": "object",
|
|
531
489
|
"required": [
|
|
@@ -620,7 +578,15 @@
|
|
|
620
578
|
"$ref": "#/$defs/FlashMessages"
|
|
621
579
|
},
|
|
622
580
|
"errors": {
|
|
623
|
-
"
|
|
581
|
+
"description": "Validation errors of the current request: a FormErrors map or, when the request carried the X-Inertia-Error-Bag header, a FormErrorBags map of bag name to FormErrors. The wire is not self-describing: the reader that sent the header reads errors[bag]; any other reader treats the map as flat.",
|
|
582
|
+
"anyOf": [
|
|
583
|
+
{
|
|
584
|
+
"$ref": "#/$defs/FormErrors"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"$ref": "#/$defs/FormErrorBags"
|
|
588
|
+
}
|
|
589
|
+
]
|
|
624
590
|
},
|
|
625
591
|
"csrf_token": {
|
|
626
592
|
"type": "string"
|
|
@@ -1048,18 +1014,60 @@
|
|
|
1048
1014
|
{
|
|
1049
1015
|
"type": "array",
|
|
1050
1016
|
"items": {
|
|
1051
|
-
"
|
|
1017
|
+
"oneOf": [
|
|
1018
|
+
{
|
|
1019
|
+
"type": "string"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
"$ref": "#/$defs/FieldMessage"
|
|
1023
|
+
}
|
|
1024
|
+
]
|
|
1052
1025
|
}
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"$ref": "#/$defs/FieldMessage"
|
|
1053
1029
|
}
|
|
1054
1030
|
]
|
|
1055
1031
|
},
|
|
1032
|
+
"FieldMessage": {
|
|
1033
|
+
"type": "object",
|
|
1034
|
+
"description": "A structured validation message: the server-resolved message plus the translation key, domain and optional params.",
|
|
1035
|
+
"required": [
|
|
1036
|
+
"message",
|
|
1037
|
+
"key",
|
|
1038
|
+
"domain"
|
|
1039
|
+
],
|
|
1040
|
+
"properties": {
|
|
1041
|
+
"message": {
|
|
1042
|
+
"type": "string"
|
|
1043
|
+
},
|
|
1044
|
+
"key": {
|
|
1045
|
+
"type": "string"
|
|
1046
|
+
},
|
|
1047
|
+
"domain": {
|
|
1048
|
+
"type": "string"
|
|
1049
|
+
},
|
|
1050
|
+
"params": {
|
|
1051
|
+
"type": "object",
|
|
1052
|
+
"additionalProperties": true
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
"additionalProperties": false
|
|
1056
|
+
},
|
|
1056
1057
|
"FormErrors": {
|
|
1057
1058
|
"type": "object",
|
|
1058
|
-
"description": "Validation errors keyed by field name. The reserved key \"_\" carries form-level errors; dotted keys target nested fields.",
|
|
1059
|
+
"description": "Validation errors keyed by field name. Each value is a message, a structured message (FieldMessage) or a list of either. The reserved key \"_\" carries form-level errors; dotted keys target nested fields.",
|
|
1059
1060
|
"additionalProperties": {
|
|
1060
1061
|
"$ref": "#/$defs/FieldError"
|
|
1061
1062
|
}
|
|
1062
1063
|
},
|
|
1064
|
+
"FormErrorBags": {
|
|
1065
|
+
"type": "object",
|
|
1066
|
+
"description": "Validation errors scoped to error bags: bag name to FormErrors.",
|
|
1067
|
+
"additionalProperties": {
|
|
1068
|
+
"$ref": "#/$defs/FormErrors"
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1063
1071
|
"FormSchemaNode": {
|
|
1064
1072
|
"oneOf": [
|
|
1065
1073
|
{
|
|
@@ -2222,21 +2230,6 @@
|
|
|
2222
2230
|
"items": {
|
|
2223
2231
|
"$ref": "#/$defs/Fragment"
|
|
2224
2232
|
}
|
|
2225
|
-
},
|
|
2226
|
-
"resources": {
|
|
2227
|
-
"$ref": "#/$defs/ResourcePatch"
|
|
2228
|
-
}
|
|
2229
|
-
},
|
|
2230
|
-
"additionalProperties": false
|
|
2231
|
-
},
|
|
2232
|
-
"ResourcePatch": {
|
|
2233
|
-
"type": "object",
|
|
2234
|
-
"properties": {
|
|
2235
|
-
"featureFlags": {
|
|
2236
|
-
"type": "object",
|
|
2237
|
-
"additionalProperties": {
|
|
2238
|
-
"type": "boolean"
|
|
2239
|
-
}
|
|
2240
2233
|
}
|
|
2241
2234
|
},
|
|
2242
2235
|
"additionalProperties": false
|
|
@@ -27,9 +27,6 @@
|
|
|
27
27
|
"layout": {
|
|
28
28
|
"$ref": "#/$defs/LayoutDescriptor"
|
|
29
29
|
},
|
|
30
|
-
"resources": {
|
|
31
|
-
"$ref": "#/$defs/PageResources"
|
|
32
|
-
},
|
|
33
30
|
"notifications": {
|
|
34
31
|
"type": "array",
|
|
35
32
|
"items": {
|
|
@@ -68,9 +65,6 @@
|
|
|
68
65
|
"$ref": "#/$defs/Notification"
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
|
-
"resources": {
|
|
72
|
-
"$ref": "#/$defs/ResourcePatch"
|
|
73
|
-
},
|
|
74
68
|
"customType": {
|
|
75
69
|
"type": "string"
|
|
76
70
|
}
|
|
@@ -462,24 +456,6 @@
|
|
|
462
456
|
},
|
|
463
457
|
"additionalProperties": false
|
|
464
458
|
},
|
|
465
|
-
"PageResources": {
|
|
466
|
-
"type": "object",
|
|
467
|
-
"required": [
|
|
468
|
-
"featureFlags"
|
|
469
|
-
],
|
|
470
|
-
"properties": {
|
|
471
|
-
"featureFlags": {
|
|
472
|
-
"type": "object",
|
|
473
|
-
"additionalProperties": {
|
|
474
|
-
"type": "boolean"
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
"branding": {
|
|
478
|
-
"$ref": "#/$defs/Branding"
|
|
479
|
-
}
|
|
480
|
-
},
|
|
481
|
-
"additionalProperties": false
|
|
482
|
-
},
|
|
483
459
|
"Identity": {
|
|
484
460
|
"type": "object",
|
|
485
461
|
"required": [
|
|
@@ -508,24 +484,6 @@
|
|
|
508
484
|
},
|
|
509
485
|
"additionalProperties": false
|
|
510
486
|
},
|
|
511
|
-
"Branding": {
|
|
512
|
-
"type": "object",
|
|
513
|
-
"required": [
|
|
514
|
-
"appName"
|
|
515
|
-
],
|
|
516
|
-
"properties": {
|
|
517
|
-
"appName": {
|
|
518
|
-
"type": "string"
|
|
519
|
-
},
|
|
520
|
-
"logoUrl": {
|
|
521
|
-
"type": "string"
|
|
522
|
-
},
|
|
523
|
-
"logoCompactUrl": {
|
|
524
|
-
"type": "string"
|
|
525
|
-
}
|
|
526
|
-
},
|
|
527
|
-
"additionalProperties": false
|
|
528
|
-
},
|
|
529
487
|
"NavigationNode": {
|
|
530
488
|
"type": "object",
|
|
531
489
|
"required": [
|
|
@@ -620,7 +578,15 @@
|
|
|
620
578
|
"$ref": "#/$defs/FlashMessages"
|
|
621
579
|
},
|
|
622
580
|
"errors": {
|
|
623
|
-
"
|
|
581
|
+
"description": "Validation errors of the current request: a FormErrors map or, when the request carried the X-Inertia-Error-Bag header, a FormErrorBags map of bag name to FormErrors. The wire is not self-describing: the reader that sent the header reads errors[bag]; any other reader treats the map as flat.",
|
|
582
|
+
"anyOf": [
|
|
583
|
+
{
|
|
584
|
+
"$ref": "#/$defs/FormErrors"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"$ref": "#/$defs/FormErrorBags"
|
|
588
|
+
}
|
|
589
|
+
]
|
|
624
590
|
},
|
|
625
591
|
"csrf_token": {
|
|
626
592
|
"type": "string"
|
|
@@ -1048,18 +1014,60 @@
|
|
|
1048
1014
|
{
|
|
1049
1015
|
"type": "array",
|
|
1050
1016
|
"items": {
|
|
1051
|
-
"
|
|
1017
|
+
"oneOf": [
|
|
1018
|
+
{
|
|
1019
|
+
"type": "string"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
"$ref": "#/$defs/FieldMessage"
|
|
1023
|
+
}
|
|
1024
|
+
]
|
|
1052
1025
|
}
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"$ref": "#/$defs/FieldMessage"
|
|
1053
1029
|
}
|
|
1054
1030
|
]
|
|
1055
1031
|
},
|
|
1032
|
+
"FieldMessage": {
|
|
1033
|
+
"type": "object",
|
|
1034
|
+
"description": "A structured validation message: the server-resolved message plus the translation key, domain and optional params.",
|
|
1035
|
+
"required": [
|
|
1036
|
+
"message",
|
|
1037
|
+
"key",
|
|
1038
|
+
"domain"
|
|
1039
|
+
],
|
|
1040
|
+
"properties": {
|
|
1041
|
+
"message": {
|
|
1042
|
+
"type": "string"
|
|
1043
|
+
},
|
|
1044
|
+
"key": {
|
|
1045
|
+
"type": "string"
|
|
1046
|
+
},
|
|
1047
|
+
"domain": {
|
|
1048
|
+
"type": "string"
|
|
1049
|
+
},
|
|
1050
|
+
"params": {
|
|
1051
|
+
"type": "object",
|
|
1052
|
+
"additionalProperties": true
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
"additionalProperties": false
|
|
1056
|
+
},
|
|
1056
1057
|
"FormErrors": {
|
|
1057
1058
|
"type": "object",
|
|
1058
|
-
"description": "Validation errors keyed by field name. The reserved key \"_\" carries form-level errors; dotted keys target nested fields.",
|
|
1059
|
+
"description": "Validation errors keyed by field name. Each value is a message, a structured message (FieldMessage) or a list of either. The reserved key \"_\" carries form-level errors; dotted keys target nested fields.",
|
|
1059
1060
|
"additionalProperties": {
|
|
1060
1061
|
"$ref": "#/$defs/FieldError"
|
|
1061
1062
|
}
|
|
1062
1063
|
},
|
|
1064
|
+
"FormErrorBags": {
|
|
1065
|
+
"type": "object",
|
|
1066
|
+
"description": "Validation errors scoped to error bags: bag name to FormErrors.",
|
|
1067
|
+
"additionalProperties": {
|
|
1068
|
+
"$ref": "#/$defs/FormErrors"
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1063
1071
|
"FormSchemaNode": {
|
|
1064
1072
|
"oneOf": [
|
|
1065
1073
|
{
|
|
@@ -2222,21 +2230,6 @@
|
|
|
2222
2230
|
"items": {
|
|
2223
2231
|
"$ref": "#/$defs/Fragment"
|
|
2224
2232
|
}
|
|
2225
|
-
},
|
|
2226
|
-
"resources": {
|
|
2227
|
-
"$ref": "#/$defs/ResourcePatch"
|
|
2228
|
-
}
|
|
2229
|
-
},
|
|
2230
|
-
"additionalProperties": false
|
|
2231
|
-
},
|
|
2232
|
-
"ResourcePatch": {
|
|
2233
|
-
"type": "object",
|
|
2234
|
-
"properties": {
|
|
2235
|
-
"featureFlags": {
|
|
2236
|
-
"type": "object",
|
|
2237
|
-
"additionalProperties": {
|
|
2238
|
-
"type": "boolean"
|
|
2239
|
-
}
|
|
2240
2233
|
}
|
|
2241
2234
|
},
|
|
2242
2235
|
"additionalProperties": false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middag-io/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MIDDAG shared React UI library for Moodle, WordPress and other Inertia hosts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -185,7 +185,10 @@
|
|
|
185
185
|
"vitest": "^4.1.12"
|
|
186
186
|
},
|
|
187
187
|
"overrides": {
|
|
188
|
-
"happy-dom": "^21.0.4"
|
|
188
|
+
"happy-dom": "^21.0.4",
|
|
189
|
+
"quick-temp": {
|
|
190
|
+
"rimraf": "^6.1.4"
|
|
191
|
+
}
|
|
189
192
|
},
|
|
190
193
|
"homepage": "https://ui-docs.middag.io",
|
|
191
194
|
"bugs": {
|
|
@@ -329,10 +329,10 @@ export function FormPanelBlock({ block }: BlockProps<FormPanelBlockData>): React
|
|
|
329
329
|
}
|
|
330
330
|
},
|
|
331
331
|
onError: (errors) => {
|
|
332
|
-
// Inertia types
|
|
333
|
-
//
|
|
332
|
+
// Inertia types the errors as flat strings; the wire may carry rich
|
|
333
|
+
// messages, which 'resolveFieldError' handles.
|
|
334
334
|
const nonField: FormErrors = {};
|
|
335
|
-
for (const [field, err] of Object.entries(errors as
|
|
335
|
+
for (const [field, err] of Object.entries(errors as FormErrors)) {
|
|
336
336
|
if (fieldKeys.has(field)) {
|
|
337
337
|
form.setError(field, { type: "server", message: resolveFieldError(err, t) });
|
|
338
338
|
} else {
|
|
@@ -53,6 +53,11 @@ import { Toaster } from "@/primitives/reui/sonner";
|
|
|
53
53
|
|
|
54
54
|
const EMPTY_NAV: NavigationTree = { tree: [], footer: [], activeKey: "" };
|
|
55
55
|
|
|
56
|
+
/** An absolute http(s) URL leaves the app, so Inertia must not handle it. */
|
|
57
|
+
function isExternalHref(href: string): boolean {
|
|
58
|
+
return /^https?:\/\//i.test(href);
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
/** A single navigation leaf — a link (or label-only node) inside the menu. */
|
|
57
62
|
function NavLeaf({ node, activeKey }: { node: NavigationNode; activeKey: string }): ReactElement {
|
|
58
63
|
const { t } = useTranslation();
|
|
@@ -62,7 +67,16 @@ function NavLeaf({ node, activeKey }: { node: NavigationNode; activeKey: string
|
|
|
62
67
|
return (
|
|
63
68
|
<SidebarMenuItem>
|
|
64
69
|
<SidebarMenuButton asChild={!!node.href} isActive={isActive}>
|
|
65
|
-
{node.href ? (
|
|
70
|
+
{node.href && (node.target || isExternalHref(node.href)) ? (
|
|
71
|
+
<a
|
|
72
|
+
href={node.href}
|
|
73
|
+
target={node.target}
|
|
74
|
+
rel="noopener noreferrer"
|
|
75
|
+
aria-current={isActive ? "page" : undefined}
|
|
76
|
+
>
|
|
77
|
+
<span className="truncate">{label}</span>
|
|
78
|
+
</a>
|
|
79
|
+
) : node.href ? (
|
|
66
80
|
<Link href={node.href} prefetch="hover" aria-current={isActive ? "page" : undefined}>
|
|
67
81
|
<span className="truncate">{label}</span>
|
|
68
82
|
</Link>
|
|
@@ -7,12 +7,21 @@
|
|
|
7
7
|
* module re-exports them under the stable public names and derives the
|
|
8
8
|
* per-component variant aliases via `Extract`.
|
|
9
9
|
*
|
|
10
|
-
* Only the FormPanelBlockData envelope
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Only the FormPanelBlockData envelope stays hand-authored. The validation
|
|
11
|
+
* error shapes ('FieldMessage', 'FieldError', 'FormErrors', 'FormErrorBags')
|
|
12
|
+
* are generated too: a field error is a plain string, a rich message
|
|
13
|
+
* ({message, key, domain, params}) or a list mixing both.
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
|
-
import type {
|
|
16
|
+
import type {
|
|
17
|
+
FieldMessage,
|
|
18
|
+
FormComponent,
|
|
19
|
+
FormErrorBags,
|
|
20
|
+
FormFieldNode,
|
|
21
|
+
FormSchemaNode,
|
|
22
|
+
FieldError as WireFieldError,
|
|
23
|
+
FormErrors as WireFormErrors,
|
|
24
|
+
} from "@/contracts/generated";
|
|
16
25
|
|
|
17
26
|
// ── Generated contract types (re-exported under the stable public names) ──────
|
|
18
27
|
|
|
@@ -110,24 +119,19 @@ export type HeaderFormField = Extract<FormFieldNode, { component: "header" }>;
|
|
|
110
119
|
// ── Form panel block data ─────────────────────────────────────────────────────
|
|
111
120
|
|
|
112
121
|
/**
|
|
113
|
-
* A
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* Hand-authored on purpose: the wire `FieldError` ($def in middag-php-ui) is the
|
|
118
|
-
* leaner `string | string[]`; unifying the two is a deferred breaking change.
|
|
122
|
+
* A rich server validation message: `message` is the server-resolved
|
|
123
|
+
* (default-locale) string; key/domain/params are the machine channel for
|
|
124
|
+
* client-side re-translation ('resolveFieldError').
|
|
119
125
|
*/
|
|
120
|
-
export
|
|
121
|
-
message: string;
|
|
122
|
-
key: string;
|
|
123
|
-
domain: string;
|
|
124
|
-
params?: Record<string, unknown>;
|
|
125
|
-
}
|
|
126
|
+
export type FieldError = FieldMessage;
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
/** What the server sends for one field: a string, a rich message or a list of both. */
|
|
129
|
+
export type FormErrorValue = WireFieldError;
|
|
128
130
|
|
|
129
131
|
/** Server validation errors keyed by field key. */
|
|
130
|
-
export type FormErrors =
|
|
132
|
+
export type FormErrors = WireFormErrors;
|
|
133
|
+
|
|
134
|
+
export type { FieldMessage, FormErrorBags };
|
|
131
135
|
|
|
132
136
|
/** HTTP method the form submits with. */
|
|
133
137
|
export type FormMethod = "post" | "put" | "patch";
|