@giddaa-housing/ui 1.0.0 → 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.
- package/css/generated/shared.css +1 -1
- package/css/giddaa.css +12 -2
- package/dist/accordion.d.ts +9 -10
- package/dist/accordion.js +41 -87
- package/dist/activity-timeline.d.ts +12 -16
- package/dist/activity-timeline.js +83 -198
- package/dist/alert.d.ts +8 -9
- package/dist/alert.js +53 -111
- package/dist/auth-layout.d.ts +4 -4
- package/dist/auth-layout.js +143 -294
- package/dist/avatar.d.ts +6 -6
- package/dist/avatar.js +49 -19
- package/dist/badge.d.ts +12 -14
- package/dist/badge.js +71 -11
- package/dist/bar-chart.d.ts +65 -67
- package/dist/bar-chart.js +232 -207
- package/dist/breadcrumb.d.ts +5 -5
- package/dist/breadcrumb.js +56 -118
- package/dist/bullet-chart.d.ts +41 -37
- package/dist/bullet-chart.js +125 -148
- package/dist/button-BZIeyUw6.d.ts +17 -0
- package/dist/button-group.d.ts +13 -16
- package/dist/button-group.js +39 -88
- package/dist/button.d.ts +2 -19
- package/dist/button.js +94 -13
- package/dist/calendar.d.ts +6 -6
- package/dist/calendar.js +138 -17
- package/dist/card.d.ts +14 -16
- package/dist/card.js +59 -145
- package/dist/carousel.d.ts +34 -35
- package/dist/carousel.js +335 -20
- package/dist/chart.d.ts +90 -63
- package/dist/chart.js +573 -28
- package/dist/checkbox.d.ts +10 -12
- package/dist/checkbox.js +82 -47
- package/dist/cn-BI_4DMBf.js +23 -0
- package/dist/collapsible.d.ts +7 -8
- package/dist/collapsible.js +22 -47
- package/dist/combobox.d.ts +10 -10
- package/dist/combobox.js +236 -44
- package/dist/cta.d.ts +12 -14
- package/dist/cta.js +175 -341
- package/dist/currency-selector.d.ts +31 -32
- package/dist/currency-selector.js +106 -184
- package/dist/data-table.d.ts +168 -0
- package/dist/data-table.js +676 -0
- package/dist/date-picker.d.ts +22 -23
- package/dist/date-picker.js +119 -192
- package/dist/details-card.d.ts +7 -7
- package/dist/details-card.js +104 -253
- package/dist/dialog.d.ts +13 -14
- package/dist/dialog.js +116 -209
- package/dist/dropdown-menu.d.ts +13 -13
- package/dist/dropdown-menu.js +180 -37
- package/dist/dropzone.d.ts +55 -55
- package/dist/dropzone.js +327 -439
- package/dist/editorial-card.d.ts +23 -25
- package/dist/editorial-card.js +129 -296
- package/dist/empty-state.d.ts +8 -9
- package/dist/empty-state.js +48 -105
- package/dist/field.d.ts +23 -25
- package/dist/field.js +110 -221
- package/dist/filter.d.ts +118 -0
- package/dist/filter.js +775 -0
- package/dist/footer.d.ts +8 -15
- package/dist/footer.js +197 -400
- package/dist/funnel-chart.d.ts +49 -48
- package/dist/funnel-chart.js +170 -189
- package/dist/gallery-indicator.d.ts +11 -12
- package/dist/gallery-indicator.js +75 -12
- package/dist/heatmap-chart.d.ts +47 -50
- package/dist/heatmap-chart.js +186 -237
- package/dist/infotip.d.ts +8 -9
- package/dist/infotip.js +33 -59
- package/dist/input-CfoEJ8A6.d.ts +12 -0
- package/dist/input-group.d.ts +16 -20
- package/dist/input-group.js +99 -23
- package/dist/input-size-context-C-SFx9sx.d.ts +10 -0
- package/dist/input-size-context.d.ts +2 -11
- package/dist/input-size-context.js +17 -9
- package/dist/input.d.ts +2 -13
- package/dist/input.js +27 -11
- package/dist/item.d.ts +7 -8
- package/dist/item.js +22 -59
- package/dist/kpi-card.d.ts +18 -20
- package/dist/kpi-card.js +84 -192
- package/dist/label.d.ts +6 -6
- package/dist/label.js +40 -8
- package/dist/line-chart.d.ts +200 -129
- package/dist/line-chart.js +330 -105
- package/dist/list-item.d.ts +22 -0
- package/dist/list-item.js +84 -0
- package/dist/logo.d.ts +4 -4
- package/dist/logo.js +92 -9
- package/dist/map-indicator.d.ts +7 -7
- package/dist/map-indicator.js +80 -106
- package/dist/match.d.ts +10 -11
- package/dist/match.js +62 -107
- package/dist/media-gallery-hero.d.ts +40 -42
- package/dist/media-gallery-hero.js +182 -343
- package/dist/media-player.d.ts +17 -17
- package/dist/media-player.js +873 -1348
- package/dist/multi-step-form.d.ts +56 -0
- package/dist/multi-step-form.js +342 -0
- package/dist/number-input.d.ts +34 -34
- package/dist/number-input.js +64 -117
- package/dist/page-header.d.ts +10 -11
- package/dist/page-header.js +34 -79
- package/dist/pagination.d.ts +17 -21
- package/dist/pagination.js +132 -207
- package/dist/password-input.d.ts +5 -13
- package/dist/password-input.js +31 -55
- package/dist/phone-input.d.ts +19 -20
- package/dist/phone-input.js +226 -344
- package/dist/photo-gallery.d.ts +19 -19
- package/dist/photo-gallery.js +313 -449
- package/dist/picker-lzgmsNfG.js +32 -0
- package/dist/pie-chart.d.ts +121 -90
- package/dist/pie-chart.js +183 -149
- package/dist/popover.d.ts +9 -9
- package/dist/popover.js +72 -23
- package/dist/price-tag.d.ts +26 -27
- package/dist/price-tag.js +113 -173
- package/dist/progress.d.ts +16 -17
- package/dist/progress.js +169 -24
- package/dist/property-listing-card.d.ts +14 -17
- package/dist/property-listing-card.js +102 -220
- package/dist/purchase-option-card.d.ts +79 -0
- package/dist/purchase-option-card.js +176 -0
- package/dist/radar-chart.d.ts +29 -31
- package/dist/radar-chart.js +162 -137
- package/dist/radio-group.d.ts +11 -13
- package/dist/radio-group.js +46 -60
- package/dist/review-block.d.ts +14 -16
- package/dist/review-block.js +154 -10
- package/dist/rich-text-editor.d.ts +30 -14
- package/dist/rich-text-editor.js +592 -716
- package/dist/scatter-chart.d.ts +45 -47
- package/dist/scatter-chart.js +236 -240
- package/dist/search-input.d.ts +8 -16
- package/dist/search-input.js +57 -109
- package/dist/select.d.ts +8 -8
- package/dist/select.js +144 -27
- package/dist/separator.d.ts +8 -9
- package/dist/separator.js +32 -8
- package/dist/sheet.d.ts +11 -11
- package/dist/sheet.js +103 -24
- package/dist/sidebar.d.ts +32 -37
- package/dist/sidebar.js +364 -634
- package/dist/size-context-D4mYvcg8.d.ts +10 -0
- package/dist/size-context.d.ts +2 -11
- package/dist/size-context.js +17 -9
- package/dist/skeleton.d.ts +4 -5
- package/dist/skeleton.js +12 -8
- package/dist/slider.d.ts +8 -9
- package/dist/slider.js +64 -135
- package/dist/sparkline.d.ts +68 -58
- package/dist/sparkline.js +315 -251
- package/dist/stepper.d.ts +23 -24
- package/dist/stepper.js +149 -246
- package/dist/styles.css +1004 -116
- package/dist/switch.d.ts +10 -12
- package/dist/switch.js +48 -70
- package/dist/table-card.d.ts +35 -0
- package/dist/table-card.js +125 -0
- package/dist/table.d.ts +18 -14
- package/dist/table.js +117 -154
- package/dist/tabs.d.ts +33 -15
- package/dist/tabs.js +110 -18
- package/dist/tag.d.ts +21 -23
- package/dist/tag.js +103 -159
- package/dist/testimonial-block.d.ts +18 -19
- package/dist/testimonial-block.js +189 -358
- package/dist/textarea-IS_D8pXf.d.ts +11 -0
- package/dist/textarea.d.ts +2 -12
- package/dist/textarea.js +24 -11
- package/dist/time-picker.d.ts +11 -11
- package/dist/time-picker.js +245 -302
- package/dist/toast.d.ts +16 -18
- package/dist/toast.js +154 -205
- package/dist/tooltip.d.ts +8 -9
- package/dist/tooltip.js +37 -12
- package/dist/tree-map.d.ts +59 -62
- package/dist/tree-map.js +226 -269
- package/dist/use-uncontrolled-CLfM1XbB.js +21 -0
- package/dist/waterfall-chart.d.ts +94 -97
- package/dist/waterfall-chart.js +455 -552
- package/package.json +36 -9
- package/dist/accordion.js.map +0 -1
- package/dist/activity-timeline.js.map +0 -1
- package/dist/alert.js.map +0 -1
- package/dist/auth-layout.js.map +0 -1
- package/dist/avatar.js.map +0 -1
- package/dist/badge.js.map +0 -1
- package/dist/bar-chart.js.map +0 -1
- package/dist/breadcrumb.js.map +0 -1
- package/dist/bullet-chart.js.map +0 -1
- package/dist/button-group.js.map +0 -1
- package/dist/button.js.map +0 -1
- package/dist/calendar.js.map +0 -1
- package/dist/card.js.map +0 -1
- package/dist/carousel.js.map +0 -1
- package/dist/chart.js.map +0 -1
- package/dist/checkbox.js.map +0 -1
- package/dist/chunk-322YCNVL.js +0 -278
- package/dist/chunk-322YCNVL.js.map +0 -1
- package/dist/chunk-3ACQVT7A.js +0 -25
- package/dist/chunk-3ACQVT7A.js.map +0 -1
- package/dist/chunk-3T65TLJX.js +0 -334
- package/dist/chunk-3T65TLJX.js.map +0 -1
- package/dist/chunk-6ZSGQHH2.js +0 -192
- package/dist/chunk-6ZSGQHH2.js.map +0 -1
- package/dist/chunk-7TBMLFGW.js +0 -41
- package/dist/chunk-7TBMLFGW.js.map +0 -1
- package/dist/chunk-B4H6RNDH.js +0 -135
- package/dist/chunk-B4H6RNDH.js.map +0 -1
- package/dist/chunk-BUXCGZ6X.js +0 -219
- package/dist/chunk-BUXCGZ6X.js.map +0 -1
- package/dist/chunk-CHII2QHH.js +0 -58
- package/dist/chunk-CHII2QHH.js.map +0 -1
- package/dist/chunk-DMNOXRRW.js +0 -147
- package/dist/chunk-DMNOXRRW.js.map +0 -1
- package/dist/chunk-EFSOSSIC.js +0 -130
- package/dist/chunk-EFSOSSIC.js.map +0 -1
- package/dist/chunk-FZDSVMKY.js +0 -363
- package/dist/chunk-FZDSVMKY.js.map +0 -1
- package/dist/chunk-GJOFIJS3.js +0 -246
- package/dist/chunk-GJOFIJS3.js.map +0 -1
- package/dist/chunk-HL3ZSYES.js +0 -23
- package/dist/chunk-HL3ZSYES.js.map +0 -1
- package/dist/chunk-JVLUBAPB.js +0 -129
- package/dist/chunk-JVLUBAPB.js.map +0 -1
- package/dist/chunk-KDPYSOYZ.js +0 -64
- package/dist/chunk-KDPYSOYZ.js.map +0 -1
- package/dist/chunk-KSMDANKI.js +0 -43
- package/dist/chunk-KSMDANKI.js.map +0 -1
- package/dist/chunk-MEKCCOP5.js +0 -46
- package/dist/chunk-MEKCCOP5.js.map +0 -1
- package/dist/chunk-NOFXVRWL.js +0 -451
- package/dist/chunk-NOFXVRWL.js.map +0 -1
- package/dist/chunk-PC5MHNVA.js +0 -171
- package/dist/chunk-PC5MHNVA.js.map +0 -1
- package/dist/chunk-QKAQZ2GU.js +0 -122
- package/dist/chunk-QKAQZ2GU.js.map +0 -1
- package/dist/chunk-QZHSHSVV.js +0 -26
- package/dist/chunk-QZHSHSVV.js.map +0 -1
- package/dist/chunk-RBMK26XD.js +0 -19
- package/dist/chunk-RBMK26XD.js.map +0 -1
- package/dist/chunk-SFNJGF6M.js +0 -262
- package/dist/chunk-SFNJGF6M.js.map +0 -1
- package/dist/chunk-UJJNLGTM.js +0 -112
- package/dist/chunk-UJJNLGTM.js.map +0 -1
- package/dist/chunk-VGR4ZWJ3.js +0 -418
- package/dist/chunk-VGR4ZWJ3.js.map +0 -1
- package/dist/chunk-XG47P6D4.js +0 -99
- package/dist/chunk-XG47P6D4.js.map +0 -1
- package/dist/chunk-XZZAHNVM.js +0 -21
- package/dist/chunk-XZZAHNVM.js.map +0 -1
- package/dist/chunk-Y4TTYVNE.js +0 -36
- package/dist/chunk-Y4TTYVNE.js.map +0 -1
- package/dist/chunk-YDWIHW6Q.js +0 -69
- package/dist/chunk-YDWIHW6Q.js.map +0 -1
- package/dist/collapsible.js.map +0 -1
- package/dist/combobox.js.map +0 -1
- package/dist/cta.js.map +0 -1
- package/dist/currency-selector.js.map +0 -1
- package/dist/date-picker.js.map +0 -1
- package/dist/details-card.js.map +0 -1
- package/dist/dialog.js.map +0 -1
- package/dist/dropdown-menu.js.map +0 -1
- package/dist/dropzone.js.map +0 -1
- package/dist/editorial-card.js.map +0 -1
- package/dist/empty-state.js.map +0 -1
- package/dist/field.js.map +0 -1
- package/dist/footer.js.map +0 -1
- package/dist/funnel-chart.js.map +0 -1
- package/dist/gallery-indicator.js.map +0 -1
- package/dist/heatmap-chart.js.map +0 -1
- package/dist/infotip.js.map +0 -1
- package/dist/input-group.js.map +0 -1
- package/dist/input-size-context.js.map +0 -1
- package/dist/input.js.map +0 -1
- package/dist/item.js.map +0 -1
- package/dist/kpi-card.js.map +0 -1
- package/dist/label.js.map +0 -1
- package/dist/line-chart.js.map +0 -1
- package/dist/logo.js.map +0 -1
- package/dist/map-indicator.js.map +0 -1
- package/dist/match.js.map +0 -1
- package/dist/media-gallery-hero.js.map +0 -1
- package/dist/media-player.js.map +0 -1
- package/dist/number-input.js.map +0 -1
- package/dist/page-header.js.map +0 -1
- package/dist/pagination.js.map +0 -1
- package/dist/password-input.js.map +0 -1
- package/dist/phone-input.js.map +0 -1
- package/dist/photo-gallery.js.map +0 -1
- package/dist/pie-chart.js.map +0 -1
- package/dist/popover.js.map +0 -1
- package/dist/price-tag.js.map +0 -1
- package/dist/progress.js.map +0 -1
- package/dist/property-listing-card.js.map +0 -1
- package/dist/radar-chart.js.map +0 -1
- package/dist/radio-group.js.map +0 -1
- package/dist/review-block.js.map +0 -1
- package/dist/rich-text-editor.js.map +0 -1
- package/dist/scatter-chart.js.map +0 -1
- package/dist/search-input.js.map +0 -1
- package/dist/select.js.map +0 -1
- package/dist/separator.js.map +0 -1
- package/dist/sheet.js.map +0 -1
- package/dist/sidebar.js.map +0 -1
- package/dist/size-context.js.map +0 -1
- package/dist/skeleton.js.map +0 -1
- package/dist/slider.js.map +0 -1
- package/dist/sparkline.js.map +0 -1
- package/dist/stepper.js.map +0 -1
- package/dist/switch.js.map +0 -1
- package/dist/tab-list.d.ts +0 -38
- package/dist/tab-list.js +0 -123
- package/dist/tab-list.js.map +0 -1
- package/dist/table.js.map +0 -1
- package/dist/tabs.js.map +0 -1
- package/dist/tag.js.map +0 -1
- package/dist/testimonial-block.js.map +0 -1
- package/dist/textarea.js.map +0 -1
- package/dist/time-picker.js.map +0 -1
- package/dist/toast.js.map +0 -1
- package/dist/tooltip.js.map +0 -1
- package/dist/tree-map.js.map +0 -1
- package/dist/waterfall-chart.js.map +0 -1
package/dist/waterfall-chart.js
CHANGED
|
@@ -1,577 +1,480 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
119
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
})
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
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
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
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 };
|