@mbao01/common 0.8.1 → 0.9.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/types/components/ActivityFeed/ActivityFeed.d.ts +6 -0
- package/dist/types/components/ActivityFeed/constants.d.ts +6 -0
- package/dist/types/components/ActivityFeed/index.d.ts +2 -0
- package/dist/types/components/ActivityFeed/types.d.ts +21 -0
- package/dist/types/components/Amount/Amount.d.ts +6 -0
- package/dist/types/components/Amount/index.d.ts +2 -0
- package/dist/types/components/Amount/types.d.ts +19 -0
- package/dist/types/components/AnimatedCounter/AnimatedCounter.d.ts +6 -0
- package/dist/types/components/AnimatedCounter/index.d.ts +2 -0
- package/dist/types/components/AnimatedCounter/types.d.ts +13 -0
- package/dist/types/components/AnimatedGroup/AnimatedGroup.d.ts +6 -0
- package/dist/types/components/AnimatedGroup/index.d.ts +2 -0
- package/dist/types/components/AnimatedGroup/types.d.ts +22 -0
- package/dist/types/components/AnimatedList/AnimatedList.d.ts +6 -0
- package/dist/types/components/AnimatedList/index.d.ts +2 -0
- package/dist/types/components/AnimatedList/types.d.ts +13 -0
- package/dist/types/components/BorderBeam/BorderBeam.d.ts +6 -0
- package/dist/types/components/BorderBeam/index.d.ts +2 -0
- package/dist/types/components/BorderBeam/types.d.ts +13 -0
- package/dist/types/components/Box/Box.d.ts +4 -0
- package/dist/types/components/Box/constants.d.ts +4 -0
- package/dist/types/components/CalendarHeatmap/CalendarHeatmap.d.ts +6 -0
- package/dist/types/components/CalendarHeatmap/index.d.ts +2 -0
- package/dist/types/components/CalendarHeatmap/types.d.ts +25 -0
- package/dist/types/components/Chart/stories/examples/AreaChart.d.ts +6 -0
- package/dist/types/components/Chart/stories/examples/BarChart.d.ts +11 -0
- package/dist/types/components/Chart/stories/examples/LineChart.d.ts +10 -0
- package/dist/types/components/Chart/stories/examples/PieChart.d.ts +5 -0
- package/dist/types/components/Chart/stories/examples/RadialChart.d.ts +5 -0
- package/dist/types/components/CircularProgress/CircularProgress.d.ts +6 -0
- package/dist/types/components/CircularProgress/constants.d.ts +5 -0
- package/dist/types/components/CircularProgress/index.d.ts +2 -0
- package/dist/types/components/CircularProgress/types.d.ts +17 -0
- package/dist/types/components/ComparisonBar/ComparisonBar.d.ts +6 -0
- package/dist/types/components/ComparisonBar/constants.d.ts +4 -0
- package/dist/types/components/ComparisonBar/index.d.ts +2 -0
- package/dist/types/components/ComparisonBar/types.d.ts +21 -0
- package/dist/types/components/Confetti/Confetti.d.ts +6 -0
- package/dist/types/components/Confetti/index.d.ts +2 -0
- package/dist/types/components/Confetti/types.d.ts +19 -0
- package/dist/types/components/CountdownTimer/CountdownTimer.d.ts +6 -0
- package/dist/types/components/CountdownTimer/index.d.ts +2 -0
- package/dist/types/components/CountdownTimer/types.d.ts +13 -0
- package/dist/types/components/DataList/DataList.d.ts +6 -0
- package/dist/types/components/DataList/constants.d.ts +12 -0
- package/dist/types/components/DataList/index.d.ts +2 -0
- package/dist/types/components/DataList/types.d.ts +15 -0
- package/dist/types/components/DatePicker/DateRangePresetPicker.d.ts +2 -0
- package/dist/types/components/DatePicker/index.d.ts +1 -0
- package/dist/types/components/DatePicker/types.d.ts +19 -0
- package/dist/types/components/Description/Description.d.ts +2 -1
- package/dist/types/components/Description/DescriptionGroup.d.ts +6 -0
- package/dist/types/components/Description/constants.d.ts +23 -0
- package/dist/types/components/Description/index.d.ts +2 -0
- package/dist/types/components/Description/types.d.ts +28 -3
- package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +1 -1
- package/dist/types/components/GlowCard/GlowCard.d.ts +6 -0
- package/dist/types/components/GlowCard/index.d.ts +2 -0
- package/dist/types/components/GlowCard/types.d.ts +8 -0
- package/dist/types/components/GradientText/GradientText.d.ts +6 -0
- package/dist/types/components/GradientText/index.d.ts +2 -0
- package/dist/types/components/GradientText/types.d.ts +14 -0
- package/dist/types/components/Greeting/Greeting.d.ts +6 -0
- package/dist/types/components/Greeting/index.d.ts +2 -0
- package/dist/types/components/Greeting/types.d.ts +9 -0
- package/dist/types/components/IconContainer/IconContainer.d.ts +2 -0
- package/dist/types/components/IconContainer/constants.d.ts +15 -0
- package/dist/types/components/IconContainer/index.d.ts +1 -0
- package/dist/types/components/IconContainer/types.d.ts +3 -0
- package/dist/types/components/KPICard/KPICard.d.ts +6 -0
- package/dist/types/components/KPICard/index.d.ts +2 -0
- package/dist/types/components/KPICard/types.d.ts +17 -0
- package/dist/types/components/Marquee/Marquee.d.ts +6 -0
- package/dist/types/components/Marquee/index.d.ts +2 -0
- package/dist/types/components/Marquee/types.d.ts +12 -0
- package/dist/types/components/Meteors/Meteors.d.ts +6 -0
- package/dist/types/components/Meteors/index.d.ts +2 -0
- package/dist/types/components/Meteors/types.d.ts +5 -0
- package/dist/types/components/MiniAreaChart/MiniAreaChart.d.ts +6 -0
- package/dist/types/components/MiniAreaChart/index.d.ts +2 -0
- package/dist/types/components/MiniAreaChart/types.d.ts +10 -0
- package/dist/types/components/MiniBarChart/MiniBarChart.d.ts +6 -0
- package/dist/types/components/MiniBarChart/index.d.ts +2 -0
- package/dist/types/components/MiniBarChart/types.d.ts +15 -0
- package/dist/types/components/MiniDonutChart/MiniDonutChart.d.ts +6 -0
- package/dist/types/components/MiniDonutChart/index.d.ts +2 -0
- package/dist/types/components/MiniDonutChart/types.d.ts +15 -0
- package/dist/types/components/MiniStackedBar/MiniStackedBar.d.ts +6 -0
- package/dist/types/components/MiniStackedBar/index.d.ts +2 -0
- package/dist/types/components/MiniStackedBar/types.d.ts +13 -0
- package/dist/types/components/NumberTicker/NumberTicker.d.ts +6 -0
- package/dist/types/components/NumberTicker/index.d.ts +2 -0
- package/dist/types/components/NumberTicker/types.d.ts +11 -0
- package/dist/types/components/Pulse/Pulse.d.ts +6 -0
- package/dist/types/components/Pulse/constants.d.ts +10 -0
- package/dist/types/components/Pulse/index.d.ts +2 -0
- package/dist/types/components/Pulse/types.d.ts +11 -0
- package/dist/types/components/ShinyButton/ShinyButton.d.ts +6 -0
- package/dist/types/components/ShinyButton/index.d.ts +2 -0
- package/dist/types/components/ShinyButton/types.d.ts +4 -0
- package/dist/types/components/Sparkline/Sparkline.d.ts +6 -0
- package/dist/types/components/Sparkline/index.d.ts +2 -0
- package/dist/types/components/Sparkline/types.d.ts +17 -0
- package/dist/types/components/SpotlightCard/SpotlightCard.d.ts +6 -0
- package/dist/types/components/SpotlightCard/index.d.ts +2 -0
- package/dist/types/components/SpotlightCard/types.d.ts +7 -0
- package/dist/types/components/StatCard/StatCard.d.ts +6 -0
- package/dist/types/components/StatCard/index.d.ts +2 -0
- package/dist/types/components/StatCard/types.d.ts +15 -0
- package/dist/types/components/TextShimmer/TextShimmer.d.ts +6 -0
- package/dist/types/components/TextShimmer/index.d.ts +2 -0
- package/dist/types/components/TextShimmer/types.d.ts +7 -0
- package/dist/types/components/TrendBadge/TrendBadge.d.ts +6 -0
- package/dist/types/components/TrendBadge/constants.d.ts +7 -0
- package/dist/types/components/TrendBadge/index.d.ts +2 -0
- package/dist/types/components/TrendBadge/types.d.ts +15 -0
- package/dist/types/components/WidgetShell/WidgetShell.d.ts +6 -0
- package/dist/types/components/WidgetShell/index.d.ts +2 -0
- package/dist/types/components/WidgetShell/types.d.ts +20 -0
- package/dist/types/index.d.ts +34 -0
- package/package.json +2 -1
- package/src/components/Accordion/constants.ts +1 -1
- package/src/components/ActivityFeed/ActivityFeed.tsx +51 -0
- package/src/components/ActivityFeed/constants.ts +19 -0
- package/src/components/ActivityFeed/index.ts +2 -0
- package/src/components/ActivityFeed/types.ts +23 -0
- package/src/components/Alert/constants.ts +1 -1
- package/src/components/AlertDialog/constants.ts +1 -1
- package/src/components/Amount/Amount.tsx +50 -0
- package/src/components/Amount/index.ts +2 -0
- package/src/components/Amount/types.ts +20 -0
- package/src/components/AnimatedCounter/AnimatedCounter.tsx +68 -0
- package/src/components/AnimatedCounter/index.ts +2 -0
- package/src/components/AnimatedCounter/types.ts +14 -0
- package/src/components/AnimatedGroup/AnimatedGroup.tsx +97 -0
- package/src/components/AnimatedGroup/index.ts +2 -0
- package/src/components/AnimatedGroup/types.ts +21 -0
- package/src/components/AnimatedList/AnimatedList.tsx +42 -0
- package/src/components/AnimatedList/index.ts +2 -0
- package/src/components/AnimatedList/types.ts +15 -0
- package/src/components/Badge/constants.ts +1 -1
- package/src/components/Banner/constants.ts +1 -1
- package/src/components/BorderBeam/BorderBeam.tsx +41 -0
- package/src/components/BorderBeam/index.ts +2 -0
- package/src/components/BorderBeam/types.ts +14 -0
- package/src/components/Box/Box.tsx +8 -2
- package/src/components/Box/constants.ts +35 -0
- package/src/components/Button/constants.ts +66 -63
- package/src/components/CalendarHeatmap/CalendarHeatmap.tsx +141 -0
- package/src/components/CalendarHeatmap/index.ts +2 -0
- package/src/components/CalendarHeatmap/types.ts +27 -0
- package/src/components/Card/constants.ts +24 -21
- package/src/components/Carousel/constants.ts +2 -2
- package/src/components/Chart/stories/examples/AreaChart.tsx +55 -0
- package/src/components/Chart/stories/examples/BarChart.tsx +95 -0
- package/src/components/Chart/stories/examples/LineChart.tsx +111 -0
- package/src/components/Chart/stories/examples/PieChart.tsx +55 -0
- package/src/components/Chart/stories/examples/RadialChart.tsx +65 -0
- package/src/components/CircularProgress/CircularProgress.tsx +46 -0
- package/src/components/CircularProgress/constants.ts +32 -0
- package/src/components/CircularProgress/index.ts +2 -0
- package/src/components/CircularProgress/types.ts +18 -0
- package/src/components/Command/constants.ts +1 -1
- package/src/components/ComparisonBar/ComparisonBar.tsx +65 -0
- package/src/components/ComparisonBar/constants.ts +23 -0
- package/src/components/ComparisonBar/index.ts +2 -0
- package/src/components/ComparisonBar/types.ts +23 -0
- package/src/components/Confetti/Confetti.tsx +82 -0
- package/src/components/Confetti/index.ts +2 -0
- package/src/components/Confetti/types.ts +20 -0
- package/src/components/CountdownTimer/CountdownTimer.tsx +91 -0
- package/src/components/CountdownTimer/index.ts +2 -0
- package/src/components/CountdownTimer/types.ts +14 -0
- package/src/components/DataList/DataList.tsx +32 -0
- package/src/components/DataList/constants.ts +47 -0
- package/src/components/DataList/index.ts +2 -0
- package/src/components/DataList/types.ts +17 -0
- package/src/components/DatePicker/DateRangePresetPicker.tsx +122 -0
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/DatePicker/types.ts +22 -0
- package/src/components/Description/Description.tsx +67 -5
- package/src/components/Description/DescriptionGroup.tsx +39 -0
- package/src/components/Description/constants.ts +128 -0
- package/src/components/Description/index.ts +10 -0
- package/src/components/Description/types.ts +31 -3
- package/src/components/Dialog/constants.ts +2 -2
- package/src/components/Dock/constants.ts +2 -2
- package/src/components/Drawer/constants.ts +2 -2
- package/src/components/Form/Checkbox/constants.ts +1 -1
- package/src/components/Form/DatetimeInput/constants.ts +1 -1
- package/src/components/Form/Input/constants.ts +1 -1
- package/src/components/Form/MultiSelect/constants.ts +1 -1
- package/src/components/Form/NativeSelect/constants.ts +1 -1
- package/src/components/Form/Radio/constants.ts +1 -1
- package/src/components/Form/Select/constants.ts +1 -1
- package/src/components/Form/Slider/constants.ts +1 -1
- package/src/components/Form/Switch/constants.ts +1 -1
- package/src/components/Form/Textarea/constants.ts +1 -1
- package/src/components/GlowCard/GlowCard.tsx +46 -0
- package/src/components/GlowCard/index.ts +2 -0
- package/src/components/GlowCard/types.ts +9 -0
- package/src/components/GradientText/GradientText.tsx +36 -0
- package/src/components/GradientText/index.ts +2 -0
- package/src/components/GradientText/types.ts +15 -0
- package/src/components/Greeting/Greeting.tsx +46 -0
- package/src/components/Greeting/index.ts +2 -0
- package/src/components/Greeting/types.ts +10 -0
- package/src/components/IconContainer/IconContainer.tsx +44 -0
- package/src/components/IconContainer/constants.ts +112 -0
- package/src/components/IconContainer/index.ts +1 -0
- package/src/components/IconContainer/types.ts +5 -0
- package/src/components/KPICard/KPICard.tsx +75 -0
- package/src/components/KPICard/index.ts +2 -0
- package/src/components/KPICard/types.ts +18 -0
- package/src/components/Marquee/Marquee.tsx +45 -0
- package/src/components/Marquee/index.ts +2 -0
- package/src/components/Marquee/types.ts +13 -0
- package/src/components/Menu/Menubar/constants.ts +2 -2
- package/src/components/Menu/NavigationMenu/constants.ts +2 -2
- package/src/components/Meteors/Meteors.tsx +38 -0
- package/src/components/Meteors/index.ts +2 -0
- package/src/components/Meteors/types.ts +6 -0
- package/src/components/MiniAreaChart/MiniAreaChart.tsx +68 -0
- package/src/components/MiniAreaChart/index.ts +2 -0
- package/src/components/MiniAreaChart/types.ts +11 -0
- package/src/components/MiniBarChart/MiniBarChart.tsx +49 -0
- package/src/components/MiniBarChart/index.ts +2 -0
- package/src/components/MiniBarChart/types.ts +16 -0
- package/src/components/MiniDonutChart/MiniDonutChart.tsx +87 -0
- package/src/components/MiniDonutChart/index.ts +2 -0
- package/src/components/MiniDonutChart/types.ts +17 -0
- package/src/components/MiniStackedBar/MiniStackedBar.tsx +61 -0
- package/src/components/MiniStackedBar/index.ts +2 -0
- package/src/components/MiniStackedBar/types.ts +15 -0
- package/src/components/NumberTicker/NumberTicker.tsx +58 -0
- package/src/components/NumberTicker/index.ts +2 -0
- package/src/components/NumberTicker/types.ts +12 -0
- package/src/components/Pagination/constants.ts +2 -2
- package/src/components/Progress/constants.ts +1 -1
- package/src/components/Pulse/Pulse.tsx +26 -0
- package/src/components/Pulse/constants.ts +55 -0
- package/src/components/Pulse/index.ts +2 -0
- package/src/components/Pulse/types.ts +12 -0
- package/src/components/Resizable/constants.ts +1 -1
- package/src/components/Sheet/constants.ts +1 -1
- package/src/components/ShinyButton/ShinyButton.tsx +57 -0
- package/src/components/ShinyButton/index.ts +2 -0
- package/src/components/ShinyButton/types.ts +8 -0
- package/src/components/Skeleton/constants.ts +1 -1
- package/src/components/Sonner/constants.ts +1 -1
- package/src/components/Sparkline/Sparkline.tsx +108 -0
- package/src/components/Sparkline/index.ts +2 -0
- package/src/components/Sparkline/types.ts +18 -0
- package/src/components/SpotlightCard/SpotlightCard.tsx +56 -0
- package/src/components/SpotlightCard/index.ts +2 -0
- package/src/components/SpotlightCard/types.ts +8 -0
- package/src/components/Stat/constants.ts +1 -1
- package/src/components/StatCard/StatCard.tsx +59 -0
- package/src/components/StatCard/index.ts +2 -0
- package/src/components/StatCard/types.ts +16 -0
- package/src/components/Tabs/constants.ts +1 -1
- package/src/components/TextShimmer/TextShimmer.tsx +34 -0
- package/src/components/TextShimmer/index.ts +2 -0
- package/src/components/TextShimmer/types.ts +8 -0
- package/src/components/Timeline/constants.ts +1 -1
- package/src/components/Toggle/constants.ts +1 -1
- package/src/components/Tooltip/constants.ts +1 -1
- package/src/components/TrendBadge/TrendBadge.tsx +40 -0
- package/src/components/TrendBadge/constants.ts +38 -0
- package/src/components/TrendBadge/index.ts +2 -0
- package/src/components/TrendBadge/types.ts +16 -0
- package/src/components/WidgetShell/WidgetShell.tsx +101 -0
- package/src/components/WidgetShell/index.ts +2 -0
- package/src/components/WidgetShell/types.ts +22 -0
- package/src/index.ts +36 -0
- package/src/stylesheets/tailwind.css +208 -0
- package/src/utilities/getSubpaths/getSubpaths.ts +1 -2
|
@@ -4,11 +4,17 @@ import { getBoxClasses } from "./constants";
|
|
|
4
4
|
import { type BoxProps } from "./types";
|
|
5
5
|
|
|
6
6
|
export const Box = React.forwardRef<HTMLDivElement, BoxProps>(
|
|
7
|
-
(
|
|
7
|
+
(
|
|
8
|
+
{ className, style, display, position, overflow, rounded, padding, shadow, children, ...props },
|
|
9
|
+
ref
|
|
10
|
+
) => {
|
|
8
11
|
return (
|
|
9
12
|
<div
|
|
10
13
|
ref={ref}
|
|
11
|
-
className={cn(
|
|
14
|
+
className={cn(
|
|
15
|
+
getBoxClasses({ style, display, position, overflow, rounded, padding, shadow }),
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
12
18
|
{...props}
|
|
13
19
|
>
|
|
14
20
|
{children}
|
|
@@ -3,6 +3,18 @@ import { createVariants } from "../../utilities";
|
|
|
3
3
|
|
|
4
4
|
export const getBoxClasses = cva("", {
|
|
5
5
|
variants: createVariants({
|
|
6
|
+
style: {
|
|
7
|
+
default: "",
|
|
8
|
+
outlined: "border border-base-200",
|
|
9
|
+
bordered: "border-[4px] border-double border-base-200",
|
|
10
|
+
elevated: "border border-base-200 bg-base-100 shadow-md",
|
|
11
|
+
ghost: "bg-base-200/40",
|
|
12
|
+
gradient:
|
|
13
|
+
"relative border-0 bg-base-100 before:absolute before:inset-0 before:-z-10 before:-m-[2px] before:rounded-[inherit] before:bg-linear-to-br before:from-primary before:via-secondary before:to-accent",
|
|
14
|
+
strip: "border border-base-300 ring-1 ring-base-300 ring-offset-[2px] ring-offset-base-200",
|
|
15
|
+
glass: "border border-white/20 bg-white/10 shadow-lg backdrop-blur-md",
|
|
16
|
+
inset: "border border-base-200 bg-base-200/20 shadow-inner",
|
|
17
|
+
},
|
|
6
18
|
display: {
|
|
7
19
|
block: "block",
|
|
8
20
|
inline: "inline",
|
|
@@ -30,5 +42,28 @@ export const getBoxClasses = cva("", {
|
|
|
30
42
|
"x-hidden": "overflow-x-hidden",
|
|
31
43
|
"y-hidden": "overflow-y-hidden",
|
|
32
44
|
},
|
|
45
|
+
rounded: {
|
|
46
|
+
none: "rounded-none",
|
|
47
|
+
sm: "rounded-sm",
|
|
48
|
+
md: "rounded-md",
|
|
49
|
+
lg: "rounded-lg",
|
|
50
|
+
xl: "rounded-xl",
|
|
51
|
+
"2xl": "rounded-2xl",
|
|
52
|
+
full: "rounded-full",
|
|
53
|
+
},
|
|
54
|
+
padding: {
|
|
55
|
+
none: "p-0",
|
|
56
|
+
sm: "p-2",
|
|
57
|
+
md: "p-4",
|
|
58
|
+
lg: "p-6",
|
|
59
|
+
xl: "p-8",
|
|
60
|
+
},
|
|
61
|
+
shadow: {
|
|
62
|
+
none: "shadow-none",
|
|
63
|
+
sm: "shadow-sm",
|
|
64
|
+
md: "shadow-md",
|
|
65
|
+
lg: "shadow-lg",
|
|
66
|
+
xl: "shadow-xl",
|
|
67
|
+
},
|
|
33
68
|
}),
|
|
34
69
|
});
|
|
@@ -1,66 +1,69 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
import { createVariants } from "../../utilities";
|
|
3
3
|
|
|
4
|
-
export const getButtonClasses = cva(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
4
|
+
export const getButtonClasses = cva(
|
|
5
|
+
"btn transition-all duration-200 ease-out active:scale-[0.97]",
|
|
6
|
+
{
|
|
7
|
+
variants: createVariants({
|
|
8
|
+
variant: {
|
|
9
|
+
accent: "btn-accent shadow-sm hover:shadow-md hover:shadow-accent/20",
|
|
10
|
+
default: "btn-default shadow-sm hover:shadow-md",
|
|
11
|
+
error: "btn-error shadow-sm hover:shadow-md hover:shadow-error/20",
|
|
12
|
+
ghost: "btn-ghost hover:bg-base-200/80",
|
|
13
|
+
info: "btn-info shadow-sm hover:shadow-md hover:shadow-info/20",
|
|
14
|
+
neutral: "btn-neutral shadow-sm hover:shadow-md hover:shadow-neutral/20",
|
|
15
|
+
primary: "btn-primary shadow-sm hover:shadow-md hover:shadow-primary/25",
|
|
16
|
+
secondary: "btn-secondary shadow-sm hover:shadow-md hover:shadow-secondary/20",
|
|
17
|
+
success: "btn-success shadow-sm hover:shadow-md hover:shadow-success/20",
|
|
18
|
+
warning: "btn-warning shadow-sm hover:shadow-md hover:shadow-warning/20",
|
|
19
|
+
},
|
|
20
|
+
outline: {
|
|
21
|
+
true: "btn-outline",
|
|
22
|
+
},
|
|
23
|
+
link: {
|
|
24
|
+
true: "btn-link !shadow-none active:scale-100",
|
|
25
|
+
},
|
|
26
|
+
rounded: {
|
|
27
|
+
xs: "rounded-xs",
|
|
28
|
+
sm: "rounded-sm",
|
|
29
|
+
md: "rounded-md",
|
|
30
|
+
lg: "rounded-lg",
|
|
31
|
+
},
|
|
32
|
+
wide: {
|
|
33
|
+
true: "btn-wide",
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
xs: "btn-xs",
|
|
37
|
+
sm: "btn-sm",
|
|
38
|
+
md: "btn-md",
|
|
39
|
+
lg: "btn-lg",
|
|
40
|
+
},
|
|
41
|
+
isLoading: {
|
|
42
|
+
true: "relative overflow-hidden",
|
|
43
|
+
},
|
|
44
|
+
disabled: {
|
|
45
|
+
true: "",
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
compoundVariants: [
|
|
49
|
+
{
|
|
50
|
+
size: undefined,
|
|
51
|
+
className: "min-h-fit h-10",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
rounded: undefined,
|
|
55
|
+
className: "rounded-md",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
disabled: true,
|
|
59
|
+
isLoading: true,
|
|
60
|
+
className: "text-transparent",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
variant: undefined,
|
|
64
|
+
outline: true,
|
|
65
|
+
className: "border-base-content/20",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import type { CalendarHeatmapProps } from "./types";
|
|
4
|
+
|
|
5
|
+
const DEFAULT_COLORS: [string, string, string, string, string] = [
|
|
6
|
+
"oklch(0.9 0.02 250)",
|
|
7
|
+
"oklch(0.8 0.08 250)",
|
|
8
|
+
"oklch(0.7 0.12 250)",
|
|
9
|
+
"oklch(0.6 0.16 250)",
|
|
10
|
+
"oklch(0.5 0.2 250)",
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const MONTH_LABELS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
14
|
+
const DAY_LABELS = ["", "Mon", "", "Wed", "", "Fri", ""];
|
|
15
|
+
|
|
16
|
+
const CalendarHeatmap = ({
|
|
17
|
+
data,
|
|
18
|
+
className,
|
|
19
|
+
startDate,
|
|
20
|
+
endDate,
|
|
21
|
+
colors = DEFAULT_COLORS,
|
|
22
|
+
cellSize = 12,
|
|
23
|
+
cellGap = 2,
|
|
24
|
+
showMonthLabels = true,
|
|
25
|
+
showDayLabels = true,
|
|
26
|
+
formatTooltip = (date, value) => `${date}: ${value}`,
|
|
27
|
+
...props
|
|
28
|
+
}: CalendarHeatmapProps) => {
|
|
29
|
+
const { weeks, monthPositions, maxValue } = useMemo(() => {
|
|
30
|
+
const end = endDate ?? new Date();
|
|
31
|
+
const start = startDate ?? new Date(end.getFullYear() - 1, end.getMonth(), end.getDate() + 1);
|
|
32
|
+
|
|
33
|
+
const dataMap = new Map(data.map((d) => [d.date, d.value]));
|
|
34
|
+
const max = Math.max(1, ...data.map((d) => d.value));
|
|
35
|
+
|
|
36
|
+
const weeksArr: { date: string; value: number; day: number }[][] = [];
|
|
37
|
+
const months: { label: string; x: number }[] = [];
|
|
38
|
+
let currentWeek: { date: string; value: number; day: number }[] = [];
|
|
39
|
+
let lastMonth = -1;
|
|
40
|
+
|
|
41
|
+
const cursor = new Date(start);
|
|
42
|
+
// Align to Sunday
|
|
43
|
+
while (cursor.getDay() !== 0) {
|
|
44
|
+
cursor.setDate(cursor.getDate() - 1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
while (cursor <= end) {
|
|
48
|
+
const dateStr = cursor.toISOString().split("T")[0];
|
|
49
|
+
const day = cursor.getDay();
|
|
50
|
+
const month = cursor.getMonth();
|
|
51
|
+
|
|
52
|
+
if (day === 0 && currentWeek.length > 0) {
|
|
53
|
+
weeksArr.push(currentWeek);
|
|
54
|
+
currentWeek = [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (month !== lastMonth) {
|
|
58
|
+
months.push({ label: MONTH_LABELS[month], x: weeksArr.length });
|
|
59
|
+
lastMonth = month;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
currentWeek.push({
|
|
63
|
+
date: dateStr,
|
|
64
|
+
value: dataMap.get(dateStr) ?? 0,
|
|
65
|
+
day,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
cursor.setDate(cursor.getDate() + 1);
|
|
69
|
+
}
|
|
70
|
+
if (currentWeek.length > 0) weeksArr.push(currentWeek);
|
|
71
|
+
|
|
72
|
+
return { weeks: weeksArr, monthPositions: months, maxValue: max };
|
|
73
|
+
}, [data, startDate, endDate]);
|
|
74
|
+
|
|
75
|
+
const getColor = (value: number) => {
|
|
76
|
+
if (value === 0) return "oklch(0.95 0 0)";
|
|
77
|
+
const level = Math.min(4, Math.floor((value / maxValue) * 4));
|
|
78
|
+
return colors[level];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const labelWidth = showDayLabels ? 28 : 0;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div className={cn("inline-flex flex-col gap-1", className)} {...props}>
|
|
85
|
+
{showMonthLabels && (
|
|
86
|
+
<div className="flex" style={{ paddingLeft: labelWidth }}>
|
|
87
|
+
{monthPositions.map((m, i) => (
|
|
88
|
+
<span
|
|
89
|
+
key={i}
|
|
90
|
+
className="text-[10px] text-base-content/50"
|
|
91
|
+
style={{
|
|
92
|
+
position: "relative",
|
|
93
|
+
left: m.x * (cellSize + cellGap),
|
|
94
|
+
width: 0,
|
|
95
|
+
whiteSpace: "nowrap",
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
{m.label}
|
|
99
|
+
</span>
|
|
100
|
+
))}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
<div className="flex gap-0">
|
|
104
|
+
{showDayLabels && (
|
|
105
|
+
<div
|
|
106
|
+
className="flex flex-col justify-between shrink-0"
|
|
107
|
+
style={{ width: labelWidth, height: 7 * (cellSize + cellGap) - cellGap }}
|
|
108
|
+
>
|
|
109
|
+
{DAY_LABELS.map((label, i) => (
|
|
110
|
+
<span key={i} className="text-[10px] text-base-content/50 leading-none" style={{ height: cellSize }}>
|
|
111
|
+
{label}
|
|
112
|
+
</span>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
<div className="flex" style={{ gap: cellGap }}>
|
|
117
|
+
{weeks.map((week, wi) => (
|
|
118
|
+
<div key={wi} className="flex flex-col" style={{ gap: cellGap }}>
|
|
119
|
+
{week.map((cell) => (
|
|
120
|
+
<div
|
|
121
|
+
key={cell.date}
|
|
122
|
+
className="rounded-[2px] transition-colors duration-150"
|
|
123
|
+
style={{
|
|
124
|
+
width: cellSize,
|
|
125
|
+
height: cellSize,
|
|
126
|
+
backgroundColor: getColor(cell.value),
|
|
127
|
+
}}
|
|
128
|
+
title={formatTooltip(cell.date, cell.value)}
|
|
129
|
+
/>
|
|
130
|
+
))}
|
|
131
|
+
</div>
|
|
132
|
+
))}
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
CalendarHeatmap.displayName = "CalendarHeatmap";
|
|
140
|
+
|
|
141
|
+
export { CalendarHeatmap };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
export type HeatmapDataPoint = {
|
|
4
|
+
date: string; // ISO date string (YYYY-MM-DD)
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type CalendarHeatmapProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
9
|
+
/** Data points with date and value */
|
|
10
|
+
data: HeatmapDataPoint[];
|
|
11
|
+
/** Start date (defaults to 1 year ago) */
|
|
12
|
+
startDate?: Date;
|
|
13
|
+
/** End date (defaults to today) */
|
|
14
|
+
endDate?: Date;
|
|
15
|
+
/** Color scale — array of 5 colors from low to high */
|
|
16
|
+
colors?: [string, string, string, string, string];
|
|
17
|
+
/** Cell size in pixels */
|
|
18
|
+
cellSize?: number;
|
|
19
|
+
/** Gap between cells in pixels */
|
|
20
|
+
cellGap?: number;
|
|
21
|
+
/** Whether to show month labels */
|
|
22
|
+
showMonthLabels?: boolean;
|
|
23
|
+
/** Whether to show day-of-week labels */
|
|
24
|
+
showDayLabels?: boolean;
|
|
25
|
+
/** Tooltip formatter */
|
|
26
|
+
formatTooltip?: (date: string, value: number) => string;
|
|
27
|
+
};
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
import { createVariants } from "../../utilities";
|
|
3
3
|
|
|
4
|
-
export const getCardClasses = cva(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
4
|
+
export const getCardClasses = cva(
|
|
5
|
+
"card transition-all duration-300 ease-out hover:shadow-lg",
|
|
6
|
+
{
|
|
7
|
+
variants: createVariants({
|
|
8
|
+
border: {
|
|
9
|
+
solid: "card-border",
|
|
10
|
+
dash: "card-dash",
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
xs: "card-xs",
|
|
14
|
+
sm: "card-sm",
|
|
15
|
+
md: "card-md",
|
|
16
|
+
lg: "card-lg",
|
|
17
|
+
xl: "card-xl",
|
|
18
|
+
},
|
|
19
|
+
horizontal: {
|
|
20
|
+
true: "card-side",
|
|
21
|
+
},
|
|
22
|
+
overlay: {
|
|
23
|
+
true: "image-full",
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
}
|
|
27
|
+
);
|
|
@@ -26,7 +26,7 @@ export const getCarouselItemClasses = cva("min-w-0 shrink-0 grow-0 basis-full",
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
export const getCarouselNextClasses = cva(
|
|
29
|
-
"absolute h-8 w-8 rounded-full p-0 disabled:bg-transparent",
|
|
29
|
+
"absolute h-8 w-8 rounded-full p-0 transition-all duration-200 hover:scale-110 disabled:bg-transparent",
|
|
30
30
|
{
|
|
31
31
|
variants: createVariants({
|
|
32
32
|
orientation: {
|
|
@@ -41,7 +41,7 @@ export const getCarouselNextClasses = cva(
|
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
export const getCarouselPreviousClasses = cva(
|
|
44
|
-
"absolute h-8 w-8 rounded-full p-0 disabled:bg-transparent",
|
|
44
|
+
"absolute h-8 w-8 rounded-full p-0 transition-all duration-200 hover:scale-110 disabled:bg-transparent",
|
|
45
45
|
{
|
|
46
46
|
variants: createVariants({
|
|
47
47
|
orientation: {
|
|
@@ -154,3 +154,58 @@ export const WithLegendAreaChartExample = (props: Partial<AreaChartProps>) => {
|
|
|
154
154
|
</Chart>
|
|
155
155
|
);
|
|
156
156
|
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Smooth gradient area chart — a single data series with a lush gradient fill,
|
|
160
|
+
* smooth natural curve, and a tooltip with a value callout. Matches the style
|
|
161
|
+
* of the "Total Sales" chart in premium dashboards.
|
|
162
|
+
*/
|
|
163
|
+
export const GradientAreaChartExample = (props: Partial<AreaChartProps>) => {
|
|
164
|
+
const chartConfig = {
|
|
165
|
+
value: {
|
|
166
|
+
label: "Revenue",
|
|
167
|
+
color: "hsl(var(--chart-1))",
|
|
168
|
+
},
|
|
169
|
+
} satisfies ChartConfig;
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<Chart config={chartConfig} className="h-[250px] w-full">
|
|
173
|
+
<AreaChart {...props.areaChart}>
|
|
174
|
+
<defs>
|
|
175
|
+
<linearGradient id="gradientFill" x1="0" y1="0" x2="0" y2="1">
|
|
176
|
+
<stop offset="0%" stopColor="var(--color-value)" stopOpacity={0.3} />
|
|
177
|
+
<stop offset="100%" stopColor="var(--color-value)" stopOpacity={0.02} />
|
|
178
|
+
</linearGradient>
|
|
179
|
+
</defs>
|
|
180
|
+
<CartesianGrid vertical={false} strokeDasharray="3 3" />
|
|
181
|
+
<XAxis
|
|
182
|
+
dataKey="month"
|
|
183
|
+
tickLine={false}
|
|
184
|
+
axisLine={false}
|
|
185
|
+
tickMargin={8}
|
|
186
|
+
{...props.xAxis}
|
|
187
|
+
/>
|
|
188
|
+
<YAxis
|
|
189
|
+
tickLine={false}
|
|
190
|
+
axisLine={false}
|
|
191
|
+
tickMargin={8}
|
|
192
|
+
tickFormatter={(v: number) => `$${(v / 1000).toFixed(0)}k`}
|
|
193
|
+
{...props.yAxis}
|
|
194
|
+
/>
|
|
195
|
+
<ChartTooltip
|
|
196
|
+
content={<ChartTooltipContent indicator="line" />}
|
|
197
|
+
/>
|
|
198
|
+
<Area
|
|
199
|
+
dataKey="value"
|
|
200
|
+
type="natural"
|
|
201
|
+
fill="url(#gradientFill)"
|
|
202
|
+
stroke="var(--color-value)"
|
|
203
|
+
strokeWidth={2.5}
|
|
204
|
+
dot={false}
|
|
205
|
+
activeDot={{ r: 5, strokeWidth: 2, fill: "var(--color-value)" }}
|
|
206
|
+
{...props.area}
|
|
207
|
+
/>
|
|
208
|
+
</AreaChart>
|
|
209
|
+
</Chart>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
@@ -419,3 +419,98 @@ export const NegativeBarChartExample = (props: Partial<BarChartProps>) => {
|
|
|
419
419
|
</Chart>
|
|
420
420
|
);
|
|
421
421
|
};
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Rounded pill-shaped bar chart — thick bars with fully rounded tops,
|
|
425
|
+
* inspired by modern dashboard UIs. One bar per day of week with
|
|
426
|
+
* the active/current day highlighted.
|
|
427
|
+
*/
|
|
428
|
+
export const RoundedBarChartExample = (props: Partial<BarChartProps>) => {
|
|
429
|
+
const chartConfig = {
|
|
430
|
+
visitors: {
|
|
431
|
+
label: "Visitors",
|
|
432
|
+
color: "hsl(var(--chart-1))",
|
|
433
|
+
},
|
|
434
|
+
} satisfies ChartConfig;
|
|
435
|
+
|
|
436
|
+
return (
|
|
437
|
+
<Chart config={chartConfig} className="h-[200px] w-full">
|
|
438
|
+
<BarChart
|
|
439
|
+
accessibilityLayer
|
|
440
|
+
barCategoryGap="25%"
|
|
441
|
+
{...props.barChart}
|
|
442
|
+
>
|
|
443
|
+
<XAxis
|
|
444
|
+
dataKey="day"
|
|
445
|
+
tickLine={false}
|
|
446
|
+
axisLine={false}
|
|
447
|
+
tickMargin={8}
|
|
448
|
+
{...props.xAxis}
|
|
449
|
+
/>
|
|
450
|
+
<YAxis hide {...props.yAxis} />
|
|
451
|
+
<ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
|
|
452
|
+
<Bar dataKey="visitors" radius={[999, 999, 999, 999]} barSize={28} {...props.bar}>
|
|
453
|
+
{(props.barChart as { data: { day: string; visitors: number; active?: boolean }[] })?.data?.map(
|
|
454
|
+
(entry, index) => (
|
|
455
|
+
<Cell
|
|
456
|
+
key={`cell-${index}`}
|
|
457
|
+
fill={entry.active ? "var(--color-visitors)" : "var(--color-visitors)"}
|
|
458
|
+
fillOpacity={entry.active ? 1 : 0.2}
|
|
459
|
+
/>
|
|
460
|
+
)
|
|
461
|
+
)}
|
|
462
|
+
</Bar>
|
|
463
|
+
</BarChart>
|
|
464
|
+
</Chart>
|
|
465
|
+
);
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Grouped rounded bar chart — side-by-side bars with rounded tops
|
|
470
|
+
* for comparing two data series.
|
|
471
|
+
*/
|
|
472
|
+
export const GroupedRoundedBarChartExample = (props: Partial<BarChartProps>) => {
|
|
473
|
+
const chartConfig = {
|
|
474
|
+
income: {
|
|
475
|
+
label: "Income",
|
|
476
|
+
color: "hsl(var(--chart-1))",
|
|
477
|
+
},
|
|
478
|
+
expenses: {
|
|
479
|
+
label: "Expenses",
|
|
480
|
+
color: "hsl(var(--chart-2))",
|
|
481
|
+
},
|
|
482
|
+
} satisfies ChartConfig;
|
|
483
|
+
|
|
484
|
+
return (
|
|
485
|
+
<Chart config={chartConfig} className="h-[250px] w-full">
|
|
486
|
+
<BarChart accessibilityLayer barCategoryGap="20%" {...props.barChart}>
|
|
487
|
+
<CartesianGrid vertical={false} strokeDasharray="3 3" />
|
|
488
|
+
<XAxis
|
|
489
|
+
dataKey="month"
|
|
490
|
+
tickLine={false}
|
|
491
|
+
axisLine={false}
|
|
492
|
+
tickMargin={8}
|
|
493
|
+
tickFormatter={(value: string) => value.slice(0, 3)}
|
|
494
|
+
{...props.xAxis}
|
|
495
|
+
/>
|
|
496
|
+
<YAxis tickLine={false} axisLine={false} tickMargin={8} {...props.yAxis} />
|
|
497
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
498
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
499
|
+
<Bar
|
|
500
|
+
dataKey="income"
|
|
501
|
+
fill="var(--color-income)"
|
|
502
|
+
radius={[6, 6, 0, 0]}
|
|
503
|
+
barSize={18}
|
|
504
|
+
{...props.bar}
|
|
505
|
+
/>
|
|
506
|
+
<Bar
|
|
507
|
+
dataKey="expenses"
|
|
508
|
+
fill="var(--color-expenses)"
|
|
509
|
+
radius={[6, 6, 0, 0]}
|
|
510
|
+
barSize={18}
|
|
511
|
+
{...props.bar}
|
|
512
|
+
/>
|
|
513
|
+
</BarChart>
|
|
514
|
+
</Chart>
|
|
515
|
+
);
|
|
516
|
+
};
|