@middag-io/react 0.45.2 → 0.45.4
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/README.md +4 -3
- package/dist-lib/base/blocks/ActionGridBlock.d.ts +0 -2
- package/dist-lib/base/blocks/ActionGridBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/ActivityTimelineBlock.d.ts +0 -2
- package/dist-lib/base/blocks/ActivityTimelineBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/CardGridBlock.d.ts +0 -2
- package/dist-lib/base/blocks/CardGridBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/DenseTableBlock.d.ts +0 -2
- package/dist-lib/base/blocks/DenseTableBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/DetailPanelBlock.d.ts +0 -2
- package/dist-lib/base/blocks/DetailPanelBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/EmptyStateBlock.d.ts +0 -2
- package/dist-lib/base/blocks/EmptyStateBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/LinkListBlock.d.ts +0 -2
- package/dist-lib/base/blocks/LinkListBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/MarkdownPanelBlock.d.ts +0 -2
- package/dist-lib/base/blocks/MarkdownPanelBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/MetricCardBlock.d.ts +0 -2
- package/dist-lib/base/blocks/MetricCardBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/StatusStripBlock.d.ts +0 -2
- package/dist-lib/base/blocks/StatusStripBlock.d.ts.map +1 -1
- package/dist-lib/base/blocks/TabsBlock.d.ts +0 -1
- package/dist-lib/base/blocks/TabsBlock.d.ts.map +1 -1
- package/dist-lib/base/layout/DashboardLayout.d.ts +0 -2
- package/dist-lib/base/layout/DashboardLayout.d.ts.map +1 -1
- package/dist-lib/base/partials/ActionBar/index.d.ts +0 -2
- package/dist-lib/base/partials/ActionBar/index.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/index.d.ts +0 -2
- package/dist-lib/base/partials/DataTable/index.d.ts.map +1 -1
- package/dist-lib/base/partials/DataTable/types.d.ts +0 -2
- package/dist-lib/base/partials/DataTable/types.d.ts.map +1 -1
- package/dist-lib/base/partials/DetailSection/index.d.ts +0 -2
- package/dist-lib/base/partials/DetailSection/index.d.ts.map +1 -1
- package/dist-lib/base/partials/EmptyPlaceholder/index.d.ts +0 -2
- package/dist-lib/base/partials/EmptyPlaceholder/index.d.ts.map +1 -1
- package/dist-lib/base/partials/FilterBar/index.d.ts +0 -2
- package/dist-lib/base/partials/FilterBar/index.d.ts.map +1 -1
- package/dist-lib/base/partials/FormSection/index.d.ts +0 -2
- package/dist-lib/base/partials/FormSection/index.d.ts.map +1 -1
- package/dist-lib/base/partials/LogViewer/index.d.ts +0 -2
- package/dist-lib/base/partials/LogViewer/index.d.ts.map +1 -1
- package/dist-lib/base/partials/MarkdownContent/index.d.ts +0 -2
- package/dist-lib/base/partials/MarkdownContent/index.d.ts.map +1 -1
- package/dist-lib/base/partials/StatRow/index.d.ts +0 -2
- package/dist-lib/base/partials/StatRow/index.d.ts.map +1 -1
- package/dist-lib/base/partials/StatusBar/index.d.ts +0 -2
- package/dist-lib/base/partials/StatusBar/index.d.ts.map +1 -1
- package/dist-lib/base/partials/StatusIndicator/index.d.ts +0 -2
- package/dist-lib/base/partials/StatusIndicator/index.d.ts.map +1 -1
- package/dist-lib/base/partials/TimelineList/index.d.ts +0 -2
- package/dist-lib/base/partials/TimelineList/index.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/EditablePanelContext.d.ts +1 -1
- package/dist-lib/base/shell/partials/EditablePanelContext.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/NavErrorBoundary.d.ts +0 -2
- package/dist-lib/base/shell/partials/NavErrorBoundary.d.ts.map +1 -1
- package/dist-lib/base/shell/partials/OverlayScreen.d.ts +1 -1
- package/dist-lib/base/theme/host-theme-detector.d.ts +1 -1
- package/dist-lib/base/theme/tokens.css +0 -2
- package/dist-lib/base/utils/clipboard.d.ts +0 -2
- package/dist-lib/base/utils/clipboard.d.ts.map +1 -1
- package/dist-lib/base/utils/icons.d.ts +1 -1
- package/dist-lib/base/utils/time.d.ts +2 -4
- package/dist-lib/base/utils/time.d.ts.map +1 -1
- package/dist-lib/contracts/block-data/index.d.ts +1 -4
- package/dist-lib/contracts/block-data/index.d.ts.map +1 -1
- package/dist-lib/contracts/navigation.d.ts +1 -4
- package/dist-lib/contracts/navigation.d.ts.map +1 -1
- package/dist-lib/contracts/shared-props.d.ts +0 -2
- package/dist-lib/contracts/shared-props.d.ts.map +1 -1
- package/dist-lib/engine/ContractPage.d.ts +1 -1
- package/dist-lib/engine/HostSlot.d.ts +0 -2
- package/dist-lib/engine/HostSlot.d.ts.map +1 -1
- package/dist-lib/engine/providers/auth.d.ts +0 -2
- package/dist-lib/engine/providers/auth.d.ts.map +1 -1
- package/dist-lib/engine/providers/flash.d.ts +0 -2
- package/dist-lib/engine/providers/flash.d.ts.map +1 -1
- package/dist-lib/engine/providers/progress.d.ts +0 -2
- package/dist-lib/engine/providers/progress.d.ts.map +1 -1
- package/dist-lib/engine/providers/scope.d.ts +0 -1
- package/dist-lib/engine/providers/scope.d.ts.map +1 -1
- package/dist-lib/engine/registries.d.ts +1 -1
- package/dist-lib/lib/portal-container.d.ts +1 -1
- package/dist-lib/middag-react.js +5530 -5512
- package/package.json +1 -1
- package/src/base/blocks/ActionGridBlock.tsx +5 -7
- package/src/base/blocks/ActivityTimelineBlock.tsx +0 -2
- package/src/base/blocks/CardGridBlock.tsx +0 -2
- package/src/base/blocks/DenseTableBlock.tsx +12 -10
- package/src/base/blocks/DetailPanelBlock.tsx +0 -2
- package/src/base/blocks/EmptyStateBlock.tsx +0 -2
- package/src/base/blocks/LinkListBlock.tsx +0 -2
- package/src/base/blocks/MarkdownPanelBlock.tsx +0 -2
- package/src/base/blocks/MetricCardBlock.tsx +0 -2
- package/src/base/blocks/StatusStripBlock.tsx +0 -2
- package/src/base/blocks/TabsBlock.tsx +0 -1
- package/src/base/layout/DashboardLayout.tsx +0 -2
- package/src/base/partials/ActionBar/index.tsx +0 -2
- package/src/base/partials/DataTable/index.tsx +32 -17
- package/src/base/partials/DataTable/types.ts +0 -2
- package/src/base/partials/DetailSection/index.tsx +0 -2
- package/src/base/partials/EmptyPlaceholder/index.tsx +0 -2
- package/src/base/partials/FilterBar/index.tsx +0 -2
- package/src/base/partials/FormSection/index.tsx +0 -2
- package/src/base/partials/LogViewer/index.tsx +0 -2
- package/src/base/partials/MarkdownContent/index.tsx +0 -2
- package/src/base/partials/StatRow/index.tsx +0 -2
- package/src/base/partials/StatusBar/index.tsx +0 -2
- package/src/base/partials/StatusIndicator/index.tsx +0 -2
- package/src/base/partials/TimelineList/index.tsx +0 -2
- package/src/base/shell/partials/EditablePanelContext.tsx +1 -1
- package/src/base/shell/partials/NavErrorBoundary.tsx +0 -2
- package/src/base/shell/partials/OverlayScreen.tsx +1 -1
- package/src/base/theme/host-theme-detector.ts +1 -1
- package/src/base/theme/tokens.css +0 -2
- package/src/base/utils/clipboard.ts +0 -2
- package/src/base/utils/icons.ts +1 -1
- package/src/base/utils/time.ts +2 -4
- package/src/contracts/block-data/index.ts +1 -4
- package/src/contracts/navigation.ts +1 -4
- package/src/contracts/shared-props.ts +0 -2
- package/src/engine/ContractPage.tsx +6 -6
- package/src/engine/HostSlot.tsx +0 -2
- package/src/engine/providers/auth.tsx +0 -2
- package/src/engine/providers/flash.tsx +0 -2
- package/src/engine/providers/progress.tsx +0 -2
- package/src/engine/providers/scope.tsx +0 -1
- package/src/engine/registries.ts +1 -1
- package/src/i18n/instance.ts +3 -3
- package/src/lib/portal-container.ts +1 -1
package/package.json
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* Each card displays an icon, title, description, and an action button.
|
|
5
5
|
* When confirmText is present, an AlertDialog gates the action.
|
|
6
6
|
* Actions execute via Inertia router.post/delete.
|
|
7
|
-
*
|
|
8
|
-
* @see ADR-807
|
|
9
7
|
*/
|
|
10
8
|
|
|
11
9
|
"use client";
|
|
@@ -107,11 +105,11 @@ function ActionCard({ item }: { item: ActionGridBlockData["items"][number] }): R
|
|
|
107
105
|
</div>
|
|
108
106
|
</CardHeader>
|
|
109
107
|
<CardContent>
|
|
110
|
-
{/* `loading`/`disabled`
|
|
111
|
-
Middag\Ui)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
{/* `loading`/`disabled` are part of the Action contract (generated from
|
|
109
|
+
Middag\Ui) but were ignored here: the server could flag an action
|
|
110
|
+
as in progress while the button stayed active and clickable.
|
|
111
|
+
`loading` implies disabled, because resubmitting during processing
|
|
112
|
+
is what the flag exists to prevent. */}
|
|
115
113
|
<Button
|
|
116
114
|
variant="outline"
|
|
117
115
|
size="sm"
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Maps BlockDescriptor<DenseTableBlockData> to DataTable partial props.
|
|
5
5
|
* Server interactions use Inertia partial reload.
|
|
6
|
-
*
|
|
7
|
-
* @see NV-05-ux-blocks.md §1
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import { useCallback, useEffect, useRef, useState, type ReactElement } from "react";
|
|
@@ -30,13 +28,17 @@ export function DenseTableBlock({ block }: BlockProps<DenseTableBlockData>): Rea
|
|
|
30
28
|
const isLoading = meta?.loading === true;
|
|
31
29
|
const clientSide = (meta as Record<string, unknown> | undefined)?.clientSide === true;
|
|
32
30
|
const rowKeyField = (meta?.rowKey as string) ?? "id";
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
// Server-mode reloads ask for this page prop only. Pages ship blocks inside
|
|
32
|
+
// the single `contract` prop, so that is the default; the block key is not a
|
|
33
|
+
// page prop and asking for it reloaded nothing.
|
|
34
|
+
const reloadKey = (meta?.partialReloadKey as string | undefined) ?? "contract";
|
|
35
|
+
// Seed the search box from the URL ?search= param. clientSide tables filter
|
|
36
|
+
// in-browser, so tag-chip links (e.g. /tickets?search=<tag>) and shareable
|
|
37
|
+
// search URLs filter on load. Server mode sends the full query on every
|
|
38
|
+
// change, and the contract does not echo the search, so the URL is the only
|
|
39
|
+
// place the current search survives a reload.
|
|
40
|
+
const initialSearch =
|
|
41
|
+
typeof window !== "undefined"
|
|
40
42
|
? (new URLSearchParams(window.location.search).get("search") ?? "")
|
|
41
43
|
: "";
|
|
42
44
|
|
|
@@ -357,7 +359,7 @@ export function DenseTableBlock({ block }: BlockProps<DenseTableBlockData>): Rea
|
|
|
357
359
|
onRowClick={inspectorEnabled || data.rowHref ? handleRowClick : undefined}
|
|
358
360
|
selectedRowKey={inspectorEnabled && selectedId ? String(selectedId) : undefined}
|
|
359
361
|
isLoading={isLoading}
|
|
360
|
-
searchValue={
|
|
362
|
+
searchValue={initialSearch}
|
|
361
363
|
searchPlaceholder={data.searchPlaceholder}
|
|
362
364
|
emptyStateIcon={data.emptyState?.icon}
|
|
363
365
|
emptyStateTitle={data.emptyState?.title}
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Delegates to DetailSection partial (created by partials-builder agent).
|
|
5
5
|
* Stub implementation until DetailSection is available — renders fields directly.
|
|
6
|
-
*
|
|
7
|
-
* @see NV-05-ux-blocks.md §4
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import { useCallback, useState, type ReactElement } from "react";
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Features: search, filters, column visibility, sorting, row selection,
|
|
5
5
|
* bulk actions, row actions, skeleton loading, empty state, mobile card layout.
|
|
6
|
-
*
|
|
7
|
-
* @see NV-05-ux-blocks.md
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import {
|
|
@@ -563,13 +561,30 @@ export function DataTable<TData extends object>({
|
|
|
563
561
|
return () => mql.removeEventListener("change", handler as (e: MediaQueryListEvent) => void);
|
|
564
562
|
}, []);
|
|
565
563
|
|
|
564
|
+
// Server mode: every request carries the full query. The server reads only
|
|
565
|
+
// what it receives, so a change that sends just its own key (the pager
|
|
566
|
+
// sending `page`) silently drops the search, sort, page size and filters.
|
|
567
|
+
const emitParamChange = useCallback(
|
|
568
|
+
(changes: DataTableParamChange) => {
|
|
569
|
+
onParamChange?.({
|
|
570
|
+
page: pagination?.page ?? 0,
|
|
571
|
+
perPage: pagination?.perPage,
|
|
572
|
+
sort: sort ?? null,
|
|
573
|
+
search: debouncedSearch,
|
|
574
|
+
filters: appliedFilters,
|
|
575
|
+
...changes,
|
|
576
|
+
});
|
|
577
|
+
},
|
|
578
|
+
[onParamChange, pagination?.page, pagination?.perPage, sort, debouncedSearch, appliedFilters],
|
|
579
|
+
);
|
|
580
|
+
|
|
566
581
|
// Emit search changes
|
|
567
582
|
useEffect(() => {
|
|
568
583
|
if (debouncedSearch !== prevDebouncedRef.current) {
|
|
569
584
|
prevDebouncedRef.current = debouncedSearch;
|
|
570
|
-
|
|
585
|
+
emitParamChange({ search: debouncedSearch, page: 0 });
|
|
571
586
|
}
|
|
572
|
-
}, [debouncedSearch,
|
|
587
|
+
}, [debouncedSearch, emitParamChange]);
|
|
573
588
|
|
|
574
589
|
// -----------------------------------------------------------------------
|
|
575
590
|
// Sorting bridge: DataTable sort <-> TanStack SortingState
|
|
@@ -589,15 +604,15 @@ export function DataTable<TData extends object>({
|
|
|
589
604
|
return;
|
|
590
605
|
}
|
|
591
606
|
if (next.length === 0) {
|
|
592
|
-
|
|
607
|
+
emitParamChange({ sort: null });
|
|
593
608
|
} else {
|
|
594
609
|
const s = next[0];
|
|
595
|
-
|
|
610
|
+
emitParamChange({
|
|
596
611
|
sort: { key: s.id, direction: s.desc ? "desc" : "asc" },
|
|
597
612
|
});
|
|
598
613
|
}
|
|
599
614
|
},
|
|
600
|
-
[sortingState,
|
|
615
|
+
[sortingState, emitParamChange, clientSide],
|
|
601
616
|
);
|
|
602
617
|
|
|
603
618
|
// -----------------------------------------------------------------------
|
|
@@ -795,7 +810,7 @@ export function DataTable<TData extends object>({
|
|
|
795
810
|
changes.perPage = next.pageSize;
|
|
796
811
|
changes.page = 0;
|
|
797
812
|
}
|
|
798
|
-
|
|
813
|
+
emitParamChange(changes);
|
|
799
814
|
},
|
|
800
815
|
getCoreRowModel: getCoreRowModel(),
|
|
801
816
|
...(clientSide
|
|
@@ -845,12 +860,12 @@ export function DataTable<TData extends object>({
|
|
|
845
860
|
table.setPageIndex(0);
|
|
846
861
|
return;
|
|
847
862
|
}
|
|
848
|
-
|
|
863
|
+
emitParamChange({
|
|
849
864
|
filters: { ...appliedFilters, [key]: value },
|
|
850
865
|
page: 0,
|
|
851
866
|
});
|
|
852
867
|
},
|
|
853
|
-
[appliedFilters,
|
|
868
|
+
[appliedFilters, emitParamChange, clientSide, table],
|
|
854
869
|
);
|
|
855
870
|
|
|
856
871
|
const handleFilterRemove = useCallback(
|
|
@@ -867,9 +882,9 @@ export function DataTable<TData extends object>({
|
|
|
867
882
|
}
|
|
868
883
|
const next = { ...appliedFilters };
|
|
869
884
|
delete next[key];
|
|
870
|
-
|
|
885
|
+
emitParamChange({ filters: next, page: 0 });
|
|
871
886
|
},
|
|
872
|
-
[appliedFilters,
|
|
887
|
+
[appliedFilters, emitParamChange, clientSide, table],
|
|
873
888
|
);
|
|
874
889
|
|
|
875
890
|
const handleFilterClearAll = useCallback(() => {
|
|
@@ -879,8 +894,8 @@ export function DataTable<TData extends object>({
|
|
|
879
894
|
table.setPageIndex(0);
|
|
880
895
|
return;
|
|
881
896
|
}
|
|
882
|
-
|
|
883
|
-
}, [
|
|
897
|
+
emitParamChange({ filters: {}, page: 0 });
|
|
898
|
+
}, [emitParamChange, clientSide, table]);
|
|
884
899
|
|
|
885
900
|
// -----------------------------------------------------------------------
|
|
886
901
|
// Column count for visibility toggle threshold
|
|
@@ -1236,7 +1251,7 @@ export function DataTable<TData extends object>({
|
|
|
1236
1251
|
if (clientSide) {
|
|
1237
1252
|
table.setPageSize(Number(e.target.value));
|
|
1238
1253
|
} else {
|
|
1239
|
-
|
|
1254
|
+
emitParamChange({ perPage: Number(e.target.value), page: 0 });
|
|
1240
1255
|
}
|
|
1241
1256
|
}}
|
|
1242
1257
|
className="border-border text-muted-foreground h-7 rounded border bg-transparent px-1.5 text-xs"
|
|
@@ -1253,7 +1268,7 @@ export function DataTable<TData extends object>({
|
|
|
1253
1268
|
size="icon-xs"
|
|
1254
1269
|
disabled={pageIndex === 0}
|
|
1255
1270
|
onClick={() =>
|
|
1256
|
-
clientSide ? table.previousPage() :
|
|
1271
|
+
clientSide ? table.previousPage() : emitParamChange({ page: pageIndex - 1 })
|
|
1257
1272
|
}
|
|
1258
1273
|
aria-label={t("middag.ui.table.previous_page")}
|
|
1259
1274
|
>
|
|
@@ -1267,7 +1282,7 @@ export function DataTable<TData extends object>({
|
|
|
1267
1282
|
size="icon-xs"
|
|
1268
1283
|
disabled={pageIndex >= pageCount - 1}
|
|
1269
1284
|
onClick={() =>
|
|
1270
|
-
clientSide ? table.nextPage() :
|
|
1285
|
+
clientSide ? table.nextPage() : emitParamChange({ page: pageIndex + 1 })
|
|
1271
1286
|
}
|
|
1272
1287
|
aria-label={t("middag.ui.table.next_page")}
|
|
1273
1288
|
>
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* Renders structured data as label/value pairs in a responsive grid.
|
|
5
5
|
* Desktop uses CSS grid (1fr/2fr), mobile stacks with overline labels.
|
|
6
6
|
* Supports multiple field kinds: text, status, timestamp, boolean, link, code, email.
|
|
7
|
-
*
|
|
8
|
-
* @see NV-05-ux-blocks.md §4 (detail section anatomy)
|
|
9
7
|
*/
|
|
10
8
|
|
|
11
9
|
import { useCallback, useState, type ReactElement } from "react";
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* EmptyPlaceholder — contextual empty state with icon, title, description, and CTA.
|
|
3
3
|
*
|
|
4
4
|
* Variants: first-use, no-results, error, permission, compact, inline.
|
|
5
|
-
*
|
|
6
|
-
* @see NV-05-ux-blocks.md §7.1–7.8, §9.3
|
|
7
5
|
*/
|
|
8
6
|
|
|
9
7
|
import { lazy, Suspense, type ReactElement } from "react";
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* FilterBar — filter trigger button + popover/sheet with available filters.
|
|
3
3
|
*
|
|
4
4
|
* Desktop (>=1024px): Popover. Tablet/Mobile: Sheet from bottom.
|
|
5
|
-
*
|
|
6
|
-
* @see NV-05-ux-blocks.md §1.2 toolbar anatomy
|
|
7
5
|
*/
|
|
8
6
|
|
|
9
7
|
import { Fragment, useState, type ReactElement } from "react";
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Receives parsed lines from server (log_reader_service::read_file).
|
|
5
5
|
* Available for dependent plugins at system/partials/LogViewer.
|
|
6
|
-
*
|
|
7
|
-
* @see ADR-924, logs-redesign-design.md
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import { useEffect, useRef, useState, type ReactElement } from "react";
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* Uses react-markdown with rehype-highlight for code blocks and rehype-sanitize
|
|
5
5
|
* for XSS prevention. External links open in a new tab; internal links use
|
|
6
6
|
* Inertia router for SPA navigation.
|
|
7
|
-
*
|
|
8
|
-
* @see NV-05-ux-blocks.md §5 (markdown content rendering)
|
|
9
7
|
*/
|
|
10
8
|
|
|
11
9
|
import { useCallback, useState, type ComponentPropsWithoutRef, type ReactElement } from "react";
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Renders entries grouped by date, connected by a vertical timeline line.
|
|
5
5
|
* Each entry has a colored icon node, actor, timestamp, action, and optional detail.
|
|
6
|
-
*
|
|
7
|
-
* @see NV-05-ux-blocks.md §6 (timeline anatomy)
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
import { useState, type ReactElement } from "react";
|
|
@@ -13,7 +13,7 @@ import type { FormSchemaNode } from "@/contracts/block-data";
|
|
|
13
13
|
*/
|
|
14
14
|
export interface EditablePanelDescriptor {
|
|
15
15
|
title: string;
|
|
16
|
-
/** Small label above the title (e.g. "
|
|
16
|
+
/** Small label above the title (e.g. "Form · enrolment-2026"). */
|
|
17
17
|
subtitle?: string;
|
|
18
18
|
/** Form schema tree — fields, sections, groups, headers (FormPanel shape). */
|
|
19
19
|
schema: FormSchemaNode[];
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NavErrorBoundary — error boundary for sidebar and page header.
|
|
3
3
|
* Shows a minimal fallback if navigation rendering fails.
|
|
4
|
-
*
|
|
5
|
-
* @see NV-05-ux-shell-sidebar.md §8.3
|
|
6
4
|
*/
|
|
7
5
|
|
|
8
6
|
import { Component, type ErrorInfo, type ReactElement, type ReactNode } from "react";
|
|
@@ -11,7 +11,7 @@ interface OverlayScreenProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Full-screen overlay panel with X close button
|
|
14
|
+
* Full-screen overlay panel with X close button.
|
|
15
15
|
*
|
|
16
16
|
* Not a modal (no backdrop, no centering). Renders a stacked screen
|
|
17
17
|
* on top of the current page. The underlying page stays mounted in the DOM.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* 2. Known localStorage keys (scan, not assume)
|
|
10
10
|
* 3. prefers-color-scheme media query (OS fallback)
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* CSS isolation via .middag-root
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
export type DetectedTheme = "dark" | "light" | "auto";
|
package/src/base/utils/icons.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Blocks receive icon names as strings from the server; this util resolves them.
|
|
5
5
|
* Delegates to the icon registry populated by registerDefaultIcons().
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Blocks reference icons by kebab-case name.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { InboxIcon } from "@hugeicons/core-free-icons";
|
package/src/base/utils/time.ts
CHANGED
|
@@ -7,14 +7,12 @@
|
|
|
7
7
|
*
|
|
8
8
|
* formatRelativeTime() keeps the hybrid scale used by timeline/timestamp
|
|
9
9
|
* displays:
|
|
10
|
-
* - < 1 min: "now"
|
|
11
|
-
* - < 1h: "N minutes ago"
|
|
10
|
+
* - < 1 min: "now"
|
|
11
|
+
* - < 1h: "N minutes ago"
|
|
12
12
|
* - < 24h: time of day (locale short time)
|
|
13
13
|
* - yesterday: "yesterday, <time>"
|
|
14
14
|
* - < 30 days: "<day month>, <time>"
|
|
15
15
|
* - >= 30 days: "<day month year>"
|
|
16
|
-
*
|
|
17
|
-
* @see NV-05-ux-blocks.md §6 (timeline timestamps)
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
import type { TimestampFormat } from "@/contracts/block-data";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Block data contracts — typed data shapes for the
|
|
2
|
+
* Block data contracts — typed data shapes for the block types.
|
|
3
3
|
*
|
|
4
4
|
* Imported by block components for BlockProps<TData> type parameter.
|
|
5
5
|
* These mirror the JSON shapes sent from PHP controllers via Inertia.
|
|
6
|
-
*
|
|
7
|
-
* @see ADR-807 ref/page-contract-v1 §5
|
|
8
|
-
* @see NV-05-ux-blocks.md
|
|
9
6
|
*/
|
|
10
7
|
|
|
11
8
|
export * from "./actions";
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Navigation contract — typed shape for the `navigation` Inertia shared prop.
|
|
3
3
|
*
|
|
4
|
-
* Unified tree model
|
|
4
|
+
* Unified tree model.
|
|
5
5
|
* PHP serializes this from navigation_registry during boot().
|
|
6
6
|
* Frontend reads it from usePage().props.navigation.
|
|
7
|
-
*
|
|
8
|
-
* @see ADR-807 ref/shell-and-navigation §4
|
|
9
|
-
* @see NV-05-ux-shell-sidebar.md §1.3
|
|
10
7
|
*/
|
|
11
8
|
|
|
12
9
|
/** Entity types for automatic icon resolution when no explicit icon is set. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ContractPage — entry point for any page driven by PageContract.
|
|
3
3
|
*
|
|
4
|
-
* Resolves shell → layout → blocks through registries
|
|
4
|
+
* Resolves shell → layout → blocks through registries.
|
|
5
5
|
* Feature pages compose their contract in the backend; the runtime
|
|
6
6
|
* handles rendering deterministically.
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ import { isLazyBlock, LazyBlock } from "@/engine/LazyBlock";
|
|
|
22
22
|
import { resolveBlock, resolveLayout, resolveShell } from "@/engine/registries";
|
|
23
23
|
import { useTranslation } from "@/i18n/useTranslation";
|
|
24
24
|
|
|
25
|
-
// Registry-based dynamic component resolution
|
|
25
|
+
// Registry-based dynamic component resolution. Shell and Layout are
|
|
26
26
|
// stable singleton references retrieved from the registry — not new components.
|
|
27
27
|
/* eslint-disable react-hooks/static-components */
|
|
28
28
|
export function ContractPage({
|
|
@@ -39,7 +39,7 @@ export function ContractPage({
|
|
|
39
39
|
[contract?.shell],
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
//
|
|
42
|
+
// unknown layout falls back to "stack" instead of rendering error
|
|
43
43
|
const Layout = useMemo(() => {
|
|
44
44
|
const resolved = resolveLayout(contract?.layout?.template);
|
|
45
45
|
if (!resolved) {
|
|
@@ -48,14 +48,14 @@ export function ContractPage({
|
|
|
48
48
|
return resolved;
|
|
49
49
|
}, [contract?.layout?.template]);
|
|
50
50
|
|
|
51
|
-
//
|
|
51
|
+
// stable reference — prevents Layout re-renders if it's memoized
|
|
52
52
|
const renderBlock = useCallback(
|
|
53
53
|
(block: BlockDescriptor): ReactElement | null => {
|
|
54
54
|
const Block = resolveBlock(block.type);
|
|
55
55
|
|
|
56
56
|
if (!Block) {
|
|
57
57
|
// role="alert" surfaces the diagnostic to assistive tech; the specific
|
|
58
|
-
// block type is a dev-only detail
|
|
58
|
+
// block type is a dev-only detail — prod shows only the
|
|
59
59
|
// translated category so internal keys never leak to end users.
|
|
60
60
|
return (
|
|
61
61
|
<div
|
|
@@ -97,7 +97,7 @@ export function ContractPage({
|
|
|
97
97
|
// ── Early returns after all hooks ───────────────────────────────────────
|
|
98
98
|
|
|
99
99
|
if (validationErrors) {
|
|
100
|
-
// The per-field validation list is a dev diagnostic
|
|
100
|
+
// The per-field validation list is a dev diagnostic; prod
|
|
101
101
|
// renders only the translated headline inside the alert.
|
|
102
102
|
return (
|
|
103
103
|
<div
|
package/src/engine/HostSlot.tsx
CHANGED
|
@@ -47,8 +47,6 @@
|
|
|
47
47
|
* | `middag-global-search` | Central search bar (⌘K) | local_middag |
|
|
48
48
|
* | `middag-org-selector` | Organization/scope switcher | local_middag |
|
|
49
49
|
* | `middag-quick-menu` | MIDDAG quick-access grid | local_middag |
|
|
50
|
-
*
|
|
51
|
-
* @see ADR-807 ref/host-integration
|
|
52
50
|
*/
|
|
53
51
|
|
|
54
52
|
"use client";
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* AuthProvider — React context for authenticated user data and capability checks.
|
|
3
3
|
*
|
|
4
4
|
* Reads auth from Inertia shared props populated by inertia_shared_props.php.
|
|
5
|
-
*
|
|
6
|
-
* @see NV-05-ux-shell-sidebar.md §1.3
|
|
7
5
|
*/
|
|
8
6
|
|
|
9
7
|
import { createContext, useContext, useMemo, type ReactNode } from "react";
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
* Flash messages are server-sent one-shot notifications (success/error/info/warning).
|
|
5
5
|
* This provider listens to flash prop changes on each Inertia navigation and
|
|
6
6
|
* fires the appropriate toast. Does not re-fire if flash is unchanged.
|
|
7
|
-
*
|
|
8
|
-
* @see NV-05-ux-shell-sidebar.md §1.3
|
|
9
7
|
*/
|
|
10
8
|
|
|
11
9
|
import { useEffect, useRef, type ReactNode } from "react";
|