@cdx-ui/components 0.3.5 → 0.3.6

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 (278) hide show
  1. package/README.md +1 -1
  2. package/coverage.svg +1 -1
  3. package/docs/components/bar-chart/content.md +703 -0
  4. package/docs/components/content.md +9 -1
  5. package/docs/components/line-chart/content.md +567 -0
  6. package/docs/components/pie-chart/content.md +493 -0
  7. package/docs/components/progress-segmented/content.md +1 -1
  8. package/docs/components/stepper/content.md +599 -0
  9. package/docs/components/system-alert/content.md +533 -0
  10. package/docs/foundations/styles/tokens/all-tokens/content.md +2 -1
  11. package/docs/llms.txt +9 -0
  12. package/docs/patterns/content.md +1 -0
  13. package/docs/patterns/dashboard/content.md +423 -19
  14. package/docs/patterns/insights/content.md +590 -0
  15. package/docs/resources/release-notes/0.3.5/content.md +7 -0
  16. package/docs/resources/release-notes/content.md +1 -0
  17. package/lib/commonjs/components/BarChart/geometry.js +1130 -0
  18. package/lib/commonjs/components/BarChart/geometry.js.map +1 -0
  19. package/lib/commonjs/components/BarChart/index.js +942 -0
  20. package/lib/commonjs/components/BarChart/index.js.map +1 -0
  21. package/lib/commonjs/components/BarChart/styles.js +26 -0
  22. package/lib/commonjs/components/BarChart/styles.js.map +1 -0
  23. package/lib/commonjs/components/Button/index.js +2 -2
  24. package/lib/commonjs/components/Button/index.js.map +1 -1
  25. package/lib/commonjs/components/LineChart/geometry.js +698 -0
  26. package/lib/commonjs/components/LineChart/geometry.js.map +1 -0
  27. package/lib/commonjs/components/LineChart/index.js +747 -0
  28. package/lib/commonjs/components/LineChart/index.js.map +1 -0
  29. package/lib/commonjs/components/LineChart/styles.js +25 -0
  30. package/lib/commonjs/components/LineChart/styles.js.map +1 -0
  31. package/lib/commonjs/components/PieChart/geometry.js +216 -0
  32. package/lib/commonjs/components/PieChart/geometry.js.map +1 -0
  33. package/lib/commonjs/components/PieChart/index.js +476 -0
  34. package/lib/commonjs/components/PieChart/index.js.map +1 -0
  35. package/lib/commonjs/components/PieChart/styles.js +88 -0
  36. package/lib/commonjs/components/PieChart/styles.js.map +1 -0
  37. package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js +9 -31
  38. package/lib/commonjs/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
  39. package/lib/commonjs/components/ProgressCircle/ProgressRing.js +52 -0
  40. package/lib/commonjs/components/ProgressCircle/ProgressRing.js.map +1 -0
  41. package/lib/commonjs/components/ScrollShadow/useScrollShadow.js +8 -7
  42. package/lib/commonjs/components/ScrollShadow/useScrollShadow.js.map +1 -1
  43. package/lib/commonjs/components/Stepper/index.js +369 -0
  44. package/lib/commonjs/components/Stepper/index.js.map +1 -0
  45. package/lib/commonjs/components/Stepper/styles.js +211 -0
  46. package/lib/commonjs/components/Stepper/styles.js.map +1 -0
  47. package/lib/commonjs/components/Stepper/useStepperLabelFit.js +22 -0
  48. package/lib/commonjs/components/Stepper/useStepperLabelFit.js.map +1 -0
  49. package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js +52 -0
  50. package/lib/commonjs/components/Stepper/useStepperLabelFit.web.js.map +1 -0
  51. package/lib/commonjs/components/Stepper/useStepperRingColors.js +31 -0
  52. package/lib/commonjs/components/Stepper/useStepperRingColors.js.map +1 -0
  53. package/lib/commonjs/components/SystemAlert/animation.js +218 -0
  54. package/lib/commonjs/components/SystemAlert/animation.js.map +1 -0
  55. package/lib/commonjs/components/SystemAlert/index.js +525 -0
  56. package/lib/commonjs/components/SystemAlert/index.js.map +1 -0
  57. package/lib/commonjs/components/SystemAlert/styles.js +178 -0
  58. package/lib/commonjs/components/SystemAlert/styles.js.map +1 -0
  59. package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js +53 -0
  60. package/lib/commonjs/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
  61. package/lib/commonjs/components/Tabs/index.js +4 -0
  62. package/lib/commonjs/components/Tabs/index.js.map +1 -1
  63. package/lib/commonjs/components/Tabs/styles.js +1 -1
  64. package/lib/commonjs/components/Tabs/styles.js.map +1 -1
  65. package/lib/commonjs/components/chart/ChartInspector.js +610 -0
  66. package/lib/commonjs/components/chart/ChartInspector.js.map +1 -0
  67. package/lib/commonjs/components/chart/format.js +93 -0
  68. package/lib/commonjs/components/chart/format.js.map +1 -0
  69. package/lib/commonjs/components/chart/index.js +2 -0
  70. package/lib/commonjs/components/chart/index.js.map +1 -0
  71. package/lib/commonjs/components/chart/motion.js +97 -0
  72. package/lib/commonjs/components/chart/motion.js.map +1 -0
  73. package/lib/commonjs/components/chart/palette.js +178 -0
  74. package/lib/commonjs/components/chart/palette.js.map +1 -0
  75. package/lib/commonjs/components/chart/size.js +34 -0
  76. package/lib/commonjs/components/chart/size.js.map +1 -0
  77. package/lib/commonjs/components/chart/ticks.js +59 -0
  78. package/lib/commonjs/components/chart/ticks.js.map +1 -0
  79. package/lib/commonjs/components/chart/types.js +6 -0
  80. package/lib/commonjs/components/chart/types.js.map +1 -0
  81. package/lib/commonjs/components/chart/useChartHostWidth.js +27 -0
  82. package/lib/commonjs/components/chart/useChartHostWidth.js.map +1 -0
  83. package/lib/commonjs/components/index.js +60 -0
  84. package/lib/commonjs/components/index.js.map +1 -1
  85. package/lib/commonjs/figma/SystemAlert.Button.figma.js +28 -0
  86. package/lib/commonjs/figma/SystemAlert.Button.figma.js.map +1 -0
  87. package/lib/commonjs/figma/SystemAlert.Close.figma.js +22 -0
  88. package/lib/commonjs/figma/SystemAlert.Close.figma.js.map +1 -0
  89. package/lib/commonjs/figma/SystemAlert.Description.figma.js +20 -0
  90. package/lib/commonjs/figma/SystemAlert.Description.figma.js.map +1 -0
  91. package/lib/commonjs/figma/SystemAlert.IconButton.figma.js +31 -0
  92. package/lib/commonjs/figma/SystemAlert.IconButton.figma.js.map +1 -0
  93. package/lib/commonjs/figma/SystemAlert.figma.js +48 -0
  94. package/lib/commonjs/figma/SystemAlert.figma.js.map +1 -0
  95. package/lib/module/components/BarChart/geometry.js +1110 -0
  96. package/lib/module/components/BarChart/geometry.js.map +1 -0
  97. package/lib/module/components/BarChart/index.js +936 -0
  98. package/lib/module/components/BarChart/index.js.map +1 -0
  99. package/lib/module/components/BarChart/styles.js +22 -0
  100. package/lib/module/components/BarChart/styles.js.map +1 -0
  101. package/lib/module/components/Button/index.js +2 -2
  102. package/lib/module/components/Button/index.js.map +1 -1
  103. package/lib/module/components/LineChart/geometry.js +685 -0
  104. package/lib/module/components/LineChart/geometry.js.map +1 -0
  105. package/lib/module/components/LineChart/index.js +741 -0
  106. package/lib/module/components/LineChart/index.js.map +1 -0
  107. package/lib/module/components/LineChart/styles.js +21 -0
  108. package/lib/module/components/LineChart/styles.js.map +1 -0
  109. package/lib/module/components/PieChart/geometry.js +209 -0
  110. package/lib/module/components/PieChart/geometry.js.map +1 -0
  111. package/lib/module/components/PieChart/index.js +471 -0
  112. package/lib/module/components/PieChart/index.js.map +1 -0
  113. package/lib/module/components/PieChart/styles.js +84 -0
  114. package/lib/module/components/PieChart/styles.js.map +1 -0
  115. package/lib/module/components/ProgressCircle/ProgressCircleRing.js +10 -32
  116. package/lib/module/components/ProgressCircle/ProgressCircleRing.js.map +1 -1
  117. package/lib/module/components/ProgressCircle/ProgressRing.js +48 -0
  118. package/lib/module/components/ProgressCircle/ProgressRing.js.map +1 -0
  119. package/lib/module/components/ScrollShadow/useScrollShadow.js +8 -7
  120. package/lib/module/components/ScrollShadow/useScrollShadow.js.map +1 -1
  121. package/lib/module/components/Stepper/index.js +360 -0
  122. package/lib/module/components/Stepper/index.js.map +1 -0
  123. package/lib/module/components/Stepper/styles.js +206 -0
  124. package/lib/module/components/Stepper/styles.js.map +1 -0
  125. package/lib/module/components/Stepper/useStepperLabelFit.js +18 -0
  126. package/lib/module/components/Stepper/useStepperLabelFit.js.map +1 -0
  127. package/lib/module/components/Stepper/useStepperLabelFit.web.js +48 -0
  128. package/lib/module/components/Stepper/useStepperLabelFit.web.js.map +1 -0
  129. package/lib/module/components/Stepper/useStepperRingColors.js +28 -0
  130. package/lib/module/components/Stepper/useStepperRingColors.js.map +1 -0
  131. package/lib/module/components/SystemAlert/animation.js +213 -0
  132. package/lib/module/components/SystemAlert/animation.js.map +1 -0
  133. package/lib/module/components/SystemAlert/index.js +515 -0
  134. package/lib/module/components/SystemAlert/index.js.map +1 -0
  135. package/lib/module/components/SystemAlert/styles.js +174 -0
  136. package/lib/module/components/SystemAlert/styles.js.map +1 -0
  137. package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js +49 -0
  138. package/lib/module/components/SystemAlert/useSystemAlertStatusBarStyle.js.map +1 -0
  139. package/lib/module/components/Tabs/index.js +4 -0
  140. package/lib/module/components/Tabs/index.js.map +1 -1
  141. package/lib/module/components/Tabs/styles.js +1 -1
  142. package/lib/module/components/Tabs/styles.js.map +1 -1
  143. package/lib/module/components/chart/ChartInspector.js +600 -0
  144. package/lib/module/components/chart/ChartInspector.js.map +1 -0
  145. package/lib/module/components/chart/format.js +84 -0
  146. package/lib/module/components/chart/format.js.map +1 -0
  147. package/lib/module/components/chart/index.js +2 -0
  148. package/lib/module/components/chart/index.js.map +1 -0
  149. package/lib/module/components/chart/motion.js +89 -0
  150. package/lib/module/components/chart/motion.js.map +1 -0
  151. package/lib/module/components/chart/palette.js +168 -0
  152. package/lib/module/components/chart/palette.js.map +1 -0
  153. package/lib/module/components/chart/size.js +29 -0
  154. package/lib/module/components/chart/size.js.map +1 -0
  155. package/lib/module/components/chart/ticks.js +55 -0
  156. package/lib/module/components/chart/ticks.js.map +1 -0
  157. package/lib/module/components/chart/types.js +4 -0
  158. package/lib/module/components/chart/types.js.map +1 -0
  159. package/lib/module/components/chart/useChartHostWidth.js +23 -0
  160. package/lib/module/components/chart/useChartHostWidth.js.map +1 -0
  161. package/lib/module/components/index.js +5 -0
  162. package/lib/module/components/index.js.map +1 -1
  163. package/lib/module/figma/SystemAlert.Button.figma.js +22 -0
  164. package/lib/module/figma/SystemAlert.Button.figma.js.map +1 -0
  165. package/lib/module/figma/SystemAlert.Close.figma.js +18 -0
  166. package/lib/module/figma/SystemAlert.Close.figma.js.map +1 -0
  167. package/lib/module/figma/SystemAlert.Description.figma.js +14 -0
  168. package/lib/module/figma/SystemAlert.Description.figma.js.map +1 -0
  169. package/lib/module/figma/SystemAlert.IconButton.figma.js +25 -0
  170. package/lib/module/figma/SystemAlert.IconButton.figma.js.map +1 -0
  171. package/lib/module/figma/SystemAlert.figma.js +42 -0
  172. package/lib/module/figma/SystemAlert.figma.js.map +1 -0
  173. package/lib/typescript/components/BarChart/geometry.d.ts +236 -0
  174. package/lib/typescript/components/BarChart/geometry.d.ts.map +1 -0
  175. package/lib/typescript/components/BarChart/index.d.ts +193 -0
  176. package/lib/typescript/components/BarChart/index.d.ts.map +1 -0
  177. package/lib/typescript/components/BarChart/styles.d.ts +32 -0
  178. package/lib/typescript/components/BarChart/styles.d.ts.map +1 -0
  179. package/lib/typescript/components/LineChart/geometry.d.ts +248 -0
  180. package/lib/typescript/components/LineChart/geometry.d.ts.map +1 -0
  181. package/lib/typescript/components/LineChart/index.d.ts +105 -0
  182. package/lib/typescript/components/LineChart/index.d.ts.map +1 -0
  183. package/lib/typescript/components/LineChart/styles.d.ts +12 -0
  184. package/lib/typescript/components/LineChart/styles.d.ts.map +1 -0
  185. package/lib/typescript/components/PieChart/geometry.d.ts +43 -0
  186. package/lib/typescript/components/PieChart/geometry.d.ts.map +1 -0
  187. package/lib/typescript/components/PieChart/index.d.ts +147 -0
  188. package/lib/typescript/components/PieChart/index.d.ts.map +1 -0
  189. package/lib/typescript/components/PieChart/styles.d.ts +27 -0
  190. package/lib/typescript/components/PieChart/styles.d.ts.map +1 -0
  191. package/lib/typescript/components/ProgressCircle/ProgressCircleRing.d.ts.map +1 -1
  192. package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts +17 -0
  193. package/lib/typescript/components/ProgressCircle/ProgressRing.d.ts.map +1 -0
  194. package/lib/typescript/components/ScrollShadow/useScrollShadow.d.ts.map +1 -1
  195. package/lib/typescript/components/Stepper/index.d.ts +68 -0
  196. package/lib/typescript/components/Stepper/index.d.ts.map +1 -0
  197. package/lib/typescript/components/Stepper/styles.d.ts +46 -0
  198. package/lib/typescript/components/Stepper/styles.d.ts.map +1 -0
  199. package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts +15 -0
  200. package/lib/typescript/components/Stepper/useStepperLabelFit.d.ts.map +1 -0
  201. package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts +10 -0
  202. package/lib/typescript/components/Stepper/useStepperLabelFit.web.d.ts.map +1 -0
  203. package/lib/typescript/components/Stepper/useStepperRingColors.d.ts +6 -0
  204. package/lib/typescript/components/Stepper/useStepperRingColors.d.ts.map +1 -0
  205. package/lib/typescript/components/SystemAlert/animation.d.ts +56 -0
  206. package/lib/typescript/components/SystemAlert/animation.d.ts.map +1 -0
  207. package/lib/typescript/components/SystemAlert/index.d.ts +110 -0
  208. package/lib/typescript/components/SystemAlert/index.d.ts.map +1 -0
  209. package/lib/typescript/components/SystemAlert/styles.d.ts +38 -0
  210. package/lib/typescript/components/SystemAlert/styles.d.ts.map +1 -0
  211. package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts +14 -0
  212. package/lib/typescript/components/SystemAlert/useSystemAlertStatusBarStyle.d.ts.map +1 -0
  213. package/lib/typescript/components/Tabs/index.d.ts.map +1 -1
  214. package/lib/typescript/components/chart/ChartInspector.d.ts +101 -0
  215. package/lib/typescript/components/chart/ChartInspector.d.ts.map +1 -0
  216. package/lib/typescript/components/chart/format.d.ts +16 -0
  217. package/lib/typescript/components/chart/format.d.ts.map +1 -0
  218. package/lib/typescript/components/chart/index.d.ts +3 -0
  219. package/lib/typescript/components/chart/index.d.ts.map +1 -0
  220. package/lib/typescript/components/chart/motion.d.ts +27 -0
  221. package/lib/typescript/components/chart/motion.d.ts.map +1 -0
  222. package/lib/typescript/components/chart/palette.d.ts +44 -0
  223. package/lib/typescript/components/chart/palette.d.ts.map +1 -0
  224. package/lib/typescript/components/chart/size.d.ts +25 -0
  225. package/lib/typescript/components/chart/size.d.ts.map +1 -0
  226. package/lib/typescript/components/chart/ticks.d.ts +3 -0
  227. package/lib/typescript/components/chart/ticks.d.ts.map +1 -0
  228. package/lib/typescript/components/chart/types.d.ts +163 -0
  229. package/lib/typescript/components/chart/types.d.ts.map +1 -0
  230. package/lib/typescript/components/chart/useChartHostWidth.d.ts +9 -0
  231. package/lib/typescript/components/chart/useChartHostWidth.d.ts.map +1 -0
  232. package/lib/typescript/components/index.d.ts +5 -0
  233. package/lib/typescript/components/index.d.ts.map +1 -1
  234. package/lib/typescript/figma/SystemAlert.Button.figma.d.ts +11 -0
  235. package/lib/typescript/figma/SystemAlert.Button.figma.d.ts.map +1 -0
  236. package/lib/typescript/figma/SystemAlert.Close.figma.d.ts +11 -0
  237. package/lib/typescript/figma/SystemAlert.Close.figma.d.ts.map +1 -0
  238. package/lib/typescript/figma/SystemAlert.Description.figma.d.ts +8 -0
  239. package/lib/typescript/figma/SystemAlert.Description.figma.d.ts.map +1 -0
  240. package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts +11 -0
  241. package/lib/typescript/figma/SystemAlert.IconButton.figma.d.ts.map +1 -0
  242. package/lib/typescript/figma/SystemAlert.figma.d.ts +8 -0
  243. package/lib/typescript/figma/SystemAlert.figma.d.ts.map +1 -0
  244. package/package.json +5 -5
  245. package/src/components/BarChart/geometry.ts +1469 -0
  246. package/src/components/BarChart/index.tsx +1424 -0
  247. package/src/components/BarChart/styles.ts +31 -0
  248. package/src/components/Button/index.tsx +1 -1
  249. package/src/components/LineChart/geometry.ts +957 -0
  250. package/src/components/LineChart/index.tsx +1109 -0
  251. package/src/components/LineChart/styles.ts +26 -0
  252. package/src/components/PieChart/geometry.ts +295 -0
  253. package/src/components/PieChart/index.tsx +715 -0
  254. package/src/components/PieChart/styles.ts +101 -0
  255. package/src/components/ProgressCircle/ProgressCircleRing.tsx +10 -39
  256. package/src/components/ProgressCircle/ProgressRing.tsx +60 -0
  257. package/src/components/ScrollShadow/useScrollShadow.ts +12 -11
  258. package/src/components/Stepper/index.tsx +452 -0
  259. package/src/components/Stepper/styles.ts +234 -0
  260. package/src/components/Stepper/useStepperLabelFit.ts +21 -0
  261. package/src/components/Stepper/useStepperLabelFit.web.ts +53 -0
  262. package/src/components/Stepper/useStepperRingColors.ts +29 -0
  263. package/src/components/SystemAlert/animation.ts +252 -0
  264. package/src/components/SystemAlert/index.tsx +684 -0
  265. package/src/components/SystemAlert/styles.ts +212 -0
  266. package/src/components/SystemAlert/useSystemAlertStatusBarStyle.ts +57 -0
  267. package/src/components/Tabs/index.tsx +4 -0
  268. package/src/components/Tabs/styles.ts +1 -1
  269. package/src/components/chart/ChartInspector.tsx +726 -0
  270. package/src/components/chart/format.ts +95 -0
  271. package/src/components/chart/index.ts +24 -0
  272. package/src/components/chart/motion.ts +98 -0
  273. package/src/components/chart/palette.tsx +247 -0
  274. package/src/components/chart/size.ts +21 -0
  275. package/src/components/chart/ticks.ts +53 -0
  276. package/src/components/chart/types.ts +183 -0
  277. package/src/components/chart/useChartHostWidth.ts +26 -0
  278. package/src/components/index.ts +5 -0
@@ -1,34 +1,438 @@
1
1
  # Dashboard (https://design.candescent.com/docs/patterns/dashboard)
2
2
 
3
+ ## Insights Overview
4
+
5
+ A summary card over topic tabs of chart preview cards for budget, spending, daily spend, cash flow, and credit score.
6
+
7
+ **Platforms:** iOS, Android
8
+
9
+ ```tsx
10
+ import {
11
+ BarChart,
12
+ Box,
13
+ Card,
14
+ Chip,
15
+ Divider,
16
+ Heading,
17
+ HStack,
18
+ Insight,
19
+ LineChart,
20
+ PieChart,
21
+ Tabs,
22
+ Text,
23
+ VStack,
24
+ } from '@cdx-ui/components';
25
+ import { FILL_WIDTH, formatUsd, formatUsdThousands } from '../_utils';
26
+
27
+ const SAFE_TO_SPEND = [
28
+ { id: 'left', label: 'Left to spend', value: 462, color: 'simple-primary' },
29
+ // TODO(forge-ui): charts have no light neutral color for a progress track. `categorical-6` is
30
+ // the closest existing token but is much darker than the design's grey.
31
+ { id: 'spent', label: 'Spent on bills', value: 738, color: 'categorical-6' },
32
+ ] as const;
33
+
34
+ const SPENDING = [
35
+ { id: 'housing', label: 'Housing', value: 2130 },
36
+ { id: 'food', label: 'Food and dining', value: 1065 },
37
+ { id: 'shopping', label: 'Shopping', value: 800 },
38
+ { id: 'transport', label: 'Transport', value: 745 },
39
+ { id: 'other', label: 'Other', value: 585, color: 'categorical-6' },
40
+ ] as const;
41
+
42
+ // Today is its own series so it can take a darker color than the earlier days; both share one
43
+ // stack, so each day still draws a single bar.
44
+ // TODO(forge-ui): BarChart can't format band-axis labels, so the single-letter days are the data
45
+ // itself and tooltips and screen readers read "S" for both Saturday and Sunday.
46
+ const DAILY_SPENDING = [
47
+ { day: 'S', earlier: 46, today: null },
48
+ { day: 'S', earlier: 62, today: null },
49
+ { day: 'M', earlier: 38, today: null },
50
+ { day: 'T', earlier: 62, today: null },
51
+ { day: 'W', earlier: 50, today: null },
52
+ { day: 'T', earlier: 36, today: null },
53
+ { day: 'F', earlier: null, today: 37 },
54
+ ];
55
+
56
+ const CASH_FLOW = [
57
+ { day: 'Mon', moneyIn: 6200, moneyOut: 2400 },
58
+ { day: 'Tue', moneyIn: 1800, moneyOut: 3100 },
59
+ { day: 'Wed', moneyIn: 2500, moneyOut: 1900 },
60
+ { day: 'Thu', moneyIn: 7400, moneyOut: 4200 },
61
+ { day: 'Fri', moneyIn: 3100, moneyOut: 2800 },
62
+ { day: 'Sat', moneyIn: 900, moneyOut: 1600 },
63
+ { day: 'Sun', moneyIn: 600, moneyOut: 1200 },
64
+ ];
65
+
66
+ const CASH_FLOW_SUMMARY = [
67
+ { label: 'Money in', value: '$22,500' },
68
+ { label: 'Money out', value: '$17,200' },
69
+ { label: 'Net', value: '+$5,300', color: 'success' as const },
70
+ ];
71
+
72
+ const CREDIT_SCORE = [
73
+ { month: 'May', score: 575 },
74
+ { month: 'Jun', score: 572 },
75
+ { month: 'Jul', score: 568 },
76
+ { month: 'Aug', score: 571 },
77
+ { month: 'Sep', score: 560 },
78
+ { month: 'Oct', score: 547 },
79
+ ];
80
+
81
+ function OnTrackChip() {
82
+ return (
83
+ <Chip color="action" size="small">
84
+ <Chip.Label>On track</Chip.Label>
85
+ </Chip>
86
+ );
87
+ }
88
+
89
+ function SafeToSpendCard() {
90
+ return (
91
+ <Card>
92
+ <Card.Stripe />
93
+ <Card.Header>
94
+ <Heading size="sm">Safe to spend</Heading>
95
+ <OnTrackChip />
96
+ </Card.Header>
97
+ <Card.Content>
98
+ <VStack space="md">
99
+ <HStack space="lg" className="items-center">
100
+ <Box className="size-24">
101
+ <PieChart
102
+ series={[
103
+ {
104
+ id: 'safe-to-spend',
105
+ data: SAFE_TO_SPEND,
106
+ innerRadius: '80%',
107
+ valueFormatter: formatUsd,
108
+ },
109
+ ]}
110
+ width={96}
111
+ height={96}
112
+ hideLegend
113
+ accessibilityLabel="$462 of your $1,200 monthly budget is left after bills."
114
+ />
115
+ </Box>
116
+ <VStack space="xs" className="flex-1">
117
+ <Heading size="xl">$462</Heading>
118
+ <Text size="sm" color="secondary">
119
+ left after bills
120
+ </Text>
121
+ </VStack>
122
+ </HStack>
123
+ <Text color="secondary">
124
+ You have <Text weight="semibold">$57/day</Text> for the next 8 days until your Jan 30
125
+ paycheck.
126
+ </Text>
127
+ </VStack>
128
+ </Card.Content>
129
+ </Card>
130
+ );
131
+ }
132
+
133
+ function SpendingCard() {
134
+ return (
135
+ <Card>
136
+ <Card.Header>
137
+ <Heading size="sm">Spending this month</Heading>
138
+ </Card.Header>
139
+ <Card.Content>
140
+ <VStack space="lg">
141
+ <PieChart
142
+ series={[
143
+ {
144
+ id: 'spending',
145
+ data: SPENDING,
146
+ innerRadius: '72%',
147
+ paddingAngle: 2,
148
+ cornerRadius: 4,
149
+ valueFormatter: formatUsd,
150
+ },
151
+ ]}
152
+ width={192}
153
+ height={192}
154
+ legendLayout="list"
155
+ centerLabel={
156
+ <Box className="items-center">
157
+ <Heading size="md">$5,325</Heading>
158
+ <Text size="xs" color="secondary" className="uppercase">
159
+ Total
160
+ </Text>
161
+ </Box>
162
+ }
163
+ />
164
+ <Insight aiGenerated>
165
+ <Insight.Description>
166
+ Food and dining is 18% higher than last month, mostly from weekend restaurant visits.
167
+ </Insight.Description>
168
+ </Insight>
169
+ </VStack>
170
+ </Card.Content>
171
+ </Card>
172
+ );
173
+ }
174
+
175
+ function DailySpendingCard() {
176
+ return (
177
+ <Card>
178
+ <Card.Header>
179
+ <Heading size="sm">Daily spending</Heading>
180
+ <OnTrackChip />
181
+ </Card.Header>
182
+ <Card.Content>
183
+ <HStack space="lg" className="flex-wrap items-end">
184
+ <VStack space="sm">
185
+ <VStack space="xs">
186
+ <Heading size="xl">$37</Heading>
187
+ <Text weight="medium">spent so far today</Text>
188
+ </VStack>
189
+ <Text size="sm" color="secondary">
190
+ Daily average: $49
191
+ </Text>
192
+ </VStack>
193
+ <BarChart
194
+ className="min-w-32 flex-1"
195
+ dataset={DAILY_SPENDING}
196
+ xAxis={[{ id: 'day', dataKey: 'day', scaleType: 'band' }]}
197
+ yAxis={[{ id: 'spend', position: 'none', min: 0, max: 62 }]}
198
+ series={[
199
+ {
200
+ id: 'earlier',
201
+ dataKey: 'earlier',
202
+ label: 'Spent',
203
+ stack: 'day',
204
+ color: 'simple-primary',
205
+ valueFormatter: formatUsd,
206
+ },
207
+ {
208
+ id: 'today',
209
+ dataKey: 'today',
210
+ label: 'Spent so far today',
211
+ stack: 'day',
212
+ color: 'simple-secondary',
213
+ valueFormatter: formatUsd,
214
+ },
215
+ ]}
216
+ grid={{ horizontal: false }}
217
+ tooltip={{ trigger: 'item' }}
218
+ categoryGapRatio={0.7}
219
+ borderRadius={999}
220
+ width={FILL_WIDTH}
221
+ height={112}
222
+ hideLegend
223
+ scrollable={false}
224
+ accessibilityLabel="Spending for the last seven days. $37 so far today, Friday, against a $49 daily average."
225
+ />
226
+ </HStack>
227
+ </Card.Content>
228
+ </Card>
229
+ );
230
+ }
231
+
232
+ function CashFlowCard() {
233
+ return (
234
+ <Card>
235
+ <Card.Header>
236
+ <Heading size="sm">Cash flow this week</Heading>
237
+ </Card.Header>
238
+ <Card.Content>
239
+ <VStack space="lg">
240
+ <BarChart
241
+ dataset={CASH_FLOW}
242
+ xAxis={[{ id: 'day', dataKey: 'day', scaleType: 'band' }]}
243
+ yAxis={[
244
+ {
245
+ id: 'amount',
246
+ min: 0,
247
+ max: 15000,
248
+ tickNumber: 4,
249
+ valueFormatter: formatUsdThousands,
250
+ },
251
+ ]}
252
+ series={[
253
+ {
254
+ id: 'moneyIn',
255
+ dataKey: 'moneyIn',
256
+ label: 'In',
257
+ stack: 'flow',
258
+ valueFormatter: formatUsd,
259
+ },
260
+ {
261
+ id: 'moneyOut',
262
+ dataKey: 'moneyOut',
263
+ label: 'Out',
264
+ stack: 'flow',
265
+ valueFormatter: formatUsd,
266
+ },
267
+ ]}
268
+ borderRadius={2}
269
+ width={FILL_WIDTH}
270
+ height={176}
271
+ scrollable={false}
272
+ accessibilityLabel="Money in and out each day this week."
273
+ />
274
+ <VStack>
275
+ {CASH_FLOW_SUMMARY.map((row, index) => (
276
+ <VStack key={row.label}>
277
+ {index > 0 ? <Divider /> : null}
278
+ <HStack className="items-center justify-between py-2">
279
+ <Text size="sm" color="secondary">
280
+ {row.label}
281
+ </Text>
282
+ <Text size="sm" weight="medium" color={row.color}>
283
+ {row.value}
284
+ </Text>
285
+ </HStack>
286
+ </VStack>
287
+ ))}
288
+ </VStack>
289
+ <Insight aiGenerated>
290
+ <Insight.Description>
291
+ More came in than went out this week. Moving $1,000 to savings would still leave a
292
+ cushion.
293
+ </Insight.Description>
294
+ </Insight>
295
+ </VStack>
296
+ </Card.Content>
297
+ </Card>
298
+ );
299
+ }
300
+
301
+ function CreditScoreCard() {
302
+ return (
303
+ <Card>
304
+ <Card.Header>
305
+ <Heading size="sm">Credit score</Heading>
306
+ </Card.Header>
307
+ <Card.Content>
308
+ <VStack space="lg">
309
+ <HStack space="lg" className="items-center">
310
+ <LineChart
311
+ className="min-w-0 flex-1"
312
+ dataset={CREDIT_SCORE}
313
+ xAxis={[
314
+ {
315
+ id: 'month',
316
+ dataKey: 'month',
317
+ tickLabelInterval: (_, index) => (CREDIT_SCORE.length - 1 - index) % 2 === 0,
318
+ },
319
+ ]}
320
+ yAxis={[{ id: 'score', min: 540, max: 580, tickNumber: 3 }]}
321
+ series={[{ id: 'score', dataKey: 'score', label: 'Credit score', color: 'danger' }]}
322
+ width={FILL_WIDTH}
323
+ height={128}
324
+ hideLegend
325
+ scrollable={false}
326
+ accessibilityLabel="Credit score from May to October, falling from 575 to 547."
327
+ />
328
+ <VStack space="xs" className="items-end">
329
+ <Heading size="xl">547</Heading>
330
+ <Text size="sm" color="secondary">
331
+ Poor
332
+ </Text>
333
+ <Text size="sm" color="danger">
334
+ −13 since Sep
335
+ </Text>
336
+ </VStack>
337
+ </HStack>
338
+ <Insight aiGenerated color="danger">
339
+ {/* TODO(forge-ui): a summary Insight has no body-size title, and Insight.Title renders
340
+ as a heading. The emphasized first line is a semibold nested Text instead. */}
341
+ <Insight.Description>
342
+ <Text weight="semibold">
343
+ 2 missed payments in the last 90 days are impacting your score
344
+ </Text>
345
+ {'\n'}
346
+ <Text color="secondary">
347
+ Set up autopay on all your cards and bills to prevent this.
348
+ </Text>
349
+ </Insight.Description>
350
+ </Insight>
351
+ </VStack>
352
+ </Card.Content>
353
+ </Card>
354
+ );
355
+ }
356
+
357
+ export default function InsightsOverviewBlock() {
358
+ return (
359
+ <VStack space="lg" className="w-full">
360
+ <Heading size="md">Your money this month</Heading>
361
+ <SafeToSpendCard />
362
+ <Tabs defaultValue="spending">
363
+ <Tabs.List accessibilityLabel="Insight topics" scrollable={false} className="self-center">
364
+ <Tabs.Tab value="spending">
365
+ <Tabs.TabLabel>Spending</Tabs.TabLabel>
366
+ </Tabs.Tab>
367
+ <Tabs.Tab value="cash-flow">
368
+ <Tabs.TabLabel>Cash flow</Tabs.TabLabel>
369
+ </Tabs.Tab>
370
+ <Tabs.Tab value="credit">
371
+ <Tabs.TabLabel>Credit</Tabs.TabLabel>
372
+ </Tabs.Tab>
373
+ </Tabs.List>
374
+ <Tabs.Panel value="spending" className="mt-3">
375
+ <VStack space="lg">
376
+ <SpendingCard />
377
+ <DailySpendingCard />
378
+ </VStack>
379
+ </Tabs.Panel>
380
+ <Tabs.Panel value="cash-flow" className="mt-3">
381
+ <CashFlowCard />
382
+ </Tabs.Panel>
383
+ <Tabs.Panel value="credit" className="mt-3">
384
+ <CreditScoreCard />
385
+ </Tabs.Panel>
386
+ </Tabs>
387
+ </VStack>
388
+ );
389
+ }
390
+ ```
391
+
3
392
  ## Dashboard Greeting
4
393
 
5
- A personalized greeting header with search, notifications, and avatar.
394
+ A branded app header with search and a notification-badged avatar, above a personalized welcome.
6
395
 
7
396
  **Platforms:** iOS, Android
8
397
 
9
398
  ```tsx
10
- import { Avatar, Badge, Heading, HStack, IconButton, Text, VStack } from '@cdx-ui/components';
11
- import { Notifications, Search } from '@cdx-ui/icons';
399
+ import { Avatar, Badge, Heading, HStack, IconButton, Image, VStack } from '@cdx-ui/components';
400
+ import { Search } from '@cdx-ui/icons';
401
+
402
+ const LOGO_STYLE = { height: 20, aspectRatio: 686 / 100 };
12
403
 
13
404
  export default function DashboardGreetingBlock() {
14
405
  return (
15
- <HStack className="w-full max-w-md items-center justify-between py-4 px-4">
16
- <VStack space="xs">
17
- <Text size="sm" color="secondary">
18
- Good morning,
19
- </Text>
20
- <Heading>Bernadette</Heading>
21
- </VStack>
22
- <HStack space="sm" className="items-center">
23
- <IconButton as={Search} accessibilityLabel="Search" />
24
- <Badge label={3} color="danger" overlap="circular" accessibilityLabel="3 notifications">
25
- <IconButton as={Notifications} accessibilityLabel="Notifications" />
26
- </Badge>
27
- <Avatar size="lg">
28
- <Avatar.Text>Bernadette Miller</Avatar.Text>
29
- </Avatar>
406
+ <VStack className="w-full max-w-md">
407
+ <HStack className="items-center justify-between px-4 pt-3 pb-2">
408
+ <Image
409
+ source="/candescent/logo-dark.png"
410
+ accessibilityLabel="Candescent"
411
+ className="dark:hidden"
412
+ style={LOGO_STYLE}
413
+ />
414
+ <Image
415
+ source="/candescent/logo-light.png"
416
+ accessibilityLabel="Candescent"
417
+ className="hidden dark:flex"
418
+ style={LOGO_STYLE}
419
+ />
420
+ <HStack space="md" className="items-center">
421
+ <IconButton as={Search} accessibilityLabel="Search" />
422
+ <Badge
423
+ label="99+"
424
+ color="info"
425
+ overlap="circular"
426
+ accessibilityLabel="99 or more notifications"
427
+ >
428
+ <Avatar size="lg">
429
+ <Avatar.Text>Bernadette Miller</Avatar.Text>
430
+ </Avatar>
431
+ </Badge>
432
+ </HStack>
30
433
  </HStack>
31
- </HStack>
434
+ <Heading className="px-5 pt-4">Welcome, Bernadette</Heading>
435
+ </VStack>
32
436
  );
33
437
  }
34
438
  ```