@cosmicdrift/kumiko-renderer-web 0.143.0 → 0.145.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 +4 -4
- package/src/widgets/result-panel.tsx +44 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.145.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.145.0",
|
|
20
|
+
"@cosmicdrift/kumiko-headless": "0.145.0",
|
|
21
|
+
"@cosmicdrift/kumiko-renderer": "0.145.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,22 +64,30 @@ export function ResultTable<Row>({
|
|
|
64
64
|
rowKey,
|
|
65
65
|
testId,
|
|
66
66
|
className,
|
|
67
|
+
card,
|
|
67
68
|
}: {
|
|
68
69
|
readonly columns: readonly ResultColumn<Row>[];
|
|
69
70
|
readonly rows: readonly Row[];
|
|
70
71
|
readonly rowKey: (row: Row, index: number) => string;
|
|
71
72
|
readonly testId?: string;
|
|
72
73
|
readonly className?: string;
|
|
74
|
+
/** Rahmen-Look wie die CRUD-Liste (DataTable): gerundeter Border-Container +
|
|
75
|
+
* bg-muted-Header-Band. Default = bare (nur die Tabelle, ohne Container). */
|
|
76
|
+
readonly card?: boolean;
|
|
73
77
|
}): ReactNode {
|
|
74
|
-
|
|
78
|
+
const table = (
|
|
75
79
|
<div className="overflow-x-auto">
|
|
76
80
|
<table data-testid={testId} className={cn("w-full text-sm", className)}>
|
|
77
|
-
<thead>
|
|
81
|
+
<thead className={cn(card === true && "bg-muted")}>
|
|
78
82
|
<tr className="border-b text-left text-muted-foreground">
|
|
79
83
|
{columns.map((col) => (
|
|
80
84
|
<th
|
|
81
85
|
key={col.header}
|
|
82
|
-
className={cn(
|
|
86
|
+
className={cn(
|
|
87
|
+
"py-1.5 font-medium",
|
|
88
|
+
card === true && "px-3",
|
|
89
|
+
col.align === "right" && "text-right",
|
|
90
|
+
)}
|
|
83
91
|
>
|
|
84
92
|
{col.header}
|
|
85
93
|
</th>
|
|
@@ -92,7 +100,11 @@ export function ResultTable<Row>({
|
|
|
92
100
|
{columns.map((col) => (
|
|
93
101
|
<td
|
|
94
102
|
key={col.header}
|
|
95
|
-
className={cn(
|
|
103
|
+
className={cn(
|
|
104
|
+
"py-1.5",
|
|
105
|
+
card === true && "px-3",
|
|
106
|
+
col.align === "right" && "text-right tabular-nums",
|
|
107
|
+
)}
|
|
96
108
|
>
|
|
97
109
|
{col.cell(row)}
|
|
98
110
|
</td>
|
|
@@ -103,6 +115,11 @@ export function ResultTable<Row>({
|
|
|
103
115
|
</table>
|
|
104
116
|
</div>
|
|
105
117
|
);
|
|
118
|
+
return card === true ? (
|
|
119
|
+
<div className="overflow-hidden rounded-lg border bg-card">{table}</div>
|
|
120
|
+
) : (
|
|
121
|
+
table
|
|
122
|
+
);
|
|
106
123
|
}
|
|
107
124
|
|
|
108
125
|
export interface ComparisonMetric<Col> {
|
|
@@ -123,6 +140,7 @@ export function ComparisonTable<Col>({
|
|
|
123
140
|
metricLabel,
|
|
124
141
|
testId,
|
|
125
142
|
className,
|
|
143
|
+
card,
|
|
126
144
|
}: {
|
|
127
145
|
readonly columns: readonly Col[];
|
|
128
146
|
readonly columnHeader: (col: Col, index: number) => string;
|
|
@@ -131,15 +149,21 @@ export function ComparisonTable<Col>({
|
|
|
131
149
|
readonly metricLabel: string;
|
|
132
150
|
readonly testId?: string;
|
|
133
151
|
readonly className?: string;
|
|
152
|
+
/** Rahmen-Look wie die CRUD-Liste (DataTable): gerundeter Border-Container +
|
|
153
|
+
* bg-muted-Header-Band. Default = bare. */
|
|
154
|
+
readonly card?: boolean;
|
|
134
155
|
}): ReactNode {
|
|
135
|
-
|
|
156
|
+
const table = (
|
|
136
157
|
<div className="overflow-x-auto">
|
|
137
158
|
<table data-testid={testId} className={cn("w-full min-w-[24rem] text-sm", className)}>
|
|
138
|
-
<thead>
|
|
159
|
+
<thead className={cn(card === true && "bg-muted")}>
|
|
139
160
|
<tr className="border-b text-left text-muted-foreground">
|
|
140
|
-
<th className="py-1.5 font-medium">{metricLabel}</th>
|
|
161
|
+
<th className={cn("py-1.5 font-medium", card === true && "px-3")}>{metricLabel}</th>
|
|
141
162
|
{columns.map((col, i) => (
|
|
142
|
-
<th
|
|
163
|
+
<th
|
|
164
|
+
key={columnKey(col, i)}
|
|
165
|
+
className={cn("py-1.5 text-right font-medium", card === true && "px-3")}
|
|
166
|
+
>
|
|
143
167
|
{columnHeader(col, i)}
|
|
144
168
|
</th>
|
|
145
169
|
))}
|
|
@@ -150,9 +174,14 @@ export function ComparisonTable<Col>({
|
|
|
150
174
|
const best = metric.bestIndex !== undefined ? metric.bestIndex(columns) : -1;
|
|
151
175
|
return (
|
|
152
176
|
<tr key={metric.label} className="border-b last:border-0">
|
|
153
|
-
<td className="py-1.5 text-muted-foreground"
|
|
177
|
+
<td className={cn("py-1.5 text-muted-foreground", card === true && "px-3")}>
|
|
178
|
+
{metric.label}
|
|
179
|
+
</td>
|
|
154
180
|
{columns.map((col, i) => (
|
|
155
|
-
<td
|
|
181
|
+
<td
|
|
182
|
+
key={columnKey(col, i)}
|
|
183
|
+
className={cn("py-1.5 text-right tabular-nums", card === true && "px-3")}
|
|
184
|
+
>
|
|
156
185
|
{i === best ? (
|
|
157
186
|
<span className="inline-block rounded bg-primary/10 px-2 py-0.5 font-semibold text-primary">
|
|
158
187
|
{metric.value(col, i)}
|
|
@@ -169,4 +198,9 @@ export function ComparisonTable<Col>({
|
|
|
169
198
|
</table>
|
|
170
199
|
</div>
|
|
171
200
|
);
|
|
201
|
+
return card === true ? (
|
|
202
|
+
<div className="overflow-hidden rounded-lg border bg-card">{table}</div>
|
|
203
|
+
) : (
|
|
204
|
+
table
|
|
205
|
+
);
|
|
172
206
|
}
|