@cosmicdrift/kumiko-renderer-web 0.79.3 → 0.80.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/primitives/index.tsx +52 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-renderer-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.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.80.0",
|
|
20
|
+
"@cosmicdrift/kumiko-headless": "0.80.0",
|
|
21
|
+
"@cosmicdrift/kumiko-renderer": "0.80.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",
|
package/src/primitives/index.tsx
CHANGED
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
import {
|
|
20
20
|
type BannerProps,
|
|
21
21
|
type ButtonProps,
|
|
22
|
+
type CardProps,
|
|
22
23
|
type CorePrimitives,
|
|
23
24
|
type DataTableFacet,
|
|
24
25
|
type DataTableProps,
|
|
@@ -1538,6 +1539,56 @@ function DefaultHeading({ variant = "page", children, testId }: HeadingProps): R
|
|
|
1538
1539
|
import { ConfigCascadeView as DefaultConfigCascadeView } from "../components/config-cascade";
|
|
1539
1540
|
import { ConfigSourceBadge as DefaultConfigSourceBadge } from "../components/config-source-badge";
|
|
1540
1541
|
|
|
1542
|
+
// Generische Card-Chrome (rounded-xl wie die Entity-Card) — slot- + options-
|
|
1543
|
+
// basiert, damit der Contract additiv wächst und Consumer nie migriert werden.
|
|
1544
|
+
function DefaultCard({ slots, options, className, testId, children }: CardProps): ReactNode {
|
|
1545
|
+
const padded = options?.padded ?? true;
|
|
1546
|
+
const radius = options?.radius ?? "xl";
|
|
1547
|
+
const footerBordered = options?.footerBordered ?? true;
|
|
1548
|
+
const s = slots ?? {};
|
|
1549
|
+
const defaultHeader =
|
|
1550
|
+
s.title !== undefined || s.subtitle !== undefined || s.headerActions !== undefined ? (
|
|
1551
|
+
<div className="flex flex-wrap items-start justify-between gap-3 px-6 pt-6 pb-4">
|
|
1552
|
+
<div className="flex flex-col gap-1">
|
|
1553
|
+
{s.title !== undefined && (
|
|
1554
|
+
<h3 className="text-base font-semibold leading-none tracking-tight">{s.title}</h3>
|
|
1555
|
+
)}
|
|
1556
|
+
{s.subtitle !== undefined && (
|
|
1557
|
+
<p className="text-sm text-muted-foreground">{s.subtitle}</p>
|
|
1558
|
+
)}
|
|
1559
|
+
</div>
|
|
1560
|
+
{s.headerActions}
|
|
1561
|
+
</div>
|
|
1562
|
+
) : null;
|
|
1563
|
+
const header = s.header ?? defaultHeader;
|
|
1564
|
+
const hasHeader = header !== null && header !== undefined;
|
|
1565
|
+
return (
|
|
1566
|
+
<div
|
|
1567
|
+
data-testid={testId}
|
|
1568
|
+
className={cn(
|
|
1569
|
+
"flex flex-col overflow-hidden border bg-card text-card-foreground shadow-sm",
|
|
1570
|
+
radius === "xl" ? "rounded-xl" : "rounded-lg",
|
|
1571
|
+
className,
|
|
1572
|
+
)}
|
|
1573
|
+
>
|
|
1574
|
+
{header}
|
|
1575
|
+
{children !== undefined && (
|
|
1576
|
+
<div className={cn("grow", padded && (hasHeader ? "px-6 pb-6" : "p-6"))}>{children}</div>
|
|
1577
|
+
)}
|
|
1578
|
+
{s.footer !== undefined && (
|
|
1579
|
+
<div
|
|
1580
|
+
className={cn(
|
|
1581
|
+
"flex items-center justify-end gap-2 px-6 py-4",
|
|
1582
|
+
footerBordered && "border-t bg-muted/30",
|
|
1583
|
+
)}
|
|
1584
|
+
>
|
|
1585
|
+
{s.footer}
|
|
1586
|
+
</div>
|
|
1587
|
+
)}
|
|
1588
|
+
</div>
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1541
1592
|
export const defaultPrimitives: CorePrimitives = {
|
|
1542
1593
|
Button: DefaultButton,
|
|
1543
1594
|
Banner: DefaultBanner,
|
|
@@ -1546,6 +1597,7 @@ export const defaultPrimitives: CorePrimitives = {
|
|
|
1546
1597
|
DataTable: DefaultDataTable,
|
|
1547
1598
|
Form: DefaultForm,
|
|
1548
1599
|
Section: DefaultSection,
|
|
1600
|
+
Card: DefaultCard,
|
|
1549
1601
|
Grid: DefaultGrid,
|
|
1550
1602
|
GridCell: DefaultGridCell,
|
|
1551
1603
|
Text: DefaultText,
|