@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.
Files changed (276) hide show
  1. package/dist/types/components/ActivityFeed/ActivityFeed.d.ts +6 -0
  2. package/dist/types/components/ActivityFeed/constants.d.ts +6 -0
  3. package/dist/types/components/ActivityFeed/index.d.ts +2 -0
  4. package/dist/types/components/ActivityFeed/types.d.ts +21 -0
  5. package/dist/types/components/Amount/Amount.d.ts +6 -0
  6. package/dist/types/components/Amount/index.d.ts +2 -0
  7. package/dist/types/components/Amount/types.d.ts +19 -0
  8. package/dist/types/components/AnimatedCounter/AnimatedCounter.d.ts +6 -0
  9. package/dist/types/components/AnimatedCounter/index.d.ts +2 -0
  10. package/dist/types/components/AnimatedCounter/types.d.ts +13 -0
  11. package/dist/types/components/AnimatedGroup/AnimatedGroup.d.ts +6 -0
  12. package/dist/types/components/AnimatedGroup/index.d.ts +2 -0
  13. package/dist/types/components/AnimatedGroup/types.d.ts +22 -0
  14. package/dist/types/components/AnimatedList/AnimatedList.d.ts +6 -0
  15. package/dist/types/components/AnimatedList/index.d.ts +2 -0
  16. package/dist/types/components/AnimatedList/types.d.ts +13 -0
  17. package/dist/types/components/BorderBeam/BorderBeam.d.ts +6 -0
  18. package/dist/types/components/BorderBeam/index.d.ts +2 -0
  19. package/dist/types/components/BorderBeam/types.d.ts +13 -0
  20. package/dist/types/components/Box/Box.d.ts +4 -0
  21. package/dist/types/components/Box/constants.d.ts +4 -0
  22. package/dist/types/components/CalendarHeatmap/CalendarHeatmap.d.ts +6 -0
  23. package/dist/types/components/CalendarHeatmap/index.d.ts +2 -0
  24. package/dist/types/components/CalendarHeatmap/types.d.ts +25 -0
  25. package/dist/types/components/Chart/components/ChartLegend.d.ts +1 -2
  26. package/dist/types/components/Chart/stories/args/index.d.ts +1 -1
  27. package/dist/types/components/Chart/stories/examples/AreaChart.d.ts +6 -0
  28. package/dist/types/components/Chart/stories/examples/BarChart.d.ts +11 -0
  29. package/dist/types/components/Chart/stories/examples/LineChart.d.ts +10 -0
  30. package/dist/types/components/Chart/stories/examples/PieChart.d.ts +5 -0
  31. package/dist/types/components/Chart/stories/examples/RadialChart.d.ts +5 -0
  32. package/dist/types/components/Chart/types.d.ts +1 -1
  33. package/dist/types/components/CircularProgress/CircularProgress.d.ts +6 -0
  34. package/dist/types/components/CircularProgress/constants.d.ts +5 -0
  35. package/dist/types/components/CircularProgress/index.d.ts +2 -0
  36. package/dist/types/components/CircularProgress/types.d.ts +17 -0
  37. package/dist/types/components/ComparisonBar/ComparisonBar.d.ts +6 -0
  38. package/dist/types/components/ComparisonBar/constants.d.ts +4 -0
  39. package/dist/types/components/ComparisonBar/index.d.ts +2 -0
  40. package/dist/types/components/ComparisonBar/types.d.ts +21 -0
  41. package/dist/types/components/Confetti/Confetti.d.ts +6 -0
  42. package/dist/types/components/Confetti/index.d.ts +2 -0
  43. package/dist/types/components/Confetti/types.d.ts +19 -0
  44. package/dist/types/components/CountdownTimer/CountdownTimer.d.ts +6 -0
  45. package/dist/types/components/CountdownTimer/index.d.ts +2 -0
  46. package/dist/types/components/CountdownTimer/types.d.ts +13 -0
  47. package/dist/types/components/DataList/DataList.d.ts +6 -0
  48. package/dist/types/components/DataList/constants.d.ts +12 -0
  49. package/dist/types/components/DataList/index.d.ts +2 -0
  50. package/dist/types/components/DataList/types.d.ts +15 -0
  51. package/dist/types/components/DatePicker/DateRangePresetPicker.d.ts +2 -0
  52. package/dist/types/components/DatePicker/index.d.ts +1 -0
  53. package/dist/types/components/DatePicker/types.d.ts +19 -0
  54. package/dist/types/components/Description/Description.d.ts +2 -1
  55. package/dist/types/components/Description/DescriptionGroup.d.ts +6 -0
  56. package/dist/types/components/Description/constants.d.ts +23 -0
  57. package/dist/types/components/Description/index.d.ts +2 -0
  58. package/dist/types/components/Description/types.d.ts +28 -3
  59. package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +1 -1
  60. package/dist/types/components/GlowCard/GlowCard.d.ts +6 -0
  61. package/dist/types/components/GlowCard/index.d.ts +2 -0
  62. package/dist/types/components/GlowCard/types.d.ts +8 -0
  63. package/dist/types/components/GradientText/GradientText.d.ts +6 -0
  64. package/dist/types/components/GradientText/index.d.ts +2 -0
  65. package/dist/types/components/GradientText/types.d.ts +14 -0
  66. package/dist/types/components/Greeting/Greeting.d.ts +6 -0
  67. package/dist/types/components/Greeting/index.d.ts +2 -0
  68. package/dist/types/components/Greeting/types.d.ts +9 -0
  69. package/dist/types/components/KPICard/KPICard.d.ts +6 -0
  70. package/dist/types/components/KPICard/index.d.ts +2 -0
  71. package/dist/types/components/KPICard/types.d.ts +21 -0
  72. package/dist/types/components/Marquee/Marquee.d.ts +6 -0
  73. package/dist/types/components/Marquee/index.d.ts +2 -0
  74. package/dist/types/components/Marquee/types.d.ts +12 -0
  75. package/dist/types/components/Meteors/Meteors.d.ts +6 -0
  76. package/dist/types/components/Meteors/index.d.ts +2 -0
  77. package/dist/types/components/Meteors/types.d.ts +5 -0
  78. package/dist/types/components/MiniAreaChart/MiniAreaChart.d.ts +6 -0
  79. package/dist/types/components/MiniAreaChart/index.d.ts +2 -0
  80. package/dist/types/components/MiniAreaChart/types.d.ts +10 -0
  81. package/dist/types/components/MiniBarChart/MiniBarChart.d.ts +6 -0
  82. package/dist/types/components/MiniBarChart/index.d.ts +2 -0
  83. package/dist/types/components/MiniBarChart/types.d.ts +15 -0
  84. package/dist/types/components/MiniDonutChart/MiniDonutChart.d.ts +6 -0
  85. package/dist/types/components/MiniDonutChart/index.d.ts +2 -0
  86. package/dist/types/components/MiniDonutChart/types.d.ts +15 -0
  87. package/dist/types/components/MiniStackedBar/MiniStackedBar.d.ts +6 -0
  88. package/dist/types/components/MiniStackedBar/index.d.ts +2 -0
  89. package/dist/types/components/MiniStackedBar/types.d.ts +13 -0
  90. package/dist/types/components/NumberTicker/NumberTicker.d.ts +6 -0
  91. package/dist/types/components/NumberTicker/index.d.ts +2 -0
  92. package/dist/types/components/NumberTicker/types.d.ts +11 -0
  93. package/dist/types/components/Pulse/Pulse.d.ts +6 -0
  94. package/dist/types/components/Pulse/constants.d.ts +10 -0
  95. package/dist/types/components/Pulse/index.d.ts +2 -0
  96. package/dist/types/components/Pulse/types.d.ts +11 -0
  97. package/dist/types/components/Resizable/Resizable.d.ts +1 -1
  98. package/dist/types/components/ShinyButton/ShinyButton.d.ts +6 -0
  99. package/dist/types/components/ShinyButton/index.d.ts +2 -0
  100. package/dist/types/components/ShinyButton/types.d.ts +4 -0
  101. package/dist/types/components/Sparkline/Sparkline.d.ts +6 -0
  102. package/dist/types/components/Sparkline/index.d.ts +2 -0
  103. package/dist/types/components/Sparkline/types.d.ts +17 -0
  104. package/dist/types/components/SpotlightCard/SpotlightCard.d.ts +6 -0
  105. package/dist/types/components/SpotlightCard/index.d.ts +2 -0
  106. package/dist/types/components/SpotlightCard/types.d.ts +7 -0
  107. package/dist/types/components/StatCard/StatCard.d.ts +6 -0
  108. package/dist/types/components/StatCard/index.d.ts +2 -0
  109. package/dist/types/components/StatCard/types.d.ts +15 -0
  110. package/dist/types/components/TextShimmer/TextShimmer.d.ts +6 -0
  111. package/dist/types/components/TextShimmer/index.d.ts +2 -0
  112. package/dist/types/components/TextShimmer/types.d.ts +7 -0
  113. package/dist/types/components/TrendBadge/TrendBadge.d.ts +6 -0
  114. package/dist/types/components/TrendBadge/constants.d.ts +7 -0
  115. package/dist/types/components/TrendBadge/index.d.ts +2 -0
  116. package/dist/types/components/TrendBadge/types.d.ts +15 -0
  117. package/dist/types/components/WidgetShell/WidgetShell.d.ts +6 -0
  118. package/dist/types/components/WidgetShell/index.d.ts +2 -0
  119. package/dist/types/components/WidgetShell/types.d.ts +20 -0
  120. package/dist/types/index.d.ts +33 -0
  121. package/package.json +58 -58
  122. package/src/components/Accordion/constants.ts +1 -1
  123. package/src/components/ActivityFeed/ActivityFeed.tsx +51 -0
  124. package/src/components/ActivityFeed/constants.ts +19 -0
  125. package/src/components/ActivityFeed/index.ts +2 -0
  126. package/src/components/ActivityFeed/types.ts +23 -0
  127. package/src/components/Alert/constants.ts +1 -1
  128. package/src/components/AlertDialog/constants.ts +1 -1
  129. package/src/components/Amount/Amount.tsx +50 -0
  130. package/src/components/Amount/index.ts +2 -0
  131. package/src/components/Amount/types.ts +20 -0
  132. package/src/components/AnimatedCounter/AnimatedCounter.tsx +68 -0
  133. package/src/components/AnimatedCounter/index.ts +2 -0
  134. package/src/components/AnimatedCounter/types.ts +14 -0
  135. package/src/components/AnimatedGroup/AnimatedGroup.tsx +97 -0
  136. package/src/components/AnimatedGroup/index.ts +2 -0
  137. package/src/components/AnimatedGroup/types.ts +21 -0
  138. package/src/components/AnimatedList/AnimatedList.tsx +42 -0
  139. package/src/components/AnimatedList/index.ts +2 -0
  140. package/src/components/AnimatedList/types.ts +15 -0
  141. package/src/components/Badge/constants.ts +1 -1
  142. package/src/components/Banner/constants.ts +1 -1
  143. package/src/components/BorderBeam/BorderBeam.tsx +41 -0
  144. package/src/components/BorderBeam/index.ts +2 -0
  145. package/src/components/BorderBeam/types.ts +14 -0
  146. package/src/components/Box/Box.tsx +8 -2
  147. package/src/components/Box/constants.ts +35 -0
  148. package/src/components/Button/constants.ts +66 -63
  149. package/src/components/CalendarHeatmap/CalendarHeatmap.tsx +141 -0
  150. package/src/components/CalendarHeatmap/index.ts +2 -0
  151. package/src/components/CalendarHeatmap/types.ts +27 -0
  152. package/src/components/Card/constants.ts +24 -21
  153. package/src/components/Carousel/constants.ts +2 -2
  154. package/src/components/Chart/components/ChartTooltip.tsx +1 -1
  155. package/src/components/Chart/stories/args/index.ts +2 -1
  156. package/src/components/Chart/stories/examples/AreaChart.tsx +55 -0
  157. package/src/components/Chart/stories/examples/BarChart.tsx +104 -6
  158. package/src/components/Chart/stories/examples/LineChart.tsx +111 -0
  159. package/src/components/Chart/stories/examples/PieChart.tsx +55 -0
  160. package/src/components/Chart/stories/examples/RadialChart.tsx +65 -0
  161. package/src/components/Chart/types.ts +1 -1
  162. package/src/components/CircularProgress/CircularProgress.tsx +46 -0
  163. package/src/components/CircularProgress/constants.ts +32 -0
  164. package/src/components/CircularProgress/index.ts +2 -0
  165. package/src/components/CircularProgress/types.ts +18 -0
  166. package/src/components/Command/constants.ts +1 -1
  167. package/src/components/ComparisonBar/ComparisonBar.tsx +65 -0
  168. package/src/components/ComparisonBar/constants.ts +23 -0
  169. package/src/components/ComparisonBar/index.ts +2 -0
  170. package/src/components/ComparisonBar/types.ts +23 -0
  171. package/src/components/Confetti/Confetti.tsx +82 -0
  172. package/src/components/Confetti/index.ts +2 -0
  173. package/src/components/Confetti/types.ts +20 -0
  174. package/src/components/CountdownTimer/CountdownTimer.tsx +91 -0
  175. package/src/components/CountdownTimer/index.ts +2 -0
  176. package/src/components/CountdownTimer/types.ts +14 -0
  177. package/src/components/DataList/DataList.tsx +32 -0
  178. package/src/components/DataList/constants.ts +47 -0
  179. package/src/components/DataList/index.ts +2 -0
  180. package/src/components/DataList/types.ts +17 -0
  181. package/src/components/DatePicker/DateRangePresetPicker.tsx +122 -0
  182. package/src/components/DatePicker/index.ts +1 -0
  183. package/src/components/DatePicker/types.ts +22 -0
  184. package/src/components/Description/Description.tsx +67 -5
  185. package/src/components/Description/DescriptionGroup.tsx +39 -0
  186. package/src/components/Description/constants.ts +128 -0
  187. package/src/components/Description/index.ts +10 -0
  188. package/src/components/Description/types.ts +31 -3
  189. package/src/components/Dialog/constants.ts +2 -2
  190. package/src/components/Dock/constants.ts +2 -2
  191. package/src/components/Drawer/constants.ts +2 -2
  192. package/src/components/Form/Checkbox/constants.ts +1 -1
  193. package/src/components/Form/DatetimeInput/constants.ts +1 -1
  194. package/src/components/Form/Input/constants.ts +1 -1
  195. package/src/components/Form/MultiSelect/constants.ts +1 -1
  196. package/src/components/Form/NativeSelect/constants.ts +1 -1
  197. package/src/components/Form/Radio/constants.ts +1 -1
  198. package/src/components/Form/Select/constants.ts +1 -1
  199. package/src/components/Form/Slider/constants.ts +1 -1
  200. package/src/components/Form/Switch/constants.ts +1 -1
  201. package/src/components/Form/Textarea/constants.ts +1 -1
  202. package/src/components/GlowCard/GlowCard.tsx +46 -0
  203. package/src/components/GlowCard/index.ts +2 -0
  204. package/src/components/GlowCard/types.ts +9 -0
  205. package/src/components/GradientText/GradientText.tsx +36 -0
  206. package/src/components/GradientText/index.ts +2 -0
  207. package/src/components/GradientText/types.ts +15 -0
  208. package/src/components/Greeting/Greeting.tsx +46 -0
  209. package/src/components/Greeting/index.ts +2 -0
  210. package/src/components/Greeting/types.ts +10 -0
  211. package/src/components/KPICard/KPICard.tsx +85 -0
  212. package/src/components/KPICard/index.ts +2 -0
  213. package/src/components/KPICard/types.ts +22 -0
  214. package/src/components/Marquee/Marquee.tsx +45 -0
  215. package/src/components/Marquee/index.ts +2 -0
  216. package/src/components/Marquee/types.ts +13 -0
  217. package/src/components/Menu/Menubar/constants.ts +2 -2
  218. package/src/components/Menu/NavigationMenu/constants.ts +2 -2
  219. package/src/components/Meteors/Meteors.tsx +38 -0
  220. package/src/components/Meteors/index.ts +2 -0
  221. package/src/components/Meteors/types.ts +6 -0
  222. package/src/components/MiniAreaChart/MiniAreaChart.tsx +68 -0
  223. package/src/components/MiniAreaChart/index.ts +2 -0
  224. package/src/components/MiniAreaChart/types.ts +11 -0
  225. package/src/components/MiniBarChart/MiniBarChart.tsx +49 -0
  226. package/src/components/MiniBarChart/index.ts +2 -0
  227. package/src/components/MiniBarChart/types.ts +16 -0
  228. package/src/components/MiniDonutChart/MiniDonutChart.tsx +87 -0
  229. package/src/components/MiniDonutChart/index.ts +2 -0
  230. package/src/components/MiniDonutChart/types.ts +17 -0
  231. package/src/components/MiniStackedBar/MiniStackedBar.tsx +61 -0
  232. package/src/components/MiniStackedBar/index.ts +2 -0
  233. package/src/components/MiniStackedBar/types.ts +15 -0
  234. package/src/components/NumberTicker/NumberTicker.tsx +58 -0
  235. package/src/components/NumberTicker/index.ts +2 -0
  236. package/src/components/NumberTicker/types.ts +12 -0
  237. package/src/components/Pagination/constants.ts +2 -2
  238. package/src/components/Progress/constants.ts +1 -1
  239. package/src/components/Pulse/Pulse.tsx +26 -0
  240. package/src/components/Pulse/constants.ts +55 -0
  241. package/src/components/Pulse/index.ts +2 -0
  242. package/src/components/Pulse/types.ts +12 -0
  243. package/src/components/Resizable/constants.ts +1 -1
  244. package/src/components/Sheet/constants.ts +1 -1
  245. package/src/components/ShinyButton/ShinyButton.tsx +57 -0
  246. package/src/components/ShinyButton/index.ts +2 -0
  247. package/src/components/ShinyButton/types.ts +8 -0
  248. package/src/components/Skeleton/constants.ts +1 -1
  249. package/src/components/Sonner/constants.ts +1 -1
  250. package/src/components/Sparkline/Sparkline.tsx +108 -0
  251. package/src/components/Sparkline/index.ts +2 -0
  252. package/src/components/Sparkline/types.ts +18 -0
  253. package/src/components/SpotlightCard/SpotlightCard.tsx +56 -0
  254. package/src/components/SpotlightCard/index.ts +2 -0
  255. package/src/components/SpotlightCard/types.ts +8 -0
  256. package/src/components/Stat/constants.ts +1 -1
  257. package/src/components/StatCard/StatCard.tsx +59 -0
  258. package/src/components/StatCard/index.ts +2 -0
  259. package/src/components/StatCard/types.ts +16 -0
  260. package/src/components/Tabs/constants.ts +1 -1
  261. package/src/components/TextShimmer/TextShimmer.tsx +34 -0
  262. package/src/components/TextShimmer/index.ts +2 -0
  263. package/src/components/TextShimmer/types.ts +8 -0
  264. package/src/components/Timeline/constants.ts +1 -1
  265. package/src/components/Toggle/constants.ts +1 -1
  266. package/src/components/Tooltip/constants.ts +1 -1
  267. package/src/components/TrendBadge/TrendBadge.tsx +40 -0
  268. package/src/components/TrendBadge/constants.ts +38 -0
  269. package/src/components/TrendBadge/index.ts +2 -0
  270. package/src/components/TrendBadge/types.ts +16 -0
  271. package/src/components/WidgetShell/WidgetShell.tsx +101 -0
  272. package/src/components/WidgetShell/index.ts +2 -0
  273. package/src/components/WidgetShell/types.ts +22 -0
  274. package/src/index.ts +35 -0
  275. package/src/stylesheets/tailwind.css +210 -0
  276. package/src/utilities/getSubpaths/getSubpaths.ts +1 -2
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from "react";
1
2
  import {
2
3
  Bar,
3
4
  BarChart,
@@ -166,12 +167,14 @@ export const BarChartExample = (props: Partial<BarChartProps>) => {
166
167
  <ChartTooltipContent
167
168
  className="w-[150px]"
168
169
  nameKey="views"
169
- labelFormatter={(value: string) => {
170
- return new Date(value).toLocaleDateString("en-US", {
171
- month: "short",
172
- day: "numeric",
173
- year: "numeric",
174
- });
170
+ labelFormatter={(value: ReactNode) => {
171
+ return typeof value === "string"
172
+ ? new Date(value).toLocaleDateString("en-US", {
173
+ month: "short",
174
+ day: "numeric",
175
+ year: "numeric",
176
+ })
177
+ : value;
175
178
  }}
176
179
  />
177
180
  }
@@ -416,3 +419,98 @@ export const NegativeBarChartExample = (props: Partial<BarChartProps>) => {
416
419
  </Chart>
417
420
  );
418
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
+ };
@@ -137,3 +137,114 @@ export const WithLegendLineChartExample = (props: LineChartProps) => {
137
137
  </Chart>
138
138
  );
139
139
  };
140
+
141
+ /**
142
+ * Smooth curved line chart with gradient stroke and refined active dot.
143
+ * Shows a single data series with emphasis on the curve smoothness.
144
+ */
145
+ export const SmoothLineChartExample = (props: LineChartProps) => {
146
+ const chartConfig = {
147
+ value: {
148
+ label: "Revenue",
149
+ color: "hsl(var(--chart-1))",
150
+ },
151
+ } satisfies ChartConfig;
152
+
153
+ return (
154
+ <Chart config={chartConfig} className="h-[250px] w-full">
155
+ <LineChart {...props.lineChart}>
156
+ <CartesianGrid vertical={false} strokeDasharray="3 3" />
157
+ <XAxis
158
+ dataKey="month"
159
+ tickLine={false}
160
+ axisLine={false}
161
+ tickMargin={8}
162
+ {...props.xAxis}
163
+ />
164
+ <YAxis
165
+ tickLine={false}
166
+ axisLine={false}
167
+ tickMargin={8}
168
+ {...props.yAxis}
169
+ />
170
+ <ChartTooltip
171
+ content={<ChartTooltipContent indicator="dot" />}
172
+ />
173
+ <Line
174
+ dataKey="value"
175
+ type="natural"
176
+ stroke="var(--color-value)"
177
+ strokeWidth={2.5}
178
+ dot={false}
179
+ activeDot={{
180
+ r: 6,
181
+ strokeWidth: 2,
182
+ stroke: "var(--color-value)",
183
+ fill: "white",
184
+ }}
185
+ {...props.line}
186
+ />
187
+ </LineChart>
188
+ </Chart>
189
+ );
190
+ };
191
+
192
+ /**
193
+ * Multi-series comparison line chart with dashed reference line.
194
+ * Useful for budget vs actual, target vs performance comparisons.
195
+ */
196
+ export const ComparisonLineChartExample = (props: LineChartProps) => {
197
+ const chartConfig = {
198
+ actual: {
199
+ label: "Actual",
200
+ color: "hsl(var(--chart-1))",
201
+ },
202
+ target: {
203
+ label: "Target",
204
+ color: "hsl(var(--chart-2))",
205
+ },
206
+ } satisfies ChartConfig;
207
+
208
+ return (
209
+ <Chart config={chartConfig} className="h-[250px] w-full">
210
+ <LineChart {...props.lineChart}>
211
+ <CartesianGrid vertical={false} strokeDasharray="3 3" />
212
+ <XAxis
213
+ dataKey="month"
214
+ tickLine={false}
215
+ axisLine={false}
216
+ tickMargin={8}
217
+ tickFormatter={(value: string) => value.slice(0, 3)}
218
+ {...props.xAxis}
219
+ />
220
+ <YAxis
221
+ tickLine={false}
222
+ axisLine={false}
223
+ tickMargin={8}
224
+ tickFormatter={(v: number) => `$${(v / 1000).toFixed(0)}k`}
225
+ {...props.yAxis}
226
+ />
227
+ <ChartTooltip content={<ChartTooltipContent />} />
228
+ <ChartLegend content={<ChartLegendContent />} />
229
+ <Line
230
+ dataKey="target"
231
+ type="monotone"
232
+ stroke="var(--color-target)"
233
+ strokeWidth={2}
234
+ strokeDasharray="6 3"
235
+ dot={false}
236
+ {...props.line}
237
+ />
238
+ <Line
239
+ dataKey="actual"
240
+ type="monotone"
241
+ stroke="var(--color-actual)"
242
+ strokeWidth={2.5}
243
+ dot={false}
244
+ activeDot={{ r: 5, strokeWidth: 2, fill: "var(--color-actual)" }}
245
+ {...props.line}
246
+ />
247
+ </LineChart>
248
+ </Chart>
249
+ );
250
+ };
@@ -169,6 +169,61 @@ export const ActiveDonutPieChartExample = (props: Partial<PieChartProps>) => {
169
169
  );
170
170
  };
171
171
 
172
+ /**
173
+ * Beautiful donut chart with a center metric label.
174
+ * Perfect for portfolio allocation, budget breakdown, etc.
175
+ */
176
+ export const CenterLabelDonutExample = (props: Partial<PieChartProps>) => {
177
+ const chartConfig = {
178
+ allocation: {
179
+ label: "Allocation",
180
+ },
181
+ stocks: {
182
+ label: "Stocks",
183
+ color: "hsl(var(--chart-1))",
184
+ },
185
+ bonds: {
186
+ label: "Bonds",
187
+ color: "hsl(var(--chart-2))",
188
+ },
189
+ real_estate: {
190
+ label: "Real Estate",
191
+ color: "hsl(var(--chart-3))",
192
+ },
193
+ crypto: {
194
+ label: "Crypto",
195
+ color: "hsl(var(--chart-4))",
196
+ },
197
+ cash: {
198
+ label: "Cash",
199
+ color: "hsl(var(--chart-5))",
200
+ },
201
+ } satisfies ChartConfig;
202
+
203
+ return (
204
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
205
+ <PieChart {...props.pieChart}>
206
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
207
+ <Pie
208
+ dataKey="value"
209
+ nameKey="category"
210
+ innerRadius={65}
211
+ outerRadius={90}
212
+ strokeWidth={3}
213
+ stroke="hsl(var(--b1, 0 0% 100%))"
214
+ paddingAngle={2}
215
+ cornerRadius={4}
216
+ {...props.pie}
217
+ />
218
+ <ChartLegend
219
+ content={<ChartLegendContent nameKey="category" />}
220
+ className="-translate-y-2 flex-wrap gap-2 *:basis-1/3 *:justify-center"
221
+ />
222
+ </PieChart>
223
+ </Chart>
224
+ );
225
+ };
226
+
172
227
  export const StackedPieChartExample = (props: Partial<PieChartProps>) => {
173
228
  const desktopData = [
174
229
  { month: "january", desktop: 186, fill: "var(--color-january)" },
@@ -190,6 +190,71 @@ export const ShapeRadialChartExample = (props: Partial<RadialBarChartProps>) =>
190
190
  );
191
191
  };
192
192
 
193
+ /**
194
+ * KPI gauge — a single-value radial chart with a large center metric
195
+ * and background track. Great for goal progress, budget usage, etc.
196
+ */
197
+ export const KPIGaugeRadialChartExample = (props: Partial<RadialBarChartProps>) => {
198
+ const chartData = [{ name: "progress", value: 73, fill: "var(--color-progress)" }];
199
+ const chartConfig = {
200
+ progress: {
201
+ label: "Progress",
202
+ color: "hsl(var(--chart-1))",
203
+ },
204
+ } satisfies ChartConfig;
205
+
206
+ return (
207
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
208
+ <RadialBarChart
209
+ data={chartData}
210
+ startAngle={180}
211
+ endAngle={0}
212
+ innerRadius={80}
213
+ outerRadius={110}
214
+ barSize={14}
215
+ {...props.radialBarChart}
216
+ >
217
+ <PolarGrid
218
+ gridType="circle"
219
+ radialLines={false}
220
+ stroke="none"
221
+ className="first:fill-base-200 last:fill-base-100"
222
+ polarRadius={[86, 74]}
223
+ />
224
+ <RadialBar
225
+ dataKey="value"
226
+ cornerRadius={10}
227
+ fill="var(--color-progress)"
228
+ background={{ fill: "hsl(var(--b2, 0 0% 90%))" }}
229
+ {...props.radialBar}
230
+ />
231
+ <PolarRadiusAxis tick={false} tickLine={false} axisLine={false}>
232
+ <Label
233
+ content={({ viewBox }) => {
234
+ if (viewBox && "cx" in viewBox && "cy" in viewBox) {
235
+ return (
236
+ <text x={viewBox.cx} y={viewBox.cy} textAnchor="middle" dominantBaseline="middle">
237
+ <tspan
238
+ x={viewBox.cx}
239
+ y={(viewBox.cy ?? 0) - 12}
240
+ className="fill-base-content text-4xl font-bold"
241
+ >
242
+ 73%
243
+ </tspan>
244
+ <tspan x={viewBox.cx} y={(viewBox.cy ?? 0) + 16} className="fill-base-content/60 text-sm">
245
+ of target
246
+ </tspan>
247
+ </text>
248
+ );
249
+ }
250
+ }}
251
+ />
252
+ </PolarRadiusAxis>
253
+ </RadialBarChart>
254
+ </Chart>
255
+ );
256
+ };
257
+
193
258
  export const StackedRadialChartExample = (props: Partial<RadialBarChartProps>) => {
194
259
  const chartData = [{ month: "january", desktop: 1260, mobile: 570 }];
195
260
  const chartConfig = {
@@ -30,7 +30,7 @@ export type ChartStyleProps = {
30
30
  };
31
31
 
32
32
  export type ChartTooltipContentProps = Partial<
33
- TooltipContentProps<number | string | (number | string)[], string>
33
+ TooltipContentProps<number | string | readonly (number | string)[], number | string>
34
34
  > &
35
35
  ComponentProps<"div"> & {
36
36
  hideLabel?: boolean;
@@ -0,0 +1,46 @@
1
+ import type { CSSProperties } from "react";
2
+ import { cn } from "../../utilities";
3
+ import { getCircularProgressClasses, getCircularProgressLabelClasses } from "./constants";
4
+ import type { CircularProgressProps } from "./types";
5
+
6
+ const CircularProgress = ({
7
+ value,
8
+ className,
9
+ size,
10
+ thickness,
11
+ variant,
12
+ showLabel = true,
13
+ label,
14
+ preset = "md",
15
+ ...props
16
+ }: CircularProgressProps) => {
17
+ const clampedValue = Math.max(0, Math.min(100, value));
18
+
19
+ const style: Record<string, string | number> = {
20
+ "--value": clampedValue,
21
+ };
22
+ if (size) style["--size"] = size;
23
+ if (thickness) style["--thickness"] = thickness;
24
+
25
+ return (
26
+ <div
27
+ className={cn(getCircularProgressClasses({ variant, preset }), className)}
28
+ style={style as CSSProperties}
29
+ role="progressbar"
30
+ aria-valuenow={clampedValue}
31
+ aria-valuemin={0}
32
+ aria-valuemax={100}
33
+ {...props}
34
+ >
35
+ {showLabel && (
36
+ <span className={getCircularProgressLabelClasses()}>
37
+ {label ?? `${Math.round(clampedValue)}%`}
38
+ </span>
39
+ )}
40
+ </div>
41
+ );
42
+ };
43
+
44
+ CircularProgress.displayName = "CircularProgress";
45
+
46
+ export { CircularProgress };
@@ -0,0 +1,32 @@
1
+ import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
3
+
4
+ export const getCircularProgressClasses = cva(
5
+ "radial-progress transition-all duration-500",
6
+ {
7
+ variants: createVariants({
8
+ variant: {
9
+ primary: "text-primary",
10
+ secondary: "text-secondary",
11
+ accent: "text-accent",
12
+ info: "text-info",
13
+ success: "text-success",
14
+ warning: "text-warning",
15
+ error: "text-error",
16
+ neutral: "text-neutral",
17
+ },
18
+ preset: {
19
+ xs: "[--size:2rem] [--thickness:2px] text-xs",
20
+ sm: "[--size:3rem] [--thickness:3px] text-xs",
21
+ md: "[--size:5rem] [--thickness:4px] text-sm",
22
+ lg: "[--size:7rem] [--thickness:5px] text-base",
23
+ xl: "[--size:9rem] [--thickness:6px] text-lg",
24
+ },
25
+ }),
26
+ defaultVariants: {
27
+ preset: "md",
28
+ },
29
+ }
30
+ );
31
+
32
+ export const getCircularProgressLabelClasses = cva("font-semibold tabular-nums");
@@ -0,0 +1,2 @@
1
+ export { CircularProgress } from "./CircularProgress";
2
+ export type { CircularProgressProps } from "./types";
@@ -0,0 +1,18 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+
3
+ export type CircularProgressProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
4
+ /** Progress value from 0 to 100 */
5
+ value: number;
6
+ /** Size of the circle (CSS value) */
7
+ size?: string;
8
+ /** Thickness of the progress ring (CSS value) */
9
+ thickness?: string;
10
+ /** Color variant */
11
+ variant?: "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "error" | "neutral";
12
+ /** Whether to show the value label */
13
+ showLabel?: boolean;
14
+ /** Custom label to display instead of percentage */
15
+ label?: ReactNode;
16
+ /** Size preset */
17
+ preset?: "xs" | "sm" | "md" | "lg" | "xl";
18
+ };
@@ -27,7 +27,7 @@ export const getCommandGroupClasses = cva(
27
27
  export const getCommandSeparatorClasses = cva("-mx-1 h-px bg-border");
28
28
 
29
29
  export const getCommandItemClasses = cva(
30
- "relative flex cursor-pointer select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors aria-selected:bg-base-300 aria-selected:text-base-content aria-disabled:underline aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-default"
30
+ "relative flex cursor-pointer select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden transition-all duration-150 aria-selected:bg-base-300 aria-selected:text-base-content aria-disabled:underline aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-disabled:cursor-default"
31
31
  );
32
32
 
33
33
  export const getCommandShortcutClasses = cva(
@@ -0,0 +1,65 @@
1
+ import { useMemo } from "react";
2
+ import { cn } from "../../utilities";
3
+ import { getComparisonBarTrackClasses, getComparisonBarSegmentClasses } from "./constants";
4
+ import type { ComparisonBarProps } from "./types";
5
+
6
+ const DEFAULT_COLORS = [
7
+ "oklch(0.7 0.15 250)",
8
+ "oklch(0.7 0.15 150)",
9
+ "oklch(0.7 0.15 50)",
10
+ "oklch(0.7 0.15 330)",
11
+ "oklch(0.6 0.15 200)",
12
+ ];
13
+
14
+ const ComparisonBar = ({
15
+ segments,
16
+ className,
17
+ showLabels = true,
18
+ showValues = false,
19
+ size = "md",
20
+ formatValue = (v) => v.toLocaleString(),
21
+ ...props
22
+ }: ComparisonBarProps) => {
23
+ const total = useMemo(() => segments.reduce((sum, s) => sum + s.value, 0), [segments]);
24
+
25
+ return (
26
+ <div className={cn("flex flex-col gap-2", className)} {...props}>
27
+ <div className={getComparisonBarTrackClasses({ size })}>
28
+ {segments.map((segment, i) => {
29
+ const percentage = total > 0 ? (segment.value / total) * 100 : 0;
30
+ return (
31
+ <div
32
+ key={i}
33
+ className={getComparisonBarSegmentClasses()}
34
+ style={{
35
+ width: `${percentage}%`,
36
+ backgroundColor: segment.color ?? DEFAULT_COLORS[i % DEFAULT_COLORS.length],
37
+ }}
38
+ title={`${segment.label}: ${formatValue(segment.value)} (${percentage.toFixed(1)}%)`}
39
+ />
40
+ );
41
+ })}
42
+ </div>
43
+ {showLabels && (
44
+ <div className="flex flex-wrap gap-x-4 gap-y-1">
45
+ {segments.map((segment, i) => (
46
+ <div key={i} className="flex items-center gap-1.5">
47
+ <span
48
+ className="size-2.5 rounded-full"
49
+ style={{ backgroundColor: segment.color ?? DEFAULT_COLORS[i % DEFAULT_COLORS.length] }}
50
+ />
51
+ <span className="text-xs text-base-content/60">{segment.label}</span>
52
+ {showValues && (
53
+ <span className="text-xs font-medium tabular-nums">{formatValue(segment.value)}</span>
54
+ )}
55
+ </div>
56
+ ))}
57
+ </div>
58
+ )}
59
+ </div>
60
+ );
61
+ };
62
+
63
+ ComparisonBar.displayName = "ComparisonBar";
64
+
65
+ export { ComparisonBar };
@@ -0,0 +1,23 @@
1
+ import { cva } from "../../libs";
2
+ import { createVariants } from "../../utilities";
3
+
4
+ export const getComparisonBarTrackClasses = cva(
5
+ "flex w-full overflow-hidden rounded-full bg-base-200",
6
+ {
7
+ variants: createVariants({
8
+ size: {
9
+ xs: "h-1.5",
10
+ sm: "h-2",
11
+ md: "h-3",
12
+ lg: "h-4",
13
+ },
14
+ }),
15
+ defaultVariants: {
16
+ size: "md",
17
+ },
18
+ }
19
+ );
20
+
21
+ export const getComparisonBarSegmentClasses = cva(
22
+ "transition-all duration-500 ease-out first:rounded-l-full last:rounded-r-full"
23
+ );
@@ -0,0 +1,2 @@
1
+ export { ComparisonBar } from "./ComparisonBar";
2
+ export type { ComparisonBarProps, ComparisonBarSegment } from "./types";
@@ -0,0 +1,23 @@
1
+ import type { HTMLAttributes } from "react";
2
+
3
+ export type ComparisonBarSegment = {
4
+ /** Segment label */
5
+ label: string;
6
+ /** Segment value */
7
+ value: number;
8
+ /** Color (CSS color or Tailwind class) */
9
+ color?: string;
10
+ };
11
+
12
+ export type ComparisonBarProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
13
+ /** Segments to display */
14
+ segments: ComparisonBarSegment[];
15
+ /** Whether to show labels */
16
+ showLabels?: boolean;
17
+ /** Whether to show values */
18
+ showValues?: boolean;
19
+ /** Height variant */
20
+ size?: "xs" | "sm" | "md" | "lg";
21
+ /** Format function for values */
22
+ formatValue?: (value: number) => string;
23
+ };