@middag-io/react 0.46.1 → 0.47.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.
Files changed (43) hide show
  1. package/dist-lib/{FormField-M7Khc1eo.js → FormField-BGqAQLtX.js} +2155 -2130
  2. package/dist-lib/{FormPanelBlock-70gQ9d9K.js → FormPanelBlock-CGgA83Mu.js} +46 -45
  3. package/dist-lib/base/blocks/CardGridBlock.d.ts.map +1 -1
  4. package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
  5. package/dist-lib/base/blocks/DetailPanelBlock.d.ts.map +1 -1
  6. package/dist-lib/base/blocks/FormPanelBlock.d.ts.map +1 -1
  7. package/dist-lib/base/partials/ActionBar/index.d.ts.map +1 -1
  8. package/dist-lib/base/partials/FilterBar/index.d.ts.map +1 -1
  9. package/dist-lib/base/shell/BasicShell.js +1 -1
  10. package/dist-lib/base/shell/partials/InlineEditablePanel.d.ts.map +1 -1
  11. package/dist-lib/base/shell/partials/InlineEditablePanel.js +131 -127
  12. package/dist-lib/base/shell/partials/PageActionButton.d.ts.map +1 -1
  13. package/dist-lib/base/shell/partials/PageActionButton.js +1 -1
  14. package/dist-lib/base/theme/appearance.d.ts.map +1 -1
  15. package/dist-lib/base/theme/appearance.js +1 -1
  16. package/dist-lib/base/utils/action-intent.d.ts +3 -0
  17. package/dist-lib/base/utils/action-intent.d.ts.map +1 -0
  18. package/dist-lib/base/utils/action-intent.js +16 -0
  19. package/dist-lib/chunks/subpath-Bs35txZS.js +166 -0
  20. package/dist-lib/contracts/generated/index.d.ts +2 -2
  21. package/dist-lib/contracts/generated/schemas.d.ts +229 -102
  22. package/dist-lib/contracts/generated/schemas.d.ts.map +1 -1
  23. package/dist-lib/contracts/generated/types.d.ts +22 -12
  24. package/dist-lib/contracts/generated/types.d.ts.map +1 -1
  25. package/dist-lib/contracts/page-contract-schema.d.ts +8 -8
  26. package/dist-lib/middag-react.js +10163 -10121
  27. package/docs/public/schemas/fragment.json +66 -2
  28. package/docs/public/schemas/page-contract.json +66 -2
  29. package/package.json +1 -1
  30. package/src/base/blocks/CardGridBlock.tsx +2 -1
  31. package/src/base/blocks/DenseTableBlock.tsx +2 -1
  32. package/src/base/blocks/DetailPanelBlock.tsx +2 -1
  33. package/src/base/blocks/FormPanelBlock.tsx +2 -1
  34. package/src/base/partials/ActionBar/index.tsx +3 -2
  35. package/src/base/partials/FilterBar/index.tsx +12 -1
  36. package/src/base/shell/partials/InlineEditablePanel.tsx +14 -7
  37. package/src/base/shell/partials/PageActionButton.tsx +3 -1
  38. package/src/base/theme/appearance.ts +2 -1
  39. package/src/base/utils/action-intent.ts +22 -0
  40. package/src/contracts/generated/index.ts +2 -2
  41. package/src/contracts/generated/schemas.ts +22 -12
  42. package/src/contracts/generated/types.ts +39 -12
  43. package/dist-lib/chunks/subpath-Bh1MAmBT.js +0 -165
@@ -1794,6 +1794,57 @@
1794
1794
  }
1795
1795
  },
1796
1796
  "additionalProperties": false
1797
+ },
1798
+ {
1799
+ "type": "object",
1800
+ "required": [
1801
+ "kind",
1802
+ "key",
1803
+ "component",
1804
+ "props"
1805
+ ],
1806
+ "properties": {
1807
+ "kind": {
1808
+ "const": "field"
1809
+ },
1810
+ "key": {
1811
+ "type": "string"
1812
+ },
1813
+ "component": {
1814
+ "enum": [
1815
+ "richtext",
1816
+ "time"
1817
+ ]
1818
+ },
1819
+ "props": {
1820
+ "$ref": "#/$defs/FieldPropsBase"
1821
+ }
1822
+ },
1823
+ "additionalProperties": false
1824
+ },
1825
+ {
1826
+ "type": "object",
1827
+ "required": [
1828
+ "kind",
1829
+ "key",
1830
+ "component",
1831
+ "props"
1832
+ ],
1833
+ "properties": {
1834
+ "kind": {
1835
+ "const": "field"
1836
+ },
1837
+ "key": {
1838
+ "type": "string"
1839
+ },
1840
+ "component": {
1841
+ "const": "autocomplete"
1842
+ },
1843
+ "props": {
1844
+ "$ref": "#/$defs/OptionFieldProps"
1845
+ }
1846
+ },
1847
+ "additionalProperties": false
1797
1848
  }
1798
1849
  ]
1799
1850
  },
@@ -1813,7 +1864,17 @@
1813
1864
  "type": "string"
1814
1865
  },
1815
1866
  "label": {
1816
- "type": "string"
1867
+ "oneOf": [
1868
+ {
1869
+ "type": "string"
1870
+ },
1871
+ {
1872
+ "$ref": "#/$defs/Translatable"
1873
+ },
1874
+ {
1875
+ "type": "null"
1876
+ }
1877
+ ]
1817
1878
  },
1818
1879
  "defaultCollapsed": {
1819
1880
  "type": "boolean"
@@ -2252,7 +2313,10 @@
2252
2313
  "date_range",
2253
2314
  "hidden",
2254
2315
  "static",
2255
- "header"
2316
+ "header",
2317
+ "richtext",
2318
+ "time",
2319
+ "autocomplete"
2256
2320
  ]
2257
2321
  },
2258
2322
  "FragmentKind": {
@@ -1794,6 +1794,57 @@
1794
1794
  }
1795
1795
  },
1796
1796
  "additionalProperties": false
1797
+ },
1798
+ {
1799
+ "type": "object",
1800
+ "required": [
1801
+ "kind",
1802
+ "key",
1803
+ "component",
1804
+ "props"
1805
+ ],
1806
+ "properties": {
1807
+ "kind": {
1808
+ "const": "field"
1809
+ },
1810
+ "key": {
1811
+ "type": "string"
1812
+ },
1813
+ "component": {
1814
+ "enum": [
1815
+ "richtext",
1816
+ "time"
1817
+ ]
1818
+ },
1819
+ "props": {
1820
+ "$ref": "#/$defs/FieldPropsBase"
1821
+ }
1822
+ },
1823
+ "additionalProperties": false
1824
+ },
1825
+ {
1826
+ "type": "object",
1827
+ "required": [
1828
+ "kind",
1829
+ "key",
1830
+ "component",
1831
+ "props"
1832
+ ],
1833
+ "properties": {
1834
+ "kind": {
1835
+ "const": "field"
1836
+ },
1837
+ "key": {
1838
+ "type": "string"
1839
+ },
1840
+ "component": {
1841
+ "const": "autocomplete"
1842
+ },
1843
+ "props": {
1844
+ "$ref": "#/$defs/OptionFieldProps"
1845
+ }
1846
+ },
1847
+ "additionalProperties": false
1797
1848
  }
1798
1849
  ]
1799
1850
  },
@@ -1813,7 +1864,17 @@
1813
1864
  "type": "string"
1814
1865
  },
1815
1866
  "label": {
1816
- "type": "string"
1867
+ "oneOf": [
1868
+ {
1869
+ "type": "string"
1870
+ },
1871
+ {
1872
+ "$ref": "#/$defs/Translatable"
1873
+ },
1874
+ {
1875
+ "type": "null"
1876
+ }
1877
+ ]
1817
1878
  },
1818
1879
  "defaultCollapsed": {
1819
1880
  "type": "boolean"
@@ -2252,7 +2313,10 @@
2252
2313
  "date_range",
2253
2314
  "hidden",
2254
2315
  "static",
2255
- "header"
2316
+ "header",
2317
+ "richtext",
2318
+ "time",
2319
+ "autocomplete"
2256
2320
  ]
2257
2321
  },
2258
2322
  "FragmentKind": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middag-io/react",
3
- "version": "0.46.1",
3
+ "version": "0.47.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",
@@ -19,6 +19,7 @@ import { Link } from "@inertiajs/react";
19
19
 
20
20
  import { ConfirmationDialog } from "@/base/partials/ConfirmationDialog";
21
21
  import { useInspector } from "@/base/shell/partials/InspectorContext";
22
+ import { isDangerIntent } from "@/base/utils/action-intent";
22
23
  import { getIcon } from "@/base/utils/icons";
23
24
  import { interpolate } from "@/base/utils/interpolate";
24
25
  import type {
@@ -180,7 +181,7 @@ export function CardGridBlock({ block }: BlockProps<CardGridBlockData>): ReactEl
180
181
  variant="ghost"
181
182
  size="icon-xs"
182
183
  className={cn(
183
- action.intent === "danger" && "text-destructive hover:text-destructive",
184
+ isDangerIntent(action.intent) && "text-destructive hover:text-destructive",
184
185
  )}
185
186
  title={renderLabel(action.label, t)}
186
187
  onClick={() => runRowAction(action, row)}
@@ -14,6 +14,7 @@ import { DataTable } from "@/base/partials/DataTable";
14
14
  import type { DataTableParamChange } from "@/base/partials/DataTable/types";
15
15
  import { useEditablePanel } from "@/base/shell/partials/EditablePanelContext";
16
16
  import { useInspector } from "@/base/shell/partials/InspectorContext";
17
+ import { isDangerIntent } from "@/base/utils/action-intent";
17
18
  import { evaluateCondition } from "@/base/utils/conditions";
18
19
  import { interpolate } from "@/base/utils/interpolate";
19
20
  import type { ActionConfirmation, DenseTableBlockData } from "@/contracts/block-data";
@@ -234,7 +235,7 @@ export function DenseTableBlock({ block }: BlockProps<DenseTableBlockData>): Rea
234
235
  id: action.id,
235
236
  label: renderLabel(action.label, t),
236
237
  icon: action.icon,
237
- intent: action.intent === "danger" ? ("danger" as const) : ("default" as const),
238
+ intent: isDangerIntent(action.intent) ? ("danger" as const) : ("default" as const),
238
239
  variant: action.variant,
239
240
  onAction: (row: Record<string, unknown>) => {
240
241
  const resolvedHref = interpolate(target.url, row);
@@ -12,6 +12,7 @@ import { router } from "@inertiajs/core";
12
12
  import type { TFunction } from "i18next";
13
13
 
14
14
  import { ConfirmationDialog } from "@/base/partials/ConfirmationDialog";
15
+ import { isDangerIntent } from "@/base/utils/action-intent";
15
16
  import { getIcon } from "@/base/utils/icons";
16
17
  import type {
17
18
  DetailPanelBlockData,
@@ -112,7 +113,7 @@ function SectionActionButton({ action }: { action: ExecutableAction }): ReactEle
112
113
  return (
113
114
  <>
114
115
  <Button
115
- variant={action.intent === "danger" ? "destructive" : "outline"}
116
+ variant={isDangerIntent(action.intent) ? "destructive" : "outline"}
116
117
  size="sm"
117
118
  onClick={handleClick}
118
119
  disabled={action.disabled}
@@ -94,6 +94,7 @@ function SchemaRenderer({
94
94
  onChange: (key: string, value: unknown) => void;
95
95
  sourceValues: Record<string, unknown>;
96
96
  }): ReactElement {
97
+ const { t } = useTranslation();
97
98
  return (
98
99
  <>
99
100
  {nodes.map((node, index) => {
@@ -116,7 +117,7 @@ function SchemaRenderer({
116
117
  <FormSection
117
118
  key={node.id}
118
119
  id={node.id}
119
- title={node.label}
120
+ title={renderLabel(node.label, t) || undefined}
120
121
  defaultCollapsed={node.defaultCollapsed}
121
122
  hasErrors={node.children.some((c) => c.kind === "field" && !!errors[c.key])}
122
123
  errorCount={
@@ -8,6 +8,7 @@
8
8
  import { useState, type ReactElement } from "react";
9
9
 
10
10
  import { ConfirmationDialog } from "@/base/partials/ConfirmationDialog";
11
+ import { isDangerIntent } from "@/base/utils/action-intent";
11
12
  import type { ExecutableAction } from "@/contracts/block-data";
12
13
  import { renderLabel } from "@/i18n/render-label";
13
14
  import { useTranslation } from "@/i18n/useTranslation";
@@ -72,7 +73,7 @@ export function ActionBar({
72
73
  <Button
73
74
  key={action.id}
74
75
  data-testid={actionTestId(action.id)}
75
- variant={action.intent === "danger" ? "destructive" : "outline"}
76
+ variant={isDangerIntent(action.intent) ? "destructive" : "outline"}
76
77
  size="sm"
77
78
  onClick={() => handleAction(action)}
78
79
  disabled={isLoading}
@@ -94,7 +95,7 @@ export function ActionBar({
94
95
  message={bulkMessage}
95
96
  intent={
96
97
  confirmAction.confirmation?.intent ??
97
- (confirmAction.intent === "danger" ? "danger" : undefined)
98
+ (isDangerIntent(confirmAction.intent) ? "danger" : undefined)
98
99
  }
99
100
  confirmLabel={
100
101
  confirmAction.confirmation?.confirmLabel
@@ -22,6 +22,17 @@ import {
22
22
  } from "@/primitives/reui/select";
23
23
  import { Separator } from "@/primitives/reui/separator";
24
24
 
25
+ const RENDERABLE_FILTER_TYPES: ReadonlySet<string> = new Set([
26
+ "select",
27
+ "multiselect",
28
+ "date_range",
29
+ ]);
30
+
31
+ /** FilterType is an open enum: a type this renderer cannot draw is skipped, not shown as a bare label. */
32
+ function isRenderableFilter(filter: { type: string }): boolean {
33
+ return RENDERABLE_FILTER_TYPES.has(filter.type);
34
+ }
35
+
25
36
  export interface FilterDef {
26
37
  key: string;
27
38
  label: string;
@@ -104,7 +115,7 @@ export function FilterBar({
104
115
  align="start"
105
116
  >
106
117
  <p className="text-sm font-semibold">{t("middag.ui.filter.title")}</p>
107
- {filters.map((filter) => (
118
+ {filters.filter(isRenderableFilter).map((filter) => (
108
119
  <div key={filter.key} className="space-y-1.5">
109
120
  <label className="text-muted-foreground text-xs font-medium">{filter.label}</label>
110
121
  {filter.type === "select" && filter.options && (
@@ -1,11 +1,13 @@
1
1
  "use client";
2
2
 
3
3
  import { useMemo, useState, type ReactElement, type ReactNode } from "react";
4
+ import type { TFunction } from "i18next";
4
5
 
5
6
  import { buildFormSchema } from "@/base/form/form-schema-builder";
6
7
  import { isFieldVisible } from "@/base/form/form-utils";
7
8
  import { FormField } from "@/base/form/FormField";
8
9
  import type { FormFieldNode, FormSchemaNode } from "@/contracts/block-data";
10
+ import { renderLabel } from "@/i18n/render-label";
9
11
  import { useTranslation } from "@/i18n/useTranslation";
10
12
  import { cn } from "@/lib/utils";
11
13
  import { Button } from "@/primitives/reui/button";
@@ -44,6 +46,7 @@ function renderNodes(
44
46
  values: Values,
45
47
  errors: Record<string, string>,
46
48
  setValue: (key: string, value: unknown) => void,
49
+ t: TFunction,
47
50
  ): ReactNode {
48
51
  return nodes.map((node, index) => {
49
52
  switch (node.kind) {
@@ -66,22 +69,26 @@ function renderNodes(
66
69
  {node.label}
67
70
  </h4>
68
71
  );
69
- case "section":
72
+ case "section": {
73
+ const sectionLabel = renderLabel(node.label, t);
70
74
  return (
71
75
  <section key={node.id} className="space-y-3">
72
- <div className="text-muted-foreground text-[11px] font-medium tracking-[0.04em] uppercase">
73
- {node.label}
74
- </div>
75
- {renderNodes(node.children, values, errors, setValue)}
76
+ {sectionLabel && (
77
+ <div className="text-muted-foreground text-[11px] font-medium tracking-[0.04em] uppercase">
78
+ {sectionLabel}
79
+ </div>
80
+ )}
81
+ {renderNodes(node.children, values, errors, setValue, t)}
76
82
  </section>
77
83
  );
84
+ }
78
85
  case "group":
79
86
  return (
80
87
  <div
81
88
  key={node.id}
82
89
  className={cn(node.columns === 2 ? "grid grid-cols-2 gap-3" : "space-y-3")}
83
90
  >
84
- {renderNodes(node.children, values, errors, setValue)}
91
+ {renderNodes(node.children, values, errors, setValue, t)}
85
92
  </div>
86
93
  );
87
94
  default:
@@ -217,7 +224,7 @@ export function InlineEditablePanel(): ReactElement | null {
217
224
  </div>
218
225
  ) : (
219
226
  <div className="space-y-3.5">
220
- {renderNodes(descriptor.schema, values, errors, setValue)}
227
+ {renderNodes(descriptor.schema, values, errors, setValue, t)}
221
228
  </div>
222
229
  )}
223
230
  </div>
@@ -20,6 +20,7 @@ import { router } from "@inertiajs/core";
20
20
  import { Link } from "@inertiajs/react";
21
21
 
22
22
  import { ConfirmationDialog } from "@/base/partials/ConfirmationDialog";
23
+ import { isDangerIntent } from "@/base/utils/action-intent";
23
24
  import { getIcon, hasIcon } from "@/base/utils/icons";
24
25
  import type { PageAction } from "@/contracts/page-contract";
25
26
  import { renderLabel } from "@/i18n/render-label";
@@ -44,7 +45,8 @@ export function PageActionButton({ action }: { action: PageAction }): ReactEleme
44
45
  const [isWaiting, setIsWaiting] = useState(false);
45
46
 
46
47
  const target = resolveActionTarget(action);
47
- const variant: ButtonVariant = VARIANT_MAP[action.intent] ?? "outline";
48
+ const variant: ButtonVariant =
49
+ VARIANT_MAP[action.intent] ?? (isDangerIntent(action.intent) ? "destructive" : "outline");
48
50
  const isNavigation = target.kind === "link";
49
51
  // External loading (server-driven via action.loading) merges with local in-flight state
50
52
  const effectiveLoading = isLoading || action.loading === true;
@@ -29,7 +29,8 @@ export type EffectiveTheme = "light" | "dark";
29
29
  * 'system' consults host page first, then OS.
30
30
  */
31
31
  export function getEffectiveTheme(preference: Appearance): EffectiveTheme {
32
- if (preference !== "system") return preference;
32
+ // An unknown preference (ThemeMode is an open enum) resolves like "system".
33
+ if (preference === "light" || preference === "dark") return preference;
33
34
 
34
35
  const hostTheme: DetectedTheme = detectHostTheme();
35
36
  if (hostTheme === "dark") return "dark";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Action intent is an open enum: a newer producer may send a value this
3
+ * renderer does not know. An unknown intent is treated as destructive (the
4
+ * safest reading), never as the neutral default, so a dangerous action is not
5
+ * rendered as an ordinary one.
6
+ */
7
+ const KNOWN_ACTION_INTENTS: ReadonlySet<string> = new Set([
8
+ "primary",
9
+ "secondary",
10
+ "danger",
11
+ "success",
12
+ "warning",
13
+ "info",
14
+ "link",
15
+ "ghost",
16
+ ]);
17
+
18
+ /** True for `danger` and for any non-empty intent this renderer does not know. */
19
+ export function isDangerIntent(intent: string | undefined | null): boolean {
20
+ if (!intent) return false;
21
+ return intent === "danger" || !KNOWN_ACTION_INTENTS.has(intent);
22
+ }
@@ -7,9 +7,9 @@
7
7
  * Regenerate: npm run gen:contracts
8
8
  * Drift gate: npm run gen:contracts:check
9
9
  *
10
- * @source middag-io/middag-php-ui@v1.10.1 schema/{page-contract.json,fragment.json}
10
+ * @source middag-io/middag-php-ui@v1.11.0 schema/{page-contract.json,fragment.json}
11
11
  * @contract-version 1
12
- * @hash 8079f706d81e80a7
12
+ * @hash 63f5044005aa4225
13
13
  */
14
14
  export * from "./types.js";
15
15
  export { pageContractSchemaCore, fragmentSchemaCore } from "./schemas.js";
@@ -7,9 +7,9 @@
7
7
  * Regenerate: npm run gen:contracts
8
8
  * Drift gate: npm run gen:contracts:check
9
9
  *
10
- * @source middag-io/middag-php-ui@v1.10.1 schema/{page-contract.json,fragment.json}
10
+ * @source middag-io/middag-php-ui@v1.11.0 schema/{page-contract.json,fragment.json}
11
11
  * @contract-version 1
12
- * @hash 8079f706d81e80a7
12
+ * @hash 63f5044005aa4225
13
13
  */
14
14
  import { z } from "zod";
15
15
  import type { NavigationNode, FormSectionNode, FormGroupNode, FormSchemaNode } from "./types.js";
@@ -46,7 +46,7 @@ export const ActionTargetSchema = z.union([z.object({
46
46
  "kind": z.literal("panel"),
47
47
  })]);
48
48
 
49
- export const ActionIntentSchema = z.enum(["primary", "secondary", "danger", "success", "warning", "info", "link", "ghost"]);
49
+ export const ActionIntentSchema = z.union([z.enum(["primary", "secondary", "danger", "success", "warning", "info", "link", "ghost"]), z.string()]);
50
50
 
51
51
  export const ConfirmationSchema = z.object({
52
52
  "title": LabelSchema,
@@ -103,7 +103,7 @@ export const LayoutDescriptorSchema = z.object({
103
103
  "meta": z.record(z.string(), z.unknown()).optional(),
104
104
  });
105
105
 
106
- export const ThemeModeSchema = z.enum(["light", "dark", "system"]);
106
+ export const ThemeModeSchema = z.union([z.enum(["light", "dark", "system"]), z.string()]);
107
107
 
108
108
  export const UserPreferencesSchema = z.object({
109
109
  "theme": ThemeModeSchema,
@@ -135,7 +135,7 @@ export const PageResourcesSchema = z.object({
135
135
  "branding": BrandingSchema.optional(),
136
136
  });
137
137
 
138
- export const NotificationLevelSchema = z.enum(["success", "info", "warning", "error"]);
138
+ export const NotificationLevelSchema = z.union([z.enum(["success", "info", "warning", "error"]), z.string()]);
139
139
 
140
140
  export const NotificationSchema = z.object({
141
141
  "level": NotificationLevelSchema,
@@ -199,9 +199,9 @@ export const NavigationNodeSchema: z.ZodType<NavigationNode> = z.object({
199
199
  "children": z.array(z.lazy(() => NavigationNodeSchema)).optional(),
200
200
  });
201
201
 
202
- export const ValueFormatSchema = z.enum(["text", "date", "datetime", "time", "number", "currency", "boolean", "badge"]);
202
+ export const ValueFormatSchema = z.union([z.enum(["text", "date", "datetime", "time", "number", "currency", "boolean", "badge"]), z.string()]);
203
203
 
204
- export const ColumnVariantSchema = z.enum(["text", "status", "badge", "boolean", "timestamp", "link", "rich_status", "html", "link_group", "annotated", "progress"]);
204
+ export const ColumnVariantSchema = z.union([z.enum(["text", "status", "badge", "boolean", "timestamp", "link", "rich_status", "html", "link_group", "annotated", "progress"]), z.string()]);
205
205
 
206
206
  export const ColumnSchema = z.object({
207
207
  "key": z.string(),
@@ -214,7 +214,7 @@ export const ColumnSchema = z.object({
214
214
  "variant": ColumnVariantSchema.optional(),
215
215
  });
216
216
 
217
- export const FilterTypeSchema = z.enum(["select", "text", "date", "date_range", "boolean", "number_range"]);
217
+ export const FilterTypeSchema = z.union([z.enum(["select", "text", "date", "date_range", "boolean", "number_range"]), z.string()]);
218
218
 
219
219
  export const FilterDefinitionSchema = z.object({
220
220
  "key": z.string(),
@@ -496,12 +496,22 @@ export const FormFieldNodeSchema = z.union([z.object({
496
496
  "props": z.object({
497
497
  "label": z.string(),
498
498
  }),
499
+ }), z.object({
500
+ "kind": z.literal("field"),
501
+ "key": z.string(),
502
+ "component": z.enum(["richtext", "time"]),
503
+ "props": FieldPropsBaseSchema,
504
+ }), z.object({
505
+ "kind": z.literal("field"),
506
+ "key": z.string(),
507
+ "component": z.literal("autocomplete"),
508
+ "props": OptionFieldPropsSchema,
499
509
  })]);
500
510
 
501
511
  export const FormSectionNodeSchema: z.ZodType<FormSectionNode> = z.object({
502
512
  "kind": z.literal("section"),
503
513
  "id": z.string(),
504
- "label": z.string(),
514
+ "label": z.union([z.string(), TranslatableSchema, z.null()]),
505
515
  "defaultCollapsed": z.boolean().optional(),
506
516
  "children": z.array(z.lazy(() => FormSchemaNodeSchema)),
507
517
  });
@@ -541,13 +551,13 @@ export const ActionResultSchema = z.object({
541
551
 
542
552
  export const ActionTargetKindSchema = z.enum(["link", "route", "request", "panel"]);
543
553
 
544
- export const ChartTypeSchema = z.enum(["line", "bar", "area"]);
554
+ export const ChartTypeSchema = z.union([z.enum(["line", "bar", "area"]), z.string()]);
545
555
 
546
556
  export const ConditionOperatorSchema = z.enum(["eq", "neq", "in", "not_in", "gt", "gte", "lt", "lte", "truthy", "falsy", "exists", "empty", "matches"]);
547
557
 
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"]);
558
+ export const FieldTypeSchema = z.union([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"]), z.string()]);
549
559
 
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"]);
560
+ export const FormComponentSchema = z.union([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", "richtext", "time", "autocomplete"]), z.string()]);
551
561
 
552
562
  export const RenderTargetSchema = z.enum(["html", "props"]);
553
563
 
@@ -7,9 +7,9 @@
7
7
  * Regenerate: npm run gen:contracts
8
8
  * Drift gate: npm run gen:contracts:check
9
9
  *
10
- * @source middag-io/middag-php-ui@v1.10.1 schema/{page-contract.json,fragment.json}
10
+ * @source middag-io/middag-php-ui@v1.11.0 schema/{page-contract.json,fragment.json}
11
11
  * @contract-version 1
12
- * @hash 8079f706d81e80a7
12
+ * @hash 63f5044005aa4225
13
13
  */
14
14
  export type Label = string | Translatable;
15
15
  export type ActionTarget =
@@ -42,9 +42,10 @@ export type ActionIntent =
42
42
  | "warning"
43
43
  | "info"
44
44
  | "link"
45
- | "ghost";
46
- export type ThemeMode = "light" | "dark" | "system";
47
- export type NotificationLevel = "success" | "info" | "warning" | "error";
45
+ | "ghost"
46
+ | (string & {});
47
+ export type ThemeMode = "light" | "dark" | "system" | (string & {});
48
+ export type NotificationLevel = "success" | "info" | "warning" | "error" | (string & {});
48
49
  export type FragmentKind =
49
50
  | "block"
50
51
  | "region"
@@ -73,7 +74,8 @@ export type ValueFormat =
73
74
  | "number"
74
75
  | "currency"
75
76
  | "boolean"
76
- | "badge";
77
+ | "badge"
78
+ | (string & {});
77
79
  export type ColumnVariant =
78
80
  | "text"
79
81
  | "status"
@@ -85,8 +87,16 @@ export type ColumnVariant =
85
87
  | "html"
86
88
  | "link_group"
87
89
  | "annotated"
88
- | "progress";
89
- export type FilterType = "select" | "text" | "date" | "date_range" | "boolean" | "number_range";
90
+ | "progress"
91
+ | (string & {});
92
+ export type FilterType =
93
+ | "select"
94
+ | "text"
95
+ | "date"
96
+ | "date_range"
97
+ | "boolean"
98
+ | "number_range"
99
+ | (string & {});
90
100
  export type FieldConstraints =
91
101
  | {
92
102
  required?: true;
@@ -297,6 +307,18 @@ export type FormFieldNode =
297
307
  props: {
298
308
  label: string;
299
309
  };
310
+ }
311
+ | {
312
+ kind: "field";
313
+ key: string;
314
+ component: "richtext" | "time";
315
+ props: FieldPropsBase;
316
+ }
317
+ | {
318
+ kind: "field";
319
+ key: string;
320
+ component: "autocomplete";
321
+ props: OptionFieldProps;
300
322
  };
301
323
  export type OptionFieldProps = FieldPropsBase & {
302
324
  options?: {
@@ -306,7 +328,7 @@ export type OptionFieldProps = FieldPropsBase & {
306
328
  };
307
329
  export type RegionUpdateMode = "replace" | "append" | "prepend" | "remove" | "update";
308
330
  export type ActionTargetKind = "link" | "route" | "request" | "panel";
309
- export type ChartType = "line" | "bar" | "area";
331
+ export type ChartType = "line" | "bar" | "area" | (string & {});
310
332
  export type ConditionOperator =
311
333
  | "eq"
312
334
  | "neq"
@@ -348,7 +370,8 @@ export type FieldType =
348
370
  | "tags"
349
371
  | "hidden"
350
372
  | "static"
351
- | "header";
373
+ | "header"
374
+ | (string & {});
352
375
  export type FormComponent =
353
376
  | "text"
354
377
  | "textarea"
@@ -380,7 +403,11 @@ export type FormComponent =
380
403
  | "date_range"
381
404
  | "hidden"
382
405
  | "static"
383
- | "header";
406
+ | "header"
407
+ | "richtext"
408
+ | "time"
409
+ | "autocomplete"
410
+ | (string & {});
384
411
  export type RenderTarget = "html" | "props";
385
412
 
386
413
  export interface PageContract {
@@ -643,7 +670,7 @@ export interface FormFieldDocumentMask {
643
670
  export interface FormSectionNode {
644
671
  kind: "section";
645
672
  id: string;
646
- label: string;
673
+ label: string | Translatable | null;
647
674
  defaultCollapsed?: boolean;
648
675
  children: FormSchemaNode[];
649
676
  }