@middag-io/react 0.45.4 → 0.46.1
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/{FormField-Csx8hGAW.js → FormField-M7Khc1eo.js} +2405 -2373
- package/dist-lib/{FormPanelBlock-Bmd0DpiX.js → FormPanelBlock-70gQ9d9K.js} +11 -11
- package/dist-lib/contracts/generated/index.d.ts +7 -7
- package/dist-lib/contracts/generated/index.d.ts.map +1 -1
- package/dist-lib/contracts/generated/schemas.d.ts +3865 -0
- package/dist-lib/contracts/generated/schemas.d.ts.map +1 -0
- package/dist-lib/contracts/generated/{contract-types.d.ts → types.d.ts} +6 -6
- package/dist-lib/contracts/generated/types.d.ts.map +1 -0
- package/dist-lib/contracts/page-contract-schema.d.ts +211 -21
- package/dist-lib/contracts/page-contract-schema.d.ts.map +1 -1
- package/dist-lib/middag-react.js +9666 -10379
- package/dist-lib/primitives/reui/button.d.ts +1 -1
- package/package.json +1 -1
- package/src/contracts/generated/index.ts +7 -7
- package/src/contracts/generated/schemas.ts +555 -0
- package/src/contracts/generated/{contract-types.ts → types.ts} +5 -5
- package/dist-lib/contracts/generated/contract-schema.d.ts +0 -183
- package/dist-lib/contracts/generated/contract-schema.d.ts.map +0 -1
- package/dist-lib/contracts/generated/contract-types.d.ts.map +0 -1
- package/src/contracts/generated/contract-schema.ts +0 -1237
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "
|
|
4
|
+
variant?: "default" | "link" | "secondary" | "ghost" | "destructive" | "outline" | null | undefined;
|
|
5
5
|
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated by
|
|
2
|
+
* @generated by @middag-io/ui-contracts-codegen — DO NOT EDIT BY HAND.
|
|
3
3
|
*
|
|
4
|
-
* Barrel
|
|
4
|
+
* Barrel of the generated contract layer.
|
|
5
5
|
*
|
|
6
|
-
* Source of truth: middag-
|
|
6
|
+
* Source of truth: middag-io/ui value objects -> JSON Schema (draft 2020-12).
|
|
7
7
|
* Regenerate: npm run gen:contracts
|
|
8
8
|
* Drift gate: npm run gen:contracts:check
|
|
9
9
|
*
|
|
10
|
-
* @source middag-php-ui
|
|
10
|
+
* @source middag-io/middag-php-ui@v1.10.1 schema/{page-contract.json,fragment.json}
|
|
11
11
|
* @contract-version 1
|
|
12
|
-
* @hash
|
|
12
|
+
* @hash 8079f706d81e80a7
|
|
13
13
|
*/
|
|
14
|
-
export * from "./
|
|
15
|
-
export { pageContractSchemaCore, fragmentSchemaCore } from "./
|
|
14
|
+
export * from "./types.js";
|
|
15
|
+
export { pageContractSchemaCore, fragmentSchemaCore } from "./schemas.js";
|
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated by @middag-io/ui-contracts-codegen — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Zod schemas of the wire contract, one per $def. Lenient on unknown keys.
|
|
5
|
+
*
|
|
6
|
+
* Source of truth: middag-io/ui value objects -> JSON Schema (draft 2020-12).
|
|
7
|
+
* Regenerate: npm run gen:contracts
|
|
8
|
+
* Drift gate: npm run gen:contracts:check
|
|
9
|
+
*
|
|
10
|
+
* @source middag-io/middag-php-ui@v1.10.1 schema/{page-contract.json,fragment.json}
|
|
11
|
+
* @contract-version 1
|
|
12
|
+
* @hash 8079f706d81e80a7
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import type { NavigationNode, FormSectionNode, FormGroupNode, FormSchemaNode } from "./types.js";
|
|
16
|
+
|
|
17
|
+
export const TranslatableSchema = z.object({
|
|
18
|
+
"key": z.string(),
|
|
19
|
+
"domain": z.string(),
|
|
20
|
+
"params": z.record(z.string(), z.unknown()).optional(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const LabelSchema = z.union([z.string(), TranslatableSchema]);
|
|
24
|
+
|
|
25
|
+
export const BreadcrumbSchema = z.object({
|
|
26
|
+
"label": LabelSchema,
|
|
27
|
+
"href": z.string().optional(),
|
|
28
|
+
"external": z.literal(true).optional(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const HttpMethodSchema = z.enum(["get", "post", "put", "patch", "delete"]);
|
|
32
|
+
|
|
33
|
+
export const ActionTargetSchema = z.union([z.object({
|
|
34
|
+
"kind": z.literal("link"),
|
|
35
|
+
"href": z.string(),
|
|
36
|
+
"external": z.literal(true).optional(),
|
|
37
|
+
}), z.object({
|
|
38
|
+
"kind": z.literal("route"),
|
|
39
|
+
"route": z.string(),
|
|
40
|
+
"params": z.record(z.string(), z.unknown()).optional(),
|
|
41
|
+
}), z.object({
|
|
42
|
+
"kind": z.literal("request"),
|
|
43
|
+
"endpoint": z.string(),
|
|
44
|
+
"method": HttpMethodSchema,
|
|
45
|
+
}), z.object({
|
|
46
|
+
"kind": z.literal("panel"),
|
|
47
|
+
})]);
|
|
48
|
+
|
|
49
|
+
export const ActionIntentSchema = z.enum(["primary", "secondary", "danger", "success", "warning", "info", "link", "ghost"]);
|
|
50
|
+
|
|
51
|
+
export const ConfirmationSchema = z.object({
|
|
52
|
+
"title": LabelSchema,
|
|
53
|
+
"message": LabelSchema,
|
|
54
|
+
"variant": z.string(),
|
|
55
|
+
"confirmLabel": LabelSchema.optional(),
|
|
56
|
+
"cancelLabel": LabelSchema.optional(),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const ActionSchema = z.object({
|
|
60
|
+
"id": z.string(),
|
|
61
|
+
"label": LabelSchema,
|
|
62
|
+
"target": ActionTargetSchema,
|
|
63
|
+
"intent": ActionIntentSchema,
|
|
64
|
+
"icon": z.string().optional(),
|
|
65
|
+
"confirmation": ConfirmationSchema.optional(),
|
|
66
|
+
"capability": z.string().optional(),
|
|
67
|
+
"disabled": z.literal(true).optional(),
|
|
68
|
+
"loading": z.literal(true).optional(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export const PageMetaSchema = z.object({
|
|
72
|
+
"key": z.string(),
|
|
73
|
+
"title": LabelSchema,
|
|
74
|
+
"subtitle": LabelSchema.optional(),
|
|
75
|
+
"breadcrumbs": z.array(BreadcrumbSchema).optional(),
|
|
76
|
+
"actions": z.array(ActionSchema).optional(),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const PollConfigSchema = z.object({
|
|
80
|
+
"endpoint": z.string(),
|
|
81
|
+
"intervalMs": z.number().int(),
|
|
82
|
+
"pauseWhenHidden": z.boolean(),
|
|
83
|
+
"stopAfterMs": z.number().int().optional(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const BlockDescriptorSchema = z.object({
|
|
87
|
+
"type": z.string(),
|
|
88
|
+
"key": z.string(),
|
|
89
|
+
"data": z.union([z.record(z.string(), z.unknown()), z.array(z.unknown()).max(0)]),
|
|
90
|
+
"variant": z.string().optional(),
|
|
91
|
+
"title": LabelSchema.optional(),
|
|
92
|
+
"subtitle": LabelSchema.optional(),
|
|
93
|
+
"actions": z.array(ActionSchema).optional(),
|
|
94
|
+
"meta": z.record(z.string(), z.unknown()).optional(),
|
|
95
|
+
"poll": PollConfigSchema.optional(),
|
|
96
|
+
"deferred": z.boolean().optional(),
|
|
97
|
+
"remember": z.boolean().optional(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const LayoutDescriptorSchema = z.object({
|
|
101
|
+
"template": z.string(),
|
|
102
|
+
"regions": z.union([z.record(z.string(), z.array(BlockDescriptorSchema)), z.array(z.unknown()).max(0)]),
|
|
103
|
+
"meta": z.record(z.string(), z.unknown()).optional(),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export const ThemeModeSchema = z.enum(["light", "dark", "system"]);
|
|
107
|
+
|
|
108
|
+
export const UserPreferencesSchema = z.object({
|
|
109
|
+
"theme": ThemeModeSchema,
|
|
110
|
+
"locale": z.string(),
|
|
111
|
+
"timezone": z.string().optional(),
|
|
112
|
+
"dateFormat": z.string().optional(),
|
|
113
|
+
"numberFormat": z.string().optional(),
|
|
114
|
+
}).catchall(z.unknown());
|
|
115
|
+
|
|
116
|
+
export const IdentitySchema = z.object({
|
|
117
|
+
"id": z.string(),
|
|
118
|
+
"name": z.string(),
|
|
119
|
+
"email": z.string().optional(),
|
|
120
|
+
"avatarUrl": z.string().optional(),
|
|
121
|
+
"roles": z.array(z.string()).optional(),
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export const BrandingSchema = z.object({
|
|
125
|
+
"appName": z.string(),
|
|
126
|
+
"logoUrl": z.string().optional(),
|
|
127
|
+
"logoCompactUrl": z.string().optional(),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const PageResourcesSchema = z.object({
|
|
131
|
+
"preferences": UserPreferencesSchema,
|
|
132
|
+
"capabilities": z.union([z.record(z.string(), z.boolean()), z.array(z.unknown()).max(0)]),
|
|
133
|
+
"featureFlags": z.union([z.record(z.string(), z.boolean()), z.array(z.unknown()).max(0)]),
|
|
134
|
+
"user": IdentitySchema.optional(),
|
|
135
|
+
"branding": BrandingSchema.optional(),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export const NotificationLevelSchema = z.enum(["success", "info", "warning", "error"]);
|
|
139
|
+
|
|
140
|
+
export const NotificationSchema = z.object({
|
|
141
|
+
"level": NotificationLevelSchema,
|
|
142
|
+
"message": LabelSchema,
|
|
143
|
+
"dismissible": z.boolean(),
|
|
144
|
+
"title": LabelSchema.optional(),
|
|
145
|
+
"timeout": z.number().int().optional(),
|
|
146
|
+
"action": ActionSchema.optional(),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export const PageContractSchema = z.object({
|
|
150
|
+
"version": z.literal("1"),
|
|
151
|
+
"shell": z.string(),
|
|
152
|
+
"page": PageMetaSchema,
|
|
153
|
+
"layout": LayoutDescriptorSchema,
|
|
154
|
+
"resources": PageResourcesSchema.optional(),
|
|
155
|
+
"notifications": z.array(NotificationSchema).optional(),
|
|
156
|
+
"entities": z.record(z.string(), z.string()).optional(),
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
export const FragmentKindSchema = z.enum(["block", "region", "table", "form", "detail", "inspector", "notifications", "custom"]);
|
|
160
|
+
|
|
161
|
+
export const ResourcePatchSchema = z.union([z.object({
|
|
162
|
+
"preferences": UserPreferencesSchema.optional(),
|
|
163
|
+
"capabilities": z.record(z.string(), z.boolean()).optional(),
|
|
164
|
+
"featureFlags": z.record(z.string(), z.boolean()).optional(),
|
|
165
|
+
}), z.array(z.unknown()).max(0)]);
|
|
166
|
+
|
|
167
|
+
export const FragmentSchema = z.object({
|
|
168
|
+
"version": z.literal("1"),
|
|
169
|
+
"kind": FragmentKindSchema,
|
|
170
|
+
"payload": z.record(z.string(), z.unknown()).optional(),
|
|
171
|
+
"notifications": z.array(NotificationSchema).optional(),
|
|
172
|
+
"resources": ResourcePatchSchema.optional(),
|
|
173
|
+
"customType": z.string().optional(),
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
export const InspectorDescriptorSchema = z.object({
|
|
177
|
+
"endpoint": z.string(),
|
|
178
|
+
"width": z.number().int(),
|
|
179
|
+
"poll": PollConfigSchema.optional(),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
export const EditablePanelDescriptorSchema = z.object({
|
|
183
|
+
"endpoint": z.string(),
|
|
184
|
+
"submitEndpoint": z.string().optional(),
|
|
185
|
+
"submitMethod": z.enum(["post", "put", "patch"]),
|
|
186
|
+
"width": z.number().int(),
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
export const NavigationNodeSchema: z.ZodType<NavigationNode> = z.object({
|
|
190
|
+
"key": z.string(),
|
|
191
|
+
"label": LabelSchema,
|
|
192
|
+
"icon": z.string().optional(),
|
|
193
|
+
"href": z.string().optional(),
|
|
194
|
+
"badge": z.string().optional(),
|
|
195
|
+
"active": z.literal(true).optional(),
|
|
196
|
+
"drilldown": z.literal(true).optional(),
|
|
197
|
+
"collapsible": z.literal(true).optional(),
|
|
198
|
+
"defaultOpen": z.literal(true).optional(),
|
|
199
|
+
"children": z.array(z.lazy(() => NavigationNodeSchema)).optional(),
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
export const ValueFormatSchema = z.enum(["text", "date", "datetime", "time", "number", "currency", "boolean", "badge"]);
|
|
203
|
+
|
|
204
|
+
export const ColumnVariantSchema = z.enum(["text", "status", "badge", "boolean", "timestamp", "link", "rich_status", "html", "link_group", "annotated", "progress"]);
|
|
205
|
+
|
|
206
|
+
export const ColumnSchema = z.object({
|
|
207
|
+
"key": z.string(),
|
|
208
|
+
"label": LabelSchema,
|
|
209
|
+
"sortable": z.boolean(),
|
|
210
|
+
"searchable": z.boolean(),
|
|
211
|
+
"format": ValueFormatSchema,
|
|
212
|
+
"formatOptions": z.record(z.string(), z.unknown()).optional(),
|
|
213
|
+
"options": z.record(z.string(), z.unknown()).optional(),
|
|
214
|
+
"variant": ColumnVariantSchema.optional(),
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
export const FilterTypeSchema = z.enum(["select", "text", "date", "date_range", "boolean", "number_range"]);
|
|
218
|
+
|
|
219
|
+
export const FilterDefinitionSchema = z.object({
|
|
220
|
+
"key": z.string(),
|
|
221
|
+
"label": LabelSchema,
|
|
222
|
+
"type": FilterTypeSchema,
|
|
223
|
+
"options": z.array(z.object({
|
|
224
|
+
"value": z.unknown(),
|
|
225
|
+
"label": LabelSchema,
|
|
226
|
+
})).optional(),
|
|
227
|
+
"placeholder": LabelSchema.optional(),
|
|
228
|
+
"default": z.unknown().optional(),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
export const TableDisplayOptionsSchema = z.object({
|
|
232
|
+
"perPage": z.number().int(),
|
|
233
|
+
"sortDirection": z.string(),
|
|
234
|
+
"selectable": z.boolean(),
|
|
235
|
+
"searchable": z.boolean(),
|
|
236
|
+
"sortColumn": z.string().optional(),
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
export const TableConfigSchema = z.object({
|
|
240
|
+
"columns": z.array(ColumnSchema),
|
|
241
|
+
"filters": z.array(FilterDefinitionSchema).optional(),
|
|
242
|
+
"rowActions": z.array(ActionSchema).optional(),
|
|
243
|
+
"bulkActions": z.array(ActionSchema).optional(),
|
|
244
|
+
"options": TableDisplayOptionsSchema,
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
export const PaginationSchema = z.object({
|
|
248
|
+
"page": z.number().int(),
|
|
249
|
+
"perPage": z.number().int(),
|
|
250
|
+
"total": z.number().int(),
|
|
251
|
+
"lastPage": z.number().int(),
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
export const ChartSeriesSchema = z.object({
|
|
255
|
+
"key": z.string(),
|
|
256
|
+
"label": z.string(),
|
|
257
|
+
"color": z.string().optional(),
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
export const TabSchema = z.object({
|
|
261
|
+
"id": z.string(),
|
|
262
|
+
"label": LabelSchema,
|
|
263
|
+
"blocks": z.array(BlockDescriptorSchema),
|
|
264
|
+
"disabled": z.boolean().optional(),
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
export const FormStepSchema = z.object({
|
|
268
|
+
"id": z.string(),
|
|
269
|
+
"label": LabelSchema,
|
|
270
|
+
"fields": z.array(z.string()),
|
|
271
|
+
"help": LabelSchema.optional(),
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
export const FieldConstraintsSchema = z.union([z.object({
|
|
275
|
+
"required": z.literal(true).optional(),
|
|
276
|
+
"min": z.number().int().optional(),
|
|
277
|
+
"max": z.number().int().optional(),
|
|
278
|
+
"minLength": z.number().int().optional(),
|
|
279
|
+
"maxLength": z.number().int().optional(),
|
|
280
|
+
"pattern": z.string().optional(),
|
|
281
|
+
"step": z.string().optional(),
|
|
282
|
+
}), z.array(z.unknown()).max(0)]);
|
|
283
|
+
|
|
284
|
+
export const FileValueSchema = z.union([z.string(), z.object({
|
|
285
|
+
"url": z.string(),
|
|
286
|
+
"name": z.string().optional(),
|
|
287
|
+
"size": z.number().int().optional(),
|
|
288
|
+
"type": z.string().optional(),
|
|
289
|
+
"id": z.string().optional(),
|
|
290
|
+
"uploadToken": z.string().optional(),
|
|
291
|
+
})]);
|
|
292
|
+
|
|
293
|
+
export const FieldErrorSchema = z.union([z.string(), z.array(z.string())]);
|
|
294
|
+
|
|
295
|
+
export const FormErrorsSchema = z.record(z.string(), FieldErrorSchema);
|
|
296
|
+
|
|
297
|
+
export const FormFieldValidationSchema = z.object({
|
|
298
|
+
"minLength": z.number().int().optional(),
|
|
299
|
+
"maxLength": z.number().int().optional(),
|
|
300
|
+
"pattern": z.string().optional(),
|
|
301
|
+
"patternMessage": z.string().optional(),
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
export const FormConditionSchema = z.object({
|
|
305
|
+
"field": z.string(),
|
|
306
|
+
"operator": z.enum(["equals", "not_equals", "in", "not_in"]),
|
|
307
|
+
"value": z.union([z.string(), z.array(z.string())]),
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
export const FieldPropsBaseSchema = z.object({
|
|
311
|
+
"label": z.string(),
|
|
312
|
+
"placeholder": z.string().optional(),
|
|
313
|
+
"helpText": z.string().optional(),
|
|
314
|
+
"required": z.boolean().optional(),
|
|
315
|
+
"disabled": z.boolean().optional(),
|
|
316
|
+
"readOnly": z.boolean().optional(),
|
|
317
|
+
"validation": FormFieldValidationSchema.optional(),
|
|
318
|
+
"visible_when": FormConditionSchema.optional(),
|
|
319
|
+
"hidden_when": FormConditionSchema.optional(),
|
|
320
|
+
"disabled_when": FormConditionSchema.optional(),
|
|
321
|
+
"required_when": FormConditionSchema.optional(),
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
export const OptionFieldPropsSchema = z.intersection(FieldPropsBaseSchema, z.object({
|
|
325
|
+
"options": z.array(z.object({
|
|
326
|
+
"value": z.string(),
|
|
327
|
+
"label": z.string(),
|
|
328
|
+
})).optional(),
|
|
329
|
+
}));
|
|
330
|
+
|
|
331
|
+
export const FormFieldDocumentMaskSchema = z.object({
|
|
332
|
+
"pattern": z.string(),
|
|
333
|
+
"maxLength": z.number().int(),
|
|
334
|
+
"placeholder": z.string().optional(),
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
export const FormFieldNodeSchema = z.union([z.object({
|
|
338
|
+
"kind": z.literal("field"),
|
|
339
|
+
"key": z.string(),
|
|
340
|
+
"component": z.enum(["text", "email", "url", "password", "color"]),
|
|
341
|
+
"props": FieldPropsBaseSchema,
|
|
342
|
+
}), z.object({
|
|
343
|
+
"kind": z.literal("field"),
|
|
344
|
+
"key": z.string(),
|
|
345
|
+
"component": z.literal("textarea"),
|
|
346
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
347
|
+
"rows": z.number().int().optional(),
|
|
348
|
+
})),
|
|
349
|
+
}), z.object({
|
|
350
|
+
"kind": z.literal("field"),
|
|
351
|
+
"key": z.string(),
|
|
352
|
+
"component": z.literal("otp"),
|
|
353
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
354
|
+
"maxLength": z.number().int().optional(),
|
|
355
|
+
"pattern": z.enum(["digits", "alphanumeric"]).optional(),
|
|
356
|
+
"groupSize": z.number().int().optional(),
|
|
357
|
+
})),
|
|
358
|
+
}), z.object({
|
|
359
|
+
"kind": z.literal("field"),
|
|
360
|
+
"key": z.string(),
|
|
361
|
+
"component": z.enum(["int", "float"]),
|
|
362
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
363
|
+
"min": z.number().optional(),
|
|
364
|
+
"max": z.number().optional(),
|
|
365
|
+
"step": z.number().optional(),
|
|
366
|
+
})),
|
|
367
|
+
}), z.object({
|
|
368
|
+
"kind": z.literal("field"),
|
|
369
|
+
"key": z.string(),
|
|
370
|
+
"component": z.literal("slider"),
|
|
371
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
372
|
+
"min": z.number().optional(),
|
|
373
|
+
"max": z.number().optional(),
|
|
374
|
+
"step": z.number().optional(),
|
|
375
|
+
"multiple": z.boolean().optional(),
|
|
376
|
+
})),
|
|
377
|
+
}), z.object({
|
|
378
|
+
"kind": z.literal("field"),
|
|
379
|
+
"key": z.string(),
|
|
380
|
+
"component": z.enum(["select", "radio"]),
|
|
381
|
+
"props": OptionFieldPropsSchema,
|
|
382
|
+
}), z.object({
|
|
383
|
+
"kind": z.literal("field"),
|
|
384
|
+
"key": z.string(),
|
|
385
|
+
"component": z.literal("multiselect"),
|
|
386
|
+
"props": OptionFieldPropsSchema,
|
|
387
|
+
}), z.object({
|
|
388
|
+
"kind": z.literal("field"),
|
|
389
|
+
"key": z.string(),
|
|
390
|
+
"component": z.literal("native_select"),
|
|
391
|
+
"props": OptionFieldPropsSchema,
|
|
392
|
+
}), z.object({
|
|
393
|
+
"kind": z.literal("field"),
|
|
394
|
+
"key": z.string(),
|
|
395
|
+
"component": z.enum(["checkbox", "switch"]),
|
|
396
|
+
"props": FieldPropsBaseSchema,
|
|
397
|
+
}), z.object({
|
|
398
|
+
"kind": z.literal("field"),
|
|
399
|
+
"key": z.string(),
|
|
400
|
+
"component": z.enum(["date", "datetime"]),
|
|
401
|
+
"props": FieldPropsBaseSchema,
|
|
402
|
+
}), z.object({
|
|
403
|
+
"kind": z.literal("field"),
|
|
404
|
+
"key": z.string(),
|
|
405
|
+
"component": z.literal("duration"),
|
|
406
|
+
"props": FieldPropsBaseSchema,
|
|
407
|
+
}), z.object({
|
|
408
|
+
"kind": z.literal("field"),
|
|
409
|
+
"key": z.string(),
|
|
410
|
+
"component": z.literal("file"),
|
|
411
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
412
|
+
"accept": z.string().optional(),
|
|
413
|
+
"multiple": z.boolean().optional(),
|
|
414
|
+
"maxFiles": z.number().int().optional(),
|
|
415
|
+
"maxSize": z.number().int().optional(),
|
|
416
|
+
})),
|
|
417
|
+
}), z.object({
|
|
418
|
+
"kind": z.literal("field"),
|
|
419
|
+
"key": z.string(),
|
|
420
|
+
"component": z.literal("entity_picker"),
|
|
421
|
+
"props": z.intersection(OptionFieldPropsSchema, z.object({
|
|
422
|
+
"autocompleteHref": z.string().optional(),
|
|
423
|
+
"autocompleteMinChars": z.number().int().optional(),
|
|
424
|
+
"entityDisplayField": z.string().optional(),
|
|
425
|
+
"entitySubtitleField": z.string().optional(),
|
|
426
|
+
"entityAvatarField": z.string().optional(),
|
|
427
|
+
})),
|
|
428
|
+
}), z.object({
|
|
429
|
+
"kind": z.literal("field"),
|
|
430
|
+
"key": z.string(),
|
|
431
|
+
"component": z.literal("phone"),
|
|
432
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
433
|
+
"defaultCountry": z.string().optional(),
|
|
434
|
+
"fixedCountry": z.boolean().optional(),
|
|
435
|
+
})),
|
|
436
|
+
}), z.object({
|
|
437
|
+
"kind": z.literal("field"),
|
|
438
|
+
"key": z.string(),
|
|
439
|
+
"component": z.literal("document"),
|
|
440
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
441
|
+
"documentType": z.string().optional(),
|
|
442
|
+
"documentScope": z.enum(["person", "company", "any"]).optional(),
|
|
443
|
+
"documentMasks": z.record(z.string(), FormFieldDocumentMaskSchema).optional(),
|
|
444
|
+
})),
|
|
445
|
+
}), z.object({
|
|
446
|
+
"kind": z.literal("field"),
|
|
447
|
+
"key": z.string(),
|
|
448
|
+
"component": z.literal("currency"),
|
|
449
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
450
|
+
"currency": z.string().optional(),
|
|
451
|
+
"currencyLocale": z.string().optional(),
|
|
452
|
+
})),
|
|
453
|
+
}), z.object({
|
|
454
|
+
"kind": z.literal("field"),
|
|
455
|
+
"key": z.string(),
|
|
456
|
+
"component": z.literal("slug"),
|
|
457
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
458
|
+
"sourceField": z.string().optional(),
|
|
459
|
+
"prefix": z.string().optional(),
|
|
460
|
+
})),
|
|
461
|
+
}), z.object({
|
|
462
|
+
"kind": z.literal("field"),
|
|
463
|
+
"key": z.string(),
|
|
464
|
+
"component": z.literal("tags"),
|
|
465
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
466
|
+
"maxTags": z.number().int().optional(),
|
|
467
|
+
})),
|
|
468
|
+
}), z.object({
|
|
469
|
+
"kind": z.literal("field"),
|
|
470
|
+
"key": z.string(),
|
|
471
|
+
"component": z.literal("rating"),
|
|
472
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
473
|
+
"maxRating": z.number().int().optional(),
|
|
474
|
+
})),
|
|
475
|
+
}), z.object({
|
|
476
|
+
"kind": z.literal("field"),
|
|
477
|
+
"key": z.string(),
|
|
478
|
+
"component": z.literal("date_range"),
|
|
479
|
+
"props": z.intersection(FieldPropsBaseSchema, z.object({
|
|
480
|
+
"operator": z.string().optional(),
|
|
481
|
+
})),
|
|
482
|
+
}), z.object({
|
|
483
|
+
"kind": z.literal("field"),
|
|
484
|
+
"key": z.string(),
|
|
485
|
+
"component": z.literal("hidden"),
|
|
486
|
+
"props": FieldPropsBaseSchema,
|
|
487
|
+
}), z.object({
|
|
488
|
+
"kind": z.literal("field"),
|
|
489
|
+
"key": z.string(),
|
|
490
|
+
"component": z.literal("static"),
|
|
491
|
+
"props": FieldPropsBaseSchema,
|
|
492
|
+
}), z.object({
|
|
493
|
+
"kind": z.literal("field"),
|
|
494
|
+
"key": z.string(),
|
|
495
|
+
"component": z.literal("header"),
|
|
496
|
+
"props": z.object({
|
|
497
|
+
"label": z.string(),
|
|
498
|
+
}),
|
|
499
|
+
})]);
|
|
500
|
+
|
|
501
|
+
export const FormSectionNodeSchema: z.ZodType<FormSectionNode> = z.object({
|
|
502
|
+
"kind": z.literal("section"),
|
|
503
|
+
"id": z.string(),
|
|
504
|
+
"label": z.string(),
|
|
505
|
+
"defaultCollapsed": z.boolean().optional(),
|
|
506
|
+
"children": z.array(z.lazy(() => FormSchemaNodeSchema)),
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
export const FormGroupNodeSchema: z.ZodType<FormGroupNode> = z.object({
|
|
510
|
+
"kind": z.literal("group"),
|
|
511
|
+
"id": z.string(),
|
|
512
|
+
"columns": z.union([z.literal(1), z.literal(2)]).optional(),
|
|
513
|
+
"children": z.array(z.lazy(() => FormSchemaNodeSchema)),
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
export const FormHeaderNodeSchema = z.object({
|
|
517
|
+
"kind": z.literal("header"),
|
|
518
|
+
"label": z.string(),
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
export const FormSchemaNodeSchema: z.ZodType<FormSchemaNode> = z.union([FormFieldNodeSchema, FormSectionNodeSchema, FormGroupNodeSchema, FormHeaderNodeSchema]);
|
|
522
|
+
|
|
523
|
+
export const RegionUpdateModeSchema = z.enum(["replace", "append", "prepend", "remove", "update"]);
|
|
524
|
+
|
|
525
|
+
export const RegionUpdateSchema = z.object({
|
|
526
|
+
"region": z.string(),
|
|
527
|
+
"mode": RegionUpdateModeSchema,
|
|
528
|
+
"blocks": z.array(BlockDescriptorSchema).optional(),
|
|
529
|
+
"keys": z.array(z.string()).optional(),
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
export const ActionResultSchema = z.object({
|
|
533
|
+
"success": z.boolean(),
|
|
534
|
+
"notifications": z.array(NotificationSchema).optional(),
|
|
535
|
+
"redirect": z.string().optional(),
|
|
536
|
+
"refreshBlocks": z.array(z.string()).optional(),
|
|
537
|
+
"errors": FormErrorsSchema.optional(),
|
|
538
|
+
"fragments": z.array(FragmentSchema).optional(),
|
|
539
|
+
"resources": ResourcePatchSchema.optional(),
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
export const ActionTargetKindSchema = z.enum(["link", "route", "request", "panel"]);
|
|
543
|
+
|
|
544
|
+
export const ChartTypeSchema = z.enum(["line", "bar", "area"]);
|
|
545
|
+
|
|
546
|
+
export const ConditionOperatorSchema = z.enum(["eq", "neq", "in", "not_in", "gt", "gte", "lt", "lte", "truthy", "falsy", "exists", "empty", "matches"]);
|
|
547
|
+
|
|
548
|
+
export const FieldTypeSchema = z.enum(["text", "textarea", "richtext", "password", "otp", "email", "url", "int", "float", "slider", "select", "multiselect", "native_select", "radio", "checkbox", "switch", "date", "datetime", "time", "duration", "file", "entity_picker", "autocomplete", "tags", "hidden", "static", "header"]);
|
|
549
|
+
|
|
550
|
+
export const FormComponentSchema = z.enum(["text", "textarea", "password", "otp", "email", "url", "int", "float", "slider", "select", "native_select", "multiselect", "radio", "checkbox", "switch", "date", "datetime", "duration", "file", "entity_picker", "phone", "document", "currency", "color", "slug", "tags", "rating", "date_range", "hidden", "static", "header"]);
|
|
551
|
+
|
|
552
|
+
export const RenderTargetSchema = z.enum(["html", "props"]);
|
|
553
|
+
|
|
554
|
+
export const pageContractSchemaCore = PageContractSchema;
|
|
555
|
+
export const fragmentSchemaCore = FragmentSchema;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @generated by
|
|
2
|
+
* @generated by @middag-io/ui-contracts-codegen — DO NOT EDIT BY HAND.
|
|
3
3
|
*
|
|
4
|
-
* TypeScript types
|
|
4
|
+
* TypeScript types of the wire contract.
|
|
5
5
|
*
|
|
6
|
-
* Source of truth: middag-
|
|
6
|
+
* Source of truth: middag-io/ui value objects -> JSON Schema (draft 2020-12).
|
|
7
7
|
* Regenerate: npm run gen:contracts
|
|
8
8
|
* Drift gate: npm run gen:contracts:check
|
|
9
9
|
*
|
|
10
|
-
* @source middag-php-ui
|
|
10
|
+
* @source middag-io/middag-php-ui@v1.10.1 schema/{page-contract.json,fragment.json}
|
|
11
11
|
* @contract-version 1
|
|
12
|
-
* @hash
|
|
12
|
+
* @hash 8079f706d81e80a7
|
|
13
13
|
*/
|
|
14
14
|
export type Label = string | Translatable;
|
|
15
15
|
export type ActionTarget =
|