@hilum/ui 3.6.2 → 3.6.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hilum/ui",
3
- "version": "3.6.2",
3
+ "version": "3.6.3",
4
4
  "private": false,
5
5
  "description": "Hilum UI — design system primitives (Button, Input, Dialog, Combobox, …) + tokens + fonts + icons",
6
6
  "license": "MIT",
@@ -0,0 +1,85 @@
1
+ import * as React from "react";
2
+ import { cn } from "../lib/utils";
3
+ import { StatusBadge, type StatusBadgeVariant } from "./status-badge";
4
+
5
+ interface StatusTileGridProps extends React.HTMLAttributes<HTMLDivElement> {
6
+ columns?: 2 | 3 | 4;
7
+ }
8
+
9
+ interface StatusTileProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
10
+ title: React.ReactNode;
11
+ status: string;
12
+ description?: React.ReactNode;
13
+ meta?: React.ReactNode;
14
+ icon?: React.ComponentType<{ className?: string }>;
15
+ labelMap?: Record<string, React.ReactNode>;
16
+ variantMap?: Record<string, StatusBadgeVariant>;
17
+ iconMap?: Record<string, React.ComponentType<{ className?: string }>>;
18
+ }
19
+
20
+ const columnClassName: Record<NonNullable<StatusTileGridProps["columns"]>, string> = {
21
+ 2: "md:grid-cols-2",
22
+ 3: "md:grid-cols-2 xl:grid-cols-3",
23
+ 4: "md:grid-cols-2 xl:grid-cols-4",
24
+ };
25
+
26
+ function StatusTileGrid({ columns = 3, className, ...props }: StatusTileGridProps) {
27
+ return (
28
+ <div
29
+ data-slot="status-tile-grid"
30
+ className={cn(
31
+ "divide-y divide-border md:grid md:gap-4 md:divide-y-0",
32
+ columnClassName[columns],
33
+ className,
34
+ )}
35
+ {...props}
36
+ />
37
+ );
38
+ }
39
+
40
+ function StatusTile({
41
+ title,
42
+ status,
43
+ description,
44
+ meta,
45
+ icon: Icon,
46
+ labelMap,
47
+ variantMap,
48
+ iconMap,
49
+ className,
50
+ ...props
51
+ }: StatusTileProps) {
52
+ return (
53
+ <div
54
+ data-slot="status-tile"
55
+ className={cn(
56
+ "min-w-0 py-4 md:rounded-lg md:border md:border-border md:bg-background md:p-4 md:shadow-natural",
57
+ className,
58
+ )}
59
+ {...props}
60
+ >
61
+ <div className="flex min-w-0 items-start justify-between gap-3">
62
+ <div className="flex min-w-0 items-center gap-2">
63
+ {Icon ? <Icon className="size-4 shrink-0 text-muted-foreground" /> : null}
64
+ <h3 className="body min-w-0 truncate font-medium text-foreground">{title}</h3>
65
+ </div>
66
+ <StatusBadge
67
+ status={status}
68
+ {...(labelMap ? { labelMap } : {})}
69
+ {...(variantMap ? { variantMap } : {})}
70
+ {...(iconMap ? { iconMap } : {})}
71
+ className="shrink-0"
72
+ />
73
+ </div>
74
+ {description ? (
75
+ <p className="body-sm mt-3 text-muted-foreground">{description}</p>
76
+ ) : null}
77
+ {meta ? <div className="mt-3 min-w-0 text-muted-foreground">{meta}</div> : null}
78
+ </div>
79
+ );
80
+ }
81
+
82
+ StatusTileGrid.displayName = "StatusTileGrid";
83
+ StatusTile.displayName = "StatusTile";
84
+
85
+ export { StatusTile, StatusTileGrid, type StatusTileProps, type StatusTileGridProps };
package/src/index.ts CHANGED
@@ -98,6 +98,7 @@ export * from "./components/spinner";
98
98
  export * from "./components/stacked-list";
99
99
  export * from "./components/stat-card";
100
100
  export * from "./components/status-badge";
101
+ export * from "./components/status-tile";
101
102
  export * from "./components/steps";
102
103
  export * from "./components/summary-tile";
103
104
  export * from "./components/switch";