@giddaa-housing/ui 1.0.0 → 1.1.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 (326) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/dist/accordion.d.ts +9 -10
  3. package/dist/accordion.js +41 -87
  4. package/dist/activity-timeline.d.ts +12 -16
  5. package/dist/activity-timeline.js +83 -198
  6. package/dist/alert.d.ts +8 -9
  7. package/dist/alert.js +53 -111
  8. package/dist/auth-layout.d.ts +4 -4
  9. package/dist/auth-layout.js +143 -294
  10. package/dist/avatar.d.ts +6 -6
  11. package/dist/avatar.js +49 -19
  12. package/dist/badge.d.ts +12 -14
  13. package/dist/badge.js +71 -11
  14. package/dist/bar-chart.d.ts +65 -67
  15. package/dist/bar-chart.js +232 -207
  16. package/dist/breadcrumb.d.ts +5 -5
  17. package/dist/breadcrumb.js +56 -118
  18. package/dist/bullet-chart.d.ts +33 -33
  19. package/dist/bullet-chart.js +121 -148
  20. package/dist/button-BZIeyUw6.d.ts +17 -0
  21. package/dist/button-group.d.ts +13 -16
  22. package/dist/button-group.js +39 -88
  23. package/dist/button.d.ts +2 -19
  24. package/dist/button.js +94 -13
  25. package/dist/calendar.d.ts +6 -6
  26. package/dist/calendar.js +138 -17
  27. package/dist/card.d.ts +14 -16
  28. package/dist/card.js +59 -145
  29. package/dist/carousel.d.ts +34 -35
  30. package/dist/carousel.js +335 -20
  31. package/dist/chart.d.ts +58 -59
  32. package/dist/chart.js +376 -28
  33. package/dist/checkbox.d.ts +10 -12
  34. package/dist/checkbox.js +82 -47
  35. package/dist/cn-BI_4DMBf.js +23 -0
  36. package/dist/collapsible.d.ts +7 -8
  37. package/dist/collapsible.js +22 -47
  38. package/dist/combobox.d.ts +10 -10
  39. package/dist/combobox.js +236 -44
  40. package/dist/cta.d.ts +12 -14
  41. package/dist/cta.js +175 -341
  42. package/dist/currency-selector.d.ts +31 -32
  43. package/dist/currency-selector.js +106 -184
  44. package/dist/data-table.d.ts +164 -0
  45. package/dist/data-table.js +673 -0
  46. package/dist/date-picker.d.ts +22 -23
  47. package/dist/date-picker.js +119 -192
  48. package/dist/details-card.d.ts +7 -7
  49. package/dist/details-card.js +104 -253
  50. package/dist/dialog.d.ts +13 -14
  51. package/dist/dialog.js +116 -209
  52. package/dist/dropdown-menu.d.ts +13 -13
  53. package/dist/dropdown-menu.js +180 -37
  54. package/dist/dropzone.d.ts +55 -55
  55. package/dist/dropzone.js +327 -439
  56. package/dist/editorial-card.d.ts +23 -25
  57. package/dist/editorial-card.js +129 -296
  58. package/dist/empty-state.d.ts +8 -9
  59. package/dist/empty-state.js +48 -105
  60. package/dist/field.d.ts +23 -25
  61. package/dist/field.js +110 -221
  62. package/dist/filter.d.ts +118 -0
  63. package/dist/filter.js +775 -0
  64. package/dist/footer.d.ts +8 -15
  65. package/dist/footer.js +197 -400
  66. package/dist/funnel-chart.d.ts +38 -41
  67. package/dist/funnel-chart.js +167 -189
  68. package/dist/gallery-indicator.d.ts +11 -12
  69. package/dist/gallery-indicator.js +75 -12
  70. package/dist/heatmap-chart.d.ts +47 -50
  71. package/dist/heatmap-chart.js +186 -237
  72. package/dist/infotip.d.ts +8 -9
  73. package/dist/infotip.js +33 -59
  74. package/dist/input-CfoEJ8A6.d.ts +12 -0
  75. package/dist/input-group.d.ts +16 -20
  76. package/dist/input-group.js +99 -23
  77. package/dist/input-size-context-C-SFx9sx.d.ts +10 -0
  78. package/dist/input-size-context.d.ts +2 -11
  79. package/dist/input-size-context.js +17 -9
  80. package/dist/input.d.ts +2 -13
  81. package/dist/input.js +27 -11
  82. package/dist/item.d.ts +7 -8
  83. package/dist/item.js +22 -59
  84. package/dist/kpi-card.d.ts +18 -20
  85. package/dist/kpi-card.js +84 -192
  86. package/dist/label.d.ts +6 -6
  87. package/dist/label.js +40 -8
  88. package/dist/line-chart.d.ts +88 -89
  89. package/dist/line-chart.js +142 -104
  90. package/dist/logo.d.ts +4 -4
  91. package/dist/logo.js +92 -9
  92. package/dist/map-indicator.d.ts +7 -7
  93. package/dist/map-indicator.js +80 -106
  94. package/dist/match.d.ts +10 -11
  95. package/dist/match.js +62 -107
  96. package/dist/media-gallery-hero.d.ts +40 -42
  97. package/dist/media-gallery-hero.js +182 -343
  98. package/dist/media-player.d.ts +17 -17
  99. package/dist/media-player.js +873 -1348
  100. package/dist/multi-step-form.d.ts +56 -0
  101. package/dist/multi-step-form.js +342 -0
  102. package/dist/number-input.d.ts +34 -34
  103. package/dist/number-input.js +61 -117
  104. package/dist/page-header.d.ts +10 -11
  105. package/dist/page-header.js +34 -79
  106. package/dist/pagination.d.ts +17 -21
  107. package/dist/pagination.js +132 -207
  108. package/dist/password-input.d.ts +5 -13
  109. package/dist/password-input.js +31 -55
  110. package/dist/phone-input.d.ts +19 -20
  111. package/dist/phone-input.js +226 -344
  112. package/dist/photo-gallery.d.ts +19 -19
  113. package/dist/photo-gallery.js +313 -449
  114. package/dist/picker-lzgmsNfG.js +32 -0
  115. package/dist/pie-chart.d.ts +60 -60
  116. package/dist/pie-chart.js +140 -148
  117. package/dist/popover.d.ts +9 -9
  118. package/dist/popover.js +72 -23
  119. package/dist/price-tag.d.ts +26 -27
  120. package/dist/price-tag.js +113 -173
  121. package/dist/progress.d.ts +16 -17
  122. package/dist/progress.js +169 -24
  123. package/dist/property-listing-card.d.ts +14 -17
  124. package/dist/property-listing-card.js +102 -220
  125. package/dist/radar-chart.d.ts +29 -31
  126. package/dist/radar-chart.js +162 -137
  127. package/dist/radio-group.d.ts +11 -13
  128. package/dist/radio-group.js +46 -60
  129. package/dist/review-block.d.ts +14 -16
  130. package/dist/review-block.js +154 -10
  131. package/dist/rich-text-editor.d.ts +30 -14
  132. package/dist/rich-text-editor.js +592 -716
  133. package/dist/scatter-chart.d.ts +45 -47
  134. package/dist/scatter-chart.js +236 -240
  135. package/dist/search-input.d.ts +8 -16
  136. package/dist/search-input.js +57 -109
  137. package/dist/select.d.ts +8 -8
  138. package/dist/select.js +144 -27
  139. package/dist/separator.d.ts +8 -9
  140. package/dist/separator.js +32 -8
  141. package/dist/sheet.d.ts +11 -11
  142. package/dist/sheet.js +103 -24
  143. package/dist/sidebar.d.ts +32 -37
  144. package/dist/sidebar.js +364 -634
  145. package/dist/size-context-D4mYvcg8.d.ts +10 -0
  146. package/dist/size-context.d.ts +2 -11
  147. package/dist/size-context.js +17 -9
  148. package/dist/skeleton.d.ts +4 -5
  149. package/dist/skeleton.js +12 -8
  150. package/dist/slider.d.ts +8 -9
  151. package/dist/slider.js +64 -135
  152. package/dist/sparkline.d.ts +43 -46
  153. package/dist/sparkline.js +221 -251
  154. package/dist/stepper.d.ts +23 -24
  155. package/dist/stepper.js +149 -246
  156. package/dist/styles.css +510 -108
  157. package/dist/switch.d.ts +10 -12
  158. package/dist/switch.js +48 -70
  159. package/dist/table-card.d.ts +35 -0
  160. package/dist/table-card.js +125 -0
  161. package/dist/table.d.ts +18 -14
  162. package/dist/table.js +113 -154
  163. package/dist/tabs.d.ts +23 -15
  164. package/dist/tabs.js +71 -18
  165. package/dist/tag.d.ts +21 -23
  166. package/dist/tag.js +103 -159
  167. package/dist/testimonial-block.d.ts +18 -19
  168. package/dist/testimonial-block.js +189 -358
  169. package/dist/textarea-IS_D8pXf.d.ts +11 -0
  170. package/dist/textarea.d.ts +2 -12
  171. package/dist/textarea.js +24 -11
  172. package/dist/time-picker.d.ts +11 -11
  173. package/dist/time-picker.js +245 -302
  174. package/dist/toast.d.ts +16 -18
  175. package/dist/toast.js +154 -205
  176. package/dist/tooltip.d.ts +8 -9
  177. package/dist/tooltip.js +37 -12
  178. package/dist/tree-map.d.ts +54 -57
  179. package/dist/tree-map.js +227 -269
  180. package/dist/use-uncontrolled-CLfM1XbB.js +21 -0
  181. package/dist/waterfall-chart.d.ts +94 -97
  182. package/dist/waterfall-chart.js +455 -552
  183. package/package.json +28 -9
  184. package/dist/accordion.js.map +0 -1
  185. package/dist/activity-timeline.js.map +0 -1
  186. package/dist/alert.js.map +0 -1
  187. package/dist/auth-layout.js.map +0 -1
  188. package/dist/avatar.js.map +0 -1
  189. package/dist/badge.js.map +0 -1
  190. package/dist/bar-chart.js.map +0 -1
  191. package/dist/breadcrumb.js.map +0 -1
  192. package/dist/bullet-chart.js.map +0 -1
  193. package/dist/button-group.js.map +0 -1
  194. package/dist/button.js.map +0 -1
  195. package/dist/calendar.js.map +0 -1
  196. package/dist/card.js.map +0 -1
  197. package/dist/carousel.js.map +0 -1
  198. package/dist/chart.js.map +0 -1
  199. package/dist/checkbox.js.map +0 -1
  200. package/dist/chunk-322YCNVL.js +0 -278
  201. package/dist/chunk-322YCNVL.js.map +0 -1
  202. package/dist/chunk-3ACQVT7A.js +0 -25
  203. package/dist/chunk-3ACQVT7A.js.map +0 -1
  204. package/dist/chunk-3T65TLJX.js +0 -334
  205. package/dist/chunk-3T65TLJX.js.map +0 -1
  206. package/dist/chunk-6ZSGQHH2.js +0 -192
  207. package/dist/chunk-6ZSGQHH2.js.map +0 -1
  208. package/dist/chunk-7TBMLFGW.js +0 -41
  209. package/dist/chunk-7TBMLFGW.js.map +0 -1
  210. package/dist/chunk-B4H6RNDH.js +0 -135
  211. package/dist/chunk-B4H6RNDH.js.map +0 -1
  212. package/dist/chunk-BUXCGZ6X.js +0 -219
  213. package/dist/chunk-BUXCGZ6X.js.map +0 -1
  214. package/dist/chunk-CHII2QHH.js +0 -58
  215. package/dist/chunk-CHII2QHH.js.map +0 -1
  216. package/dist/chunk-DMNOXRRW.js +0 -147
  217. package/dist/chunk-DMNOXRRW.js.map +0 -1
  218. package/dist/chunk-EFSOSSIC.js +0 -130
  219. package/dist/chunk-EFSOSSIC.js.map +0 -1
  220. package/dist/chunk-FZDSVMKY.js +0 -363
  221. package/dist/chunk-FZDSVMKY.js.map +0 -1
  222. package/dist/chunk-GJOFIJS3.js +0 -246
  223. package/dist/chunk-GJOFIJS3.js.map +0 -1
  224. package/dist/chunk-HL3ZSYES.js +0 -23
  225. package/dist/chunk-HL3ZSYES.js.map +0 -1
  226. package/dist/chunk-JVLUBAPB.js +0 -129
  227. package/dist/chunk-JVLUBAPB.js.map +0 -1
  228. package/dist/chunk-KDPYSOYZ.js +0 -64
  229. package/dist/chunk-KDPYSOYZ.js.map +0 -1
  230. package/dist/chunk-KSMDANKI.js +0 -43
  231. package/dist/chunk-KSMDANKI.js.map +0 -1
  232. package/dist/chunk-MEKCCOP5.js +0 -46
  233. package/dist/chunk-MEKCCOP5.js.map +0 -1
  234. package/dist/chunk-NOFXVRWL.js +0 -451
  235. package/dist/chunk-NOFXVRWL.js.map +0 -1
  236. package/dist/chunk-PC5MHNVA.js +0 -171
  237. package/dist/chunk-PC5MHNVA.js.map +0 -1
  238. package/dist/chunk-QKAQZ2GU.js +0 -122
  239. package/dist/chunk-QKAQZ2GU.js.map +0 -1
  240. package/dist/chunk-QZHSHSVV.js +0 -26
  241. package/dist/chunk-QZHSHSVV.js.map +0 -1
  242. package/dist/chunk-RBMK26XD.js +0 -19
  243. package/dist/chunk-RBMK26XD.js.map +0 -1
  244. package/dist/chunk-SFNJGF6M.js +0 -262
  245. package/dist/chunk-SFNJGF6M.js.map +0 -1
  246. package/dist/chunk-UJJNLGTM.js +0 -112
  247. package/dist/chunk-UJJNLGTM.js.map +0 -1
  248. package/dist/chunk-VGR4ZWJ3.js +0 -418
  249. package/dist/chunk-VGR4ZWJ3.js.map +0 -1
  250. package/dist/chunk-XG47P6D4.js +0 -99
  251. package/dist/chunk-XG47P6D4.js.map +0 -1
  252. package/dist/chunk-XZZAHNVM.js +0 -21
  253. package/dist/chunk-XZZAHNVM.js.map +0 -1
  254. package/dist/chunk-Y4TTYVNE.js +0 -36
  255. package/dist/chunk-Y4TTYVNE.js.map +0 -1
  256. package/dist/chunk-YDWIHW6Q.js +0 -69
  257. package/dist/chunk-YDWIHW6Q.js.map +0 -1
  258. package/dist/collapsible.js.map +0 -1
  259. package/dist/combobox.js.map +0 -1
  260. package/dist/cta.js.map +0 -1
  261. package/dist/currency-selector.js.map +0 -1
  262. package/dist/date-picker.js.map +0 -1
  263. package/dist/details-card.js.map +0 -1
  264. package/dist/dialog.js.map +0 -1
  265. package/dist/dropdown-menu.js.map +0 -1
  266. package/dist/dropzone.js.map +0 -1
  267. package/dist/editorial-card.js.map +0 -1
  268. package/dist/empty-state.js.map +0 -1
  269. package/dist/field.js.map +0 -1
  270. package/dist/footer.js.map +0 -1
  271. package/dist/funnel-chart.js.map +0 -1
  272. package/dist/gallery-indicator.js.map +0 -1
  273. package/dist/heatmap-chart.js.map +0 -1
  274. package/dist/infotip.js.map +0 -1
  275. package/dist/input-group.js.map +0 -1
  276. package/dist/input-size-context.js.map +0 -1
  277. package/dist/input.js.map +0 -1
  278. package/dist/item.js.map +0 -1
  279. package/dist/kpi-card.js.map +0 -1
  280. package/dist/label.js.map +0 -1
  281. package/dist/line-chart.js.map +0 -1
  282. package/dist/logo.js.map +0 -1
  283. package/dist/map-indicator.js.map +0 -1
  284. package/dist/match.js.map +0 -1
  285. package/dist/media-gallery-hero.js.map +0 -1
  286. package/dist/media-player.js.map +0 -1
  287. package/dist/number-input.js.map +0 -1
  288. package/dist/page-header.js.map +0 -1
  289. package/dist/pagination.js.map +0 -1
  290. package/dist/password-input.js.map +0 -1
  291. package/dist/phone-input.js.map +0 -1
  292. package/dist/photo-gallery.js.map +0 -1
  293. package/dist/pie-chart.js.map +0 -1
  294. package/dist/popover.js.map +0 -1
  295. package/dist/price-tag.js.map +0 -1
  296. package/dist/progress.js.map +0 -1
  297. package/dist/property-listing-card.js.map +0 -1
  298. package/dist/radar-chart.js.map +0 -1
  299. package/dist/radio-group.js.map +0 -1
  300. package/dist/review-block.js.map +0 -1
  301. package/dist/rich-text-editor.js.map +0 -1
  302. package/dist/scatter-chart.js.map +0 -1
  303. package/dist/search-input.js.map +0 -1
  304. package/dist/select.js.map +0 -1
  305. package/dist/separator.js.map +0 -1
  306. package/dist/sheet.js.map +0 -1
  307. package/dist/sidebar.js.map +0 -1
  308. package/dist/size-context.js.map +0 -1
  309. package/dist/skeleton.js.map +0 -1
  310. package/dist/slider.js.map +0 -1
  311. package/dist/sparkline.js.map +0 -1
  312. package/dist/stepper.js.map +0 -1
  313. package/dist/switch.js.map +0 -1
  314. package/dist/tab-list.d.ts +0 -38
  315. package/dist/tab-list.js +0 -123
  316. package/dist/tab-list.js.map +0 -1
  317. package/dist/table.js.map +0 -1
  318. package/dist/tabs.js.map +0 -1
  319. package/dist/tag.js.map +0 -1
  320. package/dist/testimonial-block.js.map +0 -1
  321. package/dist/textarea.js.map +0 -1
  322. package/dist/time-picker.js.map +0 -1
  323. package/dist/toast.js.map +0 -1
  324. package/dist/tooltip.js.map +0 -1
  325. package/dist/tree-map.js.map +0 -1
  326. package/dist/waterfall-chart.js.map +0 -1
@@ -1,577 +1,480 @@
1
1
  "use client";
2
- import {
3
- ChartCard,
4
- ChartContainer,
5
- ChartDescription,
6
- ChartHeader,
7
- ChartTitle,
8
- ChartTooltip,
9
- ChartTooltipContent
10
- } from "./chunk-NOFXVRWL.js";
11
- import {
12
- SizeProvider,
13
- useComponentSize
14
- } from "./chunk-HL3ZSYES.js";
15
- import {
16
- cn
17
- } from "./chunk-Y4TTYVNE.js";
18
-
19
- // src/waterfall-chart.tsx
20
- import { cva } from "class-variance-authority";
21
- import {
22
- Bar,
23
- LabelList,
24
- BarChart as RechartsBarChart,
25
- ReferenceLine,
26
- XAxis,
27
- YAxis
28
- } from "recharts";
2
+ import { t as cn } from "./cn-BI_4DMBf.js";
3
+ import { SizeProvider, useComponentSize } from "./size-context.js";
4
+ import { ChartCard, ChartContainer, ChartDescription, ChartHeader, ChartTitle, ChartTooltip, ChartTooltipContent } from "./chart.js";
29
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
30
- var WATERFALL_CHART_COLORS = {
31
- total: "var(--color-status-info)",
32
- increase: "var(--color-status-success)",
33
- decrease: "var(--color-status-danger)",
34
- connector: "var(--color-line-strong)",
35
- baseline: "var(--color-line)"
6
+ import { cva } from "class-variance-authority";
7
+ import { Bar, BarChart, LabelList, ReferenceLine, XAxis, YAxis } from "recharts";
8
+ //#region src/waterfall-chart.tsx
9
+ const WATERFALL_CHART_COLORS = {
10
+ total: "var(--color-status-info)",
11
+ increase: "var(--color-status-success)",
12
+ decrease: "var(--color-status-danger)",
13
+ connector: "var(--color-line-strong)",
14
+ baseline: "var(--color-line)"
36
15
  };
37
- var WATERFALL_CHART_LEGEND_ITEMS = [
38
- { label: "Increase", color: WATERFALL_CHART_COLORS.increase },
39
- { label: "Decrease", color: WATERFALL_CHART_COLORS.decrease },
40
- { label: "Total", color: WATERFALL_CHART_COLORS.total }
16
+ const WATERFALL_CHART_LEGEND_ITEMS = [
17
+ {
18
+ label: "Increase",
19
+ color: WATERFALL_CHART_COLORS.increase
20
+ },
21
+ {
22
+ label: "Decrease",
23
+ color: WATERFALL_CHART_COLORS.decrease
24
+ },
25
+ {
26
+ label: "Total",
27
+ color: WATERFALL_CHART_COLORS.total
28
+ }
41
29
  ];
42
- var WATERFALL_CHART_CONFIG = {
43
- increase: {
44
- label: "Increase",
45
- color: WATERFALL_CHART_COLORS.increase
46
- },
47
- decrease: {
48
- label: "Decrease",
49
- color: WATERFALL_CHART_COLORS.decrease
50
- },
51
- total: {
52
- label: "Total",
53
- color: WATERFALL_CHART_COLORS.total
54
- }
30
+ const WATERFALL_CHART_CONFIG = {
31
+ increase: {
32
+ label: "Increase",
33
+ color: WATERFALL_CHART_COLORS.increase
34
+ },
35
+ decrease: {
36
+ label: "Decrease",
37
+ color: WATERFALL_CHART_COLORS.decrease
38
+ },
39
+ total: {
40
+ label: "Total",
41
+ color: WATERFALL_CHART_COLORS.total
42
+ }
55
43
  };
56
- var WATERFALL_CHART_LAYOUT = {
57
- sm: {
58
- height: 150,
59
- horizontalHeight: 170,
60
- margin: { top: 18, right: 8, bottom: 0, left: 0 },
61
- horizontalMargin: { top: 6, right: 36, bottom: 0, left: 0 },
62
- barSize: 18,
63
- barRadius: 3,
64
- connectorWidth: 1.25,
65
- valueGap: 4,
66
- tickFontSize: 10,
67
- yAxisWidth: 56,
68
- xAxisHeight: 20
69
- },
70
- md: {
71
- height: 190,
72
- horizontalHeight: 220,
73
- margin: { top: 22, right: 10, bottom: 0, left: 0 },
74
- horizontalMargin: { top: 8, right: 44, bottom: 0, left: 0 },
75
- barSize: 24,
76
- barRadius: 4,
77
- connectorWidth: 1.5,
78
- valueGap: 5,
79
- tickFontSize: 11,
80
- yAxisWidth: 72,
81
- xAxisHeight: 24
82
- },
83
- lg: {
84
- height: 250,
85
- horizontalHeight: 280,
86
- margin: { top: 28, right: 12, bottom: 0, left: 0 },
87
- horizontalMargin: { top: 10, right: 56, bottom: 0, left: 0 },
88
- barSize: 32,
89
- barRadius: 5,
90
- connectorWidth: 1.5,
91
- valueGap: 6,
92
- tickFontSize: 12,
93
- yAxisWidth: 88,
94
- xAxisHeight: 28
95
- }
44
+ const WATERFALL_CHART_LAYOUT = {
45
+ sm: {
46
+ height: 150,
47
+ horizontalHeight: 170,
48
+ margin: {
49
+ top: 18,
50
+ right: 8,
51
+ bottom: 0,
52
+ left: 0
53
+ },
54
+ horizontalMargin: {
55
+ top: 6,
56
+ right: 36,
57
+ bottom: 0,
58
+ left: 0
59
+ },
60
+ barSize: 18,
61
+ barRadius: 3,
62
+ connectorWidth: 1.25,
63
+ valueGap: 4,
64
+ tickFontSize: 10,
65
+ yAxisWidth: 56,
66
+ xAxisHeight: 20
67
+ },
68
+ md: {
69
+ height: 190,
70
+ horizontalHeight: 220,
71
+ margin: {
72
+ top: 22,
73
+ right: 10,
74
+ bottom: 0,
75
+ left: 0
76
+ },
77
+ horizontalMargin: {
78
+ top: 8,
79
+ right: 44,
80
+ bottom: 0,
81
+ left: 0
82
+ },
83
+ barSize: 24,
84
+ barRadius: 4,
85
+ connectorWidth: 1.5,
86
+ valueGap: 5,
87
+ tickFontSize: 11,
88
+ yAxisWidth: 72,
89
+ xAxisHeight: 24
90
+ },
91
+ lg: {
92
+ height: 250,
93
+ horizontalHeight: 280,
94
+ margin: {
95
+ top: 28,
96
+ right: 12,
97
+ bottom: 0,
98
+ left: 0
99
+ },
100
+ horizontalMargin: {
101
+ top: 10,
102
+ right: 56,
103
+ bottom: 0,
104
+ left: 0
105
+ },
106
+ barSize: 32,
107
+ barRadius: 5,
108
+ connectorWidth: 1.5,
109
+ valueGap: 6,
110
+ tickFontSize: 12,
111
+ yAxisWidth: 88,
112
+ xAxisHeight: 28
113
+ }
96
114
  };
97
- var waterfallLegendVariants = cva("flex min-w-0", {
98
- variants: {
99
- placement: {
100
- right: "flex-col items-start",
101
- bottom: "flex-row flex-wrap items-center"
102
- },
103
- size: {
104
- sm: "text-gdt-xs",
105
- md: "text-gdt-xs",
106
- lg: "text-gdt-sm"
107
- }
108
- },
109
- compoundVariants: [
110
- { placement: "right", size: "sm", className: "gap-2" },
111
- { placement: "right", size: "md", className: "gap-2.5" },
112
- { placement: "right", size: "lg", className: "gap-3" },
113
- { placement: "bottom", className: "gap-x-4 gap-y-2" }
114
- ],
115
- defaultVariants: { placement: "right", size: "md" }
115
+ const waterfallLegendVariants = cva("flex min-w-0", {
116
+ variants: {
117
+ placement: {
118
+ right: "flex-col items-start",
119
+ bottom: "flex-row flex-wrap items-center"
120
+ },
121
+ size: {
122
+ sm: "text-gdt-xs",
123
+ md: "text-gdt-xs",
124
+ lg: "text-gdt-sm"
125
+ }
126
+ },
127
+ compoundVariants: [
128
+ {
129
+ placement: "right",
130
+ size: "sm",
131
+ className: "gap-2"
132
+ },
133
+ {
134
+ placement: "right",
135
+ size: "md",
136
+ className: "gap-2.5"
137
+ },
138
+ {
139
+ placement: "right",
140
+ size: "lg",
141
+ className: "gap-3"
142
+ },
143
+ {
144
+ placement: "bottom",
145
+ className: "gap-x-4 gap-y-2"
146
+ }
147
+ ],
148
+ defaultVariants: {
149
+ placement: "right",
150
+ size: "md"
151
+ }
116
152
  });
117
153
  function defaultValueFormatter(value, { step }) {
118
- if (step.type === "total") {
119
- return value.toLocaleString("en-NG");
120
- }
121
- return `${value > 0 ? "+" : ""}${value.toLocaleString("en-NG")}`;
154
+ if (step.type === "total") return value.toLocaleString("en-NG");
155
+ return `${value > 0 ? "+" : ""}${value.toLocaleString("en-NG")}`;
122
156
  }
123
157
  function resolveWaterfallData(data) {
124
- let running = 0;
125
- return data.map((datum, index) => {
126
- const isEdge = index === 0 || index === data.length - 1;
127
- const requestedType = datum.type ?? (isEdge ? "total" : "auto");
128
- const type = requestedType === "auto" ? datum.value >= 0 ? "increase" : "decrease" : requestedType;
129
- if (type === "total") {
130
- running = datum.value;
131
- return {
132
- label: datum.label,
133
- value: datum.value,
134
- start: 0,
135
- end: datum.value,
136
- range: [0, datum.value].sort((a, b) => a - b),
137
- type,
138
- fill: datum.fill ?? WATERFALL_CHART_COLORS.total
139
- };
140
- }
141
- const start = running;
142
- const end = running + datum.value;
143
- running = end;
144
- return {
145
- label: datum.label,
146
- value: datum.value,
147
- start,
148
- end,
149
- range: [start, end].sort((a, b) => a - b),
150
- type,
151
- fill: datum.fill ?? (type === "increase" ? WATERFALL_CHART_COLORS.increase : WATERFALL_CHART_COLORS.decrease)
152
- };
153
- });
158
+ let running = 0;
159
+ return data.map((datum, index) => {
160
+ const isEdge = index === 0 || index === data.length - 1;
161
+ const requestedType = datum.type ?? (isEdge ? "total" : "auto");
162
+ const type = requestedType === "auto" ? datum.value >= 0 ? "increase" : "decrease" : requestedType;
163
+ if (type === "total") {
164
+ running = datum.value;
165
+ return {
166
+ label: datum.label,
167
+ value: datum.value,
168
+ start: 0,
169
+ end: datum.value,
170
+ range: [0, datum.value].sort((a, b) => a - b),
171
+ type,
172
+ fill: datum.fill ?? WATERFALL_CHART_COLORS.total
173
+ };
174
+ }
175
+ const start = running;
176
+ const end = running + datum.value;
177
+ running = end;
178
+ return {
179
+ label: datum.label,
180
+ value: datum.value,
181
+ start,
182
+ end,
183
+ range: [start, end].sort((a, b) => a - b),
184
+ type,
185
+ fill: datum.fill ?? (type === "increase" ? WATERFALL_CHART_COLORS.increase : WATERFALL_CHART_COLORS.decrease)
186
+ };
187
+ });
154
188
  }
155
189
  function getWaterfallDomain(steps, domain) {
156
- if (domain) return domain;
157
- const values = steps.flatMap((step) => [step.start, step.end, 0]);
158
- const min = Math.min(...values);
159
- const max = Math.max(...values);
160
- const span = Math.max(max - min, 1);
161
- const pad = span * 0.08;
162
- return [Math.min(0, min - pad), Math.max(0, max + pad)];
190
+ if (domain) return domain;
191
+ const values = steps.flatMap((step) => [
192
+ step.start,
193
+ step.end,
194
+ 0
195
+ ]);
196
+ const min = Math.min(...values);
197
+ const max = Math.max(...values);
198
+ const pad = Math.max(max - min, 1) * .08;
199
+ return [Math.min(0, min - pad), Math.max(0, max + pad)];
163
200
  }
164
201
  function getPayloadStep(payload) {
165
- if (typeof payload !== "object" || payload === null) return void 0;
166
- if (!("payload" in payload)) return void 0;
167
- const row = payload.payload;
168
- if (typeof row !== "object" || row === null) return void 0;
169
- if (!("step" in row)) return void 0;
170
- return row.step;
202
+ if (typeof payload !== "object" || payload === null) return void 0;
203
+ if (!("payload" in payload)) return void 0;
204
+ const row = payload.payload;
205
+ if (typeof row !== "object" || row === null) return void 0;
206
+ if (!("step" in row)) return void 0;
207
+ return row.step;
171
208
  }
172
209
  function findDatumByLabel(data, label) {
173
- const stringLabel = String(label);
174
- return data.find((datum) => datum.label === stringLabel) ?? {
175
- label: stringLabel,
176
- value: 0
177
- };
210
+ const stringLabel = String(label);
211
+ return data.find((datum) => datum.label === stringLabel) ?? {
212
+ label: stringLabel,
213
+ value: 0
214
+ };
178
215
  }
179
216
  function formatTooltipValue(valueFormatter, data) {
180
- return (_value, _name, item, index) => {
181
- const step = getPayloadStep(item);
182
- if (!step) return "";
183
- const datumIndex = Math.max(index, 0);
184
- return valueFormatter(step.value, {
185
- datum: data[datumIndex] ?? {
186
- label: step.label,
187
- value: step.value,
188
- type: step.type
189
- },
190
- step,
191
- index: datumIndex
192
- });
193
- };
217
+ return (_value, _name, item, index) => {
218
+ const step = getPayloadStep(item);
219
+ if (!step) return "";
220
+ const datumIndex = Math.max(index, 0);
221
+ return valueFormatter(step.value, {
222
+ datum: data[datumIndex] ?? {
223
+ label: step.label,
224
+ value: step.value,
225
+ type: step.type
226
+ },
227
+ step,
228
+ index: datumIndex
229
+ });
230
+ };
194
231
  }
195
- function WaterfallChartLegend({
196
- className,
197
- size,
198
- placement = "right",
199
- items = WATERFALL_CHART_LEGEND_ITEMS,
200
- ...props
201
- }) {
202
- const resolvedSize = useComponentSize(size);
203
- const markerClassName = resolvedSize === "sm" ? "size-2" : resolvedSize === "lg" ? "size-3" : "size-2.5";
204
- return /* @__PURE__ */ jsx(
205
- "div",
206
- {
207
- className: cn(
208
- waterfallLegendVariants({ placement, size: resolvedSize }),
209
- className
210
- ),
211
- ...props,
212
- children: items.map((item) => /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-2", children: [
213
- /* @__PURE__ */ jsx(
214
- "span",
215
- {
216
- "aria-hidden": "true",
217
- className: cn("shrink-0 rounded-[2px]", markerClassName),
218
- style: { backgroundColor: item.color }
219
- }
220
- ),
221
- /* @__PURE__ */ jsx("span", { className: "font-medium text-fg-secondary", children: item.label })
222
- ] }, item.label))
223
- }
224
- );
232
+ function WaterfallChartLegend({ className, size, placement = "right", items = WATERFALL_CHART_LEGEND_ITEMS, ...props }) {
233
+ const resolvedSize = useComponentSize(size);
234
+ const markerClassName = resolvedSize === "sm" ? "size-2" : resolvedSize === "lg" ? "size-3" : "size-2.5";
235
+ return /* @__PURE__ */ jsx("div", {
236
+ className: cn(waterfallLegendVariants({
237
+ placement,
238
+ size: resolvedSize
239
+ }), className),
240
+ ...props,
241
+ children: items.map((item) => /* @__PURE__ */ jsxs("div", {
242
+ className: "inline-flex items-center gap-2",
243
+ children: [/* @__PURE__ */ jsx("span", {
244
+ "aria-hidden": "true",
245
+ className: cn("shrink-0 rounded-[2px]", markerClassName),
246
+ style: { backgroundColor: item.color }
247
+ }), /* @__PURE__ */ jsx("span", {
248
+ className: "font-medium text-fg-secondary",
249
+ children: item.label
250
+ })]
251
+ }, item.label))
252
+ });
225
253
  }
226
254
  function WaterfallBarShape(props) {
227
- const x = Number(props.x ?? 0);
228
- const y = Number(props.y ?? 0);
229
- const width = Number(props.width ?? 0);
230
- const height = Number(props.height ?? 0);
231
- const payload = props.payload;
232
- const radius = Number(props.radius ?? 0);
233
- const rectX = width < 0 ? x + width : x;
234
- const rectY = height < 0 ? y + height : y;
235
- const rectWidth = Math.abs(width);
236
- const rectHeight = Math.abs(height);
237
- if (rectWidth <= 0 || rectHeight <= 0) return null;
238
- return /* @__PURE__ */ jsx(
239
- "rect",
240
- {
241
- x: rectX,
242
- y: rectY,
243
- width: rectWidth,
244
- height: rectHeight,
245
- rx: radius,
246
- fill: payload?.step?.fill ?? payload?.fill ?? WATERFALL_CHART_COLORS.total
247
- }
248
- );
255
+ const x = Number(props.x ?? 0);
256
+ const y = Number(props.y ?? 0);
257
+ const width = Number(props.width ?? 0);
258
+ const height = Number(props.height ?? 0);
259
+ const payload = props.payload;
260
+ const radius = Number(props.radius ?? 0);
261
+ const rectX = width < 0 ? x + width : x;
262
+ const rectY = height < 0 ? y + height : y;
263
+ const rectWidth = Math.abs(width);
264
+ const rectHeight = Math.abs(height);
265
+ if (rectWidth <= 0 || rectHeight <= 0) return null;
266
+ return /* @__PURE__ */ jsx("rect", {
267
+ x: rectX,
268
+ y: rectY,
269
+ width: rectWidth,
270
+ height: rectHeight,
271
+ rx: radius,
272
+ fill: payload?.step?.fill ?? payload?.fill ?? WATERFALL_CHART_COLORS.total
273
+ });
249
274
  }
250
- function WaterfallValueLabel({
251
- x,
252
- y,
253
- width,
254
- height,
255
- value,
256
- payload,
257
- orientation = "vertical",
258
- layout,
259
- valueFormatter = defaultValueFormatter,
260
- data,
261
- index
262
- }) {
263
- const step = payload?.step ?? payload;
264
- if (!step || x == null || y == null || width == null || height == null) {
265
- return null;
266
- }
267
- const resolvedIndex = index ?? data.findIndex((datum) => datum.label === step.label);
268
- const context = {
269
- datum: data[resolvedIndex] ?? {
270
- label: step.label,
271
- value: step.value,
272
- type: step.type
273
- },
274
- step,
275
- index: Math.max(resolvedIndex, 0)
276
- };
277
- const fallbackLabel = Array.isArray(value) ? value.join(", ") : value == null ? "" : String(value);
278
- const label = valueFormatter(step.value, context) ?? fallbackLabel;
279
- const numX = Number(x);
280
- const numY = Number(y);
281
- const numWidth = Number(width);
282
- const numHeight = Number(height);
283
- const rectX = numWidth < 0 ? numX + numWidth : numX;
284
- const rectY = numHeight < 0 ? numY + numHeight : numY;
285
- const rectWidth = Math.abs(numWidth);
286
- const rectHeight = Math.abs(numHeight);
287
- if (orientation === "horizontal") {
288
- return /* @__PURE__ */ jsx(
289
- "text",
290
- {
291
- x: rectX + rectWidth + layout.valueGap,
292
- y: rectY + rectHeight / 2,
293
- dominantBaseline: "central",
294
- className: "fill-fg-primary text-gdt-xs font-semibold tabular-nums",
295
- children: label
296
- }
297
- );
298
- }
299
- return /* @__PURE__ */ jsx(
300
- "text",
301
- {
302
- x: rectX + rectWidth / 2,
303
- y: Math.max(10, rectY - layout.valueGap),
304
- textAnchor: "middle",
305
- className: "fill-fg-primary text-gdt-xs font-semibold tabular-nums",
306
- children: label
307
- }
308
- );
275
+ function WaterfallValueLabel({ x, y, width, height, value, payload, orientation = "vertical", layout, valueFormatter = defaultValueFormatter, data, index }) {
276
+ const step = payload?.step ?? payload;
277
+ if (!step || x == null || y == null || width == null || height == null) return null;
278
+ const resolvedIndex = index ?? data.findIndex((datum) => datum.label === step.label);
279
+ const context = {
280
+ datum: data[resolvedIndex] ?? {
281
+ label: step.label,
282
+ value: step.value,
283
+ type: step.type
284
+ },
285
+ step,
286
+ index: Math.max(resolvedIndex, 0)
287
+ };
288
+ const fallbackLabel = Array.isArray(value) ? value.join(", ") : value == null ? "" : String(value);
289
+ const label = valueFormatter(step.value, context) ?? fallbackLabel;
290
+ const numX = Number(x);
291
+ const numY = Number(y);
292
+ const numWidth = Number(width);
293
+ const numHeight = Number(height);
294
+ const rectX = numWidth < 0 ? numX + numWidth : numX;
295
+ const rectY = numHeight < 0 ? numY + numHeight : numY;
296
+ const rectWidth = Math.abs(numWidth);
297
+ const rectHeight = Math.abs(numHeight);
298
+ if (orientation === "horizontal") return /* @__PURE__ */ jsx("text", {
299
+ x: rectX + rectWidth + layout.valueGap,
300
+ y: rectY + rectHeight / 2,
301
+ dominantBaseline: "central",
302
+ className: "fill-fg-primary text-gdt-xs font-semibold tabular-nums",
303
+ children: label
304
+ });
305
+ return /* @__PURE__ */ jsx("text", {
306
+ x: rectX + rectWidth / 2,
307
+ y: Math.max(10, rectY - layout.valueGap),
308
+ textAnchor: "middle",
309
+ className: "fill-fg-primary text-gdt-xs font-semibold tabular-nums",
310
+ children: label
311
+ });
309
312
  }
310
- function WaterfallChartPlot({
311
- data,
312
- size,
313
- orientation = "vertical",
314
- legend = false,
315
- showValues = true,
316
- showTooltip = false,
317
- valueType = "number",
318
- valueFormatter = defaultValueFormatter,
319
- categoryFormatter = (label) => label,
320
- domain,
321
- ariaLabel,
322
- className,
323
- ...props
324
- }) {
325
- const resolvedSize = useComponentSize(size);
326
- const layout = WATERFALL_CHART_LAYOUT[resolvedSize];
327
- const steps = resolveWaterfallData(data);
328
- if (!steps.length) return null;
329
- const isHorizontal = orientation === "horizontal";
330
- const resolvedDomain = getWaterfallDomain(steps, domain);
331
- const chartHeight = isHorizontal ? layout.horizontalHeight : layout.height;
332
- const chartMargin = isHorizontal ? layout.horizontalMargin : layout.margin;
333
- const chartData = steps.map((step) => ({
334
- ...step,
335
- range: step.range,
336
- step
337
- }));
338
- const summary = ariaLabel ?? `Waterfall chart from ${steps[0]?.label ?? "start"} to ${steps.at(-1)?.label ?? "end"}`;
339
- return /* @__PURE__ */ jsx(
340
- "div",
341
- {
342
- className: cn("w-full min-w-0", className),
343
- "data-slot": "waterfall-chart-plot",
344
- role: "img",
345
- "aria-label": summary,
346
- ...props,
347
- children: /* @__PURE__ */ jsxs(
348
- "div",
349
- {
350
- className: cn(
351
- "flex min-w-0 gap-5",
352
- legend === "bottom" ? "flex-col" : "items-center justify-between max-sm:flex-col"
353
- ),
354
- children: [
355
- /* @__PURE__ */ jsx(
356
- ChartContainer,
357
- {
358
- config: WATERFALL_CHART_CONFIG,
359
- className: "aspect-auto w-full min-w-0 flex-1",
360
- style: { height: chartHeight },
361
- initialDimension: { width: 420, height: chartHeight },
362
- children: /* @__PURE__ */ jsxs(
363
- RechartsBarChart,
364
- {
365
- accessibilityLayer: true,
366
- data: chartData,
367
- layout: isHorizontal ? "vertical" : "horizontal",
368
- margin: chartMargin,
369
- children: [
370
- isHorizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [
371
- /* @__PURE__ */ jsx(
372
- XAxis,
373
- {
374
- type: "number",
375
- domain: resolvedDomain,
376
- axisLine: false,
377
- tickLine: false,
378
- tick: false
379
- }
380
- ),
381
- /* @__PURE__ */ jsx(
382
- YAxis,
383
- {
384
- type: "category",
385
- dataKey: "label",
386
- width: layout.yAxisWidth,
387
- axisLine: false,
388
- tickLine: false,
389
- tickMargin: 8,
390
- tick: { fontSize: layout.tickFontSize },
391
- tickFormatter: (label) => categoryFormatter(
392
- String(label),
393
- findDatumByLabel(data, label)
394
- )
395
- }
396
- ),
397
- /* @__PURE__ */ jsx(
398
- ReferenceLine,
399
- {
400
- x: 0,
401
- stroke: WATERFALL_CHART_COLORS.baseline,
402
- strokeWidth: layout.connectorWidth
403
- }
404
- ),
405
- steps.slice(0, -1).map((step, index) => /* @__PURE__ */ jsx(
406
- ReferenceLine,
407
- {
408
- segment: [
409
- { x: step.end, y: steps[index].label },
410
- { x: step.end, y: steps[index + 1].label }
411
- ],
412
- stroke: WATERFALL_CHART_COLORS.connector,
413
- strokeWidth: layout.connectorWidth
414
- },
415
- `${step.label}-connector`
416
- ))
417
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
418
- /* @__PURE__ */ jsx(
419
- XAxis,
420
- {
421
- dataKey: "label",
422
- height: layout.xAxisHeight,
423
- axisLine: false,
424
- tickLine: false,
425
- tickMargin: 8,
426
- tick: { fontSize: layout.tickFontSize },
427
- tickFormatter: (label) => categoryFormatter(
428
- String(label),
429
- findDatumByLabel(data, label)
430
- )
431
- }
432
- ),
433
- /* @__PURE__ */ jsx(
434
- YAxis,
435
- {
436
- type: "number",
437
- domain: resolvedDomain,
438
- width: layout.yAxisWidth,
439
- axisLine: false,
440
- tickLine: false,
441
- tick: false
442
- }
443
- ),
444
- /* @__PURE__ */ jsx(
445
- ReferenceLine,
446
- {
447
- y: 0,
448
- stroke: WATERFALL_CHART_COLORS.baseline,
449
- strokeWidth: layout.connectorWidth
450
- }
451
- ),
452
- steps.slice(0, -1).map((step, index) => /* @__PURE__ */ jsx(
453
- ReferenceLine,
454
- {
455
- segment: [
456
- { x: steps[index].label, y: step.end },
457
- { x: steps[index + 1].label, y: step.end }
458
- ],
459
- stroke: WATERFALL_CHART_COLORS.connector,
460
- strokeWidth: layout.connectorWidth
461
- },
462
- `${step.label}-connector`
463
- ))
464
- ] }),
465
- showTooltip ? /* @__PURE__ */ jsx(
466
- ChartTooltip,
467
- {
468
- cursor: false,
469
- content: /* @__PURE__ */ jsx(
470
- ChartTooltipContent,
471
- {
472
- nameKey: "type",
473
- valueType,
474
- formatter: formatTooltipValue(valueFormatter, data)
475
- }
476
- )
477
- }
478
- ) : null,
479
- /* @__PURE__ */ jsx(
480
- Bar,
481
- {
482
- dataKey: "range",
483
- name: "Change",
484
- barSize: layout.barSize,
485
- isAnimationActive: false,
486
- shape: /* @__PURE__ */ jsx(WaterfallBarShape, { radius: layout.barRadius }),
487
- children: showValues ? /* @__PURE__ */ jsx(
488
- LabelList,
489
- {
490
- dataKey: "range",
491
- content: /* @__PURE__ */ jsx(
492
- WaterfallValueLabel,
493
- {
494
- orientation,
495
- layout,
496
- valueFormatter,
497
- data
498
- }
499
- )
500
- }
501
- ) : null
502
- }
503
- )
504
- ]
505
- }
506
- )
507
- }
508
- ),
509
- legend ? /* @__PURE__ */ jsx(
510
- WaterfallChartLegend,
511
- {
512
- size: resolvedSize,
513
- placement: legend,
514
- className: legend === "bottom" ? "justify-center" : "shrink-0"
515
- }
516
- ) : null
517
- ]
518
- }
519
- )
520
- }
521
- );
313
+ function WaterfallChartPlot({ data, size, orientation = "vertical", legend = false, showValues = true, showTooltip = false, valueType = "number", valueFormatter = defaultValueFormatter, categoryFormatter = (label) => label, domain, ariaLabel, className, ...props }) {
314
+ const resolvedSize = useComponentSize(size);
315
+ const layout = WATERFALL_CHART_LAYOUT[resolvedSize];
316
+ const steps = resolveWaterfallData(data);
317
+ if (!steps.length) return null;
318
+ const isHorizontal = orientation === "horizontal";
319
+ const resolvedDomain = getWaterfallDomain(steps, domain);
320
+ const chartHeight = isHorizontal ? layout.horizontalHeight : layout.height;
321
+ const chartMargin = isHorizontal ? layout.horizontalMargin : layout.margin;
322
+ const chartData = steps.map((step) => ({
323
+ ...step,
324
+ range: step.range,
325
+ step
326
+ }));
327
+ const summary = ariaLabel ?? `Waterfall chart from ${steps[0]?.label ?? "start"} to ${steps.at(-1)?.label ?? "end"}`;
328
+ return /* @__PURE__ */ jsx("div", {
329
+ className: cn("w-full min-w-0", className),
330
+ "data-slot": "waterfall-chart-plot",
331
+ role: "img",
332
+ "aria-label": summary,
333
+ ...props,
334
+ children: /* @__PURE__ */ jsxs("div", {
335
+ className: cn("flex min-w-0 gap-5", legend === "bottom" ? "flex-col" : "items-center justify-between max-sm:flex-col"),
336
+ children: [/* @__PURE__ */ jsx(ChartContainer, {
337
+ config: WATERFALL_CHART_CONFIG,
338
+ className: "aspect-auto w-full min-w-0 flex-1",
339
+ style: { height: chartHeight },
340
+ initialDimension: {
341
+ width: 420,
342
+ height: chartHeight
343
+ },
344
+ children: /* @__PURE__ */ jsxs(BarChart, {
345
+ accessibilityLayer: true,
346
+ data: chartData,
347
+ layout: isHorizontal ? "vertical" : "horizontal",
348
+ margin: chartMargin,
349
+ children: [
350
+ isHorizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [
351
+ /* @__PURE__ */ jsx(XAxis, {
352
+ type: "number",
353
+ domain: resolvedDomain,
354
+ axisLine: false,
355
+ tickLine: false,
356
+ tick: false
357
+ }),
358
+ /* @__PURE__ */ jsx(YAxis, {
359
+ type: "category",
360
+ dataKey: "label",
361
+ width: layout.yAxisWidth,
362
+ axisLine: false,
363
+ tickLine: false,
364
+ tickMargin: 8,
365
+ tick: { fontSize: layout.tickFontSize },
366
+ tickFormatter: (label) => categoryFormatter(String(label), findDatumByLabel(data, label))
367
+ }),
368
+ /* @__PURE__ */ jsx(ReferenceLine, {
369
+ x: 0,
370
+ stroke: WATERFALL_CHART_COLORS.baseline,
371
+ strokeWidth: layout.connectorWidth
372
+ }),
373
+ steps.slice(0, -1).map((step, index) => /* @__PURE__ */ jsx(ReferenceLine, {
374
+ segment: [{
375
+ x: step.end,
376
+ y: steps[index].label
377
+ }, {
378
+ x: step.end,
379
+ y: steps[index + 1].label
380
+ }],
381
+ stroke: WATERFALL_CHART_COLORS.connector,
382
+ strokeWidth: layout.connectorWidth
383
+ }, `${step.label}-connector`))
384
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
385
+ /* @__PURE__ */ jsx(XAxis, {
386
+ dataKey: "label",
387
+ height: layout.xAxisHeight,
388
+ axisLine: false,
389
+ tickLine: false,
390
+ tickMargin: 8,
391
+ tick: { fontSize: layout.tickFontSize },
392
+ tickFormatter: (label) => categoryFormatter(String(label), findDatumByLabel(data, label))
393
+ }),
394
+ /* @__PURE__ */ jsx(YAxis, {
395
+ type: "number",
396
+ domain: resolvedDomain,
397
+ width: layout.yAxisWidth,
398
+ axisLine: false,
399
+ tickLine: false,
400
+ tick: false
401
+ }),
402
+ /* @__PURE__ */ jsx(ReferenceLine, {
403
+ y: 0,
404
+ stroke: WATERFALL_CHART_COLORS.baseline,
405
+ strokeWidth: layout.connectorWidth
406
+ }),
407
+ steps.slice(0, -1).map((step, index) => /* @__PURE__ */ jsx(ReferenceLine, {
408
+ segment: [{
409
+ x: steps[index].label,
410
+ y: step.end
411
+ }, {
412
+ x: steps[index + 1].label,
413
+ y: step.end
414
+ }],
415
+ stroke: WATERFALL_CHART_COLORS.connector,
416
+ strokeWidth: layout.connectorWidth
417
+ }, `${step.label}-connector`))
418
+ ] }),
419
+ showTooltip ? /* @__PURE__ */ jsx(ChartTooltip, {
420
+ cursor: false,
421
+ content: /* @__PURE__ */ jsx(ChartTooltipContent, {
422
+ nameKey: "type",
423
+ valueType,
424
+ formatter: formatTooltipValue(valueFormatter, data)
425
+ })
426
+ }) : null,
427
+ /* @__PURE__ */ jsx(Bar, {
428
+ dataKey: "range",
429
+ name: "Change",
430
+ barSize: layout.barSize,
431
+ isAnimationActive: false,
432
+ shape: /* @__PURE__ */ jsx(WaterfallBarShape, { radius: layout.barRadius }),
433
+ children: showValues ? /* @__PURE__ */ jsx(LabelList, {
434
+ dataKey: "range",
435
+ content: /* @__PURE__ */ jsx(WaterfallValueLabel, {
436
+ orientation,
437
+ layout,
438
+ valueFormatter,
439
+ data
440
+ })
441
+ }) : null
442
+ })
443
+ ]
444
+ })
445
+ }), legend ? /* @__PURE__ */ jsx(WaterfallChartLegend, {
446
+ size: resolvedSize,
447
+ placement: legend,
448
+ className: legend === "bottom" ? "justify-center" : "shrink-0"
449
+ }) : null]
450
+ })
451
+ });
522
452
  }
523
- function WaterfallChart({
524
- data,
525
- size,
526
- orientation = "vertical",
527
- title,
528
- description,
529
- legend = "right",
530
- showValues = true,
531
- showTooltip = false,
532
- valueType = "number",
533
- valueFormatter,
534
- categoryFormatter,
535
- domain,
536
- ariaLabel,
537
- className,
538
- ...props
539
- }) {
540
- const resolvedSize = useComponentSize(size);
541
- const showHeader = title != null || description != null;
542
- return /* @__PURE__ */ jsx(ChartCard, { size: resolvedSize, className, ...props, children: /* @__PURE__ */ jsxs(SizeProvider, { size: resolvedSize, children: [
543
- showHeader ? /* @__PURE__ */ jsxs(ChartHeader, { children: [
544
- title != null ? /* @__PURE__ */ jsx(ChartTitle, { children: title }) : null,
545
- description != null ? /* @__PURE__ */ jsx(ChartDescription, { children: description }) : null
546
- ] }) : null,
547
- /* @__PURE__ */ jsx(
548
- WaterfallChartPlot,
549
- {
550
- data,
551
- size: resolvedSize,
552
- orientation,
553
- legend,
554
- showValues,
555
- showTooltip,
556
- valueType,
557
- valueFormatter,
558
- categoryFormatter,
559
- domain,
560
- ariaLabel
561
- }
562
- )
563
- ] }) });
453
+ function WaterfallChart({ data, size, orientation = "vertical", title, description, legend = "right", showValues = true, showTooltip = false, valueType = "number", valueFormatter, categoryFormatter, domain, ariaLabel, className, ...props }) {
454
+ const resolvedSize = useComponentSize(size);
455
+ const showHeader = title != null || description != null;
456
+ return /* @__PURE__ */ jsx(ChartCard, {
457
+ size: resolvedSize,
458
+ className,
459
+ ...props,
460
+ children: /* @__PURE__ */ jsxs(SizeProvider, {
461
+ size: resolvedSize,
462
+ children: [showHeader ? /* @__PURE__ */ jsxs(ChartHeader, { children: [title != null ? /* @__PURE__ */ jsx(ChartTitle, { children: title }) : null, description != null ? /* @__PURE__ */ jsx(ChartDescription, { children: description }) : null] }) : null, /* @__PURE__ */ jsx(WaterfallChartPlot, {
463
+ data,
464
+ size: resolvedSize,
465
+ orientation,
466
+ legend,
467
+ showValues,
468
+ showTooltip,
469
+ valueType,
470
+ valueFormatter,
471
+ categoryFormatter,
472
+ domain,
473
+ ariaLabel
474
+ })]
475
+ })
476
+ });
564
477
  }
565
- var WaterfallChartCard = WaterfallChart;
566
- export {
567
- WATERFALL_CHART_COLORS,
568
- WATERFALL_CHART_CONFIG,
569
- WATERFALL_CHART_LAYOUT,
570
- WATERFALL_CHART_LEGEND_ITEMS,
571
- WaterfallChart,
572
- WaterfallChartCard,
573
- WaterfallChartLegend,
574
- WaterfallChartPlot,
575
- resolveWaterfallData
576
- };
577
- //# sourceMappingURL=waterfall-chart.js.map
478
+ const WaterfallChartCard = WaterfallChart;
479
+ //#endregion
480
+ export { WATERFALL_CHART_COLORS, WATERFALL_CHART_CONFIG, WATERFALL_CHART_LAYOUT, WATERFALL_CHART_LEGEND_ITEMS, WaterfallChart, WaterfallChartCard, WaterfallChartLegend, WaterfallChartPlot, resolveWaterfallData };