@bikdotai/bik-component-library 0.0.858 → 0.0.859-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
  2. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
  3. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ChartLayout.js +2 -0
  4. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ChartLayout.js.map +1 -0
  5. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js +2 -0
  6. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js.map +1 -0
  7. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js +2 -0
  8. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js.map +1 -0
  9. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js +2 -0
  10. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js.map +1 -0
  11. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  12. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js.map +1 -1
  13. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.js.map +1 -1
  14. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/chartPalette.js +2 -0
  15. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/chartPalette.js.map +1 -0
  16. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/formatChartValue.js +2 -0
  17. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/formatChartValue.js.map +1 -0
  18. package/dist/cjs/index.js +1 -1
  19. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +3 -0
  20. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +182 -172
  21. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
  22. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.d.ts +16 -0
  23. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.js +69 -0
  24. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.js.map +1 -0
  25. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.d.ts +3 -0
  26. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js +166 -0
  27. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js.map +1 -0
  28. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.model.d.ts +21 -0
  29. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.d.ts +3 -0
  30. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js +176 -0
  31. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js.map +1 -0
  32. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.model.d.ts +19 -0
  33. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.d.ts +23 -0
  34. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js +48 -0
  35. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js.map +1 -0
  36. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  37. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js.map +1 -1
  38. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +1 -0
  39. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.js.map +1 -1
  40. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.d.ts +3 -0
  41. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.js +18 -0
  42. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.js.map +1 -0
  43. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.d.ts +4 -0
  44. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.js +13 -0
  45. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.js.map +1 -0
  46. package/dist/esm/components/analytics-chips-and-dropdowns/index.d.ts +4 -0
  47. package/dist/esm/icons/index.d.ts +24 -24
  48. package/dist/esm/index.js +383 -379
  49. package/dist/esm/index.js.map +1 -1
  50. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ import { jsxs as a, jsx as i } from "react/jsx-runtime";
2
+ import { TitleRegular as s, TitleMedium as c, BodyCaption as p } from "../../TypographyStyle.js";
3
+ import { COLORS as r } from "../../../constants/Theme.js";
4
+ const x = ({
5
+ title: e,
6
+ padding: o,
7
+ gap: d,
8
+ dataTest: t,
9
+ wrapperStyle: l,
10
+ children: n
11
+ }) => /* @__PURE__ */ a(
12
+ "div",
13
+ {
14
+ "data-test": t,
15
+ style: {
16
+ display: "flex",
17
+ flexDirection: "column",
18
+ gap: d,
19
+ width: "100%",
20
+ padding: o,
21
+ borderRadius: 8,
22
+ border: `1px solid ${r.stroke.primary}`,
23
+ backgroundColor: r.surface.standard,
24
+ ...l
25
+ },
26
+ children: [
27
+ e && /* @__PURE__ */ i(s, { color: r.content.primary, children: e }),
28
+ n
29
+ ]
30
+ }
31
+ ), f = ({
32
+ value: e,
33
+ chip: o
34
+ }) => /* @__PURE__ */ a(
35
+ "div",
36
+ {
37
+ style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" },
38
+ children: [
39
+ /* @__PURE__ */ i(
40
+ c,
41
+ {
42
+ color: r.content.primary,
43
+ style: { whiteSpace: "nowrap" },
44
+ children: e
45
+ }
46
+ ),
47
+ o && /* @__PURE__ */ i(
48
+ "div",
49
+ {
50
+ style: {
51
+ display: "inline-flex",
52
+ alignItems: "center",
53
+ padding: "4px 8px",
54
+ borderRadius: 4,
55
+ border: `1px solid ${r.stroke.primary}`,
56
+ backgroundColor: r.surface.subdued,
57
+ whiteSpace: "nowrap"
58
+ },
59
+ children: /* @__PURE__ */ i(p, { color: r.content.secondary, children: o })
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ export {
66
+ x as ChartCard,
67
+ f as ChartValueRow
68
+ };
69
+ //# sourceMappingURL=ChartLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartLayout.js","sources":["../../../../../src/components/analytics-chips-and-dropdowns/chart/ChartLayout.tsx"],"sourcesContent":["import React, { CSSProperties, ReactNode } from 'react';\nimport {\n\tBodyCaption,\n\tTitleMedium,\n\tTitleRegular,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\ninterface ChartCardProps {\n\ttitle?: string;\n\tpadding: CSSProperties['padding'];\n\tgap: number;\n\tdataTest: string;\n\twrapperStyle?: CSSProperties;\n\tchildren: ReactNode;\n}\n\nexport const ChartCard: React.FC<ChartCardProps> = ({\n\ttitle,\n\tpadding,\n\tgap,\n\tdataTest,\n\twrapperStyle,\n\tchildren,\n}) => (\n\t<div\n\t\tdata-test={dataTest}\n\t\tstyle={{\n\t\t\tdisplay: 'flex',\n\t\t\tflexDirection: 'column',\n\t\t\tgap,\n\t\t\twidth: '100%',\n\t\t\tpadding,\n\t\t\tborderRadius: 8,\n\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\tbackgroundColor: COLORS.surface.standard,\n\t\t\t...wrapperStyle,\n\t\t}}\n\t>\n\t\t{title && (\n\t\t\t<TitleRegular color={COLORS.content.primary}>{title}</TitleRegular>\n\t\t)}\n\t\t{children}\n\t</div>\n);\n\ninterface ChartValueRowProps {\n\tvalue: ReactNode;\n\tchip?: ReactNode;\n}\n\nexport const ChartValueRow: React.FC<ChartValueRowProps> = ({\n\tvalue,\n\tchip,\n}) => (\n\t<div\n\t\tstyle={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}\n\t>\n\t\t<TitleMedium\n\t\t\tcolor={COLORS.content.primary}\n\t\t\tstyle={{ whiteSpace: 'nowrap' }}\n\t\t>\n\t\t\t{value}\n\t\t</TitleMedium>\n\t\t{chip && (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\t\t\tbackgroundColor: COLORS.surface.subdued,\n\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{chip}</BodyCaption>\n\t\t\t</div>\n\t\t)}\n\t</div>\n);\n"],"names":["ChartCard","title","padding","gap","dataTest","wrapperStyle","children","jsxs","COLORS","TitleRegular","ChartValueRow","value","chip","jsx","TitleMedium","BodyCaption"],"mappings":";;;AAiBO,MAAMA,IAAsC,CAAC;AAAA,EACnD,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,KAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AACD,MACC,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,aAAWH;AAAA,IACX,OAAO;AAAA,MACN,SAAS;AAAA,MACT,eAAe;AAAA,MACf,KAAAD;AAAA,MACA,OAAO;AAAA,MACP,SAAAD;AAAA,MACA,cAAc;AAAA,MACd,QAAQ,aAAaM,EAAO,OAAO,OAAO;AAAA,MAC1C,iBAAiBA,EAAO,QAAQ;AAAA,MAChC,GAAGH;AAAA,IAAA;AAAA,IAGH,UAAA;AAAA,MAAAJ,uBACCQ,GAAA,EAAa,OAAOD,EAAO,QAAQ,SAAU,UAAAP,GAAM;AAAA,MAEpDK;AAAA,IAAA;AAAA,EAAA;AACF,GAQYI,IAA8C,CAAC;AAAA,EAC3D,OAAAC;AAAA,EACA,MAAAC;AACD,MACC,gBAAAL;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,OAAO,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,GAAG,UAAU,OAAA;AAAA,IAElE,UAAA;AAAA,MAAA,gBAAAM;AAAA,QAACC;AAAA,QAAA;AAAA,UACA,OAAON,EAAO,QAAQ;AAAA,UACtB,OAAO,EAAE,YAAY,SAAA;AAAA,UAEpB,UAAAG;AAAA,QAAA;AAAA,MAAA;AAAA,MAEDC,KACA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,OAAO;AAAA,YACN,SAAS;AAAA,YACT,YAAY;AAAA,YACZ,SAAS;AAAA,YACT,cAAc;AAAA,YACd,QAAQ,aAAaL,EAAO,OAAO,OAAO;AAAA,YAC1C,iBAAiBA,EAAO,QAAQ;AAAA,YAChC,YAAY;AAAA,UAAA;AAAA,UAGb,4BAACO,GAAA,EAAY,OAAOP,EAAO,QAAQ,WAAY,UAAAI,EAAA,CAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IACrD;AAAA,EAAA;AAEF;"}
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { ComparisonBarChartI } from './ComparisonBarChart.model';
3
+ export declare const ComparisonBarChart: React.FC<ComparisonBarChartI>;
@@ -0,0 +1,166 @@
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
+ import { useMemo as R, useState as $ } from "react";
3
+ import { BodyCaption as b } from "../../../TypographyStyle.js";
4
+ import { COLORS as n } from "../../../../constants/Theme.js";
5
+ import { ChartCard as w, ChartValueRow as L } from "../ChartLayout.js";
6
+ import { pickColor as B, COMPARISON_BAR_COLORS as O } from "../chartPalette.js";
7
+ import { toChartValue as d, formatPercent as S, clamp as C, formatChartValue as A } from "../formatChartValue.js";
8
+ const M = Array.from(
9
+ { length: 2 },
10
+ (e, i) => ({ key: `placeholder-${i}`, label: "", value: 0 })
11
+ ), E = ({
12
+ row: { bar: e, fillWidth: i, color: s, percentageLabel: l },
13
+ labelWidth: c,
14
+ barHeight: m,
15
+ showTooltip: h,
16
+ locale: u
17
+ }) => {
18
+ const [f, t] = $(!1);
19
+ return /* @__PURE__ */ p("div", { style: { display: "flex", alignItems: "center", gap: 32 }, children: [
20
+ /* @__PURE__ */ p(
21
+ "div",
22
+ {
23
+ style: {
24
+ width: c,
25
+ flexShrink: 0,
26
+ display: "flex",
27
+ flexDirection: "column",
28
+ gap: 8
29
+ },
30
+ children: [
31
+ /* @__PURE__ */ o(b, { color: n.content.secondary, children: e.label }),
32
+ /* @__PURE__ */ o(
33
+ L,
34
+ {
35
+ value: e.valueLabel ?? A(d(e.value), u),
36
+ chip: l
37
+ }
38
+ )
39
+ ]
40
+ }
41
+ ),
42
+ /* @__PURE__ */ p(
43
+ "div",
44
+ {
45
+ "data-test": `comparison-bar-chart-bar-${e.key}`,
46
+ onMouseEnter: () => t(!0),
47
+ onMouseLeave: () => t(!1),
48
+ style: { position: "relative", flex: 1, height: m },
49
+ children: [
50
+ /* @__PURE__ */ o(
51
+ "div",
52
+ {
53
+ "data-test": `comparison-bar-chart-track-${e.key}`,
54
+ style: {
55
+ position: "absolute",
56
+ inset: 0,
57
+ borderRadius: 4,
58
+ border: `1px solid ${n.stroke.primary}`,
59
+ backgroundColor: n.surface.standard,
60
+ overflow: "hidden"
61
+ },
62
+ children: /* @__PURE__ */ o(
63
+ "div",
64
+ {
65
+ "data-test": `comparison-bar-chart-fill-${e.key}`,
66
+ style: {
67
+ position: "absolute",
68
+ top: 0,
69
+ left: 0,
70
+ bottom: 0,
71
+ width: `${i}%`,
72
+ backgroundColor: s
73
+ }
74
+ }
75
+ )
76
+ }
77
+ ),
78
+ h && f && /* @__PURE__ */ p(
79
+ "div",
80
+ {
81
+ "data-test": `comparison-bar-chart-tooltip-${e.key}`,
82
+ style: {
83
+ position: "absolute",
84
+ top: "50%",
85
+ left: `${C(i / 2, 8, 92)}%`,
86
+ transform: "translate(-50%, -50%)",
87
+ padding: "4px 8px",
88
+ borderRadius: 4,
89
+ backgroundColor: n.content.primary,
90
+ boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.12)",
91
+ pointerEvents: "none"
92
+ },
93
+ children: [
94
+ /* @__PURE__ */ o(
95
+ "div",
96
+ {
97
+ style: {
98
+ position: "absolute",
99
+ top: -5,
100
+ left: "50%",
101
+ transform: "translateX(-50%)",
102
+ width: 0,
103
+ height: 0,
104
+ borderLeft: "5px solid transparent",
105
+ borderRight: "5px solid transparent",
106
+ borderBottom: `5px solid ${n.content.primary}`
107
+ }
108
+ }
109
+ ),
110
+ /* @__PURE__ */ o(b, { color: n.content.primaryInverse, children: l })
111
+ ]
112
+ }
113
+ )
114
+ ]
115
+ }
116
+ )
117
+ ] });
118
+ }, N = ({
119
+ bars: e = [],
120
+ title: i,
121
+ total: s,
122
+ colors: l = O,
123
+ labelWidth: c = 180,
124
+ barHeight: m = 52,
125
+ locale: h,
126
+ showTooltip: u = !0,
127
+ wrapperStyle: f
128
+ }) => {
129
+ const t = e.some((r) => d(r.value) > 0), v = e.length ? e : M, k = R(() => {
130
+ const r = s !== void 0 ? d(s) : v.reduce((a, y) => a + d(y.value), 0);
131
+ return v.map((a, y) => {
132
+ const x = a.percentage ?? (r > 0 ? d(a.value) / r * 100 : 0), g = Number.isFinite(x) ? Math.max(x, 0) : 0;
133
+ return {
134
+ bar: a,
135
+ fillWidth: C(g, 0, 100),
136
+ color: t ? a.color ?? B(l, y) : void 0,
137
+ percentageLabel: t ? a.percentageLabel ?? `${S(g)}%` : ""
138
+ };
139
+ });
140
+ }, [v, s, l, t]);
141
+ return /* @__PURE__ */ o(
142
+ w,
143
+ {
144
+ dataTest: "comparison-bar-chart",
145
+ title: i,
146
+ padding: 24,
147
+ gap: 24,
148
+ wrapperStyle: f,
149
+ children: k.map((r) => /* @__PURE__ */ o(
150
+ E,
151
+ {
152
+ row: r,
153
+ labelWidth: c,
154
+ barHeight: m,
155
+ showTooltip: u && t,
156
+ locale: h
157
+ },
158
+ r.bar.key
159
+ ))
160
+ }
161
+ );
162
+ };
163
+ export {
164
+ N as ComparisonBarChart
165
+ };
166
+ //# sourceMappingURL=ComparisonBarChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComparisonBarChart.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { BodyCaption } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ChartCard, ChartValueRow } from '../ChartLayout';\nimport { COMPARISON_BAR_COLORS, pickColor } from '../chartPalette';\nimport {\n\tclamp,\n\tformatChartValue,\n\tformatPercent,\n\ttoChartValue,\n} from '../formatChartValue';\nimport type {\n\tComparisonBarChartI,\n\tComparisonBarI,\n} from './ComparisonBarChart.model';\n\nconst PLACEHOLDER_BARS: ComparisonBarI[] = Array.from(\n\t{ length: 2 },\n\t(_, index) => ({ key: `placeholder-${index}`, label: '', value: 0 }),\n);\n\ninterface PreparedBar {\n\tbar: ComparisonBarI;\n\tfillWidth: number;\n\tcolor?: string;\n\tpercentageLabel: string;\n}\n\ninterface BarRowProps {\n\trow: PreparedBar;\n\tlabelWidth: number;\n\tbarHeight: number;\n\tshowTooltip: boolean;\n\tlocale?: string;\n}\n\nconst BarRow: React.FC<BarRowProps> = ({\n\trow: { bar, fillWidth, color, percentageLabel },\n\tlabelWidth,\n\tbarHeight,\n\tshowTooltip,\n\tlocale,\n}) => {\n\tconst [isHovered, setIsHovered] = useState(false);\n\n\treturn (\n\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 32 }}>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\twidth: labelWidth,\n\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tgap: 8,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodyCaption color={COLORS.content.secondary}>{bar.label}</BodyCaption>\n\t\t\t\t<ChartValueRow\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tbar.valueLabel ?? formatChartValue(toChartValue(bar.value), locale)\n\t\t\t\t\t}\n\t\t\t\t\tchip={percentageLabel}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<div\n\t\t\t\tdata-test={`comparison-bar-chart-bar-${bar.key}`}\n\t\t\t\tonMouseEnter={() => setIsHovered(true)}\n\t\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\t\tstyle={{ position: 'relative', flex: 1, height: barHeight }}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tdata-test={`comparison-bar-chart-track-${bar.key}`}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\tborder: `1px solid ${COLORS.stroke.primary}`,\n\t\t\t\t\t\tbackgroundColor: COLORS.surface.standard,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-test={`comparison-bar-chart-fill-${bar.key}`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\twidth: `${fillWidth}%`,\n\t\t\t\t\t\t\tbackgroundColor: color,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{showTooltip && isHovered && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tdata-test={`comparison-bar-chart-tooltip-${bar.key}`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\ttop: '50%',\n\t\t\t\t\t\t\tleft: `${clamp(fillWidth / 2, 8, 92)}%`,\n\t\t\t\t\t\t\ttransform: 'translate(-50%, -50%)',\n\t\t\t\t\t\t\tpadding: '4px 8px',\n\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\tbackgroundColor: COLORS.content.primary,\n\t\t\t\t\t\t\tboxShadow: '0px 2px 4px rgba(0, 0, 0, 0.12)',\n\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\ttop: -5,\n\t\t\t\t\t\t\t\tleft: '50%',\n\t\t\t\t\t\t\t\ttransform: 'translateX(-50%)',\n\t\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\t\tborderLeft: '5px solid transparent',\n\t\t\t\t\t\t\t\tborderRight: '5px solid transparent',\n\t\t\t\t\t\t\t\tborderBottom: `5px solid ${COLORS.content.primary}`,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.primaryInverse}>\n\t\t\t\t\t\t\t{percentageLabel}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport const ComparisonBarChart: React.FC<ComparisonBarChartI> = ({\n\tbars = [],\n\ttitle,\n\ttotal,\n\tcolors = COMPARISON_BAR_COLORS,\n\tlabelWidth = 180,\n\tbarHeight = 52,\n\tlocale,\n\tshowTooltip = true,\n\twrapperStyle,\n}) => {\n\tconst hasData = bars.some((bar) => toChartValue(bar.value) > 0);\n\tconst visibleBars = bars.length ? bars : PLACEHOLDER_BARS;\n\n\tconst rows = useMemo<PreparedBar[]>(() => {\n\t\tconst denominator =\n\t\t\ttotal !== undefined\n\t\t\t\t? toChartValue(total)\n\t\t\t\t: visibleBars.reduce((sum, bar) => sum + toChartValue(bar.value), 0);\n\n\t\treturn visibleBars.map((bar, index) => {\n\t\t\tconst percentage =\n\t\t\t\tbar.percentage ??\n\t\t\t\t(denominator > 0 ? (toChartValue(bar.value) / denominator) * 100 : 0);\n\t\t\tconst share = Number.isFinite(percentage) ? Math.max(percentage, 0) : 0;\n\t\t\treturn {\n\t\t\t\tbar,\n\t\t\t\tfillWidth: clamp(share, 0, 100),\n\t\t\t\tcolor: hasData ? bar.color ?? pickColor(colors, index) : undefined,\n\t\t\t\tpercentageLabel: hasData\n\t\t\t\t\t? bar.percentageLabel ?? `${formatPercent(share)}%`\n\t\t\t\t\t: '',\n\t\t\t};\n\t\t});\n\t}, [visibleBars, total, colors, hasData]);\n\n\treturn (\n\t\t<ChartCard\n\t\t\tdataTest=\"comparison-bar-chart\"\n\t\t\ttitle={title}\n\t\t\tpadding={24}\n\t\t\tgap={24}\n\t\t\twrapperStyle={wrapperStyle}\n\t\t>\n\t\t\t{rows.map((row) => (\n\t\t\t\t<BarRow\n\t\t\t\t\tkey={row.bar.key}\n\t\t\t\t\trow={row}\n\t\t\t\t\tlabelWidth={labelWidth}\n\t\t\t\t\tbarHeight={barHeight}\n\t\t\t\t\tshowTooltip={showTooltip && hasData}\n\t\t\t\t\tlocale={locale}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</ChartCard>\n\t);\n};\n"],"names":["PLACEHOLDER_BARS","_","index","BarRow","bar","fillWidth","color","percentageLabel","labelWidth","barHeight","showTooltip","locale","isHovered","setIsHovered","useState","jsxs","jsx","BodyCaption","COLORS","ChartValueRow","formatChartValue","toChartValue","clamp","ComparisonBarChart","bars","title","total","colors","COMPARISON_BAR_COLORS","wrapperStyle","hasData","visibleBars","rows","useMemo","denominator","sum","percentage","share","pickColor","formatPercent","ChartCard","row"],"mappings":";;;;;;;AAgBA,MAAMA,IAAqC,MAAM;AAAA,EAChD,EAAE,QAAQ,EAAA;AAAA,EACV,CAACC,GAAGC,OAAW,EAAE,KAAK,eAAeA,CAAK,IAAI,OAAO,IAAI,OAAO,EAAA;AACjE,GAiBMC,IAAgC,CAAC;AAAA,EACtC,KAAK,EAAE,KAAAC,GAAK,WAAAC,GAAW,OAAAC,GAAO,iBAAAC,EAAA;AAAA,EAC9B,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK;AAEhD,SACC,gBAAAC,EAAC,OAAA,EAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,GAAA,GACzD,UAAA;AAAA,IAAA,gBAAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,OAAO;AAAA,UACN,OAAOP;AAAA,UACP,YAAY;AAAA,UACZ,SAAS;AAAA,UACT,eAAe;AAAA,UACf,KAAK;AAAA,QAAA;AAAA,QAGN,UAAA;AAAA,UAAA,gBAAAQ,EAACC,KAAY,OAAOC,EAAO,QAAQ,WAAY,YAAI,OAAM;AAAA,UACzD,gBAAAF;AAAA,YAACG;AAAA,YAAA;AAAA,cACA,OACCf,EAAI,cAAcgB,EAAiBC,EAAajB,EAAI,KAAK,GAAGO,CAAM;AAAA,cAEnE,MAAMJ;AAAA,YAAA;AAAA,UAAA;AAAA,QACP;AAAA,MAAA;AAAA,IAAA;AAAA,IAGD,gBAAAQ;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,aAAW,4BAA4BX,EAAI,GAAG;AAAA,QAC9C,cAAc,MAAMS,EAAa,EAAI;AAAA,QACrC,cAAc,MAAMA,EAAa,EAAK;AAAA,QACtC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AACN,GAAaL,GAAOC,GAAQG,CAAO,CAAC;AAExC,SACC,gBAAAd;AAAA,IAACwB;AAAA,IAAA;AAAA,MACA,UAAS;AAAA,MACT,OAAAf;AAAA,MACA,SAAS;AAAA,MACT,KAAK;AAAA,MACL,cAAAI;AAAA,MAEC,UAAAG,EAAK,IAAI,CAACS,MACV,gBAAAzB;AAAA,QAACb;AAAA,QAAA;AAAA,UAEA,KAAAsC;AAAA,UACA,YAAAjC;AAAA,UACA,WAAAC;AAAA,UACA,aAAaC,KAAeoB;AAAA,UAC5B,QAAAnB;AAAA,QAAA;AAAA,QALK8B,EAAI,IAAI;AAAA,MAAA,CAOd;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
@@ -0,0 +1,21 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface ComparisonBarI {
3
+ key: string;
4
+ label: string;
5
+ value: number;
6
+ valueLabel?: string;
7
+ percentage?: number;
8
+ percentageLabel?: string;
9
+ color?: string;
10
+ }
11
+ export interface ComparisonBarChartI {
12
+ bars: ComparisonBarI[];
13
+ title?: string;
14
+ total?: number;
15
+ colors?: string[];
16
+ labelWidth?: number;
17
+ barHeight?: number;
18
+ locale?: string;
19
+ showTooltip?: boolean;
20
+ wrapperStyle?: CSSProperties;
21
+ }
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { FunnelChartI } from './FunnelChart.model';
3
+ export declare const FunnelChart: React.FC<FunnelChartI>;
@@ -0,0 +1,176 @@
1
+ import { jsx as o, jsxs as y } from "react/jsx-runtime";
2
+ import { useMemo as m } from "react";
3
+ import { BodyTiny as L } from "../../../TypographyStyle.js";
4
+ import { COLORS as v } from "../../../../constants/Theme.js";
5
+ import { ChartCard as w, ChartValueRow as x } from "../ChartLayout.js";
6
+ import { pickColor as S, FUNNEL_BAND_COLORS as $ } from "../chartPalette.js";
7
+ import { toChartValue as d, formatPercent as E, formatChartValue as O } from "../formatChartValue.js";
8
+ import { buildFunnelLayout as R, FUNNEL_VIEW_WIDTH as k } from "./funnelGeometry.js";
9
+ const _ = Array.from(
10
+ { length: 4 },
11
+ (t, a) => ({ key: `placeholder-${a}`, label: "", value: 0 })
12
+ ), A = (t, a) => {
13
+ const r = t[a];
14
+ if (r.percentageLabel !== void 0)
15
+ return r.percentageLabel;
16
+ if (a === 0)
17
+ return d(r.value) > 0 ? "100%" : "";
18
+ const l = r.branchOf ? t.find((h) => h.key === r.branchOf) : t[a - 1], n = d(l?.value);
19
+ if (!l || n === 0)
20
+ return "";
21
+ const f = d(r.value) / n * 100;
22
+ return `${E(f)}% of ${l.label}`;
23
+ }, g = ({
24
+ left: t,
25
+ height: a
26
+ }) => /* @__PURE__ */ o(
27
+ "div",
28
+ {
29
+ style: {
30
+ position: "absolute",
31
+ top: 0,
32
+ bottom: a === void 0 ? 0 : void 0,
33
+ height: a,
34
+ left: t,
35
+ width: 1,
36
+ backgroundColor: v.stroke.primary
37
+ }
38
+ }
39
+ ), D = ({
40
+ stage: t,
41
+ color: a,
42
+ chip: r,
43
+ locale: l
44
+ }) => /* @__PURE__ */ y(
45
+ "div",
46
+ {
47
+ "data-test": `funnel-chart-header-${t.key}`,
48
+ style: {
49
+ flex: 1,
50
+ minWidth: 0,
51
+ display: "flex",
52
+ flexDirection: "column",
53
+ gap: 8,
54
+ alignItems: "flex-start",
55
+ padding: "0 8px 0 12px"
56
+ },
57
+ children: [
58
+ t.label && /* @__PURE__ */ y(
59
+ "div",
60
+ {
61
+ style: {
62
+ display: "flex",
63
+ alignItems: "center",
64
+ gap: 8,
65
+ width: "100%",
66
+ opacity: 0.8
67
+ },
68
+ children: [
69
+ /* @__PURE__ */ o(
70
+ "span",
71
+ {
72
+ style: {
73
+ width: 16,
74
+ height: 16,
75
+ borderRadius: 2.667,
76
+ backgroundColor: a,
77
+ flexShrink: 0
78
+ }
79
+ }
80
+ ),
81
+ /* @__PURE__ */ o(L, { color: v.content.secondary, children: t.label })
82
+ ]
83
+ }
84
+ ),
85
+ /* @__PURE__ */ o(
86
+ x,
87
+ {
88
+ value: t.valueLabel ?? O(d(t.value), l),
89
+ chip: r
90
+ }
91
+ )
92
+ ]
93
+ }
94
+ ), j = ({
95
+ stages: t = [],
96
+ title: a,
97
+ plotHeight: r = 291,
98
+ headerHeight: l = 83,
99
+ colors: n = $,
100
+ locale: f,
101
+ wrapperStyle: h
102
+ }) => {
103
+ const i = t.length ? t : _, s = m(
104
+ () => R(i, { plotHeight: r, headerHeight: l }),
105
+ [i, r, l]
106
+ ), c = !s.isEmpty, b = (e) => `${e / k * 100}%`, u = m(
107
+ () => i.map((e, p) => ({
108
+ stage: e,
109
+ color: c ? e.color ?? S(n, p) : v.content.inactive,
110
+ chip: c ? A(i, p) : ""
111
+ })),
112
+ [i, n, c]
113
+ ), C = m(
114
+ () => new Map(u.map(({ stage: e, color: p }) => [e.key, p])),
115
+ [u]
116
+ );
117
+ return /* @__PURE__ */ o(
118
+ w,
119
+ {
120
+ dataTest: "funnel-chart",
121
+ title: a,
122
+ padding: "18px 24px",
123
+ gap: 14,
124
+ wrapperStyle: { overflow: "hidden", ...h },
125
+ children: /* @__PURE__ */ y("div", { style: { position: "relative", width: "100%", height: r }, children: [
126
+ /* @__PURE__ */ o(
127
+ "svg",
128
+ {
129
+ width: "100%",
130
+ height: "100%",
131
+ viewBox: `0 0 ${k} ${r}`,
132
+ preserveAspectRatio: "none",
133
+ "aria-hidden": !0,
134
+ style: { position: "absolute", inset: 0 },
135
+ children: s.bands.map((e) => /* @__PURE__ */ o(
136
+ "path",
137
+ {
138
+ "data-test": `funnel-chart-band-${e.key}`,
139
+ d: e.d,
140
+ fill: c ? C.get(e.key) : "transparent"
141
+ },
142
+ e.key
143
+ ))
144
+ }
145
+ ),
146
+ s.separators.full.map((e) => /* @__PURE__ */ o(g, { left: b(e) }, `full-${e}`)),
147
+ s.separators.header.map((e) => /* @__PURE__ */ o(
148
+ g,
149
+ {
150
+ left: b(e),
151
+ height: l
152
+ },
153
+ `header-${e}`
154
+ )),
155
+ /* @__PURE__ */ o(
156
+ "div",
157
+ {
158
+ style: {
159
+ position: "absolute",
160
+ top: 0,
161
+ left: 0,
162
+ right: 0,
163
+ height: l,
164
+ display: "flex"
165
+ },
166
+ children: u.map((e) => /* @__PURE__ */ o(D, { ...e, locale: f }, e.stage.key))
167
+ }
168
+ )
169
+ ] })
170
+ }
171
+ );
172
+ };
173
+ export {
174
+ j as FunnelChart
175
+ };
176
+ //# sourceMappingURL=FunnelChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FunnelChart.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { BodyTiny } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { ChartCard, ChartValueRow } from '../ChartLayout';\nimport { FUNNEL_BAND_COLORS, pickColor } from '../chartPalette';\nimport {\n\tformatChartValue,\n\tformatPercent,\n\ttoChartValue,\n} from '../formatChartValue';\nimport type { FunnelChartI, FunnelStageI } from './FunnelChart.model';\nimport { buildFunnelLayout, FUNNEL_VIEW_WIDTH } from './funnelGeometry';\n\nconst PLACEHOLDER_STAGES: FunnelStageI[] = Array.from(\n\t{ length: 4 },\n\t(_, index) => ({ key: `placeholder-${index}`, label: '', value: 0 }),\n);\n\nconst derivePercentageLabel = (\n\tstages: FunnelStageI[],\n\tindex: number,\n): string => {\n\tconst stage = stages[index];\n\tif (stage.percentageLabel !== undefined) {\n\t\treturn stage.percentageLabel;\n\t}\n\tif (index === 0) {\n\t\treturn toChartValue(stage.value) > 0 ? '100%' : '';\n\t}\n\tconst reference = stage.branchOf\n\t\t? stages.find((candidate) => candidate.key === stage.branchOf)\n\t\t: stages[index - 1];\n\tconst referenceValue = toChartValue(reference?.value);\n\tif (!reference || referenceValue === 0) {\n\t\treturn '';\n\t}\n\tconst share = (toChartValue(stage.value) / referenceValue) * 100;\n\treturn `${formatPercent(share)}% of ${reference.label}`;\n};\n\nconst Separator: React.FC<{ left: string; height?: number }> = ({\n\tleft,\n\theight,\n}) => (\n\t<div\n\t\tstyle={{\n\t\t\tposition: 'absolute',\n\t\t\ttop: 0,\n\t\t\tbottom: height === undefined ? 0 : undefined,\n\t\t\theight,\n\t\t\tleft,\n\t\t\twidth: 1,\n\t\t\tbackgroundColor: COLORS.stroke.primary,\n\t\t}}\n\t/>\n);\n\ninterface StageHeaderProps {\n\tstage: FunnelStageI;\n\tcolor?: string;\n\tchip: string;\n\tlocale?: string;\n}\n\nconst StageHeader: React.FC<StageHeaderProps> = ({\n\tstage,\n\tcolor,\n\tchip,\n\tlocale,\n}) => (\n\t<div\n\t\tdata-test={`funnel-chart-header-${stage.key}`}\n\t\tstyle={{\n\t\t\tflex: 1,\n\t\t\tminWidth: 0,\n\t\t\tdisplay: 'flex',\n\t\t\tflexDirection: 'column',\n\t\t\tgap: 8,\n\t\t\talignItems: 'flex-start',\n\t\t\tpadding: '0 8px 0 12px',\n\t\t}}\n\t>\n\t\t{stage.label && (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tgap: 8,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\topacity: 0.8,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\twidth: 16,\n\t\t\t\t\t\theight: 16,\n\t\t\t\t\t\tborderRadius: 2.667,\n\t\t\t\t\t\tbackgroundColor: color,\n\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t<BodyTiny color={COLORS.content.secondary}>{stage.label}</BodyTiny>\n\t\t\t</div>\n\t\t)}\n\t\t<ChartValueRow\n\t\t\tvalue={\n\t\t\t\tstage.valueLabel ?? formatChartValue(toChartValue(stage.value), locale)\n\t\t\t}\n\t\t\tchip={chip}\n\t\t/>\n\t</div>\n);\n\nexport const FunnelChart: React.FC<FunnelChartI> = ({\n\tstages = [],\n\ttitle,\n\tplotHeight = 291,\n\theaderHeight = 83,\n\tcolors = FUNNEL_BAND_COLORS,\n\tlocale,\n\twrapperStyle,\n}) => {\n\tconst visibleStages = stages.length ? stages : PLACEHOLDER_STAGES;\n\n\tconst layout = useMemo(\n\t\t() => buildFunnelLayout(visibleStages, { plotHeight, headerHeight }),\n\t\t[visibleStages, plotHeight, headerHeight],\n\t);\n\n\tconst hasData = !layout.isEmpty;\n\tconst toPercent = (x: number) => `${(x / FUNNEL_VIEW_WIDTH) * 100}%`;\n\n\tconst headers = useMemo(\n\t\t() =>\n\t\t\tvisibleStages.map((stage, index) => ({\n\t\t\t\tstage,\n\t\t\t\tcolor: hasData\n\t\t\t\t\t? stage.color ?? pickColor(colors, index)\n\t\t\t\t\t: COLORS.content.inactive,\n\t\t\t\tchip: hasData ? derivePercentageLabel(visibleStages, index) : '',\n\t\t\t})),\n\t\t[visibleStages, colors, hasData],\n\t);\n\n\tconst colorByStage = useMemo(\n\t\t() => new Map(headers.map(({ stage, color }) => [stage.key, color])),\n\t\t[headers],\n\t);\n\n\treturn (\n\t\t<ChartCard\n\t\t\tdataTest=\"funnel-chart\"\n\t\t\ttitle={title}\n\t\t\tpadding=\"18px 24px\"\n\t\t\tgap={14}\n\t\t\twrapperStyle={{ overflow: 'hidden', ...wrapperStyle }}\n\t\t>\n\t\t\t<div style={{ position: 'relative', width: '100%', height: plotHeight }}>\n\t\t\t\t<svg\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tviewBox={`0 0 ${FUNNEL_VIEW_WIDTH} ${plotHeight}`}\n\t\t\t\t\tpreserveAspectRatio=\"none\"\n\t\t\t\t\taria-hidden\n\t\t\t\t\tstyle={{ position: 'absolute', inset: 0 }}\n\t\t\t\t>\n\t\t\t\t\t{layout.bands.map((band) => (\n\t\t\t\t\t\t<path\n\t\t\t\t\t\t\tkey={band.key}\n\t\t\t\t\t\t\tdata-test={`funnel-chart-band-${band.key}`}\n\t\t\t\t\t\t\td={band.d}\n\t\t\t\t\t\t\tfill={hasData ? colorByStage.get(band.key) : 'transparent'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</svg>\n\n\t\t\t\t{layout.separators.full.map((x) => (\n\t\t\t\t\t<Separator key={`full-${x}`} left={toPercent(x)} />\n\t\t\t\t))}\n\t\t\t\t{layout.separators.header.map((x) => (\n\t\t\t\t\t<Separator\n\t\t\t\t\t\tkey={`header-${x}`}\n\t\t\t\t\t\tleft={toPercent(x)}\n\t\t\t\t\t\theight={headerHeight}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\theight: headerHeight,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{headers.map((header) => (\n\t\t\t\t\t\t<StageHeader key={header.stage.key} {...header} locale={locale} />\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</ChartCard>\n\t);\n};\n"],"names":["PLACEHOLDER_STAGES","_","index","derivePercentageLabel","stages","stage","toChartValue","reference","candidate","referenceValue","share","formatPercent","Separator","left","height","jsx","COLORS","StageHeader","color","chip","locale","jsxs","BodyTiny","ChartValueRow","formatChartValue","FunnelChart","title","plotHeight","headerHeight","colors","FUNNEL_BAND_COLORS","wrapperStyle","visibleStages","layout","useMemo","buildFunnelLayout","hasData","toPercent","x","FUNNEL_VIEW_WIDTH","headers","pickColor","colorByStage","ChartCard","band","header"],"mappings":";;;;;;;;AAaA,MAAMA,IAAqC,MAAM;AAAA,EAChD,EAAE,QAAQ,EAAA;AAAA,EACV,CAACC,GAAGC,OAAW,EAAE,KAAK,eAAeA,CAAK,IAAI,OAAO,IAAI,OAAO,EAA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OAAO,IAAI,CAACK,MAC9B,gBAAAvB;AAAA,UAACH;AAAA,UAAA;AAAA,YAEA,MAAMyB,EAAUC,CAAC;AAAA,YACjB,QAAQV;AAAA,UAAA;AAAA,UAFH,UAAUU,CAAC;AAAA,QAAA,CAIjB;AAAA,QAED,gBAAAvB;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,OAAO;AAAA,cACN,UAAU;AAAA,cACV,KAAK;AAAA,cACL,MAAM;AAAA,cACN,OAAO;AAAA,cACP,QAAQa;AAAA,cACR,SAAS;AAAA,YAAA;AAAA,YAGT,UAAAY,EAAQ,IAAI,CAACK,MACb,gBAAA9B,EAACE,GAAA,EAAoC,GAAG4B,GAAQ,QAAAzB,EAAA,GAA9ByB,EAAO,MAAM,GAAiC,CAChE;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACD;AAAA,IAAA;AAAA,EAAA;AAGH;"}
@@ -0,0 +1,19 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface FunnelStageI {
3
+ key: string;
4
+ label: string;
5
+ value: number;
6
+ valueLabel?: string;
7
+ percentageLabel?: string;
8
+ color?: string;
9
+ branchOf?: string;
10
+ }
11
+ export interface FunnelChartI {
12
+ stages: FunnelStageI[];
13
+ title?: string;
14
+ plotHeight?: number;
15
+ headerHeight?: number;
16
+ colors?: string[];
17
+ locale?: string;
18
+ wrapperStyle?: CSSProperties;
19
+ }
@@ -0,0 +1,23 @@
1
+ export declare const FUNNEL_VIEW_WIDTH = 1000;
2
+ export interface FunnelGeometryStage {
3
+ key: string;
4
+ value: number;
5
+ branchOf?: string;
6
+ }
7
+ export interface FunnelGeometryOptions {
8
+ plotHeight: number;
9
+ headerHeight: number;
10
+ }
11
+ export interface FunnelBandLayout {
12
+ key: string;
13
+ d: string;
14
+ }
15
+ export interface FunnelLayout {
16
+ bands: FunnelBandLayout[];
17
+ separators: {
18
+ full: number[];
19
+ header: number[];
20
+ };
21
+ isEmpty: boolean;
22
+ }
23
+ export declare const buildFunnelLayout: (stages: FunnelGeometryStage[], { plotHeight, headerHeight }: FunnelGeometryOptions) => FunnelLayout;
@@ -0,0 +1,48 @@
1
+ import { toChartValue as x, clamp as k } from "../formatChartValue.js";
2
+ const B = 1e3, a = (n) => Math.round(n * 100) / 100, F = (n) => n.reduce((c, s, o) => {
3
+ const r = c[c.length - 1];
4
+ return s.branchOf && r?.branchOf === s.branchOf ? r.stageIndexes.push(o) : c.push({ branchOf: s.branchOf, stageIndexes: [o] }), c;
5
+ }, []), N = (n, { plotHeight: c, headerHeight: s }) => {
6
+ const o = Math.max(c - s, 0), r = s + o / 2, b = x(n[0]?.value), $ = n.length === 0 || b === 0 || o === 0, p = (t) => a(t / n.length * B), g = (t) => $ ? 0 : k(t / b * o, 0, o), l = F(n);
7
+ let m = 0;
8
+ const h = l.map((t) => {
9
+ const e = p(m);
10
+ return m += t.stageIndexes.length, { x0: e, x1: p(m) };
11
+ }), I = l.map(
12
+ (t) => t.stageIndexes.reduce(
13
+ (e, u) => e + x(n[u].value),
14
+ 0
15
+ )
16
+ ), O = [];
17
+ return l.forEach((t, e) => {
18
+ const { x0: u, x1: T } = h[e], f = I[e], V = I[e + 1] ?? f, E = g(f), L = g(V);
19
+ let i = r - E / 2, d = r - L / 2;
20
+ t.stageIndexes.forEach((y) => {
21
+ const M = f > 0 ? x(n[y].value) / f : 0, v = i + E * M, C = d + L * M;
22
+ O.push({
23
+ key: n[y].key,
24
+ d: [
25
+ `M${u} ${a(i)}`,
26
+ `L${T} ${a(d)}`,
27
+ `L${T} ${a(C)}`,
28
+ `L${u} ${a(v)}`,
29
+ "Z"
30
+ ].join(" ")
31
+ }), i = v, d = C;
32
+ });
33
+ }), {
34
+ bands: O,
35
+ separators: {
36
+ full: h.length ? [h[0].x0, ...h.map((t) => t.x1)] : [],
37
+ header: l.flatMap(
38
+ (t) => t.stageIndexes.slice(1).map((e) => p(e))
39
+ )
40
+ },
41
+ isEmpty: $
42
+ };
43
+ };
44
+ export {
45
+ B as FUNNEL_VIEW_WIDTH,
46
+ N as buildFunnelLayout
47
+ };
48
+ //# sourceMappingURL=funnelGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"funnelGeometry.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.ts"],"sourcesContent":["import { clamp, toChartValue } from '../formatChartValue';\n\nexport const FUNNEL_VIEW_WIDTH = 1000;\n\nexport interface FunnelGeometryStage {\n\tkey: string;\n\tvalue: number;\n\tbranchOf?: string;\n}\n\nexport interface FunnelGeometryOptions {\n\tplotHeight: number;\n\theaderHeight: number;\n}\n\nexport interface FunnelBandLayout {\n\tkey: string;\n\td: string;\n}\n\nexport interface FunnelLayout {\n\tbands: FunnelBandLayout[];\n\tseparators: {\n\t\tfull: number[];\n\t\theader: number[];\n\t};\n\tisEmpty: boolean;\n}\n\ninterface ColumnGroup {\n\tbranchOf?: string;\n\tstageIndexes: number[];\n}\n\nconst round = (value: number) => Math.round(value * 100) / 100;\n\nconst groupIntoColumns = (stages: FunnelGeometryStage[]): ColumnGroup[] =>\n\tstages.reduce<ColumnGroup[]>((groups, stage, index) => {\n\t\tconst current = groups[groups.length - 1];\n\t\tif (stage.branchOf && current?.branchOf === stage.branchOf) {\n\t\t\tcurrent.stageIndexes.push(index);\n\t\t} else {\n\t\t\tgroups.push({ branchOf: stage.branchOf, stageIndexes: [index] });\n\t\t}\n\t\treturn groups;\n\t}, []);\n\nexport const buildFunnelLayout = (\n\tstages: FunnelGeometryStage[],\n\t{ plotHeight, headerHeight }: FunnelGeometryOptions,\n): FunnelLayout => {\n\tconst bandArea = Math.max(plotHeight - headerHeight, 0);\n\tconst centerY = headerHeight + bandArea / 2;\n\tconst baseValue = toChartValue(stages[0]?.value);\n\tconst isEmpty = stages.length === 0 || baseValue === 0 || bandArea === 0;\n\n\tconst toX = (cellIndex: number) =>\n\t\tround((cellIndex / stages.length) * FUNNEL_VIEW_WIDTH);\n\tconst heightOf = (value: number) =>\n\t\tisEmpty ? 0 : clamp((value / baseValue) * bandArea, 0, bandArea);\n\n\tconst groups = groupIntoColumns(stages);\n\tlet cellCursor = 0;\n\tconst columns = groups.map((group) => {\n\t\tconst x0 = toX(cellCursor);\n\t\tcellCursor += group.stageIndexes.length;\n\t\treturn { x0, x1: toX(cellCursor) };\n\t});\n\n\tconst columnTotals = groups.map((group) =>\n\t\tgroup.stageIndexes.reduce(\n\t\t\t(total, index) => total + toChartValue(stages[index].value),\n\t\t\t0,\n\t\t),\n\t);\n\n\tconst bands: FunnelBandLayout[] = [];\n\tgroups.forEach((group, columnIndex) => {\n\t\tconst { x0, x1 } = columns[columnIndex];\n\t\tconst leftTotal = columnTotals[columnIndex];\n\t\tconst rightTotal = columnTotals[columnIndex + 1] ?? leftTotal;\n\t\tconst leftHeight = heightOf(leftTotal);\n\t\tconst rightHeight = heightOf(rightTotal);\n\n\t\tlet leftTop = centerY - leftHeight / 2;\n\t\tlet rightTop = centerY - rightHeight / 2;\n\n\t\tgroup.stageIndexes.forEach((stageIndex) => {\n\t\t\tconst share =\n\t\t\t\tleftTotal > 0 ? toChartValue(stages[stageIndex].value) / leftTotal : 0;\n\t\t\tconst leftBottom = leftTop + leftHeight * share;\n\t\t\tconst rightBottom = rightTop + rightHeight * share;\n\t\t\tbands.push({\n\t\t\t\tkey: stages[stageIndex].key,\n\t\t\t\td: [\n\t\t\t\t\t`M${x0} ${round(leftTop)}`,\n\t\t\t\t\t`L${x1} ${round(rightTop)}`,\n\t\t\t\t\t`L${x1} ${round(rightBottom)}`,\n\t\t\t\t\t`L${x0} ${round(leftBottom)}`,\n\t\t\t\t\t'Z',\n\t\t\t\t].join(' '),\n\t\t\t});\n\t\t\tleftTop = leftBottom;\n\t\t\trightTop = rightBottom;\n\t\t});\n\t});\n\n\treturn {\n\t\tbands,\n\t\tseparators: {\n\t\t\tfull: columns.length ? [columns[0].x0, ...columns.map((c) => c.x1)] : [],\n\t\t\theader: groups.flatMap((group) =>\n\t\t\t\tgroup.stageIndexes.slice(1).map((index) => toX(index)),\n\t\t\t),\n\t\t},\n\t\tisEmpty,\n\t};\n};\n"],"names":["FUNNEL_VIEW_WIDTH","round","value","groupIntoColumns","stages","groups","stage","index","current","buildFunnelLayout","plotHeight","headerHeight","bandArea","centerY","baseValue","toChartValue","isEmpty","toX","cellIndex","heightOf","clamp","cellCursor","columns","group","x0","columnTotals","total","bands","columnIndex","x1","leftTotal","rightTotal","leftHeight","rightHeight","leftTop","rightTop","stageIndex","share","leftBottom","rightBottom","c"],"mappings":";AAEO,MAAMA,IAAoB,KAgC3BC,IAAQ,CAACC,MAAkB,KAAK,MAAMA,IAAQ,GAAG,IAAI,KAErDC,IAAmB,CAACC,MACzBA,EAAO,OAAsB,CAACC,GAAQC,GAAOC,MAAU;AACtD,QAAMC,IAAUH,EAAOA,EAAO,SAAS,CAAC;AACxC,SAAIC,EAAM,YAAYE,GAAS,aAAaF,EAAM,WACjDE,EAAQ,aAAa,KAAKD,CAAK,IAE/BF,EAAO,KAAK,EAAE,UAAUC,EAAM,UAAU,cAAc,CAACC,CAAK,GAAG,GAEzDF;AACR,GAAG,EAAE,GAEOI,IAAoB,CAChCL,GACA,EAAE,YAAAM,GAAY,cAAAC,QACI;AAClB,QAAMC,IAAW,KAAK,IAAIF,IAAaC,GAAc,CAAC,GAChDE,IAAUF,IAAeC,IAAW,GACpCE,IAAYC,EAAaX,EAAO,CAAC,GAAG,KAAK,GACzCY,IAAUZ,EAAO,WAAW,KAAKU,MAAc,KAAKF,MAAa,GAEjEK,IAAM,CAACC,MACZjB,EAAOiB,IAAYd,EAAO,SAAUJ,CAAiB,GAChDmB,IAAW,CAACjB,MACjBc,IAAU,IAAII,EAAOlB,IAAQY,IAAaF,GAAU,GAAGA,CAAQ,GAE1DP,IAASF,EAAiBC,CAAM;AACtC,MAAIiB,IAAa;AACjB,QAAMC,IAAUjB,EAAO,IAAI,CAACkB,MAAU;AACrC,UAAMC,IAAKP,EAAII,CAAU;AACzB,WAAAA,KAAcE,EA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ACX,MAAML,EAAQ,SAAS,CAACA,EAAQ,CAAC,EAAE,IAAI,GAAGA,EAAQ,IAAI,CAACkB,MAAMA,EAAE,EAAE,CAAC,IAAI,CAAA;AAAA,MACtE,QAAQnC,EAAO;AAAA,QAAQ,CAACkB,MACvBA,EAAM,aAAa,MAAM,CAAC,EAAE,IAAI,CAAChB,MAAUU,EAAIV,CAAK,CAAC;AAAA,MAAA;AAAA,IACtD;AAAA,IAED,SAAAS;AAAA,EAAA;AAEF;"}
@@ -65,7 +65,7 @@ const ae = (e, d, x) => {
65
65
  ], P = e.customBarColors ? e.customBarColors : e.customColourScaleBrand || e.customColourScalePastel ? e.colorSchema === E.PASTEL ? e.customColourScalePastel : e.customColourScaleBrand : e.colorSchema === E.PASTEL ? N : S, v = e.customHoverColour, Z = K(
66
66
  () => ({
67
67
  barPercentage: e?.barPercentage || 0.4,
68
- categoryPercentage: 1,
68
+ categoryPercentage: e?.categoryPercentage ?? 1,
69
69
  pointStyle: "circle",
70
70
  barWidth: e.barWidth,
71
71
  borderRadius: e?.borderRadius || void 0,