@hilum/ui 3.6.12 → 3.7.1
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 +33 -9
- package/dist/index.js +223 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/card.tsx +14 -3
- package/src/components/chart.tsx +2 -1
- package/src/components/color-input.tsx +14 -3
- package/src/components/input.tsx +38 -2
- package/src/components/searchable-table.tsx +28 -27
- package/src/components/select.tsx +38 -1
- package/src/components/sidebar.tsx +17 -0
- package/src/components/table.tsx +62 -17
- package/src/components/textarea.tsx +35 -2
- package/src/components/titled-card.tsx +31 -10
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../lib/utils";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Card,
|
|
7
|
+
CardContent,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CardTitle,
|
|
11
|
+
type CardMobileSurface,
|
|
12
|
+
} from "./card";
|
|
6
13
|
import { CardHeading } from "./card-heading";
|
|
7
14
|
|
|
8
15
|
interface TitledCardProps {
|
|
@@ -12,6 +19,7 @@ interface TitledCardProps {
|
|
|
12
19
|
actionButtons?: React.ReactNode;
|
|
13
20
|
icon?: React.ComponentType<{ className?: string }>;
|
|
14
21
|
contentPadding?: "default" | "flush-mobile" | "flush";
|
|
22
|
+
mobileSurface?: CardMobileSurface;
|
|
15
23
|
className?: string;
|
|
16
24
|
contentClassName?: string;
|
|
17
25
|
containerClassName?: string;
|
|
@@ -25,12 +33,14 @@ function TitledCard({
|
|
|
25
33
|
actionButtons,
|
|
26
34
|
icon: Icon,
|
|
27
35
|
contentPadding = "default",
|
|
36
|
+
mobileSurface = "flush",
|
|
28
37
|
className,
|
|
29
38
|
contentClassName,
|
|
30
39
|
containerClassName,
|
|
31
40
|
titleClassName,
|
|
32
41
|
}: TitledCardProps) {
|
|
33
42
|
const hasHeader = Boolean(title || subtitle || actionButtons);
|
|
43
|
+
const hasContent = Boolean(children);
|
|
34
44
|
const canUseCardHeading = Boolean(title) && !actionButtons && !titleClassName;
|
|
35
45
|
const contentPaddingClassName =
|
|
36
46
|
contentPadding === "flush"
|
|
@@ -40,27 +50,33 @@ function TitledCard({
|
|
|
40
50
|
: hasHeader
|
|
41
51
|
? "p-4 sm:p-5"
|
|
42
52
|
: "p-0 sm:p-5";
|
|
53
|
+
const isMobileFlat = mobileSurface === "flat" || mobileSurface === "flush";
|
|
43
54
|
|
|
44
55
|
return (
|
|
45
56
|
<Card
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"max-sm:rounded-none max-sm:border-0 max-sm:bg-transparent max-sm:shadow-none",
|
|
49
|
-
containerClassName,
|
|
50
|
-
className,
|
|
51
|
-
)}
|
|
57
|
+
mobileSurface={mobileSurface}
|
|
58
|
+
className={cn("min-w-0 overflow-hidden", containerClassName, className)}
|
|
52
59
|
data-slot="titled-card"
|
|
53
60
|
>
|
|
54
61
|
{canUseCardHeading ? (
|
|
55
62
|
<CardHeading
|
|
56
63
|
title={title!}
|
|
57
64
|
{...(subtitle ? { description: subtitle } : {})}
|
|
58
|
-
className=
|
|
65
|
+
className={cn(
|
|
66
|
+
!hasContent && "border-b-0",
|
|
67
|
+
isMobileFlat && "max-sm:border-b-0 max-sm:px-0 max-sm:pb-3",
|
|
68
|
+
)}
|
|
59
69
|
>
|
|
60
70
|
{Icon && <Icon className="size-5 shrink-0 text-muted-foreground" />}
|
|
61
71
|
</CardHeading>
|
|
62
72
|
) : hasHeader ? (
|
|
63
|
-
<CardHeader
|
|
73
|
+
<CardHeader
|
|
74
|
+
className={cn(
|
|
75
|
+
"flex flex-col gap-3 border-b border-border p-4 sm:flex-row sm:items-start sm:justify-between sm:p-5",
|
|
76
|
+
!hasContent && "border-b-0",
|
|
77
|
+
isMobileFlat && "max-sm:border-b-0 max-sm:px-0 max-sm:pb-3",
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
64
80
|
<div className="min-w-0 flex-1">
|
|
65
81
|
{title && (
|
|
66
82
|
<CardTitle
|
|
@@ -88,7 +104,12 @@ function TitledCard({
|
|
|
88
104
|
) : null}
|
|
89
105
|
{children && (
|
|
90
106
|
<CardContent
|
|
91
|
-
className={cn(
|
|
107
|
+
className={cn(
|
|
108
|
+
contentPaddingClassName,
|
|
109
|
+
"min-w-0",
|
|
110
|
+
isMobileFlat && "max-sm:px-0",
|
|
111
|
+
contentClassName,
|
|
112
|
+
)}
|
|
92
113
|
>
|
|
93
114
|
{children}
|
|
94
115
|
</CardContent>
|