@hilum/ui 3.6.1 → 3.6.2
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/dist/index.d.ts +20 -2
- package/dist/index.js +43 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/summary-tile.tsx +56 -0
- package/src/components/titled-card.tsx +12 -12
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../lib/utils";
|
|
3
|
+
|
|
4
|
+
interface SummaryTileGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
columns?: 2 | 3 | 4;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface SummaryTileProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
title: string;
|
|
10
|
+
value: React.ReactNode;
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const columnClassName: Record<NonNullable<SummaryTileGridProps["columns"]>, string> = {
|
|
15
|
+
2: "md:grid-cols-2",
|
|
16
|
+
3: "md:grid-cols-2 xl:grid-cols-3",
|
|
17
|
+
4: "md:grid-cols-2 xl:grid-cols-4",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function SummaryTileGrid({ columns = 3, className, ...props }: SummaryTileGridProps) {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
data-slot="summary-tile-grid"
|
|
24
|
+
className={cn(
|
|
25
|
+
"divide-y divide-border md:grid md:gap-3 md:divide-y-0",
|
|
26
|
+
columnClassName[columns],
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function SummaryTile({ title, value, description, className, ...props }: SummaryTileProps) {
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
data-slot="summary-tile"
|
|
38
|
+
className={cn(
|
|
39
|
+
"min-w-0 py-4 md:rounded-lg md:border md:border-border md:bg-card md:p-4",
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
{...props}
|
|
43
|
+
>
|
|
44
|
+
<p className="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{title}</p>
|
|
45
|
+
<p className="mt-2 text-xl font-semibold text-foreground">{value}</p>
|
|
46
|
+
{description ? (
|
|
47
|
+
<p className="mt-1 text-sm leading-5 text-muted-foreground">{description}</p>
|
|
48
|
+
) : null}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
SummaryTileGrid.displayName = "SummaryTileGrid";
|
|
54
|
+
SummaryTile.displayName = "SummaryTile";
|
|
55
|
+
|
|
56
|
+
export { SummaryTile, SummaryTileGrid, type SummaryTileProps, type SummaryTileGridProps };
|
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../lib/utils";
|
|
5
|
-
import {
|
|
6
|
-
Card,
|
|
7
|
-
CardContent,
|
|
8
|
-
CardDescription,
|
|
9
|
-
CardHeader,
|
|
10
|
-
CardTitle,
|
|
11
|
-
} from "./card";
|
|
5
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./card";
|
|
12
6
|
import { CardHeading } from "./card-heading";
|
|
13
7
|
|
|
14
8
|
interface TitledCardProps {
|
|
@@ -17,6 +11,7 @@ interface TitledCardProps {
|
|
|
17
11
|
children?: React.ReactNode;
|
|
18
12
|
actionButtons?: React.ReactNode;
|
|
19
13
|
icon?: React.ComponentType<{ className?: string }>;
|
|
14
|
+
contentPadding?: "default" | "flush-mobile" | "flush";
|
|
20
15
|
className?: string;
|
|
21
16
|
contentClassName?: string;
|
|
22
17
|
containerClassName?: string;
|
|
@@ -29,6 +24,7 @@ function TitledCard({
|
|
|
29
24
|
children,
|
|
30
25
|
actionButtons,
|
|
31
26
|
icon: Icon,
|
|
27
|
+
contentPadding = "default",
|
|
32
28
|
className,
|
|
33
29
|
contentClassName,
|
|
34
30
|
containerClassName,
|
|
@@ -36,6 +32,14 @@ function TitledCard({
|
|
|
36
32
|
}: TitledCardProps) {
|
|
37
33
|
const hasHeader = Boolean(title || subtitle || actionButtons);
|
|
38
34
|
const canUseCardHeading = Boolean(title) && !actionButtons && !titleClassName;
|
|
35
|
+
const contentPaddingClassName =
|
|
36
|
+
contentPadding === "flush"
|
|
37
|
+
? "p-0"
|
|
38
|
+
: contentPadding === "flush-mobile"
|
|
39
|
+
? "p-0 sm:p-5"
|
|
40
|
+
: hasHeader
|
|
41
|
+
? "p-4 sm:p-5"
|
|
42
|
+
: "p-0 sm:p-5";
|
|
39
43
|
|
|
40
44
|
return (
|
|
41
45
|
<Card
|
|
@@ -84,11 +88,7 @@ function TitledCard({
|
|
|
84
88
|
) : null}
|
|
85
89
|
{children && (
|
|
86
90
|
<CardContent
|
|
87
|
-
className={cn(
|
|
88
|
-
hasHeader ? "p-4 sm:p-5" : "p-0 sm:p-5",
|
|
89
|
-
"min-w-0 max-sm:px-0",
|
|
90
|
-
contentClassName,
|
|
91
|
-
)}
|
|
91
|
+
className={cn(contentPaddingClassName, "min-w-0 max-sm:px-0", contentClassName)}
|
|
92
92
|
>
|
|
93
93
|
{children}
|
|
94
94
|
</CardContent>
|
package/src/index.ts
CHANGED
|
@@ -99,6 +99,7 @@ export * from "./components/stacked-list";
|
|
|
99
99
|
export * from "./components/stat-card";
|
|
100
100
|
export * from "./components/status-badge";
|
|
101
101
|
export * from "./components/steps";
|
|
102
|
+
export * from "./components/summary-tile";
|
|
102
103
|
export * from "./components/switch";
|
|
103
104
|
export * from "./components/table";
|
|
104
105
|
export * from "./components/tabs";
|