@cosmicdrift/kumiko-renderer-web 0.244.0 → 0.246.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/package.json +5 -5
- package/src/__tests__/nav-tree.test.tsx +86 -2
- package/src/__tests__/primitives.test.tsx +28 -0
- package/src/__tests__/projection-detail.test.tsx +140 -0
- package/src/layout/__tests__/shell-breadcrumb.test.ts +74 -0
- package/src/layout/nav-tree.tsx +72 -30
- package/src/layout/shell-breadcrumb.ts +55 -21
- package/src/primitives/__tests__/select-display-request.test.tsx +122 -0
- package/src/primitives/index.tsx +13 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.246.0",
|
|
4
4
|
"description": "Web-platform bindings for @cosmicdrift/kumiko-renderer. HTML default-primitives, browser history-based navigation, EventSource-backed live events, and a one-call createKumikoApp that mounts the whole stack via react-dom.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"./styles.css": "./src/styles.css"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.
|
|
20
|
-
"@cosmicdrift/kumiko-headless": "0.
|
|
21
|
-
"@cosmicdrift/kumiko-renderer": "0.
|
|
19
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.246.0",
|
|
20
|
+
"@cosmicdrift/kumiko-headless": "0.246.0",
|
|
21
|
+
"@cosmicdrift/kumiko-renderer": "0.246.0",
|
|
22
22
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
23
23
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
24
24
|
"@radix-ui/react-label": "^2.1.8",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/react-dom": "^19.2.3",
|
|
65
65
|
"jsdom": "^29.1.1",
|
|
66
66
|
"tailwindcss": "^4.3.0",
|
|
67
|
-
"@cosmicdrift/kumiko-locale-de": "0.
|
|
67
|
+
"@cosmicdrift/kumiko-locale-de": "0.246.0"
|
|
68
68
|
},
|
|
69
69
|
"repository": {
|
|
70
70
|
"type": "git",
|
|
@@ -21,8 +21,8 @@ import type {
|
|
|
21
21
|
TreeChildrenSubscribe,
|
|
22
22
|
TreeNode,
|
|
23
23
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
24
|
-
import type { FeatureSchema, LiveEventSubscriber } from "@cosmicdrift/kumiko-renderer";
|
|
25
|
-
import { LiveEventsProvider } from "@cosmicdrift/kumiko-renderer";
|
|
24
|
+
import type { FeatureSchema, LiveEventSubscriber, NavApi } from "@cosmicdrift/kumiko-renderer";
|
|
25
|
+
import { LiveEventsProvider, NavProvider } from "@cosmicdrift/kumiko-renderer";
|
|
26
26
|
import { act } from "@testing-library/react";
|
|
27
27
|
import type { ReactNode } from "react";
|
|
28
28
|
import { NavProvidersProvider } from "../app/nav-providers-context";
|
|
@@ -463,6 +463,90 @@ describe("NavTree navBadges (Runtime-Badge-Slot)", () => {
|
|
|
463
463
|
});
|
|
464
464
|
});
|
|
465
465
|
|
|
466
|
+
// fw#2724: leaving a list for a sub-screen (entityEdit/actionForm/...) used
|
|
467
|
+
// to lose BOTH orientation cues at once — nav marks nothing, breadcrumb
|
|
468
|
+
// shrinks to one crumb. NavTree now falls back to resolveParentScreenId
|
|
469
|
+
// (same resolution shell-breadcrumb.ts uses) when the routed screen has no
|
|
470
|
+
// node of its own in the tree.
|
|
471
|
+
function navWithRoute(screenId: string): NavApi {
|
|
472
|
+
return {
|
|
473
|
+
route: { screenId },
|
|
474
|
+
navigate: () => {},
|
|
475
|
+
replace: () => {},
|
|
476
|
+
hrefFor: () => "",
|
|
477
|
+
searchParams: {},
|
|
478
|
+
setSearchParams: () => {},
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
describe("NavTree active-marker parent fallback", () => {
|
|
483
|
+
test("screen without its own nav entry highlights the resolved parent, without aria-current", () => {
|
|
484
|
+
const schema: FeatureSchema = {
|
|
485
|
+
featureName: "showcase",
|
|
486
|
+
entities: {},
|
|
487
|
+
screens: [
|
|
488
|
+
{ id: "user-list", type: "entityList", entity: "profile", columns: [] },
|
|
489
|
+
{
|
|
490
|
+
id: "user-edit",
|
|
491
|
+
type: "entityEdit",
|
|
492
|
+
// Deliberately a DIFFERENT entity than "user-list" — the old
|
|
493
|
+
// same-entity heuristic must NOT be what resolves this; only the
|
|
494
|
+
// explicit listScreenId does.
|
|
495
|
+
entity: "user-detail",
|
|
496
|
+
listScreenId: "user-list",
|
|
497
|
+
layout: { sections: [{ fields: [] }] },
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
navs: [{ id: "user-list", label: "Users", screen: "user-list", order: 10 }],
|
|
501
|
+
} as FeatureSchema;
|
|
502
|
+
|
|
503
|
+
render(
|
|
504
|
+
<NavProvider value={navWithRoute("user-edit")}>
|
|
505
|
+
<NavTree schema={schema} />
|
|
506
|
+
</NavProvider>,
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
const link = screen.getByText("Users").closest("a");
|
|
510
|
+
expect(link?.getAttribute("data-active")).toBe("true");
|
|
511
|
+
expect(link?.hasAttribute("aria-current")).toBe(false);
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
test("screen with its own nav entry still marks itself and keeps aria-current=page", () => {
|
|
515
|
+
const schema: FeatureSchema = {
|
|
516
|
+
featureName: "showcase",
|
|
517
|
+
entities: {},
|
|
518
|
+
screens: [
|
|
519
|
+
{ id: "user-list", type: "entityList", entity: "profile", columns: [] },
|
|
520
|
+
{
|
|
521
|
+
id: "user-edit",
|
|
522
|
+
type: "entityEdit",
|
|
523
|
+
entity: "profile",
|
|
524
|
+
layout: { sections: [{ fields: [] }] },
|
|
525
|
+
},
|
|
526
|
+
],
|
|
527
|
+
navs: [
|
|
528
|
+
{ id: "user-list", label: "Users", screen: "user-list", order: 10 },
|
|
529
|
+
{ id: "user-edit", label: "Edit User", screen: "user-edit", order: 20 },
|
|
530
|
+
],
|
|
531
|
+
} as FeatureSchema;
|
|
532
|
+
|
|
533
|
+
render(
|
|
534
|
+
<NavProvider value={navWithRoute("user-edit")}>
|
|
535
|
+
<NavTree schema={schema} />
|
|
536
|
+
</NavProvider>,
|
|
537
|
+
);
|
|
538
|
+
|
|
539
|
+
const editLink = screen.getByText("Edit User").closest("a");
|
|
540
|
+
expect(editLink?.getAttribute("data-active")).toBe("true");
|
|
541
|
+
expect(editLink?.getAttribute("aria-current")).toBe("page");
|
|
542
|
+
|
|
543
|
+
// The list is not silently highlighted too — only the exact match is.
|
|
544
|
+
const listLink = screen.getByText("Users").closest("a");
|
|
545
|
+
expect(listLink?.getAttribute("data-active")).toBe("false");
|
|
546
|
+
expect(listLink?.hasAttribute("aria-current")).toBe(false);
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
|
|
466
550
|
// ── Visual-Tree-Merge: dynamische Knoten in der EINEN Nav ──────────────
|
|
467
551
|
//
|
|
468
552
|
// Beweist die vier Caps die NavTree aus dem alten VisualTree übernimmt:
|
|
@@ -437,6 +437,34 @@ describe("DataTable", () => {
|
|
|
437
437
|
expect(onRowClick).toHaveBeenCalledWith(row);
|
|
438
438
|
});
|
|
439
439
|
|
|
440
|
+
// chromeless (fw#2722): a relatedList section in a tabs-mode Akte already
|
|
441
|
+
// sits inside a tab panel — the table's own card frame would nest a card
|
|
442
|
+
// inside that boundary without separating anything further.
|
|
443
|
+
describe("chromeless", () => {
|
|
444
|
+
const cols = [{ field: "name", label: "Name", type: "string", sortable: false }] as const;
|
|
445
|
+
const oneRow = [{ id: "r1", values: { name: "Alice" } }];
|
|
446
|
+
|
|
447
|
+
// Table itself renders its own [data-slot="table-container"] wrapper div
|
|
448
|
+
// (ui/table.tsx) around the <table data-testid> — the card frame lives
|
|
449
|
+
// one level up, on DefaultDataTable's own wrapping div.
|
|
450
|
+
test("default: table renders with its own card frame", () => {
|
|
451
|
+
render(<DataTable columns={cols} rows={oneRow} testId="t" />);
|
|
452
|
+
const wrapper = screen.getByTestId("t").parentElement?.parentElement;
|
|
453
|
+
expect(wrapper?.className).toContain("border");
|
|
454
|
+
expect(wrapper?.className).toContain("rounded-lg");
|
|
455
|
+
expect(wrapper?.className).toContain("bg-card");
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
test("chromeless: table drops the card frame, table markup is unchanged", () => {
|
|
459
|
+
render(<DataTable columns={cols} rows={oneRow} testId="t" chromeless />);
|
|
460
|
+
const wrapper = screen.getByTestId("t").parentElement?.parentElement;
|
|
461
|
+
expect(wrapper?.className).not.toContain("border");
|
|
462
|
+
expect(wrapper?.className).not.toContain("rounded-lg");
|
|
463
|
+
expect(wrapper?.className).not.toContain("bg-card");
|
|
464
|
+
expect(screen.getByTestId("row-r1")).not.toBeNull();
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
|
|
440
468
|
// Sort-Header pinnt das 3-State-Toggle-Verhalten + Visual-Indicator
|
|
441
469
|
// + aria-sort. Renderer-Vertrag mit dem Caller (RenderList): jede
|
|
442
470
|
// sortable-Column liefert beim Click den nächsten Sort-State zurück
|
|
@@ -923,3 +923,143 @@ describe("KumikoScreen / projectionDetail extension section with its own <form>
|
|
|
923
923
|
expect(outerSubmitFired).toBe(false);
|
|
924
924
|
});
|
|
925
925
|
});
|
|
926
|
+
|
|
927
|
+
// fw#2713: `actions` are on the record the head shows, not on whichever tab
|
|
928
|
+
// is open — they used to render in the card footer, below the active tab's
|
|
929
|
+
// content, so a long tab pushed them off-screen and they visually "moved"
|
|
930
|
+
// as the tab content's length changed. They now render inside the head
|
|
931
|
+
// region (title/status/metrics), before any tab content, in both layout
|
|
932
|
+
// modes — `single` gets the same treatment as `tabs` since the actions
|
|
933
|
+
// belong to the header regardless of how the body is laid out.
|
|
934
|
+
describe("KumikoScreen / projectionDetail header actions placement (fw#2713)", () => {
|
|
935
|
+
const dispatcher: Dispatcher = createMockDispatcher({
|
|
936
|
+
query: (async () => ({
|
|
937
|
+
isSuccess: true,
|
|
938
|
+
data: { userId: "user-42", createdAt: "2026-07-01T00:00:00Z" },
|
|
939
|
+
})) as unknown as Dispatcher["query"],
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
test("with actions declared: the action button renders in the head region, before the tab content, not in the form footer", async () => {
|
|
943
|
+
const screenWithActions: ProjectionDetailScreenDefinition = {
|
|
944
|
+
...detailScreen,
|
|
945
|
+
header: { title: "userId" },
|
|
946
|
+
layout: { mode: "tabs", sections: detailScreen.layout.sections },
|
|
947
|
+
actions: [
|
|
948
|
+
{
|
|
949
|
+
kind: "navigate",
|
|
950
|
+
id: "open-user",
|
|
951
|
+
label: "sessions.detail.action.openUser",
|
|
952
|
+
screen: "user-detail",
|
|
953
|
+
},
|
|
954
|
+
],
|
|
955
|
+
};
|
|
956
|
+
const schemaWithActions: FeatureSchema = {
|
|
957
|
+
featureName: "sessions",
|
|
958
|
+
entities: {},
|
|
959
|
+
screens: [screenWithActions],
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
render(
|
|
963
|
+
<DispatcherProvider dispatcher={dispatcher}>
|
|
964
|
+
<KumikoScreen
|
|
965
|
+
schema={schemaWithActions}
|
|
966
|
+
qn="sessions:screen:session-detail"
|
|
967
|
+
entityId="sess-1"
|
|
968
|
+
/>
|
|
969
|
+
</DispatcherProvider>,
|
|
970
|
+
);
|
|
971
|
+
|
|
972
|
+
const actionButton = await waitFor(() => screen.getByTestId("render-edit-action-open-user"));
|
|
973
|
+
// The footer regions RenderEdit's Form would otherwise draw the action
|
|
974
|
+
// into are gone entirely — the action moved out, it didn't just gain a
|
|
975
|
+
// second home.
|
|
976
|
+
expect(screen.queryByTestId("render-edit-form-actions")).toBeNull();
|
|
977
|
+
expect(screen.queryByTestId("render-edit-form-actions-secondary")).toBeNull();
|
|
978
|
+
// The action sits in the head Card, ahead of the field it shares a
|
|
979
|
+
// screen with in document order — i.e. inside headerRegion, not the
|
|
980
|
+
// card body below it.
|
|
981
|
+
const field = screen.getByTestId("field-userId");
|
|
982
|
+
expect(
|
|
983
|
+
actionButton.compareDocumentPosition(field) & Node.DOCUMENT_POSITION_FOLLOWING,
|
|
984
|
+
).toBeTruthy();
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
test("without actions: no action area renders at all (no empty strip, no leftover footer)", async () => {
|
|
988
|
+
render(
|
|
989
|
+
<DispatcherProvider dispatcher={dispatcher}>
|
|
990
|
+
<KumikoScreen schema={schema} qn="sessions:screen:session-detail" entityId="sess-1" />
|
|
991
|
+
</DispatcherProvider>,
|
|
992
|
+
);
|
|
993
|
+
|
|
994
|
+
await waitFor(() => screen.getByTestId("render-edit-form"));
|
|
995
|
+
expect(screen.queryByTestId("kumiko-screen-projection-detail-actions")).toBeNull();
|
|
996
|
+
expect(screen.queryByTestId("render-edit-form-actions")).toBeNull();
|
|
997
|
+
expect(screen.queryByTestId("render-edit-form-actions-secondary")).toBeNull();
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
test("switching tabs leaves the action in place — same head placement regardless of which tab is active", async () => {
|
|
1001
|
+
const tabsScreen: ProjectionDetailScreenDefinition = {
|
|
1002
|
+
...detailScreen,
|
|
1003
|
+
header: { title: "userId" },
|
|
1004
|
+
layout: {
|
|
1005
|
+
mode: "tabs",
|
|
1006
|
+
sections: [
|
|
1007
|
+
{ id: "overview", title: "Session", fields: ["userId"] },
|
|
1008
|
+
{ id: "meta", title: "Meta", fields: ["createdAt"] },
|
|
1009
|
+
],
|
|
1010
|
+
},
|
|
1011
|
+
actions: [
|
|
1012
|
+
{
|
|
1013
|
+
kind: "navigate",
|
|
1014
|
+
id: "open-user",
|
|
1015
|
+
label: "sessions.detail.action.openUser",
|
|
1016
|
+
screen: "user-detail",
|
|
1017
|
+
},
|
|
1018
|
+
],
|
|
1019
|
+
};
|
|
1020
|
+
const tabsSchema: FeatureSchema = {
|
|
1021
|
+
featureName: "sessions",
|
|
1022
|
+
entities: {},
|
|
1023
|
+
screens: [tabsScreen],
|
|
1024
|
+
};
|
|
1025
|
+
function navWithTab(tab: string | undefined): NavApi {
|
|
1026
|
+
return {
|
|
1027
|
+
route: undefined,
|
|
1028
|
+
navigate: () => {},
|
|
1029
|
+
replace: () => {},
|
|
1030
|
+
hrefFor: () => "",
|
|
1031
|
+
searchParams: tab !== undefined ? { tab } : {},
|
|
1032
|
+
setSearchParams: () => {},
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
const { unmount } = render(
|
|
1037
|
+
<NavProvider value={navWithTab("overview")}>
|
|
1038
|
+
<DispatcherProvider dispatcher={dispatcher}>
|
|
1039
|
+
<KumikoScreen schema={tabsSchema} qn="sessions:screen:session-detail" entityId="sess-1" />
|
|
1040
|
+
</DispatcherProvider>
|
|
1041
|
+
</NavProvider>,
|
|
1042
|
+
);
|
|
1043
|
+
const buttonOnOverview = await waitFor(() =>
|
|
1044
|
+
screen.getByTestId("render-edit-action-open-user"),
|
|
1045
|
+
);
|
|
1046
|
+
expect(buttonOnOverview.textContent).toBe("sessions.detail.action.openUser");
|
|
1047
|
+
unmount();
|
|
1048
|
+
|
|
1049
|
+
render(
|
|
1050
|
+
<NavProvider value={navWithTab("meta")}>
|
|
1051
|
+
<DispatcherProvider dispatcher={dispatcher}>
|
|
1052
|
+
<KumikoScreen schema={tabsSchema} qn="sessions:screen:session-detail" entityId="sess-1" />
|
|
1053
|
+
</DispatcherProvider>
|
|
1054
|
+
</NavProvider>,
|
|
1055
|
+
);
|
|
1056
|
+
const buttonOnMeta = await waitFor(() => screen.getByTestId("render-edit-action-open-user"));
|
|
1057
|
+
expect(buttonOnMeta.textContent).toBe("sessions.detail.action.openUser");
|
|
1058
|
+
// Same head placement on both tabs — ahead of whichever field the
|
|
1059
|
+
// active tab shows, not trailing it.
|
|
1060
|
+
const fieldOnMeta = screen.getByTestId("field-createdAt");
|
|
1061
|
+
expect(
|
|
1062
|
+
buttonOnMeta.compareDocumentPosition(fieldOnMeta) & Node.DOCUMENT_POSITION_FOLLOWING,
|
|
1063
|
+
).toBeTruthy();
|
|
1064
|
+
});
|
|
1065
|
+
});
|
|
@@ -105,4 +105,78 @@ describe("resolveDetailBreadcrumb", () => {
|
|
|
105
105
|
test("unknown screen returns undefined", () => {
|
|
106
106
|
expect(resolveDetailBreadcrumb([], "missing", t)).toBeUndefined();
|
|
107
107
|
});
|
|
108
|
+
|
|
109
|
+
// fw#2724: explicit `listScreenId` on entityEdit/actionForm must win over
|
|
110
|
+
// the rowAction/entity heuristics, not just supplement them (the way it
|
|
111
|
+
// already did for custom/projectionDetail above).
|
|
112
|
+
test("explicit listScreenId on entityEdit wins over the rowAction heuristic", () => {
|
|
113
|
+
const screens: ScreenDefinition[] = [
|
|
114
|
+
{
|
|
115
|
+
id: "user-list",
|
|
116
|
+
type: "entityList",
|
|
117
|
+
entity: "user",
|
|
118
|
+
columns: ["email"],
|
|
119
|
+
rowActions: [
|
|
120
|
+
{
|
|
121
|
+
kind: "navigate",
|
|
122
|
+
id: "view",
|
|
123
|
+
label: "kumiko.actions.view",
|
|
124
|
+
screen: "user-edit",
|
|
125
|
+
entityId: "id",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "user-archive",
|
|
131
|
+
type: "entityList",
|
|
132
|
+
entity: "user",
|
|
133
|
+
columns: ["email"],
|
|
134
|
+
rowActions: [],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "user-edit",
|
|
138
|
+
type: "entityEdit",
|
|
139
|
+
entity: "user",
|
|
140
|
+
listScreenId: "user-archive",
|
|
141
|
+
layout: { sections: [{ fields: ["email"] }] },
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
// Without the explicit field, the rowAction heuristic would resolve
|
|
145
|
+
// "user-list" (see "entityList navigate rowAction..." above) — the
|
|
146
|
+
// declared listScreenId overrides that guess.
|
|
147
|
+
expect(resolveDetailBreadcrumb(screens, "user-edit", t)?.[0]?.screenId).toBe("user-archive");
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Regression guard: an actionForm without listScreenId (the common case —
|
|
151
|
+
// the field is new and optional) must keep resolving exactly like before,
|
|
152
|
+
// via the rowAction heuristic. Pins that existing apps see no change.
|
|
153
|
+
test("actionForm without listScreenId still resolves via the rowAction heuristic", () => {
|
|
154
|
+
const screens: ScreenDefinition[] = [
|
|
155
|
+
{
|
|
156
|
+
id: "invoice-list",
|
|
157
|
+
type: "entityList",
|
|
158
|
+
entity: "invoice",
|
|
159
|
+
columns: ["status"],
|
|
160
|
+
rowActions: [
|
|
161
|
+
{
|
|
162
|
+
kind: "navigate",
|
|
163
|
+
id: "approve",
|
|
164
|
+
label: "kumiko.actions.view",
|
|
165
|
+
screen: "invoice-approve",
|
|
166
|
+
entityId: "id",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "invoice-approve",
|
|
172
|
+
type: "actionForm",
|
|
173
|
+
handler: "billing:write:invoice:approve",
|
|
174
|
+
fields: { notes: { type: "text" } },
|
|
175
|
+
layout: { sections: [{ fields: ["notes"] }] },
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
expect(resolveDetailBreadcrumb(screens, "invoice-approve", t)?.[0]?.screenId).toBe(
|
|
179
|
+
"invoice-list",
|
|
180
|
+
);
|
|
181
|
+
});
|
|
108
182
|
});
|
package/src/layout/nav-tree.tsx
CHANGED
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
SidebarMenuSubItem,
|
|
57
57
|
useSidebar,
|
|
58
58
|
} from "../ui/sidebar";
|
|
59
|
+
import { resolveParentScreenId } from "./shell-breadcrumb";
|
|
59
60
|
import { useDispatchTarget } from "./target-resolver-stub";
|
|
60
61
|
import { parseTargetFromSearchParams } from "./target-url";
|
|
61
62
|
|
|
@@ -92,6 +93,24 @@ const NavBadgesContext = createContext<ReadonlyMap<string, ReactNode>>(EMPTY_BAD
|
|
|
92
93
|
type NavFilter = { readonly q: string; readonly matches: (rawLabel: string) => boolean };
|
|
93
94
|
const NavFilterContext = createContext<NavFilter>({ q: "", matches: () => true });
|
|
94
95
|
|
|
96
|
+
// Which nav node should highlight for the current route. `exact` means the
|
|
97
|
+
// active screen has its own node in {tree} (aria-current="page" belongs
|
|
98
|
+
// here); otherwise {screenId} is the resolved parent from
|
|
99
|
+
// resolveParentScreenId — a screen reachable only through a list stays
|
|
100
|
+
// orientable, but a Screen-Reader shouldn't be told it IS that list.
|
|
101
|
+
type ActiveScreenMarker = { readonly screenId: string; readonly exact: boolean } | undefined;
|
|
102
|
+
const ActiveScreenMarkerContext = createContext<ActiveScreenMarker>(undefined);
|
|
103
|
+
|
|
104
|
+
// Walks only the static `children` — provider-emitted nodes (treeNodeToNavNode
|
|
105
|
+
// below) never set `screen`, so they can't hide a match this walk would miss.
|
|
106
|
+
function treeContainsScreen(nodes: readonly NavNode[], screenId: string): boolean {
|
|
107
|
+
return nodes.some(
|
|
108
|
+
(n) =>
|
|
109
|
+
(n.screen !== undefined && lastSegment(n.screen) === screenId) ||
|
|
110
|
+
treeContainsScreen(n.children, screenId),
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
95
114
|
// Ein Knoten überlebt den Filter, wenn er selbst oder ein Nachfahre matcht.
|
|
96
115
|
// Provider-Kinder sind zur Filterzeit schon materialisiert (Provider-Knoten
|
|
97
116
|
// sind default-expanded → eager geladen), darum reicht die statische
|
|
@@ -115,6 +134,19 @@ export function NavTree({
|
|
|
115
134
|
return resolveNavigation({ source, ...(user !== undefined && { user }) });
|
|
116
135
|
}, [app, user, allowedNavQns]);
|
|
117
136
|
|
|
137
|
+
const nav = useNav();
|
|
138
|
+
const activeScreenId = nav.route?.screenId;
|
|
139
|
+
// Same "no nav entry of its own" gap the breadcrumb closes (fw#2724):
|
|
140
|
+
// when the routed screen has no node in {tree}, fall back to its
|
|
141
|
+
// resolved parent so a detail/edit/form screen still orients the user.
|
|
142
|
+
const activeMarker = useMemo((): ActiveScreenMarker => {
|
|
143
|
+
if (activeScreenId === undefined) return undefined;
|
|
144
|
+
if (treeContainsScreen(tree, activeScreenId)) return { screenId: activeScreenId, exact: true };
|
|
145
|
+
const allScreens = app.features.flatMap((f) => f.screens);
|
|
146
|
+
const parentScreenId = resolveParentScreenId(allScreens, activeScreenId);
|
|
147
|
+
return parentScreenId !== undefined ? { screenId: parentScreenId, exact: false } : undefined;
|
|
148
|
+
}, [tree, app.features, activeScreenId]);
|
|
149
|
+
|
|
118
150
|
// Collapsed-Set: nur die explizit zugeklappten qualified-names. Default
|
|
119
151
|
// ist also "alles auf" — neue Features tauchen sofort offen auf, ohne
|
|
120
152
|
// dass der User erst klicken muss.
|
|
@@ -148,34 +180,36 @@ export function NavTree({
|
|
|
148
180
|
const navFilter = useMemo<NavFilter>(() => ({ q, matches }), [q, matches]);
|
|
149
181
|
|
|
150
182
|
return (
|
|
151
|
-
<
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
<div
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</div>
|
|
162
|
-
{tree.map((node) =>
|
|
163
|
-
isPureSection(node) ? (
|
|
164
|
-
<NavSection
|
|
165
|
-
key={node.qualifiedName}
|
|
166
|
-
node={node}
|
|
167
|
-
collapsed={collapsed}
|
|
168
|
-
onToggle={onToggle}
|
|
183
|
+
<ActiveScreenMarkerContext.Provider value={activeMarker}>
|
|
184
|
+
<NavFilterContext.Provider value={navFilter}>
|
|
185
|
+
<NavBadgesContext.Provider value={navBadges ?? EMPTY_BADGES}>
|
|
186
|
+
<div data-testid={testId} data-kumiko-layout="nav-tree" className="flex w-full flex-col">
|
|
187
|
+
<div className="px-2 pt-2 pb-1 group-data-[collapsible=icon]:hidden">
|
|
188
|
+
<SidebarInput
|
|
189
|
+
value={filter}
|
|
190
|
+
onChange={(e) => setFilter(e.target.value)}
|
|
191
|
+
placeholder={t("kumiko.nav.search")}
|
|
192
|
+
aria-label={t("kumiko.nav.search")}
|
|
169
193
|
/>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
194
|
+
</div>
|
|
195
|
+
{tree.map((node) =>
|
|
196
|
+
isPureSection(node) ? (
|
|
197
|
+
<NavSection
|
|
198
|
+
key={node.qualifiedName}
|
|
199
|
+
node={node}
|
|
200
|
+
collapsed={collapsed}
|
|
201
|
+
onToggle={onToggle}
|
|
202
|
+
/>
|
|
203
|
+
) : (
|
|
204
|
+
<SidebarMenu key={node.qualifiedName} className="px-2 py-1">
|
|
205
|
+
<NavMenuNode node={node} collapsed={collapsed} onToggle={onToggle} />
|
|
206
|
+
</SidebarMenu>
|
|
207
|
+
),
|
|
208
|
+
)}
|
|
209
|
+
</div>
|
|
210
|
+
</NavBadgesContext.Provider>
|
|
211
|
+
</NavFilterContext.Provider>
|
|
212
|
+
</ActiveScreenMarkerContext.Provider>
|
|
179
213
|
);
|
|
180
214
|
}
|
|
181
215
|
|
|
@@ -387,6 +421,9 @@ type NavNodeState = {
|
|
|
387
421
|
readonly expandable: boolean;
|
|
388
422
|
readonly isExpanded: boolean;
|
|
389
423
|
readonly active: boolean;
|
|
424
|
+
// Narrower than `active`: true only for the node that IS the routed
|
|
425
|
+
// screen — never for a parent-fallback match. Drives aria-current="page".
|
|
426
|
+
readonly ariaCurrent: boolean;
|
|
390
427
|
readonly childNodes: readonly NavNode[];
|
|
391
428
|
readonly hidden: boolean;
|
|
392
429
|
readonly providerLoading: boolean;
|
|
@@ -416,8 +453,12 @@ function useNavNodeState(node: NavNode, collapsed: ReadonlySet<string>): NavNode
|
|
|
416
453
|
() => parseTargetFromSearchParams(nav.searchParams),
|
|
417
454
|
[nav.searchParams],
|
|
418
455
|
);
|
|
456
|
+
const activeMarker = useContext(ActiveScreenMarkerContext);
|
|
419
457
|
const screenActive =
|
|
420
|
-
node.screen !== undefined &&
|
|
458
|
+
node.screen !== undefined &&
|
|
459
|
+
activeMarker !== undefined &&
|
|
460
|
+
lastSegment(node.screen) === activeMarker.screenId;
|
|
461
|
+
const screenIsExactMatch = screenActive && activeMarker?.exact === true;
|
|
421
462
|
const targetActive = node.target !== undefined && targetsEqual(node.target, activeTarget);
|
|
422
463
|
const childNodes = node.provider === true ? (providerChildren ?? []) : node.children;
|
|
423
464
|
const visibleChildNodes = filterActive
|
|
@@ -429,6 +470,7 @@ function useNavNodeState(node: NavNode, collapsed: ReadonlySet<string>): NavNode
|
|
|
429
470
|
expandable,
|
|
430
471
|
isExpanded,
|
|
431
472
|
active: screenActive || targetActive,
|
|
473
|
+
ariaCurrent: screenIsExactMatch || targetActive,
|
|
432
474
|
childNodes: visibleChildNodes,
|
|
433
475
|
// Ein gefilterter Knoten verschwindet nur, wenn weder er selbst noch ein
|
|
434
476
|
// sichtbar gebliebenes Kind matcht — sonst bliebe ein leerer Ordner-Header.
|
|
@@ -595,7 +637,7 @@ function NavMenuNode({ node, collapsed, onToggle }: NavSubProps): ReactNode {
|
|
|
595
637
|
<SidebarMenuButton asChild isActive={s.active} tooltip={s.displayLabel}>
|
|
596
638
|
<KumikoLink
|
|
597
639
|
to={{ ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }}
|
|
598
|
-
{...(s.
|
|
640
|
+
{...(s.ariaCurrent && { "aria-current": "page" })}
|
|
599
641
|
>
|
|
600
642
|
<NavLeadingIcon node={node} active={s.active} label={s.displayLabel} />
|
|
601
643
|
<span
|
|
@@ -715,7 +757,7 @@ function NavSubNode({ node, collapsed, onToggle }: NavSubProps): ReactNode {
|
|
|
715
757
|
<SidebarMenuSubButton asChild isActive={s.active}>
|
|
716
758
|
<KumikoLink
|
|
717
759
|
to={{ ...(s.workspaceId !== undefined && { workspaceId: s.workspaceId }), screenId }}
|
|
718
|
-
{...(s.
|
|
760
|
+
{...(s.ariaCurrent && { "aria-current": "page" })}
|
|
719
761
|
>
|
|
720
762
|
<NavLeadingIcon node={node} active={s.active} label={s.displayLabel} />
|
|
721
763
|
<span
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
-
import { lastSegment } from "
|
|
2
|
+
import { lastSegment } from "@cosmicdrift/kumiko-renderer";
|
|
3
3
|
|
|
4
4
|
export type BreadcrumbCrumb = {
|
|
5
5
|
readonly label: string;
|
|
@@ -10,13 +10,38 @@ export function screenTitleKey(screenShortId: string): string {
|
|
|
10
10
|
return `screen:${screenShortId}.title`;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// Every screen type carrying `listScreenId` declares it identically — reading
|
|
14
|
+
// it here (instead of at each call site) keeps the switch the only place
|
|
15
|
+
// that has to grow when a new screen type adopts the field.
|
|
16
|
+
function explicitListScreenId(screen: ScreenDefinition): string | undefined {
|
|
17
|
+
switch (screen.type) {
|
|
18
|
+
case "custom":
|
|
19
|
+
case "projectionDetail":
|
|
20
|
+
case "entityEdit":
|
|
21
|
+
case "actionForm":
|
|
22
|
+
return screen.listScreenId;
|
|
23
|
+
default:
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Shared by the breadcrumb (this file) and NavTree's active-marker fallback
|
|
29
|
+
// (nav-tree.tsx) — both need "which list screen does this detail belong to",
|
|
30
|
+
// so this is the one place that answers it. An explicit `listScreenId` wins
|
|
31
|
+
// over the heuristics below (rowAction target / same-entity entityList): a
|
|
32
|
+
// screen author who declares it is opting out of the guess.
|
|
33
|
+
function resolveParentScreen(
|
|
14
34
|
screens: readonly ScreenDefinition[],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
35
|
+
detail: ScreenDefinition,
|
|
36
|
+
): ScreenDefinition | undefined {
|
|
37
|
+
const detailScreenId = lastSegment(detail.id);
|
|
38
|
+
|
|
39
|
+
const listFromExplicit = ((): ScreenDefinition | undefined => {
|
|
40
|
+
const explicitId = explicitListScreenId(detail);
|
|
41
|
+
return explicitId !== undefined
|
|
42
|
+
? screens.find((s) => lastSegment(s.id) === explicitId)
|
|
43
|
+
: undefined;
|
|
44
|
+
})();
|
|
20
45
|
|
|
21
46
|
const listFromRowAction = screens.find((s) => {
|
|
22
47
|
if (s.type !== "entityList") return false;
|
|
@@ -28,22 +53,31 @@ export function resolveDetailBreadcrumb(
|
|
|
28
53
|
? screens.find((s) => s.type === "entityList" && s.entity === detail.entity)
|
|
29
54
|
: undefined;
|
|
30
55
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
? screens.find((s) => lastSegment(s.id) === detail.listScreenId)
|
|
34
|
-
: undefined;
|
|
56
|
+
return listFromExplicit ?? listFromRowAction ?? listFromEntity;
|
|
57
|
+
}
|
|
35
58
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
/** The short id of {screenId}'s parent list screen, resolved via the same
|
|
60
|
+
* logic as `resolveDetailBreadcrumb` — `undefined` when nothing resolves
|
|
61
|
+
* (unknown screen, or no explicit/heuristic parent). */
|
|
62
|
+
export function resolveParentScreenId(
|
|
63
|
+
screens: readonly ScreenDefinition[],
|
|
64
|
+
screenId: string,
|
|
65
|
+
): string | undefined {
|
|
66
|
+
const detail = screens.find((s) => lastSegment(s.id) === screenId);
|
|
67
|
+
if (detail === undefined) return undefined;
|
|
68
|
+
const parent = resolveParentScreen(screens, detail);
|
|
69
|
+
return parent !== undefined ? lastSegment(parent.id) : undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function resolveDetailBreadcrumb(
|
|
73
|
+
screens: readonly ScreenDefinition[],
|
|
74
|
+
detailScreenId: string,
|
|
75
|
+
t: (key: string) => string,
|
|
76
|
+
): readonly BreadcrumbCrumb[] | undefined {
|
|
77
|
+
const detail = screens.find((s) => lastSegment(s.id) === detailScreenId);
|
|
78
|
+
if (detail === undefined) return undefined;
|
|
44
79
|
|
|
45
|
-
const list =
|
|
46
|
-
listFromRowAction ?? listFromEntity ?? listFromCustomParent ?? listFromProjectionDetailParent;
|
|
80
|
+
const list = resolveParentScreen(screens, detail);
|
|
47
81
|
if (list === undefined) {
|
|
48
82
|
return [{ label: t(screenTitleKey(detailScreenId)) }];
|
|
49
83
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// `kind: "select"` with an explicit `display` (#2711). The short-option-set
|
|
2
|
+
// heuristic covered by select-segmented.test.tsx stays the default; these
|
|
3
|
+
// tests only cover the case where the caller states a presentation and the
|
|
4
|
+
// heuristic would have decided the other way.
|
|
5
|
+
|
|
6
|
+
import { describe, expect, test } from "bun:test";
|
|
7
|
+
import { fireEvent } from "@testing-library/react";
|
|
8
|
+
import { render, screen } from "../../__tests__/test-utils";
|
|
9
|
+
import { defaultPrimitives } from "../index";
|
|
10
|
+
|
|
11
|
+
const { Field, Input } = defaultPrimitives;
|
|
12
|
+
|
|
13
|
+
// Six options, every label past the 14-char threshold — the heuristic would
|
|
14
|
+
// render a dropdown for these.
|
|
15
|
+
const HEURISTIC_REJECTS = [
|
|
16
|
+
"Background Jobs Queue",
|
|
17
|
+
"Inbound Mail Processing",
|
|
18
|
+
"Realtime Event Stream",
|
|
19
|
+
"Scheduled Reporting",
|
|
20
|
+
"Tenant Provisioning",
|
|
21
|
+
"Search Index Rebuild",
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
// Three short labels — the heuristic would render the radio group for these.
|
|
25
|
+
const HEURISTIC_ACCEPTS = ["Draft", "Review", "Done"];
|
|
26
|
+
|
|
27
|
+
function renderSelect(
|
|
28
|
+
options: readonly string[],
|
|
29
|
+
overrides: {
|
|
30
|
+
readonly display?: "radio" | "dropdown";
|
|
31
|
+
readonly value?: string;
|
|
32
|
+
} = {},
|
|
33
|
+
): string[] {
|
|
34
|
+
const changes: string[] = [];
|
|
35
|
+
render(
|
|
36
|
+
<Field id="area" label="Area" testId="field-area">
|
|
37
|
+
<Input
|
|
38
|
+
kind="select"
|
|
39
|
+
id="area"
|
|
40
|
+
name="area"
|
|
41
|
+
value={overrides.value ?? options[0] ?? ""}
|
|
42
|
+
onChange={(v) => changes.push(v)}
|
|
43
|
+
options={options}
|
|
44
|
+
{...(overrides.display !== undefined && { display: overrides.display })}
|
|
45
|
+
/>
|
|
46
|
+
</Field>,
|
|
47
|
+
);
|
|
48
|
+
return changes;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
describe("DefaultInput select — explicit display request", () => {
|
|
52
|
+
test('display: "radio" renders the radio group even where the heuristic says dropdown', () => {
|
|
53
|
+
renderSelect(HEURISTIC_REJECTS, { display: "radio" });
|
|
54
|
+
expect(screen.queryByTestId("combobox-area")).toBeNull();
|
|
55
|
+
expect(screen.getAllByRole("radio")).toHaveLength(6);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("the forced radio group keeps the accessible group name and checked state", () => {
|
|
59
|
+
renderSelect(HEURISTIC_REJECTS, {
|
|
60
|
+
display: "radio",
|
|
61
|
+
value: "Realtime Event Stream",
|
|
62
|
+
});
|
|
63
|
+
expect(screen.getByRole("radiogroup", { name: "Area" })).toBeTruthy();
|
|
64
|
+
expect(
|
|
65
|
+
screen.getByRole("radio", { name: "Realtime Event Stream" }).getAttribute("aria-checked"),
|
|
66
|
+
).toBe("true");
|
|
67
|
+
expect(
|
|
68
|
+
screen.getByRole("radio", { name: "Background Jobs Queue" }).getAttribute("aria-checked"),
|
|
69
|
+
).toBe("false");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("the forced radio group reports the raw option value on click", () => {
|
|
73
|
+
const changes = renderSelect(HEURISTIC_REJECTS, {
|
|
74
|
+
display: "radio",
|
|
75
|
+
value: "Background Jobs Queue",
|
|
76
|
+
});
|
|
77
|
+
fireEvent.click(screen.getByRole("radio", { name: "Search Index Rebuild" }));
|
|
78
|
+
expect(changes).toEqual(["Search Index Rebuild"]);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('display: "dropdown" keeps the dropdown where the heuristic says radio group', () => {
|
|
82
|
+
renderSelect(HEURISTIC_ACCEPTS, { display: "dropdown" });
|
|
83
|
+
expect(screen.queryByRole("radiogroup")).toBeNull();
|
|
84
|
+
expect(screen.getByTestId("combobox-area")).toBeTruthy();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("no display stated: the heuristic still decides", () => {
|
|
88
|
+
renderSelect(HEURISTIC_REJECTS);
|
|
89
|
+
expect(screen.getByTestId("combobox-area")).toBeTruthy();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('display: "radio" without options falls back to the dropdown, not an empty group', () => {
|
|
93
|
+
renderSelect([], { display: "radio" });
|
|
94
|
+
expect(screen.queryByRole("radiogroup")).toBeNull();
|
|
95
|
+
expect(screen.getByTestId("combobox-area")).toBeTruthy();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("labelled options render their label and report their value", () => {
|
|
99
|
+
const changes: string[] = [];
|
|
100
|
+
render(
|
|
101
|
+
<Field id="area" label="Area" testId="field-area">
|
|
102
|
+
<Input
|
|
103
|
+
kind="select"
|
|
104
|
+
id="area"
|
|
105
|
+
name="area"
|
|
106
|
+
value="jobs"
|
|
107
|
+
onChange={(v) => changes.push(v)}
|
|
108
|
+
display="radio"
|
|
109
|
+
options={[
|
|
110
|
+
{ value: "jobs", label: "Background Jobs Queue" },
|
|
111
|
+
{ value: "mail", label: "Inbound Mail Processing" },
|
|
112
|
+
{ value: "search", label: "Search Index Rebuild" },
|
|
113
|
+
{ value: "events", label: "Realtime Event Stream" },
|
|
114
|
+
{ value: "tenants", label: "Tenant Provisioning" },
|
|
115
|
+
]}
|
|
116
|
+
/>
|
|
117
|
+
</Field>,
|
|
118
|
+
);
|
|
119
|
+
fireEvent.click(screen.getByRole("radio", { name: "Inbound Mail Processing" }));
|
|
120
|
+
expect(changes).toEqual(["mail"]);
|
|
121
|
+
});
|
|
122
|
+
});
|
package/src/primitives/index.tsx
CHANGED
|
@@ -422,11 +422,10 @@ function withUnitSuffix(unit: string | undefined, input: ReactNode): ReactNode {
|
|
|
422
422
|
);
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
//
|
|
425
|
+
// Default presentation for `kind: "select"` with a small closed option set —
|
|
426
426
|
// a 4-value Status field looked wrong stretched into a full-width dropdown
|
|
427
|
-
// (edit-existing screenshot feedback).
|
|
428
|
-
//
|
|
429
|
-
// `options` + string value/onChange).
|
|
427
|
+
// (edit-existing screenshot feedback). Only consulted when the caller states
|
|
428
|
+
// no `display` of its own; an explicit `display` wins (#2711).
|
|
430
429
|
const SEGMENTED_SELECT_MAX_OPTIONS = 4;
|
|
431
430
|
const SEGMENTED_SELECT_MAX_LABEL_LENGTH = 14;
|
|
432
431
|
|
|
@@ -699,7 +698,13 @@ function DefaultInput(props: InputProps): ReactNode {
|
|
|
699
698
|
const comboOptions = props.options.map((o) =>
|
|
700
699
|
typeof o === "string" ? { value: o, label: o } : o,
|
|
701
700
|
);
|
|
702
|
-
|
|
701
|
+
// An explicit `display` is an author decision and outranks the
|
|
702
|
+
// heuristic in both directions — a requested radio group renders as
|
|
703
|
+
// one even when the labels are long or numerous (#2711).
|
|
704
|
+
const wantsRadioGroup =
|
|
705
|
+
props.display === "radio" ||
|
|
706
|
+
(props.display === undefined && isSegmentedSelectEligible(comboOptions));
|
|
707
|
+
if (wantsRadioGroup && comboOptions.length > 0) {
|
|
703
708
|
return (
|
|
704
709
|
<SegmentedSelect
|
|
705
710
|
id={props.id}
|
|
@@ -898,6 +903,7 @@ function DefaultDataTable({
|
|
|
898
903
|
onCellChange,
|
|
899
904
|
getRowTestId,
|
|
900
905
|
getCellTestId,
|
|
906
|
+
chromeless,
|
|
901
907
|
}: DataTableProps): ReactNode {
|
|
902
908
|
// One locale/translate subscription per table — not per cell (fw#2345).
|
|
903
909
|
// Optional hooks: a bare DataTable outside LocaleProvider must not crash.
|
|
@@ -930,7 +936,8 @@ function DefaultDataTable({
|
|
|
930
936
|
// trägt den bg-muted-Grauton. `bg-card` (statt transparent) → die Liste
|
|
931
937
|
// sitzt auf derselben Card-Fläche wie Forms; auf Themes mit farbigem
|
|
932
938
|
// Page-Background (z.B. Cream) matchen Listen sonst nicht die Cards.
|
|
933
|
-
|
|
939
|
+
// `chromeless` drops that frame for a host with its own boundary already (a tab panel, fw#2722).
|
|
940
|
+
<div className={cn("overflow-hidden", chromeless !== true && "rounded-lg border bg-card")}>
|
|
934
941
|
<Table data-testid={testId}>
|
|
935
942
|
<TableHeader className="bg-muted">
|
|
936
943
|
<TableRow className="hover:bg-transparent">
|