@mbao01/common 0.8.0 → 0.9.0
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/components/ChartLegend.d.ts +1 -2
- package/dist/types/components/Chart/stories/args/index.d.ts +1 -1
- 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/Chart/types.d.ts +1 -1
- 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/KPICard/KPICard.d.ts +6 -0
- package/dist/types/components/KPICard/index.d.ts +2 -0
- package/dist/types/components/KPICard/types.d.ts +21 -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/Resizable/Resizable.d.ts +1 -1
- 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 +33 -0
- package/package.json +58 -58
- 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/components/ChartTooltip.tsx +1 -1
- package/src/components/Chart/stories/args/index.ts +2 -1
- package/src/components/Chart/stories/examples/AreaChart.tsx +55 -0
- package/src/components/Chart/stories/examples/BarChart.tsx +104 -6
- 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/Chart/types.ts +1 -1
- 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/KPICard/KPICard.tsx +85 -0
- package/src/components/KPICard/index.ts +2 -0
- package/src/components/KPICard/types.ts +22 -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 +35 -0
- package/src/stylesheets/tailwind.css +210 -0
- package/src/utilities/getSubpaths/getSubpaths.ts +1 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -25,12 +25,17 @@ export * from './components/Image';
|
|
|
25
25
|
export * from './components/Spinner';
|
|
26
26
|
/** data display */
|
|
27
27
|
export * from './components/Accordion';
|
|
28
|
+
export * from './components/ActivityFeed';
|
|
28
29
|
export * from './components/Alert';
|
|
30
|
+
export * from './components/Amount';
|
|
29
31
|
export * from './components/Avatar';
|
|
30
32
|
export * from './components/Badge';
|
|
31
33
|
export * from './components/Card';
|
|
32
34
|
export * from './components/Calendar';
|
|
35
|
+
export * from './components/CircularProgress';
|
|
33
36
|
export * from './components/Collapsible';
|
|
37
|
+
export * from './components/CountdownTimer';
|
|
38
|
+
export * from './components/DataList';
|
|
34
39
|
export * from './components/Description';
|
|
35
40
|
export * from './components/Dock';
|
|
36
41
|
export * from './components/Indicator';
|
|
@@ -40,15 +45,21 @@ export * from './components/List';
|
|
|
40
45
|
export * from './components/Progress';
|
|
41
46
|
export * from './components/Resizable';
|
|
42
47
|
export * from './components/ScrollArea';
|
|
48
|
+
export * from './components/ComparisonBar';
|
|
43
49
|
export * from './components/Separator';
|
|
44
50
|
export * from './components/Sonner';
|
|
51
|
+
export * from './components/Sparkline';
|
|
45
52
|
export * from './components/Stack';
|
|
46
53
|
export * from './components/Stat';
|
|
54
|
+
export * from './components/StatCard';
|
|
47
55
|
export * from './components/Status';
|
|
48
56
|
export * from './components/Table';
|
|
49
57
|
export * from './components/Tabs';
|
|
50
58
|
export * from './components/Text';
|
|
51
59
|
export * from './components/Timeline';
|
|
60
|
+
export * from './components/TrendBadge';
|
|
61
|
+
export * from './components/CalendarHeatmap';
|
|
62
|
+
export * from './components/Greeting';
|
|
52
63
|
/** data input */
|
|
53
64
|
export * from './components/DatetimePicker';
|
|
54
65
|
export * from './components/FileUploader';
|
|
@@ -65,9 +76,11 @@ export * from './components/Chart';
|
|
|
65
76
|
export * from './components/Command';
|
|
66
77
|
export * from './components/Dialog';
|
|
67
78
|
export * from './components/HoverCard';
|
|
79
|
+
export * from './components/KPICard';
|
|
68
80
|
export * from './components/Popover';
|
|
69
81
|
export * from './components/Slot';
|
|
70
82
|
export * from './components/Widget';
|
|
83
|
+
export * from './components/WidgetShell';
|
|
71
84
|
/** molecules */
|
|
72
85
|
export * from './components/Banner';
|
|
73
86
|
export * from './components/Empty';
|
|
@@ -78,3 +91,23 @@ export * from './components/Footer';
|
|
|
78
91
|
export * from './components/Header';
|
|
79
92
|
export * from './components/Panel';
|
|
80
93
|
export * from './components/Sheet';
|
|
94
|
+
/** inline charts */
|
|
95
|
+
export * from './components/MiniAreaChart';
|
|
96
|
+
export * from './components/MiniBarChart';
|
|
97
|
+
export * from './components/MiniDonutChart';
|
|
98
|
+
export * from './components/MiniStackedBar';
|
|
99
|
+
/** effects */
|
|
100
|
+
export * from './components/AnimatedCounter';
|
|
101
|
+
export * from './components/AnimatedGroup';
|
|
102
|
+
export * from './components/AnimatedList';
|
|
103
|
+
export * from './components/BorderBeam';
|
|
104
|
+
export * from './components/Confetti';
|
|
105
|
+
export * from './components/GlowCard';
|
|
106
|
+
export * from './components/GradientText';
|
|
107
|
+
export * from './components/Marquee';
|
|
108
|
+
export * from './components/Meteors';
|
|
109
|
+
export * from './components/NumberTicker';
|
|
110
|
+
export * from './components/Pulse';
|
|
111
|
+
export * from './components/ShinyButton';
|
|
112
|
+
export * from './components/SpotlightCard';
|
|
113
|
+
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.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -45,25 +45,6 @@
|
|
|
45
45
|
"sideEffects": [
|
|
46
46
|
"*.css"
|
|
47
47
|
],
|
|
48
|
-
"scripts": {
|
|
49
|
-
"clean": "pnpx rimraf node_modules",
|
|
50
|
-
"dev": "storybook dev -p 6006",
|
|
51
|
-
"build": "tsc && vite build",
|
|
52
|
-
"build-storybook": "storybook build -o ../../docs/storybook/common",
|
|
53
|
-
"lint": "eslint --report-unused-disable-directives --max-warnings 30",
|
|
54
|
-
"prettier": "prettier --check \"**/*.{ts,tsx}\"",
|
|
55
|
-
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
56
|
-
"preview": "vite preview",
|
|
57
|
-
"prod": "pnpx http-server ../../docs/storybook/common --port 6006",
|
|
58
|
-
"test": "vitest run",
|
|
59
|
-
"test:coverage": "vitest run --coverage",
|
|
60
|
-
"test:ui": "vitest --ui",
|
|
61
|
-
"test:visual": "test-storybook --url http://127.0.0.1:6006",
|
|
62
|
-
"test:visual:coverage": "test-storybook --coverage --url http://127.0.0.1:6006",
|
|
63
|
-
"test:visual:ci": "test-storybook --ci --verbose --url http://127.0.0.1:6006",
|
|
64
|
-
"test:visual:watch": "test-storybook --watch --url http://127.0.0.1:6006",
|
|
65
|
-
"test:watch": "vitest"
|
|
66
|
-
},
|
|
67
48
|
"dependencies": {
|
|
68
49
|
"@dnd-kit/core": "^6.3.1",
|
|
69
50
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
@@ -99,64 +80,65 @@
|
|
|
99
80
|
"cmdk": "^1.1.1",
|
|
100
81
|
"date-fns": "^4.1.0",
|
|
101
82
|
"embla-carousel-react": "^8.6.0",
|
|
102
|
-
"
|
|
103
|
-
"react
|
|
104
|
-
"react-
|
|
105
|
-
"react-
|
|
83
|
+
"framer-motion": "^12.38.0",
|
|
84
|
+
"lucide-react": "^0.577.0",
|
|
85
|
+
"react-day-picker": "^9.14.0",
|
|
86
|
+
"react-dropzone": "^14.4.1",
|
|
87
|
+
"react-international-phone": "^4.8.0",
|
|
106
88
|
"react-otp-input": "^3.1.1",
|
|
107
89
|
"react-resizable-panels": "^3.0.6",
|
|
108
90
|
"sonner": "^2.0.7",
|
|
109
|
-
"tailwind-merge": "^3.
|
|
91
|
+
"tailwind-merge": "^3.5.0",
|
|
110
92
|
"timescape": "^0.8.0",
|
|
111
93
|
"universal-cookie": "^8.0.1",
|
|
112
94
|
"vaul": "^1.1.2"
|
|
113
95
|
},
|
|
114
96
|
"devDependencies": {
|
|
115
|
-
"@eslint/js": "^9.39.
|
|
116
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.7.
|
|
117
|
-
"@storybook/addon-a11y": "^10.
|
|
97
|
+
"@eslint/js": "^9.39.4",
|
|
98
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
99
|
+
"@storybook/addon-a11y": "^10.2.19",
|
|
118
100
|
"@storybook/addon-coverage": "^3.0.0",
|
|
119
|
-
"@storybook/addon-docs": "^10.
|
|
120
|
-
"@storybook/addon-links": "^10.
|
|
121
|
-
"@storybook/addon-onboarding": "^10.
|
|
122
|
-
"@storybook/addon-themes": "^10.
|
|
123
|
-
"@storybook/react-vite": "^10.
|
|
101
|
+
"@storybook/addon-docs": "^10.2.19",
|
|
102
|
+
"@storybook/addon-links": "^10.2.19",
|
|
103
|
+
"@storybook/addon-onboarding": "^10.2.19",
|
|
104
|
+
"@storybook/addon-themes": "^10.2.19",
|
|
105
|
+
"@storybook/react-vite": "^10.2.19",
|
|
124
106
|
"@storybook/test-runner": "^0.24.2",
|
|
125
|
-
"@tailwindcss/postcss": "^4.1
|
|
126
|
-
"@tailwindcss/vite": "^4.1
|
|
107
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
108
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
127
109
|
"@testing-library/jest-dom": "^6.9.1",
|
|
128
|
-
"@testing-library/react": "^16.3.
|
|
110
|
+
"@testing-library/react": "^16.3.2",
|
|
129
111
|
"@testing-library/user-event": "^14.6.1",
|
|
130
|
-
"@types/jest-image-snapshot": "^6.4.
|
|
131
|
-
"@types/node": "^25.0
|
|
132
|
-
"@types/react": "
|
|
133
|
-
"@types/react-dom": "
|
|
134
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
135
|
-
"@typescript-eslint/parser": "^8.
|
|
136
|
-
"@vitejs/plugin-react": "^5.
|
|
112
|
+
"@types/jest-image-snapshot": "^6.4.1",
|
|
113
|
+
"@types/node": "^25.5.0",
|
|
114
|
+
"@types/react": "19.2.14",
|
|
115
|
+
"@types/react-dom": "19.2.3",
|
|
116
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
117
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
118
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
137
119
|
"@vitest/coverage-v8": "^3.2.4",
|
|
138
120
|
"@vitest/ui": "^3.2.4",
|
|
139
121
|
"axe-playwright": "^2.2.2",
|
|
140
|
-
"daisyui": "^5.5.
|
|
141
|
-
"eslint": "^9.39.
|
|
122
|
+
"daisyui": "^5.5.19",
|
|
123
|
+
"eslint": "^9.39.4",
|
|
142
124
|
"eslint-plugin-react": "^7.37.5",
|
|
143
125
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
144
126
|
"eslint-plugin-react-refresh": "^0.4.26",
|
|
145
|
-
"eslint-plugin-storybook": "^10.
|
|
127
|
+
"eslint-plugin-storybook": "^10.2.19",
|
|
146
128
|
"globals": "^16.5.0",
|
|
147
|
-
"jest-image-snapshot": "^6.5.
|
|
129
|
+
"jest-image-snapshot": "^6.5.2",
|
|
148
130
|
"jsdom": "^27.4.0",
|
|
149
131
|
"path": "^0.12.7",
|
|
150
|
-
"postcss": "^8.5.
|
|
151
|
-
"prettier": "^3.
|
|
152
|
-
"react": "^19.2.
|
|
153
|
-
"react-dom": "^19.2.
|
|
154
|
-
"react-router-dom": "^7.
|
|
155
|
-
"recharts": "^3.
|
|
156
|
-
"storybook": "^10.
|
|
157
|
-
"tailwindcss": "^4.1
|
|
132
|
+
"postcss": "^8.5.8",
|
|
133
|
+
"prettier": "^3.8.1",
|
|
134
|
+
"react": "^19.2.4",
|
|
135
|
+
"react-dom": "^19.2.4",
|
|
136
|
+
"react-router-dom": "^7.13.1",
|
|
137
|
+
"recharts": "^3.8.0",
|
|
138
|
+
"storybook": "^10.2.19",
|
|
139
|
+
"tailwindcss": "^4.2.1",
|
|
158
140
|
"typescript": "^5.9.3",
|
|
159
|
-
"typescript-eslint": "^8.
|
|
141
|
+
"typescript-eslint": "^8.57.0",
|
|
160
142
|
"vite": "^6.4.1",
|
|
161
143
|
"vite-plugin-dts": "^4.5.4",
|
|
162
144
|
"vitest": "^3.2.4"
|
|
@@ -168,5 +150,23 @@
|
|
|
168
150
|
"recharts": "2",
|
|
169
151
|
"typescript": "5"
|
|
170
152
|
},
|
|
171
|
-
"
|
|
172
|
-
|
|
153
|
+
"scripts": {
|
|
154
|
+
"clean": "pnpx rimraf node_modules",
|
|
155
|
+
"dev": "storybook dev -p 6006",
|
|
156
|
+
"build": "tsc && vite build",
|
|
157
|
+
"build-storybook": "storybook build -o ../../docs/storybook/common",
|
|
158
|
+
"lint": "eslint --report-unused-disable-directives --max-warnings 30",
|
|
159
|
+
"prettier": "prettier --check \"**/*.{ts,tsx}\"",
|
|
160
|
+
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
161
|
+
"preview": "vite preview",
|
|
162
|
+
"prod": "pnpx http-server ../../docs/storybook/common --port 6006",
|
|
163
|
+
"test": "vitest run",
|
|
164
|
+
"test:coverage": "vitest run --coverage",
|
|
165
|
+
"test:ui": "vitest --ui",
|
|
166
|
+
"test:visual": "test-storybook --url http://127.0.0.1:6006",
|
|
167
|
+
"test:visual:coverage": "test-storybook --coverage --url http://127.0.0.1:6006",
|
|
168
|
+
"test:visual:ci": "test-storybook --ci --verbose --url http://127.0.0.1:6006",
|
|
169
|
+
"test:visual:watch": "test-storybook --watch --url http://127.0.0.1:6006",
|
|
170
|
+
"test:watch": "vitest"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -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
|
+
};
|