@giddaa-housing/ui 0.1.0 → 1.0.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/README.md +18 -6
- package/css/base.css +37 -0
- package/css/components.css +135 -0
- package/css/generated/shared.css +1 -0
- package/css/giddaa.css +402 -0
- package/css/preset.css +77 -0
- package/css/styles.css +2 -0
- package/css/theme.css +255 -0
- package/dist/accordion.js +5 -35
- package/dist/accordion.js.map +1 -1
- package/dist/activity-timeline.d.ts +33 -0
- package/dist/activity-timeline.js +212 -0
- package/dist/activity-timeline.js.map +1 -0
- package/dist/alert.js +5 -35
- package/dist/alert.js.map +1 -1
- package/dist/auth-layout.d.ts +23 -0
- package/dist/auth-layout.js +304 -0
- package/dist/auth-layout.js.map +1 -0
- package/dist/avatar.js +10 -142
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +6 -114
- package/dist/badge.js.map +1 -1
- package/dist/bar-chart.d.ts +101 -77
- package/dist/bar-chart.js +142 -220
- package/dist/bar-chart.js.map +1 -1
- package/dist/breadcrumb.js +5 -35
- package/dist/breadcrumb.js.map +1 -1
- package/dist/bullet-chart.js +15 -48
- package/dist/bullet-chart.js.map +1 -1
- package/dist/button-group.js +14 -90
- package/dist/button-group.js.map +1 -1
- package/dist/button.d.ts +5 -5
- package/dist/button.js +7 -140
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +12 -287
- package/dist/calendar.js.map +1 -1
- package/dist/card.js +5 -35
- package/dist/card.js.map +1 -1
- package/dist/carousel.js +12 -386
- package/dist/carousel.js.map +1 -1
- package/dist/chart.js +16 -480
- package/dist/chart.js.map +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +13 -48
- package/dist/checkbox.js.map +1 -1
- package/dist/chunk-322YCNVL.js +278 -0
- package/dist/chunk-322YCNVL.js.map +1 -0
- package/dist/chunk-3ACQVT7A.js +25 -0
- package/dist/chunk-3ACQVT7A.js.map +1 -0
- package/dist/chunk-3T65TLJX.js +334 -0
- package/dist/chunk-3T65TLJX.js.map +1 -0
- package/dist/chunk-6ZSGQHH2.js +192 -0
- package/dist/chunk-6ZSGQHH2.js.map +1 -0
- package/dist/chunk-7TBMLFGW.js +41 -0
- package/dist/chunk-7TBMLFGW.js.map +1 -0
- package/dist/chunk-B4H6RNDH.js +135 -0
- package/dist/chunk-B4H6RNDH.js.map +1 -0
- package/dist/chunk-BUXCGZ6X.js +219 -0
- package/dist/chunk-BUXCGZ6X.js.map +1 -0
- package/dist/chunk-CHII2QHH.js +58 -0
- package/dist/chunk-CHII2QHH.js.map +1 -0
- package/dist/chunk-DMNOXRRW.js +147 -0
- package/dist/chunk-DMNOXRRW.js.map +1 -0
- package/dist/chunk-EFSOSSIC.js +130 -0
- package/dist/chunk-EFSOSSIC.js.map +1 -0
- package/dist/chunk-FZDSVMKY.js +363 -0
- package/dist/chunk-FZDSVMKY.js.map +1 -0
- package/dist/chunk-GJOFIJS3.js +246 -0
- package/dist/chunk-GJOFIJS3.js.map +1 -0
- package/dist/chunk-HL3ZSYES.js +23 -0
- package/dist/chunk-HL3ZSYES.js.map +1 -0
- package/dist/chunk-JVLUBAPB.js +129 -0
- package/dist/chunk-JVLUBAPB.js.map +1 -0
- package/dist/chunk-KDPYSOYZ.js +64 -0
- package/dist/chunk-KDPYSOYZ.js.map +1 -0
- package/dist/chunk-KSMDANKI.js +43 -0
- package/dist/chunk-KSMDANKI.js.map +1 -0
- package/dist/chunk-MEKCCOP5.js +46 -0
- package/dist/chunk-MEKCCOP5.js.map +1 -0
- package/dist/chunk-NOFXVRWL.js +451 -0
- package/dist/chunk-NOFXVRWL.js.map +1 -0
- package/dist/chunk-PC5MHNVA.js +171 -0
- package/dist/chunk-PC5MHNVA.js.map +1 -0
- package/dist/chunk-QKAQZ2GU.js +122 -0
- package/dist/chunk-QKAQZ2GU.js.map +1 -0
- package/dist/chunk-QZHSHSVV.js +26 -0
- package/dist/chunk-QZHSHSVV.js.map +1 -0
- package/dist/chunk-RBMK26XD.js +19 -0
- package/dist/chunk-RBMK26XD.js.map +1 -0
- package/dist/chunk-SFNJGF6M.js +262 -0
- package/dist/chunk-SFNJGF6M.js.map +1 -0
- package/dist/chunk-UJJNLGTM.js +112 -0
- package/dist/chunk-UJJNLGTM.js.map +1 -0
- package/dist/chunk-VGR4ZWJ3.js +418 -0
- package/dist/chunk-VGR4ZWJ3.js.map +1 -0
- package/dist/chunk-XG47P6D4.js +99 -0
- package/dist/chunk-XG47P6D4.js.map +1 -0
- package/dist/chunk-XZZAHNVM.js +21 -0
- package/dist/chunk-XZZAHNVM.js.map +1 -0
- package/dist/chunk-Y4TTYVNE.js +36 -0
- package/dist/chunk-Y4TTYVNE.js.map +1 -0
- package/dist/chunk-YDWIHW6Q.js +69 -0
- package/dist/chunk-YDWIHW6Q.js.map +1 -0
- package/dist/collapsible.js +6 -35
- package/dist/collapsible.js.map +1 -1
- package/dist/combobox.js +26 -694
- package/dist/combobox.js.map +1 -1
- package/dist/cta.d.ts +66 -0
- package/dist/cta.js +358 -0
- package/dist/cta.js.map +1 -0
- package/dist/currency-selector.d.ts +42 -0
- package/dist/currency-selector.js +192 -0
- package/dist/currency-selector.js.map +1 -0
- package/dist/date-picker.d.ts +18 -10
- package/dist/date-picker.js +105 -430
- package/dist/date-picker.js.map +1 -1
- package/dist/details-card.d.ts +19 -0
- package/dist/details-card.js +267 -0
- package/dist/details-card.js.map +1 -0
- package/dist/dialog.js +36 -146
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +20 -358
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/dropzone.js +13 -40
- package/dist/dropzone.js.map +1 -1
- package/dist/editorial-card.d.ts +29 -0
- package/dist/editorial-card.js +311 -0
- package/dist/editorial-card.js.map +1 -0
- package/dist/empty-state.js +5 -35
- package/dist/empty-state.js.map +1 -1
- package/dist/field.js +30 -135
- package/dist/field.js.map +1 -1
- package/dist/footer.d.ts +47 -0
- package/dist/footer.js +430 -0
- package/dist/footer.js.map +1 -0
- package/dist/funnel-chart.js +42 -415
- package/dist/funnel-chart.js.map +1 -1
- package/dist/gallery-indicator.d.ts +18 -0
- package/dist/gallery-indicator.js +12 -0
- package/dist/gallery-indicator.js.map +1 -0
- package/dist/heatmap-chart.d.ts +98 -0
- package/dist/heatmap-chart.js +248 -0
- package/dist/heatmap-chart.js.map +1 -0
- package/dist/infotip.d.ts +11 -0
- package/dist/infotip.js +66 -0
- package/dist/infotip.js.map +1 -0
- package/dist/input-group.d.ts +2 -1
- package/dist/input-group.js +15 -371
- package/dist/input-group.js.map +1 -1
- package/dist/input-size-context.js +5 -19
- package/dist/input-size-context.js.map +1 -1
- package/dist/input.js +6 -78
- package/dist/input.js.map +1 -1
- package/dist/item.js +5 -35
- package/dist/item.js.map +1 -1
- package/dist/kpi-card.js +12 -52
- package/dist/kpi-card.js.map +1 -1
- package/dist/label.js +5 -64
- package/dist/label.js.map +1 -1
- package/dist/line-chart.js +9 -166
- package/dist/line-chart.js.map +1 -1
- package/dist/logo.js +4 -141
- package/dist/logo.js.map +1 -1
- package/dist/map-indicator.d.ts +13 -0
- package/dist/map-indicator.js +109 -0
- package/dist/map-indicator.js.map +1 -0
- package/dist/match.d.ts +16 -0
- package/dist/match.js +113 -0
- package/dist/match.js.map +1 -0
- package/dist/media-gallery-hero.d.ts +60 -0
- package/dist/media-gallery-hero.js +362 -0
- package/dist/media-gallery-hero.js.map +1 -0
- package/dist/media-player.d.ts +60 -0
- package/dist/media-player.js +1394 -0
- package/dist/media-player.js.map +1 -0
- package/dist/number-input.js +30 -325
- package/dist/number-input.js.map +1 -1
- package/dist/page-header.js +4 -32
- package/dist/page-header.js.map +1 -1
- package/dist/pagination.d.ts +1 -0
- package/dist/pagination.js +27 -161
- package/dist/pagination.js.map +1 -1
- package/dist/password-input.d.ts +1 -0
- package/dist/password-input.js +21 -319
- package/dist/password-input.js.map +1 -1
- package/dist/phone-input.d.ts +2 -1
- package/dist/phone-input.js +148 -359
- package/dist/phone-input.js.map +1 -1
- package/dist/photo-gallery.d.ts +1 -1
- package/dist/photo-gallery.js +97 -393
- package/dist/photo-gallery.js.map +1 -1
- package/dist/pie-chart.js +17 -52
- package/dist/pie-chart.js.map +1 -1
- package/dist/popover.js +13 -158
- package/dist/popover.js.map +1 -1
- package/dist/price-tag.d.ts +35 -0
- package/dist/price-tag.js +178 -0
- package/dist/price-tag.js.map +1 -0
- package/dist/progress.d.ts +5 -2
- package/dist/progress.js +14 -303
- package/dist/progress.js.map +1 -1
- package/dist/property-listing-card.d.ts +32 -0
- package/dist/property-listing-card.js +235 -0
- package/dist/property-listing-card.js.map +1 -0
- package/dist/radar-chart.d.ts +110 -0
- package/dist/radar-chart.js +147 -0
- package/dist/radar-chart.js.map +1 -0
- package/dist/radio-group.js +15 -50
- package/dist/radio-group.js.map +1 -1
- package/dist/review-block.d.ts +20 -0
- package/dist/review-block.js +10 -0
- package/dist/review-block.js.map +1 -0
- package/dist/rich-text-editor.js +172 -433
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/scatter-chart.d.ts +142 -0
- package/dist/scatter-chart.js +252 -0
- package/dist/scatter-chart.js.map +1 -0
- package/dist/search-input.d.ts +1 -0
- package/dist/search-input.js +22 -320
- package/dist/search-input.js.map +1 -1
- package/dist/select.js +15 -292
- package/dist/select.js.map +1 -1
- package/dist/separator.js +5 -68
- package/dist/separator.js.map +1 -1
- package/dist/sheet.js +14 -271
- package/dist/sheet.js.map +1 -1
- package/dist/sidebar.d.ts +1 -1
- package/dist/sidebar.js +89 -494
- package/dist/sidebar.js.map +1 -1
- package/dist/size-context.js +5 -17
- package/dist/size-context.js.map +1 -1
- package/dist/skeleton.js +4 -44
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.d.ts +28 -0
- package/dist/slider.js +152 -0
- package/dist/slider.js.map +1 -0
- package/dist/sparkline.js +33 -341
- package/dist/sparkline.js.map +1 -1
- package/dist/stepper.js +5 -35
- package/dist/stepper.js.map +1 -1
- package/dist/styles.css +9593 -2
- package/dist/switch.js +13 -48
- package/dist/switch.js.map +1 -1
- package/dist/tab-list.js +35 -306
- package/dist/tab-list.js.map +1 -1
- package/dist/table.js +5 -32
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +10 -150
- package/dist/tabs.js.map +1 -1
- package/dist/tag.d.ts +7 -6
- package/dist/tag.js +101 -97
- package/dist/tag.js.map +1 -1
- package/dist/testimonial-block.d.ts +34 -0
- package/dist/testimonial-block.js +377 -0
- package/dist/testimonial-block.js.map +1 -0
- package/dist/textarea.js +6 -73
- package/dist/textarea.js.map +1 -1
- package/dist/time-picker.js +119 -279
- package/dist/time-picker.js.map +1 -1
- package/dist/toast.js +27 -132
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.d.ts +5 -5
- package/dist/tooltip.js +7 -90
- package/dist/tooltip.js.map +1 -1
- package/dist/tree-map.js +41 -414
- package/dist/tree-map.js.map +1 -1
- package/dist/waterfall-chart.d.ts +129 -0
- package/dist/waterfall-chart.js +577 -0
- package/dist/waterfall-chart.js.map +1 -0
- package/package.json +98 -28
- package/dist/base.css +0 -32
- package/dist/files/red-hat-display-latin-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff2 +0 -0
- package/dist/index.d.ts +0 -87
- package/dist/index.js +0 -10448
- package/dist/index.js.map +0 -1
- package/dist/red-hat-display.css +0 -2
- package/dist/theme/giddaa.css +0 -2
package/dist/funnel-chart.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
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
|
+
useComponentSize
|
|
13
|
+
} from "./chunk-HL3ZSYES.js";
|
|
14
|
+
import {
|
|
15
|
+
cn
|
|
16
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
17
|
+
|
|
18
|
+
// src/funnel-chart.tsx
|
|
19
|
+
import { cva } from "class-variance-authority";
|
|
3
20
|
import {
|
|
4
21
|
Bar,
|
|
5
22
|
BarChart,
|
|
@@ -8,397 +25,7 @@ import {
|
|
|
8
25
|
XAxis,
|
|
9
26
|
YAxis
|
|
10
27
|
} from "recharts";
|
|
11
|
-
|
|
12
|
-
// src/lib/cn.ts
|
|
13
|
-
import { clsx } from "clsx";
|
|
14
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
15
|
-
var twMerge = extendTailwindMerge({
|
|
16
|
-
extend: {
|
|
17
|
-
classGroups: {
|
|
18
|
-
"font-size": [
|
|
19
|
-
{
|
|
20
|
-
text: [
|
|
21
|
-
"gdt-display",
|
|
22
|
-
"gdt-h1",
|
|
23
|
-
"gdt-h2",
|
|
24
|
-
"gdt-h3",
|
|
25
|
-
"gdt-h4",
|
|
26
|
-
"gdt-h5",
|
|
27
|
-
"gdt-xl",
|
|
28
|
-
"gdt-lg",
|
|
29
|
-
"gdt-md",
|
|
30
|
-
"gdt-sm",
|
|
31
|
-
"gdt-xs",
|
|
32
|
-
"gdt-subtext",
|
|
33
|
-
"gdt-capitalized"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
function cn(...inputs) {
|
|
41
|
-
return twMerge(clsx(inputs));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/components/ui/chart.tsx
|
|
45
|
-
import { cva } from "class-variance-authority";
|
|
46
|
-
import * as React from "react";
|
|
47
|
-
import * as RechartsPrimitive from "recharts";
|
|
48
|
-
|
|
49
|
-
// src/components/ui/size-context.tsx
|
|
50
|
-
import { createContext, useContext } from "react";
|
|
51
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
52
|
-
var SizeContext = createContext(void 0);
|
|
53
|
-
function SizeProvider({
|
|
54
|
-
children,
|
|
55
|
-
size
|
|
56
|
-
}) {
|
|
57
|
-
if (!size) {
|
|
58
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
59
|
-
}
|
|
60
|
-
return /* @__PURE__ */ jsx(SizeContext.Provider, { value: size, children });
|
|
61
|
-
}
|
|
62
|
-
function useComponentSize(size, fallback = "md") {
|
|
63
|
-
const inheritedSize = useContext(SizeContext);
|
|
64
|
-
return size ?? inheritedSize ?? fallback;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// src/components/ui/chart.tsx
|
|
68
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
69
|
-
var SERIES_COLOR_PLACEHOLDER = "var(--color-surface-brand)";
|
|
70
|
-
function formatChartValue(value, type) {
|
|
71
|
-
if (Array.isArray(value)) {
|
|
72
|
-
return value.join(", ");
|
|
73
|
-
}
|
|
74
|
-
if (typeof value !== "number") {
|
|
75
|
-
return value == null ? "" : String(value);
|
|
76
|
-
}
|
|
77
|
-
switch (type) {
|
|
78
|
-
case "currency":
|
|
79
|
-
return `\u20A6${value.toLocaleString("en-NG")}`;
|
|
80
|
-
case "percentage":
|
|
81
|
-
return `${value.toLocaleString("en-NG", {
|
|
82
|
-
minimumFractionDigits: 1,
|
|
83
|
-
maximumFractionDigits: 1
|
|
84
|
-
})}%`;
|
|
85
|
-
default:
|
|
86
|
-
return value.toLocaleString("en-NG");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
var THEMES = { light: "", dark: ".dark" };
|
|
90
|
-
var INITIAL_DIMENSION = { width: 320, height: 200 };
|
|
91
|
-
var ChartContext = React.createContext(null);
|
|
92
|
-
function useChart() {
|
|
93
|
-
const context = React.useContext(ChartContext);
|
|
94
|
-
if (!context) {
|
|
95
|
-
throw new Error("useChart must be used within a <ChartContainer />");
|
|
96
|
-
}
|
|
97
|
-
return context;
|
|
98
|
-
}
|
|
99
|
-
var chartCardVariants = cva(
|
|
100
|
-
"flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1",
|
|
101
|
-
{
|
|
102
|
-
variants: {
|
|
103
|
-
size: {
|
|
104
|
-
sm: "gap-3 p-4",
|
|
105
|
-
md: "gap-4 p-5",
|
|
106
|
-
lg: "gap-5 p-6"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
defaultVariants: { size: "md" }
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
function ChartCard({
|
|
113
|
-
className,
|
|
114
|
-
size,
|
|
115
|
-
children,
|
|
116
|
-
...props
|
|
117
|
-
}) {
|
|
118
|
-
const resolvedSize = useComponentSize(size);
|
|
119
|
-
return /* @__PURE__ */ jsx2(SizeProvider, { size: resolvedSize, children: /* @__PURE__ */ jsx2(
|
|
120
|
-
"section",
|
|
121
|
-
{
|
|
122
|
-
"data-slot": "chart-card",
|
|
123
|
-
className: cn(chartCardVariants({ size: resolvedSize }), className),
|
|
124
|
-
...props,
|
|
125
|
-
children
|
|
126
|
-
}
|
|
127
|
-
) });
|
|
128
|
-
}
|
|
129
|
-
function ChartHeader({ className, ...props }) {
|
|
130
|
-
return /* @__PURE__ */ jsx2(
|
|
131
|
-
"div",
|
|
132
|
-
{
|
|
133
|
-
"data-slot": "chart-header",
|
|
134
|
-
className: cn("flex min-w-0 flex-col gap-1", className),
|
|
135
|
-
...props
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
var chartTitleVariants = cva("min-w-0 font-bold text-fg-primary", {
|
|
140
|
-
variants: {
|
|
141
|
-
size: {
|
|
142
|
-
sm: "text-gdt-md",
|
|
143
|
-
md: "text-gdt-lg",
|
|
144
|
-
lg: "text-gdt-h5"
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
defaultVariants: { size: "md" }
|
|
148
|
-
});
|
|
149
|
-
function ChartTitle({
|
|
150
|
-
className,
|
|
151
|
-
size,
|
|
152
|
-
...props
|
|
153
|
-
}) {
|
|
154
|
-
const resolvedSize = useComponentSize(size);
|
|
155
|
-
return /* @__PURE__ */ jsx2(
|
|
156
|
-
"h3",
|
|
157
|
-
{
|
|
158
|
-
"data-slot": "chart-title",
|
|
159
|
-
className: cn(chartTitleVariants({ size: resolvedSize }), className),
|
|
160
|
-
...props
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
var chartDescriptionVariants = cva("min-w-0 font-normal text-fg-secondary", {
|
|
165
|
-
variants: {
|
|
166
|
-
size: {
|
|
167
|
-
sm: "text-gdt-xs",
|
|
168
|
-
md: "text-gdt-sm",
|
|
169
|
-
lg: "text-gdt-sm"
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
defaultVariants: { size: "md" }
|
|
173
|
-
});
|
|
174
|
-
function ChartDescription({
|
|
175
|
-
className,
|
|
176
|
-
size,
|
|
177
|
-
...props
|
|
178
|
-
}) {
|
|
179
|
-
const resolvedSize = useComponentSize(size);
|
|
180
|
-
return /* @__PURE__ */ jsx2(
|
|
181
|
-
"p",
|
|
182
|
-
{
|
|
183
|
-
"data-slot": "chart-description",
|
|
184
|
-
className: cn(
|
|
185
|
-
chartDescriptionVariants({ size: resolvedSize }),
|
|
186
|
-
className
|
|
187
|
-
),
|
|
188
|
-
...props
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
function ChartContainer({
|
|
193
|
-
id,
|
|
194
|
-
className,
|
|
195
|
-
children,
|
|
196
|
-
config,
|
|
197
|
-
initialDimension = INITIAL_DIMENSION,
|
|
198
|
-
...props
|
|
199
|
-
}) {
|
|
200
|
-
const uniqueId = React.useId();
|
|
201
|
-
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
202
|
-
return /* @__PURE__ */ jsx2(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs(
|
|
203
|
-
"div",
|
|
204
|
-
{
|
|
205
|
-
"data-slot": "chart",
|
|
206
|
-
"data-chart": chartId,
|
|
207
|
-
className: cn(
|
|
208
|
-
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
209
|
-
className
|
|
210
|
-
),
|
|
211
|
-
...props,
|
|
212
|
-
children: [
|
|
213
|
-
/* @__PURE__ */ jsx2(ChartStyle, { id: chartId, config }),
|
|
214
|
-
/* @__PURE__ */ jsx2(
|
|
215
|
-
RechartsPrimitive.ResponsiveContainer,
|
|
216
|
-
{
|
|
217
|
-
initialDimension,
|
|
218
|
-
children
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
) });
|
|
224
|
-
}
|
|
225
|
-
var ChartStyle = ({ id, config }) => {
|
|
226
|
-
const colorConfig = Object.entries(config).filter(
|
|
227
|
-
([, config2]) => config2.theme ?? config2.color
|
|
228
|
-
);
|
|
229
|
-
if (!colorConfig.length) {
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
const styleContent = Object.entries(THEMES).map(
|
|
233
|
-
([theme, prefix]) => `
|
|
234
|
-
${prefix} [data-chart=${id}] {
|
|
235
|
-
${colorConfig.map(([key, itemConfig]) => {
|
|
236
|
-
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
237
|
-
return color ? ` --color-${key}: ${color};` : null;
|
|
238
|
-
}).join("\n")}
|
|
239
|
-
}
|
|
240
|
-
`
|
|
241
|
-
).join("\n");
|
|
242
|
-
return /* @__PURE__ */ jsx2("style", { children: styleContent });
|
|
243
|
-
};
|
|
244
|
-
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
245
|
-
var chartTooltipVariants = cva(
|
|
246
|
-
"flex flex-col bg-surface-overlay border border-line-subtle shadow-2",
|
|
247
|
-
{
|
|
248
|
-
variants: {
|
|
249
|
-
size: {
|
|
250
|
-
xs: "gap-0.5 rounded-md p-2",
|
|
251
|
-
sm: "gap-0.5 rounded-md p-2.5",
|
|
252
|
-
md: "gap-1 rounded-lg p-3",
|
|
253
|
-
lg: "gap-1 rounded-xl p-3.5"
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
defaultVariants: {
|
|
257
|
-
size: "md"
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
var chartTooltipDotVariants = cva("shrink-0 rounded-full", {
|
|
262
|
-
variants: {
|
|
263
|
-
size: {
|
|
264
|
-
xs: "size-1.5",
|
|
265
|
-
sm: "size-2",
|
|
266
|
-
md: "size-2.5",
|
|
267
|
-
lg: "size-2.5"
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
defaultVariants: {
|
|
271
|
-
size: "md"
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
var chartTooltipLabelVariants = cva("font-medium text-fg-secondary", {
|
|
275
|
-
variants: {
|
|
276
|
-
size: {
|
|
277
|
-
xs: "text-gdt-xs",
|
|
278
|
-
sm: "text-gdt-xs",
|
|
279
|
-
md: "text-gdt-sm",
|
|
280
|
-
lg: "text-gdt-sm"
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
defaultVariants: { size: "md" }
|
|
284
|
-
});
|
|
285
|
-
var chartTooltipValueVariants = cva(
|
|
286
|
-
"font-extrabold text-fg-primary tabular-nums",
|
|
287
|
-
{
|
|
288
|
-
variants: {
|
|
289
|
-
size: {
|
|
290
|
-
xs: "text-gdt-sm",
|
|
291
|
-
sm: "text-gdt-md",
|
|
292
|
-
md: "text-gdt-lg",
|
|
293
|
-
lg: "text-gdt-xl"
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
defaultVariants: { size: "md" }
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
function ChartTooltipContent({
|
|
300
|
-
active,
|
|
301
|
-
payload,
|
|
302
|
-
className,
|
|
303
|
-
hideIndicator = false,
|
|
304
|
-
label,
|
|
305
|
-
labelFormatter,
|
|
306
|
-
formatter,
|
|
307
|
-
color,
|
|
308
|
-
nameKey,
|
|
309
|
-
valueType = "number",
|
|
310
|
-
size = "md"
|
|
311
|
-
}) {
|
|
312
|
-
const { config } = useChart();
|
|
313
|
-
if (!active || !payload?.length) {
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
316
|
-
const [item] = payload.filter((entry) => entry.type !== "none");
|
|
317
|
-
if (!item) {
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
|
|
321
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
322
|
-
const dotColor = color ?? item.payload?.fill ?? item.color ?? SERIES_COLOR_PLACEHOLDER;
|
|
323
|
-
const metricLabel = itemConfig?.label ?? item.name;
|
|
324
|
-
const heroValue = formatter ? formatter(item.value, item.name ?? "", item, 0, item.payload) : formatChartValue(item.value, valueType);
|
|
325
|
-
const periodCaption = labelFormatter ? labelFormatter(label, payload) : (typeof label === "string" ? config[label]?.label : null) ?? label;
|
|
326
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(chartTooltipVariants({ size }), className), children: [
|
|
327
|
-
metricLabel != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:shrink-0", children: [
|
|
328
|
-
!hideIndicator && (itemConfig?.icon ? /* @__PURE__ */ jsx2(itemConfig.icon, {}) : /* @__PURE__ */ jsx2(
|
|
329
|
-
"span",
|
|
330
|
-
{
|
|
331
|
-
"aria-hidden": "true",
|
|
332
|
-
className: cn(chartTooltipDotVariants({ size })),
|
|
333
|
-
style: { backgroundColor: dotColor }
|
|
334
|
-
}
|
|
335
|
-
)),
|
|
336
|
-
/* @__PURE__ */ jsx2("span", { className: cn(chartTooltipLabelVariants({ size })), children: metricLabel })
|
|
337
|
-
] }),
|
|
338
|
-
/* @__PURE__ */ jsx2("p", { className: cn(chartTooltipValueVariants({ size })), children: heroValue }),
|
|
339
|
-
periodCaption != null && periodCaption !== "" && /* @__PURE__ */ jsx2("p", { className: "text-gdt-xs text-fg-caption-placeholder", children: periodCaption })
|
|
340
|
-
] });
|
|
341
|
-
}
|
|
342
|
-
var chartLegendItemVariants = cva(
|
|
343
|
-
"group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0",
|
|
344
|
-
{
|
|
345
|
-
variants: {
|
|
346
|
-
size: {
|
|
347
|
-
sm: "gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3",
|
|
348
|
-
md: "gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5"
|
|
349
|
-
},
|
|
350
|
-
interactive: {
|
|
351
|
-
true: "cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised",
|
|
352
|
-
false: ""
|
|
353
|
-
},
|
|
354
|
-
inactive: {
|
|
355
|
-
true: "text-fg-caption-placeholder line-through",
|
|
356
|
-
false: ""
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
defaultVariants: {
|
|
360
|
-
size: "md",
|
|
361
|
-
interactive: false,
|
|
362
|
-
inactive: false
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
);
|
|
366
|
-
var chartLegendMarkerSizeVariants = cva("shrink-0", {
|
|
367
|
-
variants: {
|
|
368
|
-
marker: {
|
|
369
|
-
dot: "rounded-full",
|
|
370
|
-
square: "rounded-[2px]",
|
|
371
|
-
line: "rounded-full"
|
|
372
|
-
},
|
|
373
|
-
size: {
|
|
374
|
-
sm: "",
|
|
375
|
-
md: ""
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
compoundVariants: [
|
|
379
|
-
{ marker: ["dot", "square"], size: "sm", className: "size-2" },
|
|
380
|
-
{ marker: ["dot", "square"], size: "md", className: "size-2.5" },
|
|
381
|
-
{ marker: "line", size: "sm", className: "h-[3px] w-3" },
|
|
382
|
-
{ marker: "line", size: "md", className: "h-[3px] w-3.5" }
|
|
383
|
-
],
|
|
384
|
-
defaultVariants: { marker: "dot", size: "md" }
|
|
385
|
-
});
|
|
386
|
-
function getPayloadConfigFromPayload(config, payload, key) {
|
|
387
|
-
if (typeof payload !== "object" || payload === null) {
|
|
388
|
-
return void 0;
|
|
389
|
-
}
|
|
390
|
-
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
391
|
-
let configLabelKey = key;
|
|
392
|
-
if (key in payload && typeof payload[key] === "string") {
|
|
393
|
-
configLabelKey = payload[key];
|
|
394
|
-
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
395
|
-
configLabelKey = payloadPayload[key];
|
|
396
|
-
}
|
|
397
|
-
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// src/components/ui/funnel-chart.tsx
|
|
401
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
28
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
402
29
|
var FUNNEL_CHART_PALETTE = [
|
|
403
30
|
"var(--color-forest-700)",
|
|
404
31
|
"var(--color-brass-500)",
|
|
@@ -411,7 +38,7 @@ var FUNNEL_CHART_LAYOUT = {
|
|
|
411
38
|
md: { height: 200, width: 220, barRadius: 4, barMaxSize: 18 },
|
|
412
39
|
lg: { height: 264, width: 288, barRadius: 5, barMaxSize: 22 }
|
|
413
40
|
};
|
|
414
|
-
var funnelStageListVariants =
|
|
41
|
+
var funnelStageListVariants = cva("flex min-w-0 flex-col", {
|
|
415
42
|
variants: {
|
|
416
43
|
size: {
|
|
417
44
|
sm: "gap-2 text-gdt-xs",
|
|
@@ -421,7 +48,7 @@ var funnelStageListVariants = cva2("flex min-w-0 flex-col", {
|
|
|
421
48
|
},
|
|
422
49
|
defaultVariants: { size: "md" }
|
|
423
50
|
});
|
|
424
|
-
var funnelLegendDotVariants =
|
|
51
|
+
var funnelLegendDotVariants = cva("shrink-0 rounded-full", {
|
|
425
52
|
variants: {
|
|
426
53
|
size: { sm: "size-2", md: "size-2.5", lg: "size-3" }
|
|
427
54
|
},
|
|
@@ -453,14 +80,14 @@ function FunnelChart({
|
|
|
453
80
|
{ label: stage.label, color: stage.fill }
|
|
454
81
|
])
|
|
455
82
|
);
|
|
456
|
-
const tooltipNode = tooltip ? /* @__PURE__ */
|
|
83
|
+
const tooltipNode = tooltip ? /* @__PURE__ */ jsx(
|
|
457
84
|
ChartTooltip,
|
|
458
85
|
{
|
|
459
86
|
cursor: false,
|
|
460
|
-
content: /* @__PURE__ */
|
|
87
|
+
content: /* @__PURE__ */ jsx(ChartTooltipContent, { nameKey: "label", valueType })
|
|
461
88
|
}
|
|
462
89
|
) : null;
|
|
463
|
-
const chartNode = type === "bars" ? /* @__PURE__ */
|
|
90
|
+
const chartNode = type === "bars" ? /* @__PURE__ */ jsxs(
|
|
464
91
|
BarChart,
|
|
465
92
|
{
|
|
466
93
|
accessibilityLayer: true,
|
|
@@ -470,9 +97,9 @@ function FunnelChart({
|
|
|
470
97
|
barCategoryGap: "0%",
|
|
471
98
|
children: [
|
|
472
99
|
tooltipNode,
|
|
473
|
-
/* @__PURE__ */
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ jsx(XAxis, { type: "number", domain: [0, top], hide: true }),
|
|
101
|
+
/* @__PURE__ */ jsx(YAxis, { type: "category", dataKey: "label", hide: true }),
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
476
103
|
Bar,
|
|
477
104
|
{
|
|
478
105
|
dataKey: "value",
|
|
@@ -483,9 +110,9 @@ function FunnelChart({
|
|
|
483
110
|
)
|
|
484
111
|
]
|
|
485
112
|
}
|
|
486
|
-
) : /* @__PURE__ */
|
|
113
|
+
) : /* @__PURE__ */ jsxs(RechartsFunnelChart, { margin: { top: 0, right: 0, bottom: 0, left: 0 }, children: [
|
|
487
114
|
tooltipNode,
|
|
488
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
489
116
|
Funnel,
|
|
490
117
|
{
|
|
491
118
|
data: stages,
|
|
@@ -495,7 +122,7 @@ function FunnelChart({
|
|
|
495
122
|
}
|
|
496
123
|
)
|
|
497
124
|
] });
|
|
498
|
-
const valueLabels = /* @__PURE__ */
|
|
125
|
+
const valueLabels = /* @__PURE__ */ jsx("ul", { className: cn(funnelStageListVariants({ size: resolvedSize })), children: stages.map((stage) => /* @__PURE__ */ jsxs(
|
|
499
126
|
"li",
|
|
500
127
|
{
|
|
501
128
|
className: "whitespace-nowrap tabular-nums text-fg-primary",
|
|
@@ -509,7 +136,7 @@ function FunnelChart({
|
|
|
509
136
|
},
|
|
510
137
|
stage.label
|
|
511
138
|
)) });
|
|
512
|
-
const legendNode = /* @__PURE__ */
|
|
139
|
+
const legendNode = /* @__PURE__ */ jsx(
|
|
513
140
|
"ul",
|
|
514
141
|
{
|
|
515
142
|
className: cn(
|
|
@@ -518,12 +145,12 @@ function FunnelChart({
|
|
|
518
145
|
resolvedSize === "sm" ? "text-gdt-xs" : "text-gdt-sm"
|
|
519
146
|
)
|
|
520
147
|
),
|
|
521
|
-
children: stages.map((stage) => /* @__PURE__ */
|
|
148
|
+
children: stages.map((stage) => /* @__PURE__ */ jsxs(
|
|
522
149
|
"li",
|
|
523
150
|
{
|
|
524
151
|
className: "flex items-center gap-2 text-fg-primary",
|
|
525
152
|
children: [
|
|
526
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
527
154
|
"span",
|
|
528
155
|
{
|
|
529
156
|
"aria-hidden": "true",
|
|
@@ -531,21 +158,21 @@ function FunnelChart({
|
|
|
531
158
|
style: { backgroundColor: stage.fill }
|
|
532
159
|
}
|
|
533
160
|
),
|
|
534
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: stage.label })
|
|
535
162
|
]
|
|
536
163
|
},
|
|
537
164
|
stage.label
|
|
538
165
|
))
|
|
539
166
|
}
|
|
540
167
|
);
|
|
541
|
-
return /* @__PURE__ */
|
|
542
|
-
(title != null || description != null) && /* @__PURE__ */
|
|
543
|
-
title != null && /* @__PURE__ */
|
|
544
|
-
description != null && /* @__PURE__ */
|
|
168
|
+
return /* @__PURE__ */ jsxs(ChartCard, { size: resolvedSize, className, ...props, children: [
|
|
169
|
+
(title != null || description != null) && /* @__PURE__ */ jsxs(ChartHeader, { children: [
|
|
170
|
+
title != null && /* @__PURE__ */ jsx(ChartTitle, { children: title }),
|
|
171
|
+
description != null && /* @__PURE__ */ jsx(ChartDescription, { children: description })
|
|
545
172
|
] }),
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
/* @__PURE__ */
|
|
548
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
174
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-4", children: [
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
549
176
|
ChartContainer,
|
|
550
177
|
{
|
|
551
178
|
config,
|
package/dist/funnel-chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/funnel-chart.tsx","../src/lib/cn.ts","../src/components/ui/chart.tsx","../src/components/ui/size-context.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport {\n\tBar,\n\tBarChart,\n\tFunnel,\n\tFunnelChart as RechartsFunnelChart,\n\tXAxis,\n\tYAxis,\n} from \"recharts\";\nimport { cn } from \"../../lib/cn\";\nimport {\n\tChartCard,\n\ttype ChartConfig,\n\tChartContainer,\n\tChartDescription,\n\tChartHeader,\n\tChartTitle,\n\tChartTooltip,\n\tChartTooltipContent,\n\ttype ChartValueType,\n} from \"./chart\";\nimport { type ComponentSize, useComponentSize } from \"./size-context\";\n\n/**\n * A staged conversion chart for drop-off analytics. Two renderings share one\n * component — `funnel` draws connected, edge-sharing trapezoids (recharts\n * `FunnelChart`) that narrow top-down; `bars` draws flush, left-aligned tracks\n * (recharts `BarChart`, vertical layout) over a faint 100 % reference, using\n * recharts' built-in `Bar` `background`. Both read top-down as the audience\n * drops off, and both reuse the same stage data, palette, value-label column,\n * legend, frame, and tooltip — only the inner plot differs (the same split as\n * `Sparkline`). Per the chart architecture the recharts primitives are rendered\n * directly here, never wrapped.\n *\n * @example\n * <FunnelChart\n * data={[\n * { label: \"Applied\", value: 1000 },\n * { label: \"Pre-qualified\", value: 720 },\n * { label: \"Closed\", value: 110 },\n * ]}\n * title=\"Application drop-off\"\n * description=\"V3 analytics · last 30 days\"\n * tooltip\n * />\n */\n\n/** Funnel sizes line up with the three shared `ComponentSize` values. */\ntype FunnelChartSize = ComponentSize;\n\n/** Plot rendering — connected trapezoids or flush-stacked bars. */\ntype FunnelChartType = \"funnel\" | \"bars\";\n\n/** Where the colour-key legend sits relative to the plot. */\ntype FunnelLegendPlacement = \"right\" | \"bottom\";\n\ntype FunnelStage = {\n\t/** Stage name, e.g. \"Applied\". */\n\tlabel: string;\n\t/** Absolute count reaching this stage. */\n\tvalue: number;\n\t/** Segment colour; defaults to the palette in stage order. */\n\tfill?: string;\n};\n\n/**\n * Stage palette, ordered top-of-funnel → bottom: forest → brass → moss → clay →\n * stone. Giddaa has no `chart-1`…`chart-N` tokens yet, so these map to the brand\n * scales; assign by order, or override per stage with `fill`.\n */\nconst FUNNEL_CHART_PALETTE = [\n\t\"var(--color-forest-700)\",\n\t\"var(--color-brass-500)\",\n\t\"var(--color-moss-600)\",\n\t\"var(--color-clay-500)\",\n\t\"var(--color-stone-500)\",\n] as const;\n\ntype FunnelChartLayout = {\n\t/** Plot box height in px. */\n\theight: number;\n\t/** Plot box width in px — the funnel/bars column; labels + legend flow after. */\n\twidth: number;\n\t/** Corner radius for the `bars` rendering. */\n\tbarRadius: number;\n\t/** Bar thickness cap for the `bars` rendering. */\n\tbarMaxSize: number;\n};\n\nconst FUNNEL_CHART_LAYOUT: Record<FunnelChartSize, FunnelChartLayout> = {\n\tsm: { height: 150, width: 150, barRadius: 3, barMaxSize: 14 },\n\tmd: { height: 200, width: 220, barRadius: 4, barMaxSize: 18 },\n\tlg: { height: 264, width: 288, barRadius: 5, barMaxSize: 22 },\n};\n\n/** Vertical stage list — value-label column and the right-hand legend share it. */\nconst funnelStageListVariants = cva(\"flex min-w-0 flex-col\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"gap-2 text-gdt-xs\",\n\t\t\tmd: \"gap-3 text-gdt-sm\",\n\t\t\tlg: \"gap-3.5 text-gdt-sm\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nconst funnelLegendDotVariants = cva(\"shrink-0 rounded-full\", {\n\tvariants: {\n\t\tsize: { sm: \"size-2\", md: \"size-2.5\", lg: \"size-3\" },\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\ntype FunnelChartProps = Omit<\n\tReact.ComponentProps<typeof ChartCard>,\n\t\"size\" | \"children\"\n> & {\n\t/** Stages in funnel order — the widest (top) stage first. */\n\tdata: FunnelStage[];\n\t/** Plot rendering. Defaults to `funnel`. */\n\ttype?: FunnelChartType;\n\t/** Explicit size; otherwise inherited from the nearest `SizeProvider`. */\n\tsize?: FunnelChartSize;\n\t/** Chart heading. Omit to hide the title. */\n\ttitle?: React.ReactNode;\n\t/** Supporting metadata (period, source). Omit to hide the description. */\n\tdescription?: React.ReactNode;\n\t/** Enable the hover value tooltip. Default false. */\n\ttooltip?: boolean;\n\t/** Legend placement — a right column or a wrapped bottom row. Default right. */\n\tlegend?: FunnelLegendPlacement;\n\t/** Format the absolute count in the value label and tooltip. */\n\tvalueFormatter?: (value: number) => string;\n\t/** Value formatting for the tooltip. Defaults to `number`. */\n\tvalueType?: ChartValueType;\n};\n\nfunction FunnelChart({\n\tdata,\n\ttype = \"funnel\",\n\tsize,\n\ttitle,\n\tdescription,\n\ttooltip = false,\n\tlegend = \"right\",\n\tvalueFormatter = (value) => value.toLocaleString(\"en-NG\"),\n\tvalueType = \"number\",\n\tclassName,\n\t...props\n}: FunnelChartProps) {\n\tconst resolvedSize = useComponentSize(size);\n\tconst layout = FUNNEL_CHART_LAYOUT[resolvedSize];\n\n\tconst stages = data.map((stage, i) => ({\n\t\t...stage,\n\t\tfill: stage.fill ?? FUNNEL_CHART_PALETTE[i % FUNNEL_CHART_PALETTE.length],\n\t}));\n\t// Top stage is the funnel's 100 % reference — every share is relative to it.\n\tconst top = stages[0]?.value || 1;\n\n\tconst config = Object.fromEntries(\n\t\tstages.map((stage) => [\n\t\t\tstage.label,\n\t\t\t{ label: stage.label, color: stage.fill },\n\t\t]),\n\t) satisfies ChartConfig;\n\n\tconst tooltipNode = tooltip ? (\n\t\t<ChartTooltip\n\t\t\tcursor={false}\n\t\t\tcontent={<ChartTooltipContent nameKey=\"label\" valueType={valueType} />}\n\t\t/>\n\t) : null;\n\n\t// Per-segment colour comes from each datum's `fill` — recharts reads it\n\t// directly, so no (deprecated) `<Cell>` children are needed.\n\tconst chartNode =\n\t\ttype === \"bars\" ? (\n\t\t\t<BarChart\n\t\t\t\taccessibilityLayer\n\t\t\t\tlayout=\"vertical\"\n\t\t\t\tdata={stages}\n\t\t\t\tmargin={{ top: 0, right: 0, bottom: 0, left: 0 }}\n\t\t\t\tbarCategoryGap=\"0%\"\n\t\t\t>\n\t\t\t\t{tooltipNode}\n\t\t\t\t<XAxis type=\"number\" domain={[0, top]} hide />\n\t\t\t\t<YAxis type=\"category\" dataKey=\"label\" hide />\n\t\t\t\t<Bar\n\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\tradius={layout.barRadius}\n\t\t\t\t\tcolor=\"var(--color-line-subtle)\"\n\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t/>\n\t\t\t</BarChart>\n\t\t) : (\n\t\t\t<RechartsFunnelChart margin={{ top: 0, right: 0, bottom: 0, left: 0 }}>\n\t\t\t\t{tooltipNode}\n\t\t\t\t<Funnel\n\t\t\t\t\tdata={stages}\n\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\tnameKey=\"label\"\n\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t/>\n\t\t\t</RechartsFunnelChart>\n\t\t);\n\n\tconst valueLabels = (\n\t\t<ul className={cn(funnelStageListVariants({ size: resolvedSize }))}>\n\t\t\t{stages.map((stage) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={stage.label}\n\t\t\t\t\tclassName=\"whitespace-nowrap tabular-nums text-fg-primary\"\n\t\t\t\t>\n\t\t\t\t\t{valueFormatter(stage.value)} ·{\" \"}\n\t\t\t\t\t{Math.round((stage.value / top) * 100)}%\n\t\t\t\t</li>\n\t\t\t))}\n\t\t</ul>\n\t);\n\n\tconst legendNode = (\n\t\t<ul\n\t\t\tclassName={cn(\n\t\t\t\tlegend === \"right\"\n\t\t\t\t\t? funnelStageListVariants({ size: resolvedSize })\n\t\t\t\t\t: cn(\n\t\t\t\t\t\t\t\"flex flex-row flex-wrap items-center gap-x-4 gap-y-2\",\n\t\t\t\t\t\t\tresolvedSize === \"sm\" ? \"text-gdt-xs\" : \"text-gdt-sm\",\n\t\t\t\t\t\t),\n\t\t\t)}\n\t\t>\n\t\t\t{stages.map((stage) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={stage.label}\n\t\t\t\t\tclassName=\"flex items-center gap-2 text-fg-primary\"\n\t\t\t\t>\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={cn(funnelLegendDotVariants({ size: resolvedSize }))}\n\t\t\t\t\t\tstyle={{ backgroundColor: stage.fill }}\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"min-w-0 truncate\">{stage.label}</span>\n\t\t\t\t</li>\n\t\t\t))}\n\t\t</ul>\n\t);\n\n\treturn (\n\t\t<ChartCard size={resolvedSize} className={className} {...props}>\n\t\t\t{(title != null || description != null) && (\n\t\t\t\t<ChartHeader>\n\t\t\t\t\t{title != null && <ChartTitle>{title}</ChartTitle>}\n\t\t\t\t\t{description != null && (\n\t\t\t\t\t\t<ChartDescription>{description}</ChartDescription>\n\t\t\t\t\t)}\n\t\t\t\t</ChartHeader>\n\t\t\t)}\n\t\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t\t<div className=\"flex flex-wrap items-center gap-x-6 gap-y-4\">\n\t\t\t\t\t<ChartContainer\n\t\t\t\t\t\tconfig={config}\n\t\t\t\t\t\tclassName=\"aspect-auto shrink-0\"\n\t\t\t\t\t\tstyle={{ width: layout.width, height: layout.height }}\n\t\t\t\t\t>\n\t\t\t\t\t\t{chartNode}\n\t\t\t\t\t</ChartContainer>\n\t\t\t\t\t{valueLabels}\n\t\t\t\t\t{legend === \"right\" && legendNode}\n\t\t\t\t</div>\n\t\t\t\t{legend === \"bottom\" && legendNode}\n\t\t\t</div>\n\t\t</ChartCard>\n\t);\n}\n\nexport { FUNNEL_CHART_LAYOUT, FUNNEL_CHART_PALETTE, FunnelChart };\nexport type {\n\tFunnelChartLayout,\n\tFunnelChartProps,\n\tFunnelChartSize,\n\tFunnelChartType,\n\tFunnelLegendPlacement,\n\tFunnelStage,\n};\n","import { type ClassValue, clsx } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n\textend: {\n\t\tclassGroups: {\n\t\t\t\"font-size\": [\n\t\t\t\t{\n\t\t\t\t\ttext: [\n\t\t\t\t\t\t\"gdt-display\",\n\t\t\t\t\t\t\"gdt-h1\",\n\t\t\t\t\t\t\"gdt-h2\",\n\t\t\t\t\t\t\"gdt-h3\",\n\t\t\t\t\t\t\"gdt-h4\",\n\t\t\t\t\t\t\"gdt-h5\",\n\t\t\t\t\t\t\"gdt-xl\",\n\t\t\t\t\t\t\"gdt-lg\",\n\t\t\t\t\t\t\"gdt-md\",\n\t\t\t\t\t\t\"gdt-sm\",\n\t\t\t\t\t\t\"gdt-xs\",\n\t\t\t\t\t\t\"gdt-subtext\",\n\t\t\t\t\t\t\"gdt-capitalized\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n});\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport type { TooltipValueType } from \"recharts\";\nimport * as RechartsPrimitive from \"recharts\";\nimport { cn } from \"../../lib/cn\";\nimport {\n\ttype ComponentSize,\n\tSizeProvider,\n\tuseComponentSize,\n} from \"./size-context\";\n\n/**\n * Markers use `--color-surface-brand` as a placeholder. Giddaa has no\n * categorical chart palette yet — add `chart-1`…`chart-N` tokens and bind each\n * series (its legend marker and tooltip dot) to its own colour once they exist.\n * Until then any series without an explicit colour paints brand-green.\n */\nconst SERIES_COLOR_PLACEHOLDER = \"var(--color-surface-brand)\";\n\n/** How a precise value is formatted in the tooltip and which prefix/suffix it carries. */\nexport type ChartValueType = \"number\" | \"percentage\" | \"currency\";\n\nfunction formatChartValue(\n\tvalue: TooltipValueType | undefined,\n\ttype: ChartValueType,\n) {\n\tif (Array.isArray(value)) {\n\t\treturn value.join(\", \");\n\t}\n\n\tif (typeof value !== \"number\") {\n\t\treturn value == null ? \"\" : String(value);\n\t}\n\n\tswitch (type) {\n\t\tcase \"currency\":\n\t\t\treturn `₦${value.toLocaleString(\"en-NG\")}`;\n\t\tcase \"percentage\":\n\t\t\treturn `${value.toLocaleString(\"en-NG\", {\n\t\t\t\tminimumFractionDigits: 1,\n\t\t\t\tmaximumFractionDigits: 1,\n\t\t\t})}%`;\n\t\tdefault:\n\t\t\treturn value.toLocaleString(\"en-NG\");\n\t}\n}\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const;\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n\tstring,\n\t{\n\t\tlabel?: React.ReactNode;\n\t\ticon?: React.ComponentType;\n\t} & (\n\t\t| { color?: string; theme?: never }\n\t\t| { color?: never; theme: Record<keyof typeof THEMES, string> }\n\t)\n>;\n\ntype ChartContextProps = {\n\tconfig: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n\tconst context = React.useContext(ChartContext);\n\n\tif (!context) {\n\t\tthrow new Error(\"useChart must be used within a <ChartContainer />\");\n\t}\n\n\treturn context;\n}\n\n/**\n * Shared chart frame — the chrome that surrounds the plot of any chart type\n * (bar, line, area, pie). These are presentational, domain-free, and size-aware:\n * a `size` flows through `SizeProvider` so the plot and its labels can scale\n * with the card. Compose them with the plot primitives:\n *\n * <ChartCard size=\"md\">\n * <ChartHeader>\n * <ChartTitle>Revenue Overview</ChartTitle>\n * <ChartDescription>Monthly revenue · Jan–Jul</ChartDescription>\n * </ChartHeader>\n * <ChartContainer config={config}>{/* recharts plot *\\/}</ChartContainer>\n * </ChartCard>\n */\nconst chartCardVariants = cva(\n\t\"flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: \"gap-3 p-4\",\n\t\t\t\tmd: \"gap-4 p-5\",\n\t\t\t\tlg: \"gap-5 p-6\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { size: \"md\" },\n\t},\n);\n\nfunction ChartCard({\n\tclassName,\n\tsize,\n\tchildren,\n\t...props\n}: React.ComponentProps<\"section\"> & { size?: ComponentSize }) {\n\tconst resolvedSize = useComponentSize(size);\n\n\treturn (\n\t\t<SizeProvider size={resolvedSize}>\n\t\t\t<section\n\t\t\t\tdata-slot=\"chart-card\"\n\t\t\t\tclassName={cn(chartCardVariants({ size: resolvedSize }), className)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</section>\n\t\t</SizeProvider>\n\t);\n}\n\nfunction ChartHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"chart-header\"\n\t\t\tclassName={cn(\"flex min-w-0 flex-col gap-1\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst chartTitleVariants = cva(\"min-w-0 font-bold text-fg-primary\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"text-gdt-md\",\n\t\t\tmd: \"text-gdt-lg\",\n\t\t\tlg: \"text-gdt-h5\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nfunction ChartTitle({\n\tclassName,\n\tsize,\n\t...props\n}: React.ComponentProps<\"h3\"> & { size?: ComponentSize }) {\n\tconst resolvedSize = useComponentSize(size);\n\n\treturn (\n\t\t<h3\n\t\t\tdata-slot=\"chart-title\"\n\t\t\tclassName={cn(chartTitleVariants({ size: resolvedSize }), className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst chartDescriptionVariants = cva(\"min-w-0 font-normal text-fg-secondary\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"text-gdt-xs\",\n\t\t\tmd: \"text-gdt-sm\",\n\t\t\tlg: \"text-gdt-sm\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nfunction ChartDescription({\n\tclassName,\n\tsize,\n\t...props\n}: React.ComponentProps<\"p\"> & { size?: ComponentSize }) {\n\tconst resolvedSize = useComponentSize(size);\n\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"chart-description\"\n\t\t\tclassName={cn(\n\t\t\t\tchartDescriptionVariants({ size: resolvedSize }),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction ChartContainer({\n\tid,\n\tclassName,\n\tchildren,\n\tconfig,\n\tinitialDimension = INITIAL_DIMENSION,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\tconfig: ChartConfig;\n\tchildren: React.ComponentProps<\n\t\ttypeof RechartsPrimitive.ResponsiveContainer\n\t>[\"children\"];\n\tinitialDimension?: {\n\t\twidth: number;\n\t\theight: number;\n\t};\n}) {\n\tconst uniqueId = React.useId();\n\tconst chartId = `chart-${id ?? uniqueId.replace(/:/g, \"\")}`;\n\n\treturn (\n\t\t<ChartContext.Provider value={{ config }}>\n\t\t\t<div\n\t\t\t\tdata-slot=\"chart\"\n\t\t\t\tdata-chart={chartId}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<ChartStyle id={chartId} config={config} />\n\t\t\t\t<RechartsPrimitive.ResponsiveContainer\n\t\t\t\t\tinitialDimension={initialDimension}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</RechartsPrimitive.ResponsiveContainer>\n\t\t\t</div>\n\t\t</ChartContext.Provider>\n\t);\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n\tconst colorConfig = Object.entries(config).filter(\n\t\t([, config]) => config.theme ?? config.color,\n\t);\n\n\tif (!colorConfig.length) {\n\t\treturn null;\n\t}\n\n\tconst styleContent = Object.entries(THEMES)\n\t\t.map(\n\t\t\t([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n\t.map(([key, itemConfig]) => {\n\t\tconst color =\n\t\t\titemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??\n\t\t\titemConfig.color;\n\t\treturn color ? ` --color-${key}: ${color};` : null;\n\t})\n\t.join(\"\\n\")}\n}\n`,\n\t\t)\n\t\t.join(\"\\n\");\n\n\treturn <style>{styleContent}</style>;\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\n/**\n * Hover tooltip for a chart data point. It surfaces a single precise value with\n * type-appropriate formatting — grouped integers, percentages, or ₦-prefixed\n * currency — sitting on an elevated overlay (bg-surface-overlay, Shadow-2,\n * 1px border-subtle) so users can read exact figures without leaving the chart.\n *\n * Anatomy: series dot · metric label · hero value · period caption.\n */\nconst chartTooltipVariants = cva(\n\t\"flex flex-col bg-surface-overlay border border-line-subtle shadow-2\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\txs: \"gap-0.5 rounded-md p-2\",\n\t\t\t\tsm: \"gap-0.5 rounded-md p-2.5\",\n\t\t\t\tmd: \"gap-1 rounded-lg p-3\",\n\t\t\t\tlg: \"gap-1 rounded-xl p-3.5\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tsize: \"md\",\n\t\t},\n\t},\n);\n\nconst chartTooltipDotVariants = cva(\"shrink-0 rounded-full\", {\n\tvariants: {\n\t\tsize: {\n\t\t\txs: \"size-1.5\",\n\t\t\tsm: \"size-2\",\n\t\t\tmd: \"size-2.5\",\n\t\t\tlg: \"size-2.5\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: \"md\",\n\t},\n});\n\nconst chartTooltipLabelVariants = cva(\"font-medium text-fg-secondary\", {\n\tvariants: {\n\t\tsize: {\n\t\t\txs: \"text-gdt-xs\",\n\t\t\tsm: \"text-gdt-xs\",\n\t\t\tmd: \"text-gdt-sm\",\n\t\t\tlg: \"text-gdt-sm\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nconst chartTooltipValueVariants = cva(\n\t\"font-extrabold text-fg-primary tabular-nums\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\txs: \"text-gdt-sm\",\n\t\t\t\tsm: \"text-gdt-md\",\n\t\t\t\tmd: \"text-gdt-lg\",\n\t\t\t\tlg: \"text-gdt-xl\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { size: \"md\" },\n\t},\n);\n\nfunction ChartTooltipContent({\n\tactive,\n\tpayload,\n\tclassName,\n\thideIndicator = false,\n\tlabel,\n\tlabelFormatter,\n\tformatter,\n\tcolor,\n\tnameKey,\n\tvalueType = \"number\",\n\tsize = \"md\",\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n\tReact.ComponentProps<\"div\"> & {\n\t\thideIndicator?: boolean;\n\t\tnameKey?: string;\n\t\tvalueType?: ChartValueType;\n\t} & VariantProps<typeof chartTooltipVariants> &\n\tOmit<\n\t\tRechartsPrimitive.DefaultTooltipContentProps<\n\t\t\tTooltipValueType,\n\t\t\tTooltipNameType\n\t\t>,\n\t\t\"accessibilityLayer\"\n\t>) {\n\tconst { config } = useChart();\n\n\tif (!active || !payload?.length) {\n\t\treturn null;\n\t}\n\n\tconst [item] = payload.filter((entry) => entry.type !== \"none\");\n\n\tif (!item) {\n\t\treturn null;\n\t}\n\n\tconst key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`;\n\tconst itemConfig = getPayloadConfigFromPayload(config, item, key);\n\tconst dotColor =\n\t\tcolor ?? item.payload?.fill ?? item.color ?? SERIES_COLOR_PLACEHOLDER;\n\n\t// Metric label — the short name of the series being read, e.g. \"Total Revenue\".\n\tconst metricLabel = itemConfig?.label ?? item.name;\n\t// Hero value — the precise, formatted figure, the visual focus of the tooltip.\n\tconst heroValue = formatter\n\t\t? formatter(item.value, item.name ?? \"\", item, 0, item.payload)\n\t\t: formatChartValue(item.value, valueType);\n\t// Period caption — the time context for the value, e.g. \"March 2026\".\n\tconst periodCaption = labelFormatter\n\t\t? labelFormatter(label, payload)\n\t\t: ((typeof label === \"string\" ? config[label]?.label : null) ?? label);\n\n\treturn (\n\t\t<div className={cn(chartTooltipVariants({ size }), className)}>\n\t\t\t{metricLabel != null && (\n\t\t\t\t<div className=\"flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:shrink-0\">\n\t\t\t\t\t{!hideIndicator &&\n\t\t\t\t\t\t(itemConfig?.icon ? (\n\t\t\t\t\t\t\t<itemConfig.icon />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\tclassName={cn(chartTooltipDotVariants({ size }))}\n\t\t\t\t\t\t\t\tstyle={{ backgroundColor: dotColor }}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t<span className={cn(chartTooltipLabelVariants({ size }))}>\n\t\t\t\t\t\t{metricLabel}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<p className={cn(chartTooltipValueVariants({ size }))}>{heroValue}</p>\n\t\t\t{periodCaption != null && periodCaption !== \"\" && (\n\t\t\t\t<p className=\"text-gdt-xs text-fg-caption-placeholder\">\n\t\t\t\t\t{periodCaption}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\n/** Marker shape that ties a legend item to its series. */\ntype ChartLegendMarker = \"dot\" | \"square\" | \"line\";\n\nconst chartLegendItemVariants = cva(\n\t\"group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: \"gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3\",\n\t\t\t\tmd: \"gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5\",\n\t\t\t},\n\t\t\tinteractive: {\n\t\t\t\ttrue: \"cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised\",\n\t\t\t\tfalse: \"\",\n\t\t\t},\n\t\t\tinactive: {\n\t\t\t\ttrue: \"text-fg-caption-placeholder line-through\",\n\t\t\t\tfalse: \"\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tsize: \"md\",\n\t\t\tinteractive: false,\n\t\t\tinactive: false,\n\t\t},\n\t},\n);\n\nconst chartLegendMarkerSizeVariants = cva(\"shrink-0\", {\n\tvariants: {\n\t\tmarker: {\n\t\t\tdot: \"rounded-full\",\n\t\t\tsquare: \"rounded-[2px]\",\n\t\t\tline: \"rounded-full\",\n\t\t},\n\t\tsize: {\n\t\t\tsm: \"\",\n\t\t\tmd: \"\",\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t{ marker: [\"dot\", \"square\"], size: \"sm\", className: \"size-2\" },\n\t\t{ marker: [\"dot\", \"square\"], size: \"md\", className: \"size-2.5\" },\n\t\t{ marker: \"line\", size: \"sm\", className: \"h-[3px] w-3\" },\n\t\t{ marker: \"line\", size: \"md\", className: \"h-[3px] w-3.5\" },\n\t],\n\tdefaultVariants: { marker: \"dot\", size: \"md\" },\n});\n\n/**\n * A shared legend for all chart types. Each item pairs a series marker with a\n * label and can be toggled to hide or show its series — the inactive state mutes\n * the marker and strikes through the label. Items compose into horizontal rows\n * or vertical columns, in two sizes, with dot, square, or line markers.\n *\n * Toggling: pass `onToggle` to make items interactive. Inactive items are read\n * from each payload entry's `inactive` flag (recharts sets this when wired) or\n * the controlled `inactiveKeys` set.\n */\nfunction ChartLegendContent({\n\tclassName,\n\thideIcon = false,\n\tpayload,\n\tverticalAlign = \"bottom\",\n\tnameKey,\n\tmarker = \"dot\",\n\tsize = \"md\",\n\torientation = \"horizontal\",\n\tinactiveKeys,\n\tonToggle,\n}: React.ComponentProps<\"div\"> & {\n\thideIcon?: boolean;\n\tnameKey?: string;\n\tmarker?: ChartLegendMarker;\n\tsize?: \"sm\" | \"md\";\n\torientation?: \"horizontal\" | \"vertical\";\n\tinactiveKeys?: Iterable<string>;\n\tonToggle?: (key: string) => void;\n} & RechartsPrimitive.DefaultLegendContentProps) {\n\tconst { config } = useChart();\n\n\tif (!payload?.length) {\n\t\treturn null;\n\t}\n\n\tconst inactiveSet = inactiveKeys ? new Set(inactiveKeys) : undefined;\n\tconst interactive = Boolean(onToggle);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"flex\",\n\t\t\t\torientation === \"vertical\"\n\t\t\t\t\t? \"flex-col items-start gap-0.5\"\n\t\t\t\t\t: \"flex-row flex-wrap items-center justify-center gap-x-1 gap-y-0.5\",\n\t\t\t\tverticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{payload\n\t\t\t\t.filter((item) => item.type !== \"none\")\n\t\t\t\t.map((item, index) => {\n\t\t\t\t\tconst key = `${nameKey ?? item.dataKey ?? \"value\"}`;\n\t\t\t\t\tconst itemKey = `${item.dataKey ?? item.value ?? index}`;\n\t\t\t\t\tconst itemConfig = getPayloadConfigFromPayload(config, item, key);\n\t\t\t\t\tconst inactive =\n\t\t\t\t\t\t(inactiveSet?.has(key) ?? false) || Boolean(item.inactive);\n\t\t\t\t\tconst markerColor = inactive\n\t\t\t\t\t\t? \"var(--color-fg-caption-placeholder)\"\n\t\t\t\t\t\t: (item.color ?? SERIES_COLOR_PLACEHOLDER);\n\n\t\t\t\t\tconst content = (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{itemConfig?.icon && !hideIcon ? (\n\t\t\t\t\t\t\t\t<itemConfig.icon />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\tchartLegendMarkerSizeVariants({ marker, size }),\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\tstyle={{ backgroundColor: markerColor }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{itemConfig?.label ?? item.value}\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\n\t\t\t\t\tif (interactive) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={itemKey}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\taria-pressed={!inactive}\n\t\t\t\t\t\t\t\tonClick={() => onToggle?.(key)}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\tchartLegendItemVariants({ size, interactive, inactive }),\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{content}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={itemKey}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\tchartLegendItemVariants({ size, interactive, inactive }),\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{content}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t</div>\n\t);\n}\n\n/** The size-scaled layout numbers a cartesian chart needs to build axis props. */\ntype CartesianAxisLayout = {\n\ttickMargin: number;\n\ttickFontSize: number;\n\tyAxisWidth: number;\n};\n\n/**\n * Shared `<XAxis>`/`<YAxis>` props — the giddaa cartesian-axis defaults (no tick\n * or axis lines, a size-scaled tick font, and a reserved value-axis width) that\n * every bar and line chart would otherwise repeat per axis. Spread the result\n * onto the recharts axis, then add the chart-specific props (`dataKey`,\n * `domain`, `ticks`, a `width`/`type` override, …):\n *\n * const chart = useBarChartLayout();\n * <XAxis dataKey=\"month\" {...chart.xAxis} />\n * <YAxis domain={[0, 120]} {...chart.yAxis} />\n */\nfunction cartesianAxisProps(layout: CartesianAxisLayout) {\n\tconst tick = { fontSize: layout.tickFontSize };\n\treturn {\n\t\txAxis: {\n\t\t\ttickLine: false,\n\t\t\taxisLine: false,\n\t\t\ttickMargin: layout.tickMargin,\n\t\t\ttick,\n\t\t},\n\t\tyAxis: {\n\t\t\ttickLine: false,\n\t\t\taxisLine: false,\n\t\t\twidth: layout.yAxisWidth,\n\t\t\ttick,\n\t\t},\n\t} as const;\n}\n\nfunction getPayloadConfigFromPayload(\n\tconfig: ChartConfig,\n\tpayload: unknown,\n\tkey: string,\n) {\n\tif (typeof payload !== \"object\" || payload === null) {\n\t\treturn undefined;\n\t}\n\n\tconst payloadPayload =\n\t\t\"payload\" in payload &&\n\t\ttypeof payload.payload === \"object\" &&\n\t\tpayload.payload !== null\n\t\t\t? payload.payload\n\t\t\t: undefined;\n\n\tlet configLabelKey: string = key;\n\n\tif (\n\t\tkey in payload &&\n\t\ttypeof payload[key as keyof typeof payload] === \"string\"\n\t) {\n\t\tconfigLabelKey = payload[key as keyof typeof payload] as string;\n\t} else if (\n\t\tpayloadPayload &&\n\t\tkey in payloadPayload &&\n\t\ttypeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n\t) {\n\t\tconfigLabelKey = payloadPayload[\n\t\t\tkey as keyof typeof payloadPayload\n\t\t] as string;\n\t}\n\n\treturn configLabelKey in config ? config[configLabelKey] : config[key];\n}\n\nexport {\n\tcartesianAxisProps,\n\tChartCard,\n\tChartContainer,\n\tChartDescription,\n\tChartHeader,\n\tChartLegend,\n\tChartLegendContent,\n\tChartStyle,\n\tChartTitle,\n\tChartTooltip,\n\tChartTooltipContent,\n};\nexport type { CartesianAxisLayout };\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext } from \"react\";\n\ntype ComponentSize = \"sm\" | \"md\" | \"lg\";\n\nconst SizeContext = createContext<ComponentSize | undefined>(undefined);\n\nfunction SizeProvider({\n\tchildren,\n\tsize,\n}: {\n\tchildren: ReactNode;\n\tsize?: ComponentSize | null;\n}) {\n\tif (!size) {\n\t\treturn <>{children}</>;\n\t}\n\n\treturn <SizeContext.Provider value={size}>{children}</SizeContext.Provider>;\n}\n\nfunction useComponentSize(\n\tsize?: ComponentSize | null,\n\tfallback: ComponentSize = \"md\",\n) {\n\tconst inheritedSize = useContext(SizeContext);\n\treturn size ?? inheritedSize ?? fallback;\n}\n\nexport { SizeProvider, useComponentSize, type ComponentSize };\n"],"mappings":";AAEA,SAAS,OAAAA,YAAW;AAEpB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,OACM;;;ACXP,SAA0B,YAAY;AACtC,SAAS,2BAA2B;AAEpC,IAAM,UAAU,oBAAoB;AAAA,EACnC,QAAQ;AAAA,IACP,aAAa;AAAA,MACZ,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAEM,SAAS,MAAM,QAAsB;AAC3C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC5B;;;AC7BA,SAAS,WAA8B;AACvC,YAAY,WAAW;AAEvB,YAAY,uBAAuB;;;ACHnC,SAAS,eAA+B,kBAAkB;AAcjD;AAVT,IAAM,cAAc,cAAyC,MAAS;AAEtE,SAAS,aAAa;AAAA,EACrB;AAAA,EACA;AACD,GAGG;AACF,MAAI,CAAC,MAAM;AACV,WAAO,gCAAG,UAAS;AAAA,EACpB;AAEA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,MAAO,UAAS;AACrD;AAEA,SAAS,iBACR,MACA,WAA0B,M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YACV,OAAO,EAAE,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO;AAAA,YAEnD;AAAA;AAAA,QACF;AAAA,QACC;AAAA,QACA,WAAW,WAAW;AAAA,SACxB;AAAA,MACC,WAAW,YAAY;AAAA,OACzB;AAAA,KACD;AAEF;","names":["cva","Fragment","jsx","config","jsx","jsxs","cva"]}
|
|
1
|
+
{"version":3,"sources":["../src/funnel-chart.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport {\n\tBar,\n\tBarChart,\n\tFunnel,\n\tFunnelChart as RechartsFunnelChart,\n\tXAxis,\n\tYAxis,\n} from \"recharts\";\nimport {\n\tChartCard,\n\ttype ChartConfig,\n\tChartContainer,\n\tChartDescription,\n\tChartHeader,\n\tChartTitle,\n\tChartTooltip,\n\tChartTooltipContent,\n\ttype ChartValueType,\n} from \"./chart\";\nimport { cn } from \"./lib/cn\";\nimport { type ComponentSize, useComponentSize } from \"./size-context\";\n\n/**\n * A staged conversion chart for drop-off analytics. Two renderings share one\n * component — `funnel` draws connected, edge-sharing trapezoids (recharts\n * `FunnelChart`) that narrow top-down; `bars` draws flush, left-aligned tracks\n * (recharts `BarChart`, vertical layout) over a faint 100 % reference, using\n * recharts' built-in `Bar` `background`. Both read top-down as the audience\n * drops off, and both reuse the same stage data, palette, value-label column,\n * legend, frame, and tooltip — only the inner plot differs (the same split as\n * `Sparkline`). Per the chart architecture the recharts primitives are rendered\n * directly here, never wrapped.\n *\n * @example\n * <FunnelChart\n * data={[\n * { label: \"Applied\", value: 1000 },\n * { label: \"Pre-qualified\", value: 720 },\n * { label: \"Closed\", value: 110 },\n * ]}\n * title=\"Application drop-off\"\n * description=\"V3 analytics · last 30 days\"\n * tooltip\n * />\n */\n\n/** Funnel sizes line up with the three shared `ComponentSize` values. */\ntype FunnelChartSize = ComponentSize;\n\n/** Plot rendering — connected trapezoids or flush-stacked bars. */\ntype FunnelChartType = \"funnel\" | \"bars\";\n\n/** Where the colour-key legend sits relative to the plot. */\ntype FunnelLegendPlacement = \"right\" | \"bottom\";\n\ntype FunnelStage = {\n\t/** Stage name, e.g. \"Applied\". */\n\tlabel: string;\n\t/** Absolute count reaching this stage. */\n\tvalue: number;\n\t/** Segment colour; defaults to the palette in stage order. */\n\tfill?: string;\n};\n\n/**\n * Stage palette, ordered top-of-funnel → bottom: forest → brass → moss → clay →\n * stone. Giddaa has no `chart-1`…`chart-N` tokens yet, so these map to the brand\n * scales; assign by order, or override per stage with `fill`.\n */\nconst FUNNEL_CHART_PALETTE = [\n\t\"var(--color-forest-700)\",\n\t\"var(--color-brass-500)\",\n\t\"var(--color-moss-600)\",\n\t\"var(--color-clay-500)\",\n\t\"var(--color-stone-500)\",\n] as const;\n\ntype FunnelChartLayout = {\n\t/** Plot box height in px. */\n\theight: number;\n\t/** Plot box width in px — the funnel/bars column; labels + legend flow after. */\n\twidth: number;\n\t/** Corner radius for the `bars` rendering. */\n\tbarRadius: number;\n\t/** Bar thickness cap for the `bars` rendering. */\n\tbarMaxSize: number;\n};\n\nconst FUNNEL_CHART_LAYOUT: Record<FunnelChartSize, FunnelChartLayout> = {\n\tsm: { height: 150, width: 150, barRadius: 3, barMaxSize: 14 },\n\tmd: { height: 200, width: 220, barRadius: 4, barMaxSize: 18 },\n\tlg: { height: 264, width: 288, barRadius: 5, barMaxSize: 22 },\n};\n\n/** Vertical stage list — value-label column and the right-hand legend share it. */\nconst funnelStageListVariants = cva(\"flex min-w-0 flex-col\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"gap-2 text-gdt-xs\",\n\t\t\tmd: \"gap-3 text-gdt-sm\",\n\t\t\tlg: \"gap-3.5 text-gdt-sm\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nconst funnelLegendDotVariants = cva(\"shrink-0 rounded-full\", {\n\tvariants: {\n\t\tsize: { sm: \"size-2\", md: \"size-2.5\", lg: \"size-3\" },\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\ntype FunnelChartProps = Omit<\n\tReact.ComponentProps<typeof ChartCard>,\n\t\"size\" | \"children\"\n> & {\n\t/** Stages in funnel order — the widest (top) stage first. */\n\tdata: FunnelStage[];\n\t/** Plot rendering. Defaults to `funnel`. */\n\ttype?: FunnelChartType;\n\t/** Explicit size; otherwise inherited from the nearest `SizeProvider`. */\n\tsize?: FunnelChartSize;\n\t/** Chart heading. Omit to hide the title. */\n\ttitle?: React.ReactNode;\n\t/** Supporting metadata (period, source). Omit to hide the description. */\n\tdescription?: React.ReactNode;\n\t/** Enable the hover value tooltip. Default false. */\n\ttooltip?: boolean;\n\t/** Legend placement — a right column or a wrapped bottom row. Default right. */\n\tlegend?: FunnelLegendPlacement;\n\t/** Format the absolute count in the value label and tooltip. */\n\tvalueFormatter?: (value: number) => string;\n\t/** Value formatting for the tooltip. Defaults to `number`. */\n\tvalueType?: ChartValueType;\n};\n\nfunction FunnelChart({\n\tdata,\n\ttype = \"funnel\",\n\tsize,\n\ttitle,\n\tdescription,\n\ttooltip = false,\n\tlegend = \"right\",\n\tvalueFormatter = (value) => value.toLocaleString(\"en-NG\"),\n\tvalueType = \"number\",\n\tclassName,\n\t...props\n}: FunnelChartProps) {\n\tconst resolvedSize = useComponentSize(size);\n\tconst layout = FUNNEL_CHART_LAYOUT[resolvedSize];\n\n\tconst stages = data.map((stage, i) => ({\n\t\t...stage,\n\t\tfill: stage.fill ?? FUNNEL_CHART_PALETTE[i % FUNNEL_CHART_PALETTE.length],\n\t}));\n\t// Top stage is the funnel's 100 % reference — every share is relative to it.\n\tconst top = stages[0]?.value || 1;\n\n\tconst config = Object.fromEntries(\n\t\tstages.map((stage) => [\n\t\t\tstage.label,\n\t\t\t{ label: stage.label, color: stage.fill },\n\t\t]),\n\t) satisfies ChartConfig;\n\n\tconst tooltipNode = tooltip ? (\n\t\t<ChartTooltip\n\t\t\tcursor={false}\n\t\t\tcontent={<ChartTooltipContent nameKey=\"label\" valueType={valueType} />}\n\t\t/>\n\t) : null;\n\n\t// Per-segment colour comes from each datum's `fill` — recharts reads it\n\t// directly, so no (deprecated) `<Cell>` children are needed.\n\tconst chartNode =\n\t\ttype === \"bars\" ? (\n\t\t\t<BarChart\n\t\t\t\taccessibilityLayer\n\t\t\t\tlayout=\"vertical\"\n\t\t\t\tdata={stages}\n\t\t\t\tmargin={{ top: 0, right: 0, bottom: 0, left: 0 }}\n\t\t\t\tbarCategoryGap=\"0%\"\n\t\t\t>\n\t\t\t\t{tooltipNode}\n\t\t\t\t<XAxis type=\"number\" domain={[0, top]} hide />\n\t\t\t\t<YAxis type=\"category\" dataKey=\"label\" hide />\n\t\t\t\t<Bar\n\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\tradius={layout.barRadius}\n\t\t\t\t\tcolor=\"var(--color-line-subtle)\"\n\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t/>\n\t\t\t</BarChart>\n\t\t) : (\n\t\t\t<RechartsFunnelChart margin={{ top: 0, right: 0, bottom: 0, left: 0 }}>\n\t\t\t\t{tooltipNode}\n\t\t\t\t<Funnel\n\t\t\t\t\tdata={stages}\n\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\tnameKey=\"label\"\n\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t/>\n\t\t\t</RechartsFunnelChart>\n\t\t);\n\n\tconst valueLabels = (\n\t\t<ul className={cn(funnelStageListVariants({ size: resolvedSize }))}>\n\t\t\t{stages.map((stage) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={stage.label}\n\t\t\t\t\tclassName=\"whitespace-nowrap tabular-nums text-fg-primary\"\n\t\t\t\t>\n\t\t\t\t\t{valueFormatter(stage.value)} ·{\" \"}\n\t\t\t\t\t{Math.round((stage.value / top) * 100)}%\n\t\t\t\t</li>\n\t\t\t))}\n\t\t</ul>\n\t);\n\n\tconst legendNode = (\n\t\t<ul\n\t\t\tclassName={cn(\n\t\t\t\tlegend === \"right\"\n\t\t\t\t\t? funnelStageListVariants({ size: resolvedSize })\n\t\t\t\t\t: cn(\n\t\t\t\t\t\t\t\"flex flex-row flex-wrap items-center gap-x-4 gap-y-2\",\n\t\t\t\t\t\t\tresolvedSize === \"sm\" ? \"text-gdt-xs\" : \"text-gdt-sm\",\n\t\t\t\t\t\t),\n\t\t\t)}\n\t\t>\n\t\t\t{stages.map((stage) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={stage.label}\n\t\t\t\t\tclassName=\"flex items-center gap-2 text-fg-primary\"\n\t\t\t\t>\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName={cn(funnelLegendDotVariants({ size: resolvedSize }))}\n\t\t\t\t\t\tstyle={{ backgroundColor: stage.fill }}\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"min-w-0 truncate\">{stage.label}</span>\n\t\t\t\t</li>\n\t\t\t))}\n\t\t</ul>\n\t);\n\n\treturn (\n\t\t<ChartCard size={resolvedSize} className={className} {...props}>\n\t\t\t{(title != null || description != null) && (\n\t\t\t\t<ChartHeader>\n\t\t\t\t\t{title != null && <ChartTitle>{title}</ChartTitle>}\n\t\t\t\t\t{description != null && (\n\t\t\t\t\t\t<ChartDescription>{description}</ChartDescription>\n\t\t\t\t\t)}\n\t\t\t\t</ChartHeader>\n\t\t\t)}\n\t\t\t<div className=\"flex flex-col gap-4\">\n\t\t\t\t<div className=\"flex flex-wrap items-center gap-x-6 gap-y-4\">\n\t\t\t\t\t<ChartContainer\n\t\t\t\t\t\tconfig={config}\n\t\t\t\t\t\tclassName=\"aspect-auto shrink-0\"\n\t\t\t\t\t\tstyle={{ width: layout.width, height: layout.height }}\n\t\t\t\t\t>\n\t\t\t\t\t\t{chartNode}\n\t\t\t\t\t</ChartContainer>\n\t\t\t\t\t{valueLabels}\n\t\t\t\t\t{legend === \"right\" && legendNode}\n\t\t\t\t</div>\n\t\t\t\t{legend === \"bottom\" && legendNode}\n\t\t\t</div>\n\t\t</ChartCard>\n\t);\n}\n\nexport { FUNNEL_CHART_LAYOUT, FUNNEL_CHART_PALETTE, FunnelChart };\nexport type {\n\tFunnelChartLayout,\n\tFunnelChartProps,\n\tFunnelChartSize,\n\tFunnelChartType,\n\tFunnelLegendPlacement,\n\tFunnelStage,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAS,WAAW;AAEpB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,OACM;AAmKK,cAQT,YARS;AArGZ,IAAM,uBAAuB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAaA,IAAM,sBAAkE;AAAA,EACvE,IAAI,EAAE,QAAQ,KAAK,OAAO,KAAK,WAAW,GAAG,YAAY,GAAG;AAAA,EAC5D,IAAI,EAAE,QAAQ,KAAK,OAAO,KAAK,WAAW,GAAG,YAAY,GAAG;AAAA,EAC5D,IAAI,EAAE,QAAQ,KAAK,OAAO,KAAK,WAAW,GAAG,YAAY,GAAG;AAC7D;AAGA,IAAM,0BAA0B,IAAI,yBAAyB;AAAA,EAC5D,UAAU;AAAA,IACT,MAAM;AAAA,MACL,IAAI;AAAA,MACJ,IAAI;AAAA,MACJ,IAAI;AAAA,IACL;AAAA,EACD;AAAA,EACA,iBAAiB,EAAE,MAAM,KAAK;AAC/B,CAAC;AAED,IAAM,0BAA0B,IAAI,yBAAyB;AAAA,EAC5D,UAAU;AAAA,IACT,MAAM,EAAE,IAAI,UAAU,IAAI,YAAY,IAAI,SAAS;AAAA,EACpD;AAAA,EACA,iBAAiB,EAAE,MAAM,KAAK;AAC/B,CAAC;AA0BD,SAAS,YAAY;AAAA,EACpB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,iBAAiB,CAAC,UAAU,MAAM,eAAe,OAAO;AAAA,EACxD,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACJ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