@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
package/dist/types/index.d.ts
CHANGED
|
@@ -21,16 +21,22 @@ export * from './components/Heading';
|
|
|
21
21
|
export * from './components/Paragraph';
|
|
22
22
|
/** utility & atoms */
|
|
23
23
|
export * from './components/AspectRatio';
|
|
24
|
+
export * from './components/IconContainer';
|
|
24
25
|
export * from './components/Image';
|
|
25
26
|
export * from './components/Spinner';
|
|
26
27
|
/** data display */
|
|
27
28
|
export * from './components/Accordion';
|
|
29
|
+
export * from './components/ActivityFeed';
|
|
28
30
|
export * from './components/Alert';
|
|
31
|
+
export * from './components/Amount';
|
|
29
32
|
export * from './components/Avatar';
|
|
30
33
|
export * from './components/Badge';
|
|
31
34
|
export * from './components/Card';
|
|
32
35
|
export * from './components/Calendar';
|
|
36
|
+
export * from './components/CircularProgress';
|
|
33
37
|
export * from './components/Collapsible';
|
|
38
|
+
export * from './components/CountdownTimer';
|
|
39
|
+
export * from './components/DataList';
|
|
34
40
|
export * from './components/Description';
|
|
35
41
|
export * from './components/Dock';
|
|
36
42
|
export * from './components/Indicator';
|
|
@@ -40,15 +46,21 @@ export * from './components/List';
|
|
|
40
46
|
export * from './components/Progress';
|
|
41
47
|
export * from './components/Resizable';
|
|
42
48
|
export * from './components/ScrollArea';
|
|
49
|
+
export * from './components/ComparisonBar';
|
|
43
50
|
export * from './components/Separator';
|
|
44
51
|
export * from './components/Sonner';
|
|
52
|
+
export * from './components/Sparkline';
|
|
45
53
|
export * from './components/Stack';
|
|
46
54
|
export * from './components/Stat';
|
|
55
|
+
export * from './components/StatCard';
|
|
47
56
|
export * from './components/Status';
|
|
48
57
|
export * from './components/Table';
|
|
49
58
|
export * from './components/Tabs';
|
|
50
59
|
export * from './components/Text';
|
|
51
60
|
export * from './components/Timeline';
|
|
61
|
+
export * from './components/TrendBadge';
|
|
62
|
+
export * from './components/CalendarHeatmap';
|
|
63
|
+
export * from './components/Greeting';
|
|
52
64
|
/** data input */
|
|
53
65
|
export * from './components/DatetimePicker';
|
|
54
66
|
export * from './components/FileUploader';
|
|
@@ -65,9 +77,11 @@ export * from './components/Chart';
|
|
|
65
77
|
export * from './components/Command';
|
|
66
78
|
export * from './components/Dialog';
|
|
67
79
|
export * from './components/HoverCard';
|
|
80
|
+
export * from './components/KPICard';
|
|
68
81
|
export * from './components/Popover';
|
|
69
82
|
export * from './components/Slot';
|
|
70
83
|
export * from './components/Widget';
|
|
84
|
+
export * from './components/WidgetShell';
|
|
71
85
|
/** molecules */
|
|
72
86
|
export * from './components/Banner';
|
|
73
87
|
export * from './components/Empty';
|
|
@@ -78,3 +92,23 @@ export * from './components/Footer';
|
|
|
78
92
|
export * from './components/Header';
|
|
79
93
|
export * from './components/Panel';
|
|
80
94
|
export * from './components/Sheet';
|
|
95
|
+
/** inline charts */
|
|
96
|
+
export * from './components/MiniAreaChart';
|
|
97
|
+
export * from './components/MiniBarChart';
|
|
98
|
+
export * from './components/MiniDonutChart';
|
|
99
|
+
export * from './components/MiniStackedBar';
|
|
100
|
+
/** effects */
|
|
101
|
+
export * from './components/AnimatedCounter';
|
|
102
|
+
export * from './components/AnimatedGroup';
|
|
103
|
+
export * from './components/AnimatedList';
|
|
104
|
+
export * from './components/BorderBeam';
|
|
105
|
+
export * from './components/Confetti';
|
|
106
|
+
export * from './components/GlowCard';
|
|
107
|
+
export * from './components/GradientText';
|
|
108
|
+
export * from './components/Marquee';
|
|
109
|
+
export * from './components/Meteors';
|
|
110
|
+
export * from './components/NumberTicker';
|
|
111
|
+
export * from './components/Pulse';
|
|
112
|
+
export * from './components/ShinyButton';
|
|
113
|
+
export * from './components/SpotlightCard';
|
|
114
|
+
export * from './components/TextShimmer';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbao01/common",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"cmdk": "^1.1.1",
|
|
81
81
|
"date-fns": "^4.1.0",
|
|
82
82
|
"embla-carousel-react": "^8.6.0",
|
|
83
|
+
"framer-motion": "^12.38.0",
|
|
83
84
|
"lucide-react": "^0.577.0",
|
|
84
85
|
"react-day-picker": "^9.14.0",
|
|
85
86
|
"react-dropzone": "^14.4.1",
|
|
@@ -3,7 +3,7 @@ import { cva } from "../../libs";
|
|
|
3
3
|
export const getAccordionItemClasses = cva("border-b");
|
|
4
4
|
|
|
5
5
|
export const getAccordionTriggerClasses = cva(
|
|
6
|
-
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all [&:hover:not(:disabled)]:underline disabled:opacity-50 [&[data-state=open]>svg]:rotate-180"
|
|
6
|
+
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all duration-200 [&:hover:not(:disabled)]:underline disabled:opacity-50 [&[data-state=open]>svg]:rotate-180"
|
|
7
7
|
);
|
|
8
8
|
|
|
9
9
|
export const getAccordionContentClasses = cva(
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CircleIcon } from "lucide-react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import {
|
|
4
|
+
getActivityFeedClasses,
|
|
5
|
+
getActivityItemClasses,
|
|
6
|
+
getActivityIconClasses,
|
|
7
|
+
getActivityLineClasses,
|
|
8
|
+
getActivityContentClasses,
|
|
9
|
+
getActivityTimestampClasses,
|
|
10
|
+
} from "./constants";
|
|
11
|
+
import type { ActivityFeedProps } from "./types";
|
|
12
|
+
|
|
13
|
+
const ActivityFeed = ({
|
|
14
|
+
items,
|
|
15
|
+
className,
|
|
16
|
+
maxItems,
|
|
17
|
+
showLine = true,
|
|
18
|
+
...props
|
|
19
|
+
}: ActivityFeedProps) => {
|
|
20
|
+
const displayItems = maxItems ? items.slice(0, maxItems) : items;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={cn(getActivityFeedClasses(), className)} {...props}>
|
|
24
|
+
{displayItems.map((item, index) => {
|
|
25
|
+
const isLast = index === displayItems.length - 1;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div key={item.id} className={getActivityItemClasses()}>
|
|
29
|
+
<div className={getActivityIconClasses()}>
|
|
30
|
+
{item.icon ?? <CircleIcon className="size-3" />}
|
|
31
|
+
</div>
|
|
32
|
+
{showLine && !isLast && <div className={getActivityLineClasses()} />}
|
|
33
|
+
<div className={getActivityContentClasses()}>
|
|
34
|
+
<div className="flex items-start justify-between gap-2">
|
|
35
|
+
<div className="text-sm">{item.content}</div>
|
|
36
|
+
{item.meta && <div className="shrink-0">{item.meta}</div>}
|
|
37
|
+
</div>
|
|
38
|
+
{item.timestamp && (
|
|
39
|
+
<span className={getActivityTimestampClasses()}>{item.timestamp}</span>
|
|
40
|
+
)}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
})}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
ActivityFeed.displayName = "ActivityFeed";
|
|
50
|
+
|
|
51
|
+
export { ActivityFeed };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cva } from "../../libs";
|
|
2
|
+
|
|
3
|
+
export const getActivityFeedClasses = cva("flex flex-col");
|
|
4
|
+
|
|
5
|
+
export const getActivityItemClasses = cva(
|
|
6
|
+
"group relative flex gap-3 pb-4 last:pb-0 transition-colors duration-150"
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
export const getActivityIconClasses = cva(
|
|
10
|
+
"relative z-10 flex size-8 shrink-0 items-center justify-center rounded-full border bg-base-100 text-base-content/60 transition-colors duration-200 group-hover:border-primary/30 group-hover:text-primary"
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const getActivityLineClasses = cva(
|
|
14
|
+
"absolute left-4 top-8 -bottom-0 w-px -translate-x-1/2 bg-base-300"
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const getActivityContentClasses = cva("flex min-w-0 flex-1 flex-col gap-0.5 pt-1");
|
|
18
|
+
|
|
19
|
+
export const getActivityTimestampClasses = cva("text-xs text-base-content/50 tabular-nums");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type ActivityItem = {
|
|
4
|
+
/** Unique identifier */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Icon or avatar to show */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Main content/description */
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
/** Timestamp or relative time label */
|
|
11
|
+
timestamp?: string;
|
|
12
|
+
/** Optional metadata (e.g. amount, status) */
|
|
13
|
+
meta?: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ActivityFeedProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
17
|
+
/** List of activity items to display */
|
|
18
|
+
items: ActivityItem[];
|
|
19
|
+
/** Maximum number of items to show */
|
|
20
|
+
maxItems?: number;
|
|
21
|
+
/** Whether to show the connecting line between items */
|
|
22
|
+
showLine?: boolean;
|
|
23
|
+
};
|
|
@@ -2,7 +2,7 @@ import { cva } from "../../libs";
|
|
|
2
2
|
import { createVariants } from "../../utilities";
|
|
3
3
|
|
|
4
4
|
export const getAlertClasses = cva(
|
|
5
|
-
"relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg]:absolute [&>svg]:left-4 [&>svg]:text-inherit",
|
|
5
|
+
"relative w-full rounded-lg border p-4 shadow-sm [&>svg~*]:pl-7 [&>svg]:absolute [&>svg]:left-4 [&>svg]:text-inherit",
|
|
6
6
|
{
|
|
7
7
|
variants: createVariants({
|
|
8
8
|
variant: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
|
|
3
3
|
export const getDialogCloseClasses = cva(
|
|
4
|
-
"absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-
|
|
4
|
+
"absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-all duration-200 hover:opacity-100 hover:rotate-90 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
|
|
5
5
|
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import type { AmountProps } from "./types";
|
|
4
|
+
|
|
5
|
+
const Amount = ({
|
|
6
|
+
value,
|
|
7
|
+
className,
|
|
8
|
+
currency,
|
|
9
|
+
locale = "en-US",
|
|
10
|
+
notation = "standard",
|
|
11
|
+
minimumFractionDigits,
|
|
12
|
+
maximumFractionDigits,
|
|
13
|
+
signDisplay = "auto",
|
|
14
|
+
colored = false,
|
|
15
|
+
...props
|
|
16
|
+
}: AmountProps) => {
|
|
17
|
+
const formatted = useMemo(() => {
|
|
18
|
+
const options: Intl.NumberFormatOptions = {
|
|
19
|
+
notation,
|
|
20
|
+
signDisplay,
|
|
21
|
+
minimumFractionDigits,
|
|
22
|
+
maximumFractionDigits,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (currency) {
|
|
26
|
+
options.style = "currency";
|
|
27
|
+
options.currency = currency;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return new Intl.NumberFormat(locale, options).format(value);
|
|
31
|
+
}, [value, currency, locale, notation, minimumFractionDigits, maximumFractionDigits, signDisplay]);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<span
|
|
35
|
+
className={cn(
|
|
36
|
+
"tabular-nums",
|
|
37
|
+
colored && value > 0 && "text-success",
|
|
38
|
+
colored && value < 0 && "text-error",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{formatted}
|
|
44
|
+
</span>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
Amount.displayName = "Amount";
|
|
49
|
+
|
|
50
|
+
export { Amount };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
export type AmountProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
4
|
+
/** The numeric value to format */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Currency code (e.g. "USD", "EUR", "GBP"). If provided, formats as currency */
|
|
7
|
+
currency?: string;
|
|
8
|
+
/** Locale for formatting (default: "en-US") */
|
|
9
|
+
locale?: string;
|
|
10
|
+
/** Notation style */
|
|
11
|
+
notation?: "standard" | "compact" | "scientific" | "engineering";
|
|
12
|
+
/** Minimum fraction digits */
|
|
13
|
+
minimumFractionDigits?: number;
|
|
14
|
+
/** Maximum fraction digits */
|
|
15
|
+
maximumFractionDigits?: number;
|
|
16
|
+
/** Whether to show sign for positive values */
|
|
17
|
+
signDisplay?: "auto" | "never" | "always" | "exceptZero";
|
|
18
|
+
/** Whether to apply trend coloring (green for positive, red for negative) */
|
|
19
|
+
colored?: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import type { AnimatedCounterProps } from "./types";
|
|
5
|
+
import { cn } from "../../utilities";
|
|
6
|
+
|
|
7
|
+
const DIGITS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
8
|
+
|
|
9
|
+
const Digit = ({ digit, className }: { digit: string; className?: string }) => {
|
|
10
|
+
const numericDigit = parseInt(digit, 10);
|
|
11
|
+
const isNumber = !isNaN(numericDigit);
|
|
12
|
+
|
|
13
|
+
if (!isNumber) {
|
|
14
|
+
return <span className={className}>{digit}</span>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<span className={cn("relative inline-block h-[1em] w-[0.6em] overflow-hidden", className)}>
|
|
19
|
+
<span
|
|
20
|
+
className="absolute left-0 flex flex-col transition-transform duration-500 ease-out"
|
|
21
|
+
style={{ transform: `translateY(-${numericDigit * 10}%)` }}
|
|
22
|
+
>
|
|
23
|
+
{DIGITS.map((d) => (
|
|
24
|
+
<span key={d} className="flex h-[1em] items-center justify-center">
|
|
25
|
+
{d}
|
|
26
|
+
</span>
|
|
27
|
+
))}
|
|
28
|
+
</span>
|
|
29
|
+
</span>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const AnimatedCounter = ({
|
|
34
|
+
value,
|
|
35
|
+
className,
|
|
36
|
+
prefix = "",
|
|
37
|
+
suffix = "",
|
|
38
|
+
decimalPlaces = 0,
|
|
39
|
+
separator = true,
|
|
40
|
+
...props
|
|
41
|
+
}: AnimatedCounterProps) => {
|
|
42
|
+
const [displayValue, setDisplayValue] = useState(value);
|
|
43
|
+
const prevValue = useRef(value);
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
prevValue.current = displayValue;
|
|
47
|
+
setDisplayValue(value);
|
|
48
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
|
+
}, [value]);
|
|
50
|
+
|
|
51
|
+
const formatted = separator
|
|
52
|
+
? displayValue.toFixed(decimalPlaces).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
|
|
53
|
+
: displayValue.toFixed(decimalPlaces);
|
|
54
|
+
|
|
55
|
+
const chars = `${prefix}${formatted}${suffix}`.split("");
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<span className={cn("inline-flex tabular-nums", className)} {...props}>
|
|
59
|
+
{chars.map((char, i) => (
|
|
60
|
+
<Digit key={`${i}-${char}`} digit={char} />
|
|
61
|
+
))}
|
|
62
|
+
</span>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
AnimatedCounter.displayName = "AnimatedCounter";
|
|
67
|
+
|
|
68
|
+
export { AnimatedCounter };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
export type AnimatedCounterProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
4
|
+
/** Target value to display */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Prefix (e.g. "$") */
|
|
7
|
+
prefix?: string;
|
|
8
|
+
/** Suffix (e.g. "%") */
|
|
9
|
+
suffix?: string;
|
|
10
|
+
/** Number of decimal places */
|
|
11
|
+
decimalPlaces?: number;
|
|
12
|
+
/** Whether to include thousand separators */
|
|
13
|
+
separator?: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { Variant, Variants } from "framer-motion";
|
|
4
|
+
import { Children } from "react";
|
|
5
|
+
import { motion } from "framer-motion";
|
|
6
|
+
import type { AnimatedGroupPreset, AnimatedGroupProps } from "./types";
|
|
7
|
+
import { cn } from "../../utilities";
|
|
8
|
+
|
|
9
|
+
const presetVariants: Record<
|
|
10
|
+
AnimatedGroupPreset,
|
|
11
|
+
{ container: { hidden: Variant; visible: Variant }; item: { hidden: Variant; visible: Variant } }
|
|
12
|
+
> = {
|
|
13
|
+
fade: {
|
|
14
|
+
container: { hidden: { opacity: 0 }, visible: { opacity: 1 } },
|
|
15
|
+
item: { hidden: { opacity: 0 }, visible: { opacity: 1 } },
|
|
16
|
+
},
|
|
17
|
+
slide: {
|
|
18
|
+
container: { hidden: {}, visible: {} },
|
|
19
|
+
item: {
|
|
20
|
+
hidden: { opacity: 0, y: 20 },
|
|
21
|
+
visible: { opacity: 1, y: 0 },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
scale: {
|
|
25
|
+
container: { hidden: {}, visible: {} },
|
|
26
|
+
item: {
|
|
27
|
+
hidden: { opacity: 0, scale: 0.8 },
|
|
28
|
+
visible: { opacity: 1, scale: 1 },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
blur: {
|
|
32
|
+
container: { hidden: {}, visible: {} },
|
|
33
|
+
item: {
|
|
34
|
+
hidden: { opacity: 0, filter: "blur(4px)" },
|
|
35
|
+
visible: { opacity: 1, filter: "blur(0px)" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
"blur-slide": {
|
|
39
|
+
container: { hidden: {}, visible: {} },
|
|
40
|
+
item: {
|
|
41
|
+
hidden: { opacity: 0, filter: "blur(4px)", y: 12 },
|
|
42
|
+
visible: { opacity: 1, filter: "blur(0px)", y: 0 },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const AnimatedGroup = ({
|
|
48
|
+
children,
|
|
49
|
+
className,
|
|
50
|
+
preset = "fade",
|
|
51
|
+
variants: customVariants,
|
|
52
|
+
staggerDelay = 0.1,
|
|
53
|
+
transition,
|
|
54
|
+
...props
|
|
55
|
+
}: AnimatedGroupProps) => {
|
|
56
|
+
const variants = customVariants ?? presetVariants[preset];
|
|
57
|
+
const containerVariants = {
|
|
58
|
+
hidden: variants.container?.hidden ?? {},
|
|
59
|
+
visible: {
|
|
60
|
+
...(variants.container?.visible as Record<string, unknown>),
|
|
61
|
+
transition: {
|
|
62
|
+
staggerChildren: staggerDelay,
|
|
63
|
+
...transition,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
} as Variants;
|
|
67
|
+
|
|
68
|
+
const itemVariants = {
|
|
69
|
+
hidden: variants.item?.hidden ?? { opacity: 0 },
|
|
70
|
+
visible: {
|
|
71
|
+
...((variants.item?.visible as Record<string, unknown>) ?? { opacity: 1 }),
|
|
72
|
+
transition: {
|
|
73
|
+
duration: 0.4,
|
|
74
|
+
ease: [0.25, 0.4, 0.25, 1],
|
|
75
|
+
...transition,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
} as Variants;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<motion.div
|
|
82
|
+
className={cn(className)}
|
|
83
|
+
variants={containerVariants}
|
|
84
|
+
initial="hidden"
|
|
85
|
+
animate="visible"
|
|
86
|
+
{...props}
|
|
87
|
+
>
|
|
88
|
+
{Children.map(children, (child) => (
|
|
89
|
+
<motion.div variants={itemVariants}>{child}</motion.div>
|
|
90
|
+
))}
|
|
91
|
+
</motion.div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
AnimatedGroup.displayName = "AnimatedGroup";
|
|
96
|
+
|
|
97
|
+
export { AnimatedGroup };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Transition, Variant } from "framer-motion";
|
|
2
|
+
import type { HTMLAttributes } from "react";
|
|
3
|
+
|
|
4
|
+
export type AnimatedGroupPreset = "fade" | "slide" | "scale" | "blur" | "blur-slide";
|
|
5
|
+
|
|
6
|
+
export type AnimatedGroupProps = Omit<
|
|
7
|
+
HTMLAttributes<HTMLDivElement>,
|
|
8
|
+
"onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart"
|
|
9
|
+
> & {
|
|
10
|
+
/** Animation preset */
|
|
11
|
+
preset?: AnimatedGroupPreset;
|
|
12
|
+
/** Custom framer-motion variants */
|
|
13
|
+
variants?: {
|
|
14
|
+
container?: { hidden?: Variant; visible?: Variant };
|
|
15
|
+
item?: { hidden?: Variant; visible?: Variant };
|
|
16
|
+
};
|
|
17
|
+
/** Stagger delay between children in seconds */
|
|
18
|
+
staggerDelay?: number;
|
|
19
|
+
/** Animation transition config */
|
|
20
|
+
transition?: Transition;
|
|
21
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
4
|
+
import { cn } from "../../utilities";
|
|
5
|
+
import type { AnimatedListProps } from "./types";
|
|
6
|
+
|
|
7
|
+
const AnimatedList = ({
|
|
8
|
+
items,
|
|
9
|
+
className,
|
|
10
|
+
maxItems,
|
|
11
|
+
staggerDelay = 100,
|
|
12
|
+
...props
|
|
13
|
+
}: AnimatedListProps) => {
|
|
14
|
+
const visibleItems = maxItems ? items.slice(-maxItems) : items;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div className={cn("flex flex-col gap-2 overflow-hidden", className)} {...props}>
|
|
18
|
+
<AnimatePresence initial={false}>
|
|
19
|
+
{visibleItems.map((item, index) => (
|
|
20
|
+
<motion.div
|
|
21
|
+
key={item.id}
|
|
22
|
+
layout
|
|
23
|
+
initial={{ opacity: 0, y: 20, scale: 0.95 }}
|
|
24
|
+
animate={{ opacity: 1, y: 0, scale: 1 }}
|
|
25
|
+
exit={{ opacity: 0, y: -20, scale: 0.95 }}
|
|
26
|
+
transition={{
|
|
27
|
+
duration: 0.3,
|
|
28
|
+
delay: index * (staggerDelay / 1000),
|
|
29
|
+
ease: [0.16, 1, 0.3, 1],
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
{item.content}
|
|
33
|
+
</motion.div>
|
|
34
|
+
))}
|
|
35
|
+
</AnimatePresence>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
AnimatedList.displayName = "AnimatedList";
|
|
41
|
+
|
|
42
|
+
export { AnimatedList };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type AnimatedListItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type AnimatedListProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
9
|
+
/** Items to display */
|
|
10
|
+
items: AnimatedListItem[];
|
|
11
|
+
/** Maximum visible items */
|
|
12
|
+
maxItems?: number;
|
|
13
|
+
/** Delay between each item appearing (ms) */
|
|
14
|
+
staggerDelay?: number;
|
|
15
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
import { createVariants } from "../../utilities";
|
|
3
3
|
|
|
4
|
-
export const getBadgeClasses = cva("badge", {
|
|
4
|
+
export const getBadgeClasses = cva("badge transition-colors duration-200", {
|
|
5
5
|
variants: createVariants({
|
|
6
6
|
variant: {
|
|
7
7
|
accent: "badge-accent",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
import { createVariants } from "../../utilities";
|
|
3
3
|
|
|
4
|
-
export const getBannerClasses = cva("alert alert-vertical sm:alert-horizontal", {
|
|
4
|
+
export const getBannerClasses = cva("alert alert-vertical sm:alert-horizontal shadow-sm", {
|
|
5
5
|
variants: createVariants({
|
|
6
6
|
variant: {
|
|
7
7
|
info: "alert-info",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import { cn } from "../../utilities";
|
|
3
|
+
import type { BorderBeamProps } from "./types";
|
|
4
|
+
|
|
5
|
+
const BorderBeam = ({
|
|
6
|
+
className,
|
|
7
|
+
size = 200,
|
|
8
|
+
duration = 4,
|
|
9
|
+
delay = 0,
|
|
10
|
+
colorFrom = "oklch(0.7 0.25 250)",
|
|
11
|
+
colorTo = "oklch(0.7 0.2 330)",
|
|
12
|
+
...props
|
|
13
|
+
}: BorderBeamProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
className={cn(
|
|
17
|
+
"pointer-events-none absolute inset-0 rounded-[inherit] border border-transparent",
|
|
18
|
+
"[mask-clip:padding-box,border-box] [mask-composite:intersect]",
|
|
19
|
+
"[mask-image:linear-gradient(transparent,transparent),linear-gradient(#fff,#fff)]",
|
|
20
|
+
"after:absolute after:aspect-square after:animate-border-beam",
|
|
21
|
+
"after:bg-[linear-gradient(var(--beam-color-from),var(--beam-color-to),transparent)]",
|
|
22
|
+
"after:[offset-path:rect(0_auto_auto_0_round_var(--beam-size))]",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
style={
|
|
26
|
+
{
|
|
27
|
+
"--beam-size": `${size}px`,
|
|
28
|
+
"--beam-color-from": colorFrom,
|
|
29
|
+
"--beam-color-to": colorTo,
|
|
30
|
+
"--tw-duration": `${duration}s`,
|
|
31
|
+
animationDelay: `${delay}s`,
|
|
32
|
+
} as CSSProperties
|
|
33
|
+
}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
BorderBeam.displayName = "BorderBeam";
|
|
40
|
+
|
|
41
|
+
export { BorderBeam };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
export type BorderBeamProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
/** Size of the beam in pixels */
|
|
5
|
+
size?: number;
|
|
6
|
+
/** Duration of the animation in seconds */
|
|
7
|
+
duration?: number;
|
|
8
|
+
/** Delay before animation starts in seconds */
|
|
9
|
+
delay?: number;
|
|
10
|
+
/** Start color of the beam gradient */
|
|
11
|
+
colorFrom?: string;
|
|
12
|
+
/** End color of the beam gradient */
|
|
13
|
+
colorTo?: string;
|
|
14
|
+
};
|