@wealthx/shadcn 1.0.2 → 1.2.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 (300) hide show
  1. package/.turbo/turbo-build.log +235 -138
  2. package/CHANGELOG.md +12 -0
  3. package/README.md +82 -0
  4. package/dist/{chunk-6OJF6XRN.mjs → chunk-24FUO7TD.mjs} +4 -8
  5. package/dist/{chunk-4AJ5HWHD.mjs → chunk-2I5S2AMY.mjs} +3 -3
  6. package/dist/chunk-2SF672SZ.mjs +161 -0
  7. package/dist/{chunk-GPRJQ24C.mjs → chunk-34NWQURD.mjs} +2 -2
  8. package/dist/{chunk-MQ72DIBH.mjs → chunk-3GF7OVTP.mjs} +14 -5
  9. package/dist/chunk-3WMX6KWS.mjs +245 -0
  10. package/dist/{chunk-PMKODV6M.mjs → chunk-462HMNO4.mjs} +6 -10
  11. package/dist/chunk-4CX4SBRO.mjs +153 -0
  12. package/dist/chunk-4MN6UQHG.mjs +443 -0
  13. package/dist/chunk-5QQVZTVZ.mjs +233 -0
  14. package/dist/{chunk-BGP2N52Z.mjs → chunk-66MI7Q4B.mjs} +5 -5
  15. package/dist/chunk-6FCGKSZX.mjs +268 -0
  16. package/dist/{chunk-CGOKTPXU.mjs → chunk-6JQFUE5I.mjs} +20 -23
  17. package/dist/{chunk-Z3MK2KKZ.mjs → chunk-7DHU4VGG.mjs} +7 -3
  18. package/dist/{chunk-VZ2NR7L3.mjs → chunk-7PYJD5JI.mjs} +35 -27
  19. package/dist/{chunk-JU2RUWHF.mjs → chunk-7XJHLGUV.mjs} +1 -1
  20. package/dist/{chunk-BMFN37JH.mjs → chunk-7YAU5CY6.mjs} +1 -1
  21. package/dist/chunk-A56YQQHG.mjs +402 -0
  22. package/dist/chunk-AH52LG6N.mjs +315 -0
  23. package/dist/{chunk-SLWCCURD.mjs → chunk-CLIN5525.mjs} +8 -4
  24. package/dist/{chunk-3VQNJ235.mjs → chunk-CSDO6VBW.mjs} +7 -0
  25. package/dist/chunk-D4ILTPOG.mjs +293 -0
  26. package/dist/{chunk-HS7TFG7V.mjs → chunk-D6ID6M4V.mjs} +1 -1
  27. package/dist/chunk-DOH3EHX7.mjs +378 -0
  28. package/dist/{chunk-MJIEMGRD.mjs → chunk-EFRENWEJ.mjs} +9 -17
  29. package/dist/chunk-ERGGHC2V.mjs +185 -0
  30. package/dist/{chunk-OXQQNQZI.mjs → chunk-FEZKMUCF.mjs} +10 -1
  31. package/dist/{chunk-55CEW76V.mjs → chunk-FH6QVUVZ.mjs} +1 -1
  32. package/dist/chunk-FMAXJ2SI.mjs +71 -0
  33. package/dist/chunk-FZIXGLMV.mjs +173 -0
  34. package/dist/{chunk-DS2AMHN2.mjs → chunk-GYMYRIZP.mjs} +2 -2
  35. package/dist/{chunk-KQDD5MU3.mjs → chunk-H45TKD34.mjs} +5 -5
  36. package/dist/{chunk-BBJBJSXQ.mjs → chunk-J5UICVJS.mjs} +1 -1
  37. package/dist/{chunk-RL772EH7.mjs → chunk-JHJHG4GO.mjs} +4 -12
  38. package/dist/chunk-KMCGSZTX.mjs +177 -0
  39. package/dist/{chunk-FHNT55I5.mjs → chunk-KUDCQ4FI.mjs} +4 -4
  40. package/dist/chunk-LE6YFY6D.mjs +209 -0
  41. package/dist/{chunk-HUVTPUV2.mjs → chunk-LLVQKSU3.mjs} +23 -19
  42. package/dist/{chunk-KKHTJNMM.mjs → chunk-MARPPFOJ.mjs} +8 -4
  43. package/dist/{chunk-6AFMNC42.mjs → chunk-N2PT566P.mjs} +15 -11
  44. package/dist/chunk-NLCKVHWB.mjs +161 -0
  45. package/dist/{chunk-YN5SYTOO.mjs → chunk-NQPOYKAQ.mjs} +9 -5
  46. package/dist/{chunk-ZZV5JVNW.mjs → chunk-NSLMILBT.mjs} +3 -7
  47. package/dist/chunk-NXA3CZ7A.mjs +248 -0
  48. package/dist/chunk-OGOYQ7BG.mjs +150 -0
  49. package/dist/{chunk-3NQGYJEZ.mjs → chunk-P6AM5V7O.mjs} +10 -18
  50. package/dist/{chunk-CZ3BW5GL.mjs → chunk-P76HMUI6.mjs} +5 -11
  51. package/dist/chunk-PCPLO5HT.mjs +671 -0
  52. package/dist/chunk-PG6K5XEC.mjs +475 -0
  53. package/dist/chunk-PJHPSRYD.mjs +234 -0
  54. package/dist/{chunk-DDPA2XXS.mjs → chunk-PMB3A7V3.mjs} +2 -2
  55. package/dist/chunk-PR6V5XKM.mjs +209 -0
  56. package/dist/{chunk-46OFHMQA.mjs → chunk-Q76O3RIQ.mjs} +10 -6
  57. package/dist/chunk-QVKWW6KE.mjs +272 -0
  58. package/dist/chunk-RGU7HOEC.mjs +140 -0
  59. package/dist/{chunk-JF4PHPD5.mjs → chunk-RGVKLTLH.mjs} +4 -4
  60. package/dist/{chunk-VG6UF6UT.mjs → chunk-RP3SQYA3.mjs} +2 -2
  61. package/dist/chunk-RRBS6D63.mjs +163 -0
  62. package/dist/chunk-SMQ3DG25.mjs +285 -0
  63. package/dist/chunk-SPJ5KXW7.mjs +199 -0
  64. package/dist/chunk-SYOD63OZ.mjs +225 -0
  65. package/dist/chunk-UFYSFDER.mjs +42 -0
  66. package/dist/chunk-VACKZOMY.mjs +190 -0
  67. package/dist/chunk-VLQZANBF.mjs +42 -0
  68. package/dist/chunk-WA6O6EUR.mjs +1885 -0
  69. package/dist/{chunk-E3K6O4FZ.mjs → chunk-WAZD7NFU.mjs} +5 -2
  70. package/dist/chunk-WG6JGJXB.mjs +165 -0
  71. package/dist/{chunk-I64K754C.mjs → chunk-WNGWBVLV.mjs} +2 -2
  72. package/dist/{chunk-3U7SD3MS.mjs → chunk-WOEHFRGB.mjs} +3 -3
  73. package/dist/{chunk-DKZRJOMF.mjs → chunk-XIRTEFKH.mjs} +12 -12
  74. package/dist/chunk-Y6DWJSKZ.mjs +79 -0
  75. package/dist/chunk-YKPROFLB.mjs +161 -0
  76. package/dist/{chunk-K76E2TQU.mjs → chunk-ZRO5JO3H.mjs} +107 -67
  77. package/dist/{chunk-VYMHBV6D.mjs → chunk-ZU4NV6RG.mjs} +5 -3
  78. package/dist/components/ui/accordion.js +40 -4
  79. package/dist/components/ui/accordion.mjs +2 -2
  80. package/dist/components/ui/add-column-modal.js +789 -0
  81. package/dist/components/ui/add-column-modal.mjs +17 -0
  82. package/dist/components/ui/add-lead-modal.js +647 -0
  83. package/dist/components/ui/add-lead-modal.mjs +16 -0
  84. package/dist/components/ui/ai-assistant-drawer.js +686 -0
  85. package/dist/components/ui/ai-assistant-drawer.mjs +16 -0
  86. package/dist/components/ui/alert-dialog.js +37 -5
  87. package/dist/components/ui/alert-dialog.mjs +4 -4
  88. package/dist/components/ui/alert.js +37 -11
  89. package/dist/components/ui/alert.mjs +2 -2
  90. package/dist/components/ui/avatar.js +36 -8
  91. package/dist/components/ui/avatar.mjs +2 -2
  92. package/dist/components/ui/backoffice-alert-history-chart.js +624 -0
  93. package/dist/components/ui/backoffice-alert-history-chart.mjs +16 -0
  94. package/dist/components/ui/backoffice-contact-history-chart.js +687 -0
  95. package/dist/components/ui/backoffice-contact-history-chart.mjs +16 -0
  96. package/dist/components/ui/badge.js +37 -2
  97. package/dist/components/ui/badge.mjs +2 -2
  98. package/dist/components/ui/borrowing-capacity-line-chart.js +639 -0
  99. package/dist/components/ui/borrowing-capacity-line-chart.mjs +16 -0
  100. package/dist/components/ui/button.js +35 -3
  101. package/dist/components/ui/button.mjs +2 -2
  102. package/dist/components/ui/calendar.js +43 -19
  103. package/dist/components/ui/calendar.mjs +3 -3
  104. package/dist/components/ui/card.js +40 -4
  105. package/dist/components/ui/card.mjs +2 -2
  106. package/dist/components/ui/cash-balance-line-chart.js +627 -0
  107. package/dist/components/ui/cash-balance-line-chart.mjs +16 -0
  108. package/dist/components/ui/cashflow-bar-chart.js +650 -0
  109. package/dist/components/ui/cashflow-bar-chart.mjs +16 -0
  110. package/dist/components/ui/checkbox.js +36 -5
  111. package/dist/components/ui/checkbox.mjs +2 -3
  112. package/dist/components/ui/chip.js +37 -2
  113. package/dist/components/ui/chip.mjs +3 -3
  114. package/dist/components/ui/combobox.js +280 -0
  115. package/dist/components/ui/combobox.mjs +28 -0
  116. package/dist/components/ui/data-table.js +160 -88
  117. package/dist/components/ui/data-table.mjs +10 -11
  118. package/dist/components/ui/date-picker.js +44 -20
  119. package/dist/components/ui/date-picker.mjs +6 -7
  120. package/dist/components/ui/dialog.js +44 -12
  121. package/dist/components/ui/dialog.mjs +4 -4
  122. package/dist/components/ui/drawer.js +46 -10
  123. package/dist/components/ui/drawer.mjs +3 -3
  124. package/dist/components/ui/dropdown-menu.js +40 -16
  125. package/dist/components/ui/dropdown-menu.mjs +3 -3
  126. package/dist/components/ui/empty.js +41 -5
  127. package/dist/components/ui/empty.mjs +2 -2
  128. package/dist/components/ui/expense-bar-chart.js +642 -0
  129. package/dist/components/ui/expense-bar-chart.mjs +16 -0
  130. package/dist/components/ui/field.js +53 -21
  131. package/dist/components/ui/field.mjs +4 -4
  132. package/dist/components/ui/financial-cards.js +1002 -0
  133. package/dist/components/ui/financial-cards.mjs +24 -0
  134. package/dist/components/ui/financial-drawers.js +637 -0
  135. package/dist/components/ui/financial-drawers.mjs +17 -0
  136. package/dist/components/ui/financial-primitives.js +218 -0
  137. package/dist/components/ui/financial-primitives.mjs +22 -0
  138. package/dist/components/ui/financial-sections.js +1422 -0
  139. package/dist/components/ui/financial-sections.mjs +30 -0
  140. package/dist/components/ui/form-primitives.js +682 -0
  141. package/dist/components/ui/form-primitives.mjs +19 -0
  142. package/dist/components/ui/income-bar-chart.js +641 -0
  143. package/dist/components/ui/income-bar-chart.mjs +16 -0
  144. package/dist/components/ui/input-group.js +43 -7
  145. package/dist/components/ui/input-group.mjs +5 -5
  146. package/dist/components/ui/input-otp.js +39 -3
  147. package/dist/components/ui/input-otp.mjs +2 -2
  148. package/dist/components/ui/input.js +34 -2
  149. package/dist/components/ui/input.mjs +2 -2
  150. package/dist/components/ui/kanban-column.js +1143 -0
  151. package/dist/components/ui/kanban-column.mjs +20 -0
  152. package/dist/components/ui/label.js +35 -7
  153. package/dist/components/ui/label.mjs +2 -2
  154. package/dist/components/ui/opportunity-card.js +960 -0
  155. package/dist/components/ui/opportunity-card.mjs +20 -0
  156. package/dist/components/ui/opportunity-edit-modals.js +3360 -0
  157. package/dist/components/ui/opportunity-edit-modals.mjs +37 -0
  158. package/dist/components/ui/opportunity-summary-tab.js +4365 -0
  159. package/dist/components/ui/opportunity-summary-tab.mjs +34 -0
  160. package/dist/components/ui/pagination.js +35 -3
  161. package/dist/components/ui/pagination.mjs +3 -3
  162. package/dist/components/ui/pipeline-alerts.js +103 -0
  163. package/dist/components/ui/pipeline-alerts.mjs +8 -0
  164. package/dist/components/ui/pipeline-board.js +1408 -0
  165. package/dist/components/ui/pipeline-board.mjs +24 -0
  166. package/dist/components/ui/pipeline-chart.js +216 -0
  167. package/dist/components/ui/pipeline-chart.mjs +10 -0
  168. package/dist/components/ui/pipeline-dialogs.js +1183 -0
  169. package/dist/components/ui/pipeline-dialogs.mjs +23 -0
  170. package/dist/components/ui/pipeline-primitives.js +300 -0
  171. package/dist/components/ui/pipeline-primitives.mjs +11 -0
  172. package/dist/components/ui/popover.js +45 -4
  173. package/dist/components/ui/popover.mjs +3 -3
  174. package/dist/components/ui/progress.js +33 -1
  175. package/dist/components/ui/progress.mjs +2 -2
  176. package/dist/components/ui/property-cashflow-doughnut-chart.js +523 -0
  177. package/dist/components/ui/property-cashflow-doughnut-chart.mjs +16 -0
  178. package/dist/components/ui/property-debt-equity-doughnut-chart.js +521 -0
  179. package/dist/components/ui/property-debt-equity-doughnut-chart.mjs +16 -0
  180. package/dist/components/ui/property-mobile-estimate-line-chart.js +682 -0
  181. package/dist/components/ui/property-mobile-estimate-line-chart.mjs +16 -0
  182. package/dist/components/ui/radio-group.js +33 -1
  183. package/dist/components/ui/radio-group.mjs +2 -2
  184. package/dist/components/ui/select.js +66 -26
  185. package/dist/components/ui/select.mjs +3 -3
  186. package/dist/components/ui/separator.js +33 -1
  187. package/dist/components/ui/separator.mjs +2 -2
  188. package/dist/components/ui/sheet.js +37 -9
  189. package/dist/components/ui/sheet.mjs +3 -3
  190. package/dist/components/ui/skeleton.js +33 -1
  191. package/dist/components/ui/skeleton.mjs +2 -2
  192. package/dist/components/ui/slider.js +86 -102
  193. package/dist/components/ui/slider.mjs +2 -2
  194. package/dist/components/ui/spinner.js +33 -1
  195. package/dist/components/ui/spinner.mjs +2 -2
  196. package/dist/components/ui/stage-timeline.js +579 -0
  197. package/dist/components/ui/stage-timeline.mjs +15 -0
  198. package/dist/components/ui/switch.js +37 -4
  199. package/dist/components/ui/switch.mjs +2 -3
  200. package/dist/components/ui/table.js +37 -5
  201. package/dist/components/ui/table.mjs +2 -2
  202. package/dist/components/ui/tabs.js +36 -12
  203. package/dist/components/ui/tabs.mjs +2 -2
  204. package/dist/components/ui/textarea.js +34 -2
  205. package/dist/components/ui/textarea.mjs +2 -2
  206. package/dist/components/ui/toggle-group.js +35 -4
  207. package/dist/components/ui/toggle-group.mjs +3 -4
  208. package/dist/components/ui/toggle.js +35 -4
  209. package/dist/components/ui/toggle.mjs +2 -3
  210. package/dist/components/ui/tooltip.js +51 -22
  211. package/dist/components/ui/tooltip.mjs +3 -3
  212. package/dist/components/ui/transactions-expense-categories-doughnut-chart.js +528 -0
  213. package/dist/components/ui/transactions-expense-categories-doughnut-chart.mjs +16 -0
  214. package/dist/components/ui/transactions-income-expense-bar-chart.js +516 -0
  215. package/dist/components/ui/transactions-income-expense-bar-chart.mjs +16 -0
  216. package/dist/components/ui/transactions-liabilities-breakdown-doughnut-chart.js +528 -0
  217. package/dist/components/ui/transactions-liabilities-breakdown-doughnut-chart.mjs +16 -0
  218. package/dist/index.js +11613 -2868
  219. package/dist/index.mjs +377 -164
  220. package/dist/lib/theme-provider.js +10 -1
  221. package/dist/lib/theme-provider.mjs +1 -1
  222. package/dist/lib/typography.js +8 -0
  223. package/dist/lib/typography.mjs +3 -1
  224. package/dist/lib/utils.js +33 -1
  225. package/dist/lib/utils.mjs +1 -1
  226. package/dist/styles.css +1 -1
  227. package/package.json +169 -6
  228. package/src/components/index.tsx +323 -13
  229. package/src/components/ui/accordion.tsx +6 -3
  230. package/src/components/ui/add-column-modal.tsx +339 -0
  231. package/src/components/ui/add-lead-modal.tsx +290 -0
  232. package/src/components/ui/ai-assistant-drawer.tsx +408 -0
  233. package/src/components/ui/alert-dialog.tsx +80 -54
  234. package/src/components/ui/alert.tsx +28 -28
  235. package/src/components/ui/avatar.tsx +30 -29
  236. package/src/components/ui/backoffice-alert-history-chart.tsx +260 -0
  237. package/src/components/ui/backoffice-contact-history-chart.tsx +325 -0
  238. package/src/components/ui/badge.tsx +17 -15
  239. package/src/components/ui/borrowing-capacity-line-chart.tsx +357 -0
  240. package/src/components/ui/button.tsx +30 -27
  241. package/src/components/ui/calendar.tsx +53 -67
  242. package/src/components/ui/card.tsx +27 -24
  243. package/src/components/ui/cash-balance-line-chart.tsx +302 -0
  244. package/src/components/ui/cashflow-bar-chart.tsx +363 -0
  245. package/src/components/ui/chart-shared.tsx +261 -0
  246. package/src/components/ui/checkbox.tsx +30 -26
  247. package/src/components/ui/combobox.tsx +223 -0
  248. package/src/components/ui/data-table.tsx +160 -99
  249. package/src/components/ui/date-picker.tsx +0 -2
  250. package/src/components/ui/dialog.tsx +70 -60
  251. package/src/components/ui/drawer.tsx +57 -48
  252. package/src/components/ui/dropdown-menu.tsx +90 -82
  253. package/src/components/ui/empty.tsx +31 -27
  254. package/src/components/ui/expense-bar-chart.tsx +296 -0
  255. package/src/components/ui/field.tsx +70 -62
  256. package/src/components/ui/financial-cards.tsx +830 -0
  257. package/src/components/ui/financial-drawers.tsx +339 -0
  258. package/src/components/ui/financial-primitives.tsx +331 -0
  259. package/src/components/ui/financial-sections.tsx +672 -0
  260. package/src/components/ui/form-primitives.tsx +536 -0
  261. package/src/components/ui/income-bar-chart.tsx +297 -0
  262. package/src/components/ui/input-group.tsx +41 -34
  263. package/src/components/ui/input-otp.tsx +29 -24
  264. package/src/components/ui/input.tsx +8 -8
  265. package/src/components/ui/kanban-column.tsx +333 -0
  266. package/src/components/ui/label.tsx +9 -12
  267. package/src/components/ui/opportunity-card.tsx +616 -0
  268. package/src/components/ui/opportunity-edit-modals.tsx +2528 -0
  269. package/src/components/ui/opportunity-summary-tab.tsx +579 -0
  270. package/src/components/ui/pipeline-alerts.tsx +74 -0
  271. package/src/components/ui/pipeline-board.tsx +268 -0
  272. package/src/components/ui/pipeline-chart.tsx +173 -0
  273. package/src/components/ui/pipeline-dialogs.tsx +303 -0
  274. package/src/components/ui/pipeline-primitives.tsx +108 -0
  275. package/src/components/ui/popover.tsx +41 -36
  276. package/src/components/ui/property-cashflow-doughnut-chart.tsx +188 -0
  277. package/src/components/ui/property-debt-equity-doughnut-chart.tsx +185 -0
  278. package/src/components/ui/property-mobile-estimate-line-chart.tsx +393 -0
  279. package/src/components/ui/select.tsx +65 -52
  280. package/src/components/ui/sheet.tsx +55 -52
  281. package/src/components/ui/slider.tsx +54 -77
  282. package/src/components/ui/stage-timeline.tsx +205 -0
  283. package/src/components/ui/switch.tsx +42 -29
  284. package/src/components/ui/table.tsx +28 -28
  285. package/src/components/ui/tabs.tsx +22 -28
  286. package/src/components/ui/textarea.tsx +8 -8
  287. package/src/components/ui/toggle-group.tsx +0 -2
  288. package/src/components/ui/toggle.tsx +13 -15
  289. package/src/components/ui/tooltip.tsx +30 -28
  290. package/src/components/ui/transactions-expense-categories-doughnut-chart.tsx +191 -0
  291. package/src/components/ui/transactions-income-expense-bar-chart.tsx +205 -0
  292. package/src/components/ui/transactions-liabilities-breakdown-doughnut-chart.tsx +191 -0
  293. package/src/lib/theme-provider.tsx +10 -0
  294. package/src/lib/typography.ts +9 -0
  295. package/src/lib/utils.ts +41 -3
  296. package/src/styles/globals.css +371 -124
  297. package/src/styles/styles-css.ts +1 -1
  298. package/tsup.config.ts +32 -0
  299. package/dist/chunk-K74JRTJR.mjs +0 -105
  300. package/dist/chunk-V7CNWJT3.mjs +0 -10
@@ -0,0 +1,297 @@
1
+ import React, { useEffect, useMemo, useRef, useState } from "react";
2
+ import {
3
+ Chart as ChartJS,
4
+ CategoryScale,
5
+ LinearScale,
6
+ BarElement,
7
+ Tooltip,
8
+ Legend,
9
+ type ChartOptions,
10
+ type ChartData,
11
+ } from "chart.js";
12
+ import { Chart } from "react-chartjs-2";
13
+ import { useThemeVars } from "@/lib/theme-provider";
14
+ import { Card, CardContent, CardHeader, CardTitle, CardAction } from "./card";
15
+ import { Empty, EmptyDescription } from "./empty";
16
+ import { Skeleton } from "./skeleton";
17
+ import { cn } from "@/lib/utils";
18
+ import {
19
+ hexToRgba,
20
+ DATASET_ALPHAS,
21
+ FALLBACK_TICK,
22
+ FALLBACK_PRIMARY,
23
+ CHART_SLICE_COUNT,
24
+ CHART_PERIODS,
25
+ formatTooltipDate,
26
+ ChartLegendItem,
27
+ ChartPeriodButton,
28
+ type ChartPeriod,
29
+ type ChartGranularity,
30
+ } from "./chart-shared";
31
+
32
+ ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip, Legend);
33
+
34
+ // ---------------------------------------------------------------------------
35
+ // Types
36
+ // ---------------------------------------------------------------------------
37
+
38
+ export interface IncomeDataset {
39
+ /** Income source label, e.g. "Employment", "Rental", "Other" */
40
+ label: string;
41
+ /** One value per data point, aligned to the months array */
42
+ data: number[];
43
+ }
44
+
45
+ export interface IncomeBarChartData {
46
+ /** Display labels, e.g. ["Jul", "Aug"] for monthly or ["Mar 8", "Mar 9"] for daily */
47
+ months: string[];
48
+ /** Optional ISO date strings per point — used for the tooltip title */
49
+ dates?: string[];
50
+ datasets: IncomeDataset[];
51
+ }
52
+
53
+ export type IncomePeriod = ChartPeriod;
54
+ export type IncomeGranularity = ChartGranularity;
55
+
56
+ export interface IncomeBarChartProps {
57
+ /** Full dataset — sliced to the selected period */
58
+ incomeData: IncomeBarChartData | null;
59
+ title?: string;
60
+ /** Show or hide the chart legend */
61
+ showLegend?: boolean;
62
+ /** Show or hide X axis labels */
63
+ showXAxis?: boolean;
64
+ /** Show or hide Y axis labels */
65
+ showYAxis?: boolean;
66
+ /** Legend placement relative to chart */
67
+ legendPosition?: "top" | "bottom";
68
+ /** Default period selector value */
69
+ defaultPeriod?: IncomePeriod;
70
+ /**
71
+ * Data granularity — controls available period buttons and slice counts.
72
+ * "monthly" (default): shows 3M / 6M / 12M, slices by month count.
73
+ * "daily": shows 1M / 3M / 6M / 12M, slices by day count (1M=30, 3M=90, etc.).
74
+ */
75
+ granularity?: IncomeGranularity;
76
+ /** Chart canvas height in pixels */
77
+ height?: number;
78
+ /** Width of the card in pixels */
79
+ width?: number | string;
80
+ className?: string;
81
+ /** Show skeleton loading state instead of the chart */
82
+ isLoading?: boolean;
83
+ }
84
+
85
+ // ---------------------------------------------------------------------------
86
+ // Constants
87
+ // ---------------------------------------------------------------------------
88
+
89
+ // ---------------------------------------------------------------------------
90
+ // Component
91
+ // ---------------------------------------------------------------------------
92
+
93
+ export function IncomeBarChart({
94
+ incomeData,
95
+ title = "Income",
96
+ showLegend = true,
97
+ showXAxis = true,
98
+ showYAxis = true,
99
+ legendPosition = "top",
100
+ defaultPeriod = 6,
101
+ granularity = "monthly",
102
+ height = 280,
103
+ width = "100%",
104
+ className,
105
+ isLoading = false,
106
+ }: IncomeBarChartProps) {
107
+ const periods = CHART_PERIODS[granularity];
108
+ const [period, setPeriod] = useState<IncomePeriod>(defaultPeriod);
109
+
110
+ // Reset period when granularity changes, but not on initial mount
111
+ // (defaultPeriod handles the initial value).
112
+ const isFirstRender = useRef(true);
113
+ useEffect(() => {
114
+ if (isFirstRender.current) {
115
+ isFirstRender.current = false;
116
+ return;
117
+ }
118
+ setPeriod(CHART_PERIODS[granularity][0]);
119
+ }, [granularity]);
120
+
121
+ const themeVars = useThemeVars();
122
+ const brandPrimary: string =
123
+ (themeVars["--theme-primary"] as string | undefined) || FALLBACK_PRIMARY;
124
+ const fontFamily: string =
125
+ (themeVars["--font-sans"] as string | undefined) || "Figtree, sans-serif";
126
+
127
+ const sliced = useMemo<IncomeBarChartData | null>(() => {
128
+ if (!incomeData?.months?.length || !incomeData.datasets.length) return null;
129
+ const count = Math.min(
130
+ CHART_SLICE_COUNT[granularity][period],
131
+ incomeData.months.length,
132
+ );
133
+ const start = incomeData.months.length - count;
134
+ return {
135
+ months: incomeData.months.slice(start),
136
+ dates: incomeData.dates?.slice(start),
137
+ datasets: incomeData.datasets.map((ds) => ({
138
+ ...ds,
139
+ data: ds.data.slice(start),
140
+ })),
141
+ };
142
+ }, [incomeData, period, granularity]);
143
+
144
+ const datasetColors = useMemo(
145
+ () =>
146
+ sliced?.datasets.map((_, i) =>
147
+ hexToRgba(brandPrimary, DATASET_ALPHAS[i % DATASET_ALPHAS.length]),
148
+ ) ?? [],
149
+ [sliced, brandPrimary],
150
+ );
151
+
152
+ const chartData = useMemo<ChartData<"bar">>(() => {
153
+ if (!sliced) return { labels: [], datasets: [] };
154
+ return {
155
+ labels: sliced.months,
156
+ datasets: sliced.datasets.map((ds, i) => ({
157
+ label: ds.label,
158
+ data: ds.data,
159
+ backgroundColor: datasetColors[i],
160
+ hoverBackgroundColor: hexToRgba(
161
+ brandPrimary,
162
+ Math.min(DATASET_ALPHAS[i % DATASET_ALPHAS.length] + 0.15, 1),
163
+ ),
164
+ borderWidth: 0,
165
+ borderRadius: 0,
166
+ borderSkipped: false,
167
+ barPercentage: 0.75,
168
+ categoryPercentage: 0.7,
169
+ stack: "income",
170
+ })),
171
+ };
172
+ }, [sliced, datasetColors, brandPrimary]);
173
+
174
+ const options = useMemo<ChartOptions<"bar">>(
175
+ () => ({
176
+ responsive: true,
177
+ maintainAspectRatio: false,
178
+ animation: { duration: 800, easing: "easeOutQuart" },
179
+ layout: { padding: 0 },
180
+ plugins: {
181
+ legend: { display: false },
182
+ tooltip: {
183
+ mode: "index",
184
+ intersect: false,
185
+ padding: 12,
186
+ cornerRadius: 0,
187
+ titleFont: { size: 11, weight: 600 },
188
+ bodyFont: { size: 12, weight: 500 },
189
+ callbacks: {
190
+ title: (tooltipItems) => {
191
+ const idx = tooltipItems[0]?.dataIndex;
192
+ if (idx != null && sliced?.dates?.[idx]) {
193
+ return formatTooltipDate(sliced.dates[idx], granularity);
194
+ }
195
+ return tooltipItems[0]?.label ?? "";
196
+ },
197
+ label: (ctx) => {
198
+ const val = ctx.raw as number;
199
+ if (val === 0) return;
200
+ return ` ${ctx.dataset.label}: $${val.toLocaleString()}`;
201
+ },
202
+ },
203
+ },
204
+ },
205
+ scales: {
206
+ x: {
207
+ display: showXAxis,
208
+ stacked: true,
209
+ grid: { display: false },
210
+ border: { display: false },
211
+ ticks: { font: { size: 10 }, color: FALLBACK_TICK },
212
+ },
213
+ y: {
214
+ display: showYAxis,
215
+ stacked: true,
216
+ grid: { display: false },
217
+ border: { display: false },
218
+ ticks: {
219
+ font: { size: 10 },
220
+ color: FALLBACK_TICK,
221
+ maxTicksLimit: 5,
222
+ padding: 8,
223
+ callback: (v) => `$${Number(v).toLocaleString()}`,
224
+ },
225
+ },
226
+ },
227
+ }),
228
+ [showXAxis, showYAxis, sliced, granularity],
229
+ );
230
+
231
+ return (
232
+ <Card
233
+ className={cn("w-full py-4 sm:py-6 gap-2", className)}
234
+ style={{ maxWidth: width, fontFamily }}
235
+ >
236
+ <CardHeader className="px-3 sm:px-6">
237
+ <CardTitle className="text-sm sm:text-base">{title}</CardTitle>
238
+ <CardAction>
239
+ <div className="flex gap-0.5 sm:gap-1">
240
+ {periods.map((p) => (
241
+ <ChartPeriodButton
242
+ key={p}
243
+ period={p}
244
+ active={period === p}
245
+ onClick={() => setPeriod(p)}
246
+ />
247
+ ))}
248
+ </div>
249
+ </CardAction>
250
+ </CardHeader>
251
+
252
+ <CardContent className="px-3 sm:px-6">
253
+ {isLoading ? (
254
+ <Skeleton style={{ height, width: "100%" }} />
255
+ ) : !sliced ? (
256
+ <Empty className="flex-none p-4" style={{ height }}>
257
+ <EmptyDescription>No data available</EmptyDescription>
258
+ </Empty>
259
+ ) : (
260
+ <div className="flex flex-col gap-2">
261
+ {showLegend && legendPosition === "top" && (
262
+ <div className="flex flex-wrap gap-x-3 gap-y-1.5 pb-2">
263
+ {sliced.datasets.map((ds, i) => (
264
+ <ChartLegendItem
265
+ key={ds.label}
266
+ label={ds.label}
267
+ color={datasetColors[i]}
268
+ />
269
+ ))}
270
+ </div>
271
+ )}
272
+ <div style={{ height, width: "100%", position: "relative" }}>
273
+ <Chart
274
+ key={brandPrimary}
275
+ type="bar"
276
+ data={chartData}
277
+ options={options}
278
+ aria-label={title}
279
+ />
280
+ </div>
281
+ {showLegend && legendPosition === "bottom" && (
282
+ <div className="flex flex-wrap gap-x-3 gap-y-1.5 pt-2">
283
+ {sliced.datasets.map((ds, i) => (
284
+ <ChartLegendItem
285
+ key={ds.label}
286
+ label={ds.label}
287
+ color={datasetColors[i]}
288
+ />
289
+ ))}
290
+ </div>
291
+ )}
292
+ </div>
293
+ )}
294
+ </CardContent>
295
+ </Card>
296
+ );
297
+ }
@@ -1,17 +1,17 @@
1
- import { type ReactElement } from "react"
2
- import * as React from "react"
3
- import { cva, type VariantProps } from "class-variance-authority"
4
- import { cn } from "@/lib/utils"
5
- import { Button } from "@/components/ui/button"
6
- import { Input } from "@/components/ui/input"
7
- import { Textarea } from "@/components/ui/textarea"
1
+ import { type ReactElement } from "react";
2
+ import * as React from "react";
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+ import { cn } from "@/lib/utils";
5
+ import { Button } from "@/components/ui/button";
6
+ import { Input } from "@/components/ui/input";
7
+ import { Textarea } from "@/components/ui/textarea";
8
8
 
9
9
  /**
10
10
  * InputGroup — shadcn/WealthX
11
11
  * Base: npx shadcn\@latest add input-group
12
12
  * WealthX: removed rounded-md (square corners per brand)
13
13
  */
14
- export type InputGroupProps = React.ComponentProps<"div">
14
+ export type InputGroupProps = React.ComponentProps<"div">;
15
15
 
16
16
  function InputGroup({ className, ...props }: InputGroupProps): ReactElement {
17
17
  return (
@@ -32,13 +32,13 @@ function InputGroup({ className, ...props }: InputGroupProps): ReactElement {
32
32
  // Error state.
33
33
  "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
34
34
 
35
- className
35
+ className,
36
36
  )}
37
37
  data-slot="input-group"
38
38
  role="group"
39
39
  {...props}
40
40
  />
41
- )
41
+ );
42
42
  }
43
43
 
44
44
  const inputGroupAddonVariants = cva(
@@ -59,10 +59,11 @@ const inputGroupAddonVariants = cva(
59
59
  defaultVariants: {
60
60
  align: "inline-start",
61
61
  },
62
- }
63
- )
62
+ },
63
+ );
64
64
 
65
- export type InputGroupAddonProps = React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>
65
+ export type InputGroupAddonProps = React.ComponentProps<"div"> &
66
+ VariantProps<typeof inputGroupAddonVariants>;
66
67
 
67
68
  function InputGroupAddon({
68
69
  className,
@@ -77,19 +78,19 @@ function InputGroupAddon({
77
78
  data-slot="input-group-addon"
78
79
  onClick={(e) => {
79
80
  if ((e.target as HTMLElement).closest("button")) {
80
- return
81
+ return;
81
82
  }
82
- e.currentTarget.parentElement?.querySelector("input")?.focus()
83
+ e.currentTarget.parentElement?.querySelector("input")?.focus();
83
84
  }}
84
85
  onKeyDown={(e) => {
85
86
  if (e.key === "Enter" || e.key === " ") {
86
- e.currentTarget.parentElement?.querySelector("input")?.focus()
87
+ e.currentTarget.parentElement?.querySelector("input")?.focus();
87
88
  }
88
89
  }}
89
90
  role="group"
90
91
  {...props}
91
92
  />
92
- )
93
+ );
93
94
  }
94
95
 
95
96
  const inputGroupButtonVariants = cva(
@@ -106,11 +107,14 @@ const inputGroupButtonVariants = cva(
106
107
  defaultVariants: {
107
108
  size: "xs",
108
109
  },
109
- }
110
- )
110
+ },
111
+ );
111
112
 
112
- export type InputGroupButtonProps = Omit<React.ComponentProps<typeof Button>, "size"> &
113
- VariantProps<typeof inputGroupButtonVariants>
113
+ export type InputGroupButtonProps = Omit<
114
+ React.ComponentProps<typeof Button>,
115
+ "size"
116
+ > &
117
+ VariantProps<typeof inputGroupButtonVariants>;
114
118
 
115
119
  function InputGroupButton({
116
120
  className,
@@ -127,24 +131,27 @@ function InputGroupButton({
127
131
  variant={variant}
128
132
  {...props}
129
133
  />
130
- )
134
+ );
131
135
  }
132
136
 
133
- export type InputGroupTextProps = React.ComponentProps<"span">
137
+ export type InputGroupTextProps = React.ComponentProps<"span">;
134
138
 
135
- function InputGroupText({ className, ...props }: InputGroupTextProps): ReactElement {
139
+ function InputGroupText({
140
+ className,
141
+ ...props
142
+ }: InputGroupTextProps): ReactElement {
136
143
  return (
137
144
  <span
138
145
  className={cn(
139
- "flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
140
- className
146
+ "flex items-center gap-2 text-body-small text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
147
+ className,
141
148
  )}
142
149
  {...props}
143
150
  />
144
- )
151
+ );
145
152
  }
146
153
 
147
- export type InputGroupInputProps = React.ComponentProps<"input">
154
+ export type InputGroupInputProps = React.ComponentProps<"input">;
148
155
 
149
156
  function InputGroupInput({
150
157
  className,
@@ -154,15 +161,15 @@ function InputGroupInput({
154
161
  <Input
155
162
  className={cn(
156
163
  "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
157
- className
164
+ className,
158
165
  )}
159
166
  data-slot="input-group-control"
160
167
  {...props}
161
168
  />
162
- )
169
+ );
163
170
  }
164
171
 
165
- export type InputGroupTextareaProps = React.ComponentProps<"textarea">
172
+ export type InputGroupTextareaProps = React.ComponentProps<"textarea">;
166
173
 
167
174
  function InputGroupTextarea({
168
175
  className,
@@ -172,12 +179,12 @@ function InputGroupTextarea({
172
179
  <Textarea
173
180
  className={cn(
174
181
  "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
175
- className
182
+ className,
176
183
  )}
177
184
  data-slot="input-group-control"
178
185
  {...props}
179
186
  />
180
- )
187
+ );
181
188
  }
182
189
 
183
190
  export {
@@ -187,4 +194,4 @@ export {
187
194
  InputGroupText,
188
195
  InputGroupInput,
189
196
  InputGroupTextarea,
190
- }
197
+ };
@@ -7,15 +7,15 @@
7
7
  * - InputOTPSlot: removed first:rounded-l-md last:rounded-r-md — sharp corners (radius-none)
8
8
  */
9
9
 
10
- import { type ReactElement } from "react"
11
- import * as React from "react"
12
- import { OTPInput, OTPInputContext } from "input-otp"
13
- import { MinusIcon } from "lucide-react"
14
- import { cn } from "@/lib/utils"
10
+ import { type ReactElement } from "react";
11
+ import * as React from "react";
12
+ import { OTPInput, OTPInputContext } from "input-otp";
13
+ import { MinusIcon } from "lucide-react";
14
+ import { cn } from "@/lib/utils";
15
15
 
16
16
  export type InputOTPProps = React.ComponentProps<typeof OTPInput> & {
17
- containerClassName?: string
18
- }
17
+ containerClassName?: string;
18
+ };
19
19
 
20
20
  function InputOTP({
21
21
  className,
@@ -27,64 +27,69 @@ function InputOTP({
27
27
  className={cn("disabled:cursor-not-allowed", className)}
28
28
  containerClassName={cn(
29
29
  "flex items-center gap-2 has-disabled:opacity-50",
30
- containerClassName
30
+ containerClassName,
31
31
  )}
32
32
  data-slot="input-otp"
33
33
  {...props}
34
34
  />
35
- )
35
+ );
36
36
  }
37
37
 
38
- export type InputOTPGroupProps = React.ComponentProps<"div">
38
+ export type InputOTPGroupProps = React.ComponentProps<"div">;
39
39
 
40
- function InputOTPGroup({ className, ...props }: InputOTPGroupProps): ReactElement {
40
+ function InputOTPGroup({
41
+ className,
42
+ ...props
43
+ }: InputOTPGroupProps): ReactElement {
41
44
  return (
42
45
  <div
43
46
  className={cn("flex items-center", className)}
44
47
  data-slot="input-otp-group"
45
48
  {...props}
46
49
  />
47
- )
50
+ );
48
51
  }
49
52
 
50
53
  export type InputOTPSlotProps = React.ComponentProps<"div"> & {
51
- index: number
52
- }
54
+ index: number;
55
+ };
53
56
 
54
57
  function InputOTPSlot({
55
58
  index,
56
59
  className,
57
60
  ...props
58
61
  }: InputOTPSlotProps): ReactElement {
59
- const inputOTPContext = React.useContext(OTPInputContext)
60
- const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index] ?? {}
62
+ const inputOTPContext = React.useContext(OTPInputContext);
63
+ const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index] ?? {};
61
64
 
62
65
  return (
63
66
  <div
64
67
  className={cn(
65
- "relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:border-l aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
66
- className
68
+ "relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-body-small shadow-xs transition-all outline-none first:border-l aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
69
+ className,
67
70
  )}
68
71
  data-active={isActive}
69
72
  data-slot="input-otp-slot"
70
73
  {...props}
71
74
  >
72
75
  {char}
73
- {hasFakeCaret ? <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
76
+ {hasFakeCaret ? (
77
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
74
78
  <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
75
- </div> : null}
79
+ </div>
80
+ ) : null}
76
81
  </div>
77
- )
82
+ );
78
83
  }
79
84
 
80
- export type InputOTPSeparatorProps = React.ComponentProps<"div">
85
+ export type InputOTPSeparatorProps = React.ComponentProps<"div">;
81
86
 
82
87
  function InputOTPSeparator({ ...props }: InputOTPSeparatorProps): ReactElement {
83
88
  return (
84
89
  <div data-slot="input-otp-separator" role="separator" {...props}>
85
90
  <MinusIcon />
86
91
  </div>
87
- )
92
+ );
88
93
  }
89
94
 
90
- export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
95
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
@@ -1,28 +1,28 @@
1
- import { type ReactElement } from "react"
2
- import * as React from "react"
3
- import { cn } from "@/lib/utils"
1
+ import { type ReactElement } from "react";
2
+ import * as React from "react";
3
+ import { cn } from "@/lib/utils";
4
4
 
5
5
  /**
6
6
  * Input — shadcn/WealthX
7
7
  * Base: npx shadcn\@latest add input
8
8
  * WealthX: removed rounded-md (square corners), added font-sans.
9
9
  */
10
- export type InputProps = React.ComponentProps<"input">
10
+ export type InputProps = React.ComponentProps<"input">;
11
11
 
12
12
  function Input({ className, type, ...props }: InputProps): ReactElement {
13
13
  return (
14
14
  <input
15
15
  className={cn(
16
- "h-9 w-full min-w-0 border border-input bg-transparent px-3 py-1 text-base font-sans shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
16
+ "h-9 w-full min-w-0 border border-input bg-transparent px-3 py-1 text-body-medium font-sans shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-label-medium file:text-foreground placeholder:font-normal placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-input/30",
17
17
  "focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/20",
18
18
  "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
19
- className
19
+ className,
20
20
  )}
21
21
  data-slot="input"
22
22
  type={type}
23
23
  {...props}
24
24
  />
25
- )
25
+ );
26
26
  }
27
27
 
28
- export { Input }
28
+ export { Input };