@bikdotai/bik-component-library 0.0.858-beta.1 → 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 (122) hide show
  1. package/README.md +4 -4
  2. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +23 -23
  3. package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
  4. package/dist/cjs/components/agent-builder/components/AiTextArea.js +1 -1
  5. package/dist/cjs/components/agent-builder/components/AiTextArea.js.map +1 -1
  6. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
  7. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
  8. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
  9. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
  10. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ChartLayout.js +2 -0
  11. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ChartLayout.js.map +1 -0
  12. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js +2 -0
  13. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js.map +1 -0
  14. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js +2 -0
  15. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js.map +1 -0
  16. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js +2 -0
  17. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js.map +1 -0
  18. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  19. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js.map +1 -1
  20. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.js.map +1 -1
  21. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/chartPalette.js +2 -0
  22. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/chartPalette.js.map +1 -0
  23. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/formatChartValue.js +2 -0
  24. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/formatChartValue.js.map +1 -0
  25. package/dist/cjs/components/bik-chatbot/components/ChatWindow.js +20 -20
  26. package/dist/cjs/components/bik-chatbot/components/ChatWindow.js.map +1 -1
  27. package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +2 -2
  28. package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js.map +1 -1
  29. package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +2 -2
  30. package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js.map +1 -1
  31. package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -1
  32. package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js.map +1 -1
  33. package/dist/cjs/components/input/ChipInput.js +1 -1
  34. package/dist/cjs/components/input/ChipInput.js.map +1 -1
  35. package/dist/cjs/components/input/Input-helper.js +1 -1
  36. package/dist/cjs/components/input/Input-helper.js.map +1 -1
  37. package/dist/cjs/components/input/Input.js +1 -1
  38. package/dist/cjs/components/input/Input.js.map +1 -1
  39. package/dist/cjs/components/plans/SubscriptionPlanSelector.js +5 -5
  40. package/dist/cjs/components/plans/SubscriptionPlanSelector.js.map +1 -1
  41. package/dist/cjs/editor/BikEditor.js +1 -1
  42. package/dist/cjs/editor/BikEditor.js.map +1 -1
  43. package/dist/cjs/editor/BikEditor.utils.js +3 -3
  44. package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
  45. package/dist/cjs/editor/extensions/buildExtensions.js +2 -2
  46. package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
  47. package/dist/cjs/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +2 -0
  48. package/dist/cjs/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +1 -0
  49. package/dist/cjs/helpers/sanitize.js +2 -0
  50. package/dist/cjs/helpers/sanitize.js.map +1 -0
  51. package/dist/cjs/index.js +1 -1
  52. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +144 -143
  53. package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js.map +1 -1
  54. package/dist/esm/components/agent-builder/components/AiTextArea.js +24 -23
  55. package/dist/esm/components/agent-builder/components/AiTextArea.js.map +1 -1
  56. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +38 -37
  57. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
  58. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +3 -0
  59. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +182 -172
  60. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js.map +1 -1
  61. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.d.ts +16 -0
  62. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.js +69 -0
  63. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ChartLayout.js.map +1 -0
  64. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.d.ts +3 -0
  65. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js +166 -0
  66. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.js.map +1 -0
  67. package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.model.d.ts +21 -0
  68. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.d.ts +3 -0
  69. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js +176 -0
  70. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.js.map +1 -0
  71. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.model.d.ts +19 -0
  72. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.d.ts +23 -0
  73. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js +48 -0
  74. package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/funnelGeometry.js.map +1 -0
  75. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  76. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js.map +1 -1
  77. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +1 -0
  78. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.js.map +1 -1
  79. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.d.ts +3 -0
  80. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.js +18 -0
  81. package/dist/esm/components/analytics-chips-and-dropdowns/chart/chartPalette.js.map +1 -0
  82. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.d.ts +4 -0
  83. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.js +13 -0
  84. package/dist/esm/components/analytics-chips-and-dropdowns/chart/formatChartValue.js.map +1 -0
  85. package/dist/esm/components/analytics-chips-and-dropdowns/index.d.ts +4 -0
  86. package/dist/esm/components/bik-chatbot/components/ChatWindow.js +54 -53
  87. package/dist/esm/components/bik-chatbot/components/ChatWindow.js.map +1 -1
  88. package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +346 -420
  89. package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js.map +1 -1
  90. package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +35 -33
  91. package/dist/esm/components/feature-announcements/MajorUpdatePopup.js.map +1 -1
  92. package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +48 -47
  93. package/dist/esm/components/feature-announcements/MinorUpdatePopup.js.map +1 -1
  94. package/dist/esm/components/feature-announcements/types/props.types.d.ts +2 -2
  95. package/dist/esm/components/input/ChipInput.js +41 -40
  96. package/dist/esm/components/input/ChipInput.js.map +1 -1
  97. package/dist/esm/components/input/Input-helper.d.ts +7 -0
  98. package/dist/esm/components/input/Input-helper.js +16 -25
  99. package/dist/esm/components/input/Input-helper.js.map +1 -1
  100. package/dist/esm/components/input/Input.js +59 -57
  101. package/dist/esm/components/input/Input.js.map +1 -1
  102. package/dist/esm/components/input/Input.model.d.ts +1 -0
  103. package/dist/esm/components/plans/SubscriptionPlanSelector.js +42 -40
  104. package/dist/esm/components/plans/SubscriptionPlanSelector.js.map +1 -1
  105. package/dist/esm/editor/BikEditor.js +221 -217
  106. package/dist/esm/editor/BikEditor.js.map +1 -1
  107. package/dist/esm/editor/BikEditor.utils.d.ts +1 -1
  108. package/dist/esm/editor/BikEditor.utils.js +141 -140
  109. package/dist/esm/editor/BikEditor.utils.js.map +1 -1
  110. package/dist/esm/editor/extensions/buildExtensions.js +35 -25
  111. package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
  112. package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.d.ts +13 -0
  113. package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js +64 -0
  114. package/dist/esm/editor/extensions/htmlTagStrip/HtmlTagStripExtension.js.map +1 -0
  115. package/dist/esm/helpers/index.d.ts +1 -0
  116. package/dist/esm/helpers/sanitize.d.ts +32 -0
  117. package/dist/esm/helpers/sanitize.js +207 -0
  118. package/dist/esm/helpers/sanitize.js.map +1 -0
  119. package/dist/esm/icons/index.d.ts +1 -1
  120. package/dist/esm/index.js +429 -415
  121. package/dist/esm/index.js.map +1 -1
  122. package/package.json +2 -1
@@ -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,K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AM,aAAa,QAAQ,CAACa,MAAe;AAC1C,YAAMC,IACLP,IAAY,IAAIf,EAAaX,EAAOgC,CAAU,EAAE,KAAK,IAAIN,IAAY,GAChEQ,IAAaJ,IAAUF,IAAaK,GACpCE,IAAcJ,IAAWF,IAAcI;AAC7C,MAAAV,EAAM,KAAK;AAAA,QACV,KAAKvB,EAAOgC,CAAU,EAAE;AAAA,QACxB,GAAG;AAAA,UACF,IAAIZ,CAAE,IAAIvB,EAAMiC,CAAO,CAAC;AAAA,UACxB,IAAIL,CAAE,IAAI5B,EAAMkC,CAAQ,CAAC;AAAA,UACzB,IAAIN,CAAE,IAAI5B,EAAMsC,CAAW,CAAC;AAAA,UAC5B,IAAIf,CAAE,IAAIvB,EAAMqC,CAAU,CAAC;AAAA,UAC3B;AAAA,QAAA,EACC,KAAK,GAAG;AAAA,MAAA,CACV,GACDJ,IAAUI,GACVH,IAAWI;AAAA,IACZ,CAAC;AAAA,EACF,CAAC,GAEM;AAAA,IACN,OAAAZ;AAAA,IACA,YAAY;AAAA,MACX,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,
@@ -1 +1 @@
1
- {"version":3,"file":"StackedBarChart.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.tsx"],"sourcesContent":["import MaximizeIcon from '@src/assets/icons/maximize.svg';\nimport {\n\tBarElement,\n\tCategoryScale,\n\tChart as ChartJS,\n\tLegend,\n\tLinearScale,\n\tTooltip,\n} from 'chart.js';\nimport ChartDataLabels from 'chartjs-plugin-datalabels';\nimport { useMemo, useState } from 'react';\nimport { Bar } from 'react-chartjs-2';\nimport { IconButton } from '@src/components/icon-button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyTiny, TitleRegular } from '@src/components/TypographyStyle';\nimport { COLORS, FONTS } from '@src/constants/Theme';\nimport {\n\ttruncateValueForIndianStore,\n\ttruncateValueForInternationalStore,\n} from '../utils/calcPercentage';\nimport {\n\tCOLOR_SCHEMA,\n\tGRAPH_ORIENTATION,\n\tStackedBarGraphI,\n} from './StackedBarChart.model';\nimport {\n\tGraphContainerWrapper,\n\tHeaderIconWrapper,\n} from './StackedBarChart.styles';\n\nChartJS.register(\n\tCategoryScale,\n\tLinearScale,\n\tBarElement,\n\tTooltip,\n\tLegend,\n\tChartDataLabels,\n);\n\nconst truncateBars = (data, labels, limit) => {\n\tif (labels.length <= limit)\n\t\treturn {\n\t\t\ttruncatedData: data,\n\t\t\ttruncatedLabels: labels,\n\t\t\toriginalData: data,\n\t\t\toriginalLabels: labels,\n\t\t};\n\tconst truncatedData = data.map((d) => d.slice(0, limit));\n\tconst othersData = data.map((d) =>\n\t\td.slice(limit).reduce((acc, curr) => acc + curr, 0),\n\t);\n\ttruncatedData.forEach((d, i) => d.push(othersData[i]));\n\tconst truncatedLabels = labels.slice(0, limit);\n\ttruncatedLabels.push('Others');\n\treturn {\n\t\ttruncatedData,\n\t\ttruncatedLabels,\n\t\toriginalData: data,\n\t\toriginalLabels: labels,\n\t};\n};\n\nexport const StackedBarChart = (props: StackedBarGraphI) => {\n\tconst { headerIcons = [], legendsAndIconDirection = 'row' } = props;\n\tconst [showPopup, setShowPopup] = useState(false);\n\tconst dummyValues = [250, 1000, 800, 1500, 300, 600];\n\tconst noDataPresent = props.yAxis.data.length === 0;\n\tconst yAxisConfigForNoData = {\n\t\tmin: 0,\n\t\tmax: 2000,\n\t\tstepSize: 200,\n\t};\n\n\tconst colorScaleBrand = [\n\t\t'#5E07BB',\n\t\t'#9E77ED',\n\t\t'#D2AEFF',\n\t\t'#F7D7FF',\n\t\t'#CDE1FF',\n\t\t'#92AFFA',\n\t\t'#3935E1',\n\t];\n\n\tconst colourScalePastel = [\n\t\t'#E6C7FF',\n\t\t'#FEC6C6',\n\t\t'#FEDEF3',\n\t\t'#DEEFFF',\n\t\t'#FFD8B1',\n\t\t'#C7E5FF',\n\t\t'#FFD3E6',\n\t\t'#C9FFE5',\n\t\t'#FFE3C7',\n\t\t'#D9D9FF',\n\t];\n\n\t// Determine which color scale to use based on props\n\tconst getColorScale = () => {\n\t\t// If custom bar colors are provided, use them\n\t\tif (props.customBarColors) return props.customBarColors;\n\n\t\t// If custom brand or pastel colors are provided\n\t\tif (props.customColourScaleBrand || props.customColourScalePastel) {\n\t\t\tif (props.colorSchema === COLOR_SCHEMA.PASTEL) {\n\t\t\t\treturn props.customColourScalePastel;\n\t\t\t} else {\n\t\t\t\treturn props.customColourScaleBrand;\n\t\t\t}\n\t\t}\n\n\t\t// Use default color scales based on schema\n\t\tif (props.colorSchema === COLOR_SCHEMA.PASTEL) {\n\t\t\treturn colourScalePastel;\n\t\t} else {\n\t\t\treturn colorScaleBrand;\n\t\t}\n\t};\n\n\tconst colourScale = getColorScale();\n\tconst hoverColourScale = props.customHoverColour;\n\n\t// Memoized bar configuration settings\n\tconst barConfig = useMemo(\n\t\t() => ({\n\t\t\tbarPercentage: props?.barPercentage || 0.4,\n\t\t\tcategoryPercentage: 1,\n\t\t\tpointStyle: 'circle',\n\t\t\tbarWidth: props.barWidth,\n\t\t\tborderRadius: props?.borderRadius || undefined,\n\t\t\t// If borderRadius is an object, disable border skipping\n\t\t\t...(typeof props?.borderRadius === 'object'\n\t\t\t\t? { borderSkipped: false }\n\t\t\t\t: {}),\n\t\t\t// If bar gap is enabled, add transparent borders for spacing\n\t\t\t...(props?.addBarGap?.flag\n\t\t\t\t? {\n\t\t\t\t\t\tborderWidth: {\n\t\t\t\t\t\t\ttop: props?.addBarGap?.value || 2,\n\t\t\t\t\t\t\tbottom: props?.addBarGap?.value || 2,\n\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tborderColor: 'transparent',\n\t\t\t\t }\n\t\t\t\t: {}),\n\t\t}),\n\t\t[\n\t\t\tprops.barWidth,\n\t\t\tprops?.borderRadius,\n\t\t\tprops?.barPercentage,\n\t\t\tprops?.addBarGap,\n\t\t],\n\t);\n\n\t// Transform y-axis data into a map grouped by dataset name\n\tconst dataSetMap = {};\n\tprops.yAxis.data.map((ele) => {\n\t\tele.map((obj) => {\n\t\t\tif (dataSetMap[obj.name]) {\n\t\t\t\tdataSetMap[obj.name].push(obj.value);\n\t\t\t} else {\n\t\t\t\tdataSetMap[obj.name] = [obj.value];\n\t\t\t}\n\t\t});\n\t});\n\n\t// Create datasets for chart with colors and bar configuration\n\tconst yAxisStackedData = Object.keys(dataSetMap).map((key, ind) => {\n\t\treturn {\n\t\t\tlabel: key,\n\t\t\tdata: dataSetMap[key],\n\t\t\tbackgroundColor: colourScale?.[ind],\n\t\t\thoverBackgroundColor:\n\t\t\t\thoverColourScale === undefined ? undefined : hoverColourScale[ind],\n\t\t\t...barConfig,\n\t\t};\n\t});\n\n\t// Conditionally reorder datasets so smaller values are drawn on top (for overlapping bars)\n\tlet reorderedYAxisData;\n\tif (props.renderInHeightWiseManner) {\n\t\treorderedYAxisData = yAxisStackedData\n\t\t\t.map((dataset, datasetIndex) => {\n\t\t\t\treturn {\n\t\t\t\t\t...dataset,\n\t\t\t\t\t// Add order property: higher values = drawn first (behind)\n\t\t\t\t\torder: dataset.data.reduce((sum, val) => sum + (val || 0), 0),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.sort((a, b) => b.order - a.order);\n\t} else {\n\t\treorderedYAxisData = yAxisStackedData;\n\t}\n\n\t// Extract labels from x-axis data (either string or object with name property)\n\tlet labels = props.xAxis.data.map((data) =>\n\t\ttypeof data === 'string' ? data : data.name,\n\t);\n\n\t// Keep track of original data before any truncation\n\tlet originalData = reorderedYAxisData;\n\t// Truncate bars if limit is specified\n\tif (props.truncateBars) {\n\t\tconst truncated = truncateBars(\n\t\t\treorderedYAxisData.map((d) => d.data),\n\t\t\tlabels,\n\t\t\tprops.truncateBars,\n\t\t);\n\t\treorderedYAxisData.forEach((d, i) => (d.data = truncated.truncatedData[i]));\n\t\tlabels = truncated.truncatedLabels;\n\t\toriginalData = truncated.originalData.map((data, i) => ({\n\t\t\t...reorderedYAxisData[i],\n\t\t\tdata,\n\t\t}));\n\t}\n\n\tconst options = {\n\t\tplugins: {\n\t\t\tlegend: {\n\t\t\t\t// Show legend only if data exists and custom legend is not used\n\t\t\t\tdisplay: !noDataPresent && !props.customLegend,\n\t\t\t\tlabels: {\n\t\t\t\t\tusePointStyle: true,\n\t\t\t\t\tfontSize: 2,\n\t\t\t\t},\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\t// Enable tooltip only when data is present\n\t\t\t\tenabled: !noDataPresent,\n\t\t\t\tcallbacks: {\n\t\t\t\t\tlabel: props.tooltipConfig?.labelCallback,\n\t\t\t\t\ttitle: props.tooltipConfig?.titleCallback,\n\t\t\t\t\tfooter: props.tooltipConfig?.footerCallback,\n\t\t\t\t},\n\t\t\t\tfooterFont: props.tooltipConfig?.footerStyles?.footerFont,\n\t\t\t},\n\t\t\tdatalabels: {\n\t\t\t\tdisplay: props.showTotal ?? false,\n\t\t\t\tanchor: 'end' as const,\n\t\t\t\talign: 'end' as const,\n\t\t\t\tclamp: true,\n\t\t\t\t// Format total value label for stacked bars\n\t\t\t\tformatter: (_, context) => {\n\t\t\t\t\tconst datasetIndex = context.datasetIndex;\n\t\t\t\t\tconst datasets = context.chart.data.datasets;\n\t\t\t\t\t// Only show label on the last dataset (top of stack)\n\t\t\t\t\tif (datasetIndex !== datasets.length - 1) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\tconst dataIndex = context.dataIndex;\n\t\t\t\t\t// Calculate sum across all datasets for this data point\n\t\t\t\t\tlet sum = 0;\n\t\t\t\t\tfor (let i = 0; i < datasets.length; i++) {\n\t\t\t\t\t\tsum += datasets[i].data[dataIndex] ?? 0;\n\t\t\t\t\t}\n\t\t\t\t\tif (!sum) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\t// Format values under 1000 as-is, others as 'k' format\n\t\t\t\t\tif (sum < 1000) {\n\t\t\t\t\t\treturn sum;\n\t\t\t\t\t}\n\t\t\t\t\treturn (sum / 1000).toString().substring(0, 4) + 'k';\n\t\t\t\t},\n\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t},\n\t\t},\n\t\tlayout: {\n\t\t\tpadding: {\n\t\t\t\t// Add right padding for horizontal orientation when showing totals\n\t\t\t\tright:\n\t\t\t\t\tprops.showTotal && props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? 50\n\t\t\t\t\t\t: 0,\n\t\t\t\t// Add top padding for non-horizontal orientation when showing totals\n\t\t\t\ttop:\n\t\t\t\t\tprops.showTotal && props.orientation != GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? 50\n\t\t\t\t\t\t: 0,\n\t\t\t},\n\t\t},\n\t\tresponsive: true,\n\t\tmaintainAspectRatio: false,\n\t\tlegend: {\n\t\t\tdisplay: !props.customLegend,\n\t\t\tlabels: {\n\t\t\t\tusePointStyle: true,\n\t\t\t},\n\t\t},\n\t\t// Set index axis based on orientation (y for horizontal, x for vertical)\n\t\tindexAxis: (props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t? 'y'\n\t\t\t: 'x') as 'y' | 'x',\n\t\tscales: {\n\t\t\tx: {\n\t\t\t\ttitle: {\n\t\t\t\t\t// For horizontal orientation, x-axis shows y-axis data and vice versa\n\t\t\t\t\tdisplay: !!(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? props.yAxis?.title\n\t\t\t\t\t\t: props.xAxis?.title),\n\t\t\t\t\ttext:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.yAxis?.title\n\t\t\t\t\t\t\t: props.xAxis?.title,\n\t\t\t\t\tcolor:\n\t\t\t\t\t\t(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.yAxis?.titleColor\n\t\t\t\t\t\t\t: props.xAxis?.titleColor) ?? COLORS.content.secondary,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\t// Show grid lines for horizontal orientation (default true unless specified)\n\t\t\t\t\tdisplay:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL &&\n\t\t\t\t\t\t(typeof props?.showGridLines?.x === 'undefined'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: props?.showGridLines?.x),\n\t\t\t\t\tcolor: COLORS.background.base,\n\t\t\t\t},\n\t\t\t\tticks: {\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.yAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t\t// Format tick labels based on orientation\n\t\t\t\t\tcallback:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? (value) => {\n\t\t\t\t\t\t\t\t\t// For horizontal, format and truncate based on store type\n\t\t\t\t\t\t\t\t\tlet formattedValue;\n\t\t\t\t\t\t\t\t\tif (props.isInternationalStore) {\n\t\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForInternationalStore(value);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForIndianStore(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst suffix = props.yAxis?.axisSuffix || '';\n\t\t\t\t\t\t\t\t\treturn `${formattedValue}${suffix}`;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: props.xAxis?.axisSuffix\n\t\t\t\t\t\t\t? (value) => `${value}${props.xAxis.axisSuffix}`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t// Determine if x-axis should be stacked (default true)\n\t\t\t\tstacked:\n\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? typeof props.yAxis?.stacked === 'boolean'\n\t\t\t\t\t\t\t? props.yAxis?.stacked\n\t\t\t\t\t\t\t: true\n\t\t\t\t\t\t: typeof props.xAxis?.stacked === 'boolean'\n\t\t\t\t\t\t? props.xAxis?.stacked\n\t\t\t\t\t\t: true,\n\t\t\t},\n\t\t\ty: {\n\t\t\t\t// Set equal height if flag is enabled (for symmetric charts)\n\t\t\t\t...(props?.equalHeight?.flag\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tsuggestedMin: -props?.equalHeight.max, // Set negative side\n\t\t\t\t\t\t\tsuggestedMax: props?.equalHeight.max, // Set positive side\n\t\t\t\t\t }\n\t\t\t\t\t: {}),\n\t\t\t\tmax: props?.yAxis?.max,\n\t\t\t\ttitle: {\n\t\t\t\t\t// For horizontal orientation, y-axis shows x-axis data and vice versa\n\t\t\t\t\tdisplay: !!(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? props.xAxis?.title\n\t\t\t\t\t\t: props.yAxis?.title),\n\t\t\t\t\ttext:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.xAxis?.title\n\t\t\t\t\t\t\t: props.yAxis?.title,\n\t\t\t\t\tcolor:\n\t\t\t\t\t\t(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.xAxis?.titleColor\n\t\t\t\t\t\t\t: props.yAxis?.titleColor) ?? COLORS.content.secondary,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\t// Show grid lines for non-horizontal orientation (default true unless specified)\n\t\t\t\t\tdisplay:\n\t\t\t\t\t\tprops.orientation !== GRAPH_ORIENTATION.HORIZONTAL &&\n\t\t\t\t\t\t(typeof props?.showGridLines?.y === 'undefined'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: props?.showGridLines?.y),\n\t\t\t\t\tcolor: COLORS.background.base,\n\t\t\t\t},\n\t\t\t\tticks: {\n\t\t\t\t\tstepSize:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.xAxis?.stepSize\n\t\t\t\t\t\t\t: props.yAxis?.stepSize,\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.xAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t\t// Apply no-data config if no data exists\n\t\t\t\t\t...(noDataPresent ? yAxisConfigForNoData : {}),\n\t\t\t\t\t// Use custom callback if provided, otherwise format based on orientation\n\t\t\t\t\tcallback: props?.ticksCallback\n\t\t\t\t\t\t? props?.ticksCallback\n\t\t\t\t\t\t: props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? (value) => {\n\t\t\t\t\t\t\t\t// For horizontal, format and truncate based on store type\n\t\t\t\t\t\t\t\tlet formattedValue;\n\t\t\t\t\t\t\t\tif (props.isInternationalStore) {\n\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForInternationalStore(value);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForIndianStore(value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst suffix = props.xAxis?.axisSuffix || '';\n\t\t\t\t\t\t\t\treturn `${formattedValue}${suffix}`;\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: props.yAxis?.axisSuffix\n\t\t\t\t\t\t? (value) => `${value}${props.yAxis.axisSuffix}`\n\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t// Determine if y-axis should be stacked (default true)\n\t\t\t\tstacked:\n\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? typeof props.xAxis?.stacked === 'boolean'\n\t\t\t\t\t\t\t? props.xAxis?.stacked\n\t\t\t\t\t\t\t: true\n\t\t\t\t\t\t: typeof props.yAxis?.stacked === 'boolean'\n\t\t\t\t\t\t? props.yAxis?.stacked\n\t\t\t\t\t\t: true,\n\t\t\t},\n\t\t},\n\t\t// Handle bar click events\n\t\tonClick: (e, activeEls) => {\n\t\t\tif (!props.onBarClick) return;\n\t\t\tconst datasetIndex = activeEls[0].datasetIndex;\n\t\t\tconst dataIndex = activeEls[0].index;\n\t\t\tconst yAxisLabel = e.chart.data.datasets[datasetIndex].label;\n\t\t\tconst xAxisLabel = e.chart.data.labels[dataIndex];\n\t\t\tprops.onBarClick(xAxisLabel, yAxisLabel);\n\t\t},\n\t\t// Change cursor to pointer on hover when bar is clickable\n\t\tonHover: (e, activeEls) => {\n\t\t\tif (!props.onBarClick) return;\n\t\t\tif (activeEls.length) e.native.target.style.cursor = 'pointer';\n\t\t},\n\t};\n\n\t// Clean up tick callbacks based on orientation\n\tif (!props.orientation || props.orientation === GRAPH_ORIENTATION.VERTICAL) {\n\t\tdelete options.scales.x.ticks['callback'];\n\t} else {\n\t\tdelete options.scales.y.ticks['callback'];\n\t}\n\n\t// Prepare data for the chart\n\tlet chartDatasets;\n\tif (noDataPresent) {\n\t\tchartDatasets = [{ data: dummyValues, backgroundColor: 'rgba(0,0,0,0)' }];\n\t} else {\n\t\tchartDatasets = reorderedYAxisData;\n\t}\n\n\tconst data = {\n\t\tlabels: labels,\n\t\tdatasets: chartDatasets,\n\t};\n\n\t// Prepare original chart data (used for popup modal)\n\tlet originalChartDatasets;\n\tif (noDataPresent) {\n\t\toriginalChartDatasets = [\n\t\t\t{ data: dummyValues, backgroundColor: 'rgba(0,0,0,0)' },\n\t\t];\n\t} else {\n\t\toriginalChartDatasets = originalData;\n\t}\n\n\tconst originalChartData = {\n\t\tlabels: props.xAxis.data.map((data) =>\n\t\t\ttypeof data === 'string' ? data : data.name,\n\t\t),\n\t\tdatasets: originalChartDatasets,\n\t};\n\n\t// Render custom legend with color boxes\n\tconst renderLegend = (isPopup = false) => {\n\t\t// Determine justification based on whether popup is allowed and current context\n\t\tlet justification;\n\t\tif (props.allowChartPopup && !isPopup) {\n\t\t\tjustification = 'flex-start';\n\t\t} else {\n\t\t\tjustification = 'flex-end';\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\toverflowY: 'scroll',\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\tgap: '10px',\n\t\t\t\t\tpadding: '0px 24px 12px 24px',\n\t\t\t\t\tjustifyContent: justification,\n\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{yAxisStackedData.map((_item) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={_item.label.replace(' ', '_')}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\tgap: '8px',\n\t\t\t\t\t\t\t\tmarginTop: '4px',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tbackgroundColor: _item.backgroundColor,\n\t\t\t\t\t\t\t\t\twidth: '16px',\n\t\t\t\t\t\t\t\t\theight: '16px',\n\t\t\t\t\t\t\t\t\tborderRadius: '2px',\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<BodyTiny color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t{_item.label}\n\t\t\t\t\t\t\t</BodyTiny>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t);\n\t};\n\n\treturn (\n\t\t<GraphContainerWrapper\n\t\t\tstyle={props.wrapperStyle ?? {}}\n\t\t\tpadding={props.outerPadding}\n\t\t\tcustomLegend={props.customLegend}\n\t\t>\n\t\t\t{props.chartHeading && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tmarginBottom: 24,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tjustifyContent: props.hideHeading ? 'flex-end' : 'space-between',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{props.hideHeading !== true && (\n\t\t\t\t\t\t<TitleRegular\n\t\t\t\t\t\t\tcolor={props.chartHeading.color ?? COLORS.content.secondary}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{props.chartHeading.heading}\n\t\t\t\t\t\t</TitleRegular>\n\t\t\t\t\t)}\n\t\t\t\t\t{props.allowChartPopup && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\tIcon={MaximizeIcon}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tsetShowPopup(true);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{props.customLegend && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tflexDirection: legendsAndIconDirection,\n\t\t\t\t\t\tjustifyContent: 'space-between',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<HeaderIconWrapper>\n\t\t\t\t\t\t{headerIcons.map((icon, index) => (\n\t\t\t\t\t\t\t<div key={index}>\n\t\t\t\t\t\t\t\t<div>{icon}</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</HeaderIconWrapper>\n\t\t\t\t\t{renderLegend()}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className=\"graph__wrapper\">\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\theight: props.graphCanvasHeight ?? 500,\n\t\t\t\t\t\twidth: props.graphCanvasWidth ?? 'auto',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<Bar options={options} data={data} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{showPopup && (\n\t\t\t\t<StyledModal\n\t\t\t\t\topen={showPopup}\n\t\t\t\t\tonClose={() => setShowPopup(false)}\n\t\t\t\t\tcloseOnOutsideClick\n\t\t\t\t\theadingTitle={props.chartHeading?.heading}\n\t\t\t\t\twidth=\"85%\"\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"graph__wrapper\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tpadding: '8px',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.customLegend && renderLegend(true)}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\theight: '70vh',\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\tpadding: '16px',\n\t\t\t\t\t\t\t\tborderRadius: '8px',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Bar options={options} data={originalChartData} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</StyledModal>\n\t\t\t)}\n\t\t</GraphContainerWrapper>\n\t);\n};\n"],"names":["ChartJS","CategoryScale","LinearScale","BarElement","Tooltip","Legend","ChartDataLabels","truncateBars","data","labels","limit","truncatedData","d","othersData","acc","curr","i","truncatedLabels","StackedBarChart","props","headerIcons","legendsAndIconDirection","showPopup","setShowPopup","useState","dummyValues","noDataPresent","yAxisConfigForNoData","colorScaleBrand","colourScalePastel","colourScale","COLOR_SCHEMA","hoverColourScale","barConfig","useMemo","dataSetMap","ele","obj","yAxisStackedData","key","ind","reorderedYAxisData","dataset","datasetIndex","sum","val","a","b","originalData","truncated","options","_","context","datasets","dataIndex","COLORS","GRAPH_ORIENTATION","FONTS","value","formattedValue","truncateValueForInternationalStore","truncateValueForIndianStore","suffix","e","activeEls","yAxisLabel","xAxisLabel","chartDatasets","originalChartDatasets","originalChartData","renderLegend","isPopup","justification","jsx","_item","jsxs","BodyTiny","GraphContainerWrapper","TitleRegular","IconButton","MaximizeIcon","HeaderIconWrapper","icon","index","Bar","StyledModal"],"mappings":";;;;;;;;;;;;;AA8BAA,EAAQ;AAAA,EACPC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACD;AAEA,MAAMC,KAAe,CAACC,GAAMC,GAAQC,MAAU;AAC7C,MAAID,EAAO,UAAUC;AACpB,WAAO;AAAA,MACN,eAAeF;AAAA,MACf,iBAAiBC;AAAA,MACjB,cAAcD;AAAA,MACd,gBAAgBC;AAAA,IAAA;AA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N,SAAS;AAAA,gBAAA;AAAA,gBAGT,UAAA;AAAA,kBAAAxD,EAAM,gBAAgBmD,EAAa,EAAI;AAAA,kBACxC,gBAAAG;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACA,OAAO;AAAA,wBACN,QAAQ;AAAA,wBACR,OAAO;AAAA,wBACP,SAAS;AAAA,wBACT,cAAc;AAAA,sBAAA;AAAA,sBAGf,UAAA,gBAAAA,EAACW,GAAA,EAAI,SAAAlC,GAAkB,MAAMmB,EAAA,CAAmB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACjD;AAAA,cAAA;AAAA,YAAA;AAAA,UACD;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
1
+ {"version":3,"file":"StackedBarChart.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.tsx"],"sourcesContent":["import MaximizeIcon from '@src/assets/icons/maximize.svg';\nimport {\n\tBarElement,\n\tCategoryScale,\n\tChart as ChartJS,\n\tLegend,\n\tLinearScale,\n\tTooltip,\n} from 'chart.js';\nimport ChartDataLabels from 'chartjs-plugin-datalabels';\nimport { useMemo, useState } from 'react';\nimport { Bar } from 'react-chartjs-2';\nimport { IconButton } from '@src/components/icon-button';\nimport { StyledModal } from '@src/components/modals';\nimport { BodyTiny, TitleRegular } from '@src/components/TypographyStyle';\nimport { COLORS, FONTS } from '@src/constants/Theme';\nimport {\n\ttruncateValueForIndianStore,\n\ttruncateValueForInternationalStore,\n} from '../utils/calcPercentage';\nimport {\n\tCOLOR_SCHEMA,\n\tGRAPH_ORIENTATION,\n\tStackedBarGraphI,\n} from './StackedBarChart.model';\nimport {\n\tGraphContainerWrapper,\n\tHeaderIconWrapper,\n} from './StackedBarChart.styles';\n\nChartJS.register(\n\tCategoryScale,\n\tLinearScale,\n\tBarElement,\n\tTooltip,\n\tLegend,\n\tChartDataLabels,\n);\n\nconst truncateBars = (data, labels, limit) => {\n\tif (labels.length <= limit)\n\t\treturn {\n\t\t\ttruncatedData: data,\n\t\t\ttruncatedLabels: labels,\n\t\t\toriginalData: data,\n\t\t\toriginalLabels: labels,\n\t\t};\n\tconst truncatedData = data.map((d) => d.slice(0, limit));\n\tconst othersData = data.map((d) =>\n\t\td.slice(limit).reduce((acc, curr) => acc + curr, 0),\n\t);\n\ttruncatedData.forEach((d, i) => d.push(othersData[i]));\n\tconst truncatedLabels = labels.slice(0, limit);\n\ttruncatedLabels.push('Others');\n\treturn {\n\t\ttruncatedData,\n\t\ttruncatedLabels,\n\t\toriginalData: data,\n\t\toriginalLabels: labels,\n\t};\n};\n\nexport const StackedBarChart = (props: StackedBarGraphI) => {\n\tconst { headerIcons = [], legendsAndIconDirection = 'row' } = props;\n\tconst [showPopup, setShowPopup] = useState(false);\n\tconst dummyValues = [250, 1000, 800, 1500, 300, 600];\n\tconst noDataPresent = props.yAxis.data.length === 0;\n\tconst yAxisConfigForNoData = {\n\t\tmin: 0,\n\t\tmax: 2000,\n\t\tstepSize: 200,\n\t};\n\n\tconst colorScaleBrand = [\n\t\t'#5E07BB',\n\t\t'#9E77ED',\n\t\t'#D2AEFF',\n\t\t'#F7D7FF',\n\t\t'#CDE1FF',\n\t\t'#92AFFA',\n\t\t'#3935E1',\n\t];\n\n\tconst colourScalePastel = [\n\t\t'#E6C7FF',\n\t\t'#FEC6C6',\n\t\t'#FEDEF3',\n\t\t'#DEEFFF',\n\t\t'#FFD8B1',\n\t\t'#C7E5FF',\n\t\t'#FFD3E6',\n\t\t'#C9FFE5',\n\t\t'#FFE3C7',\n\t\t'#D9D9FF',\n\t];\n\n\t// Determine which color scale to use based on props\n\tconst getColorScale = () => {\n\t\t// If custom bar colors are provided, use them\n\t\tif (props.customBarColors) return props.customBarColors;\n\n\t\t// If custom brand or pastel colors are provided\n\t\tif (props.customColourScaleBrand || props.customColourScalePastel) {\n\t\t\tif (props.colorSchema === COLOR_SCHEMA.PASTEL) {\n\t\t\t\treturn props.customColourScalePastel;\n\t\t\t} else {\n\t\t\t\treturn props.customColourScaleBrand;\n\t\t\t}\n\t\t}\n\n\t\t// Use default color scales based on schema\n\t\tif (props.colorSchema === COLOR_SCHEMA.PASTEL) {\n\t\t\treturn colourScalePastel;\n\t\t} else {\n\t\t\treturn colorScaleBrand;\n\t\t}\n\t};\n\n\tconst colourScale = getColorScale();\n\tconst hoverColourScale = props.customHoverColour;\n\n\t// Memoized bar configuration settings\n\tconst barConfig = useMemo(\n\t\t() => ({\n\t\t\tbarPercentage: props?.barPercentage || 0.4,\n\t\t\tcategoryPercentage: props?.categoryPercentage ?? 1,\n\t\t\tpointStyle: 'circle',\n\t\t\tbarWidth: props.barWidth,\n\t\t\tborderRadius: props?.borderRadius || undefined,\n\t\t\t// If borderRadius is an object, disable border skipping\n\t\t\t...(typeof props?.borderRadius === 'object'\n\t\t\t\t? { borderSkipped: false }\n\t\t\t\t: {}),\n\t\t\t// If bar gap is enabled, add transparent borders for spacing\n\t\t\t...(props?.addBarGap?.flag\n\t\t\t\t? {\n\t\t\t\t\t\tborderWidth: {\n\t\t\t\t\t\t\ttop: props?.addBarGap?.value || 2,\n\t\t\t\t\t\t\tbottom: props?.addBarGap?.value || 2,\n\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tborderColor: 'transparent',\n\t\t\t\t }\n\t\t\t\t: {}),\n\t\t}),\n\t\t[\n\t\t\tprops.barWidth,\n\t\t\tprops?.borderRadius,\n\t\t\tprops?.barPercentage,\n\t\t\tprops?.addBarGap,\n\t\t],\n\t);\n\n\t// Transform y-axis data into a map grouped by dataset name\n\tconst dataSetMap = {};\n\tprops.yAxis.data.map((ele) => {\n\t\tele.map((obj) => {\n\t\t\tif (dataSetMap[obj.name]) {\n\t\t\t\tdataSetMap[obj.name].push(obj.value);\n\t\t\t} else {\n\t\t\t\tdataSetMap[obj.name] = [obj.value];\n\t\t\t}\n\t\t});\n\t});\n\n\t// Create datasets for chart with colors and bar configuration\n\tconst yAxisStackedData = Object.keys(dataSetMap).map((key, ind) => {\n\t\treturn {\n\t\t\tlabel: key,\n\t\t\tdata: dataSetMap[key],\n\t\t\tbackgroundColor: colourScale?.[ind],\n\t\t\thoverBackgroundColor:\n\t\t\t\thoverColourScale === undefined ? undefined : hoverColourScale[ind],\n\t\t\t...barConfig,\n\t\t};\n\t});\n\n\t// Conditionally reorder datasets so smaller values are drawn on top (for overlapping bars)\n\tlet reorderedYAxisData;\n\tif (props.renderInHeightWiseManner) {\n\t\treorderedYAxisData = yAxisStackedData\n\t\t\t.map((dataset, datasetIndex) => {\n\t\t\t\treturn {\n\t\t\t\t\t...dataset,\n\t\t\t\t\t// Add order property: higher values = drawn first (behind)\n\t\t\t\t\torder: dataset.data.reduce((sum, val) => sum + (val || 0), 0),\n\t\t\t\t};\n\t\t\t})\n\t\t\t.sort((a, b) => b.order - a.order);\n\t} else {\n\t\treorderedYAxisData = yAxisStackedData;\n\t}\n\n\t// Extract labels from x-axis data (either string or object with name property)\n\tlet labels = props.xAxis.data.map((data) =>\n\t\ttypeof data === 'string' ? data : data.name,\n\t);\n\n\t// Keep track of original data before any truncation\n\tlet originalData = reorderedYAxisData;\n\t// Truncate bars if limit is specified\n\tif (props.truncateBars) {\n\t\tconst truncated = truncateBars(\n\t\t\treorderedYAxisData.map((d) => d.data),\n\t\t\tlabels,\n\t\t\tprops.truncateBars,\n\t\t);\n\t\treorderedYAxisData.forEach((d, i) => (d.data = truncated.truncatedData[i]));\n\t\tlabels = truncated.truncatedLabels;\n\t\toriginalData = truncated.originalData.map((data, i) => ({\n\t\t\t...reorderedYAxisData[i],\n\t\t\tdata,\n\t\t}));\n\t}\n\n\tconst options = {\n\t\tplugins: {\n\t\t\tlegend: {\n\t\t\t\t// Show legend only if data exists and custom legend is not used\n\t\t\t\tdisplay: !noDataPresent && !props.customLegend,\n\t\t\t\tlabels: {\n\t\t\t\t\tusePointStyle: true,\n\t\t\t\t\tfontSize: 2,\n\t\t\t\t},\n\t\t\t},\n\t\t\ttooltip: {\n\t\t\t\t// Enable tooltip only when data is present\n\t\t\t\tenabled: !noDataPresent,\n\t\t\t\tcallbacks: {\n\t\t\t\t\tlabel: props.tooltipConfig?.labelCallback,\n\t\t\t\t\ttitle: props.tooltipConfig?.titleCallback,\n\t\t\t\t\tfooter: props.tooltipConfig?.footerCallback,\n\t\t\t\t},\n\t\t\t\tfooterFont: props.tooltipConfig?.footerStyles?.footerFont,\n\t\t\t},\n\t\t\tdatalabels: {\n\t\t\t\tdisplay: props.showTotal ?? false,\n\t\t\t\tanchor: 'end' as const,\n\t\t\t\talign: 'end' as const,\n\t\t\t\tclamp: true,\n\t\t\t\t// Format total value label for stacked bars\n\t\t\t\tformatter: (_, context) => {\n\t\t\t\t\tconst datasetIndex = context.datasetIndex;\n\t\t\t\t\tconst datasets = context.chart.data.datasets;\n\t\t\t\t\t// Only show label on the last dataset (top of stack)\n\t\t\t\t\tif (datasetIndex !== datasets.length - 1) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\tconst dataIndex = context.dataIndex;\n\t\t\t\t\t// Calculate sum across all datasets for this data point\n\t\t\t\t\tlet sum = 0;\n\t\t\t\t\tfor (let i = 0; i < datasets.length; i++) {\n\t\t\t\t\t\tsum += datasets[i].data[dataIndex] ?? 0;\n\t\t\t\t\t}\n\t\t\t\t\tif (!sum) {\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t}\n\t\t\t\t\t// Format values under 1000 as-is, others as 'k' format\n\t\t\t\t\tif (sum < 1000) {\n\t\t\t\t\t\treturn sum;\n\t\t\t\t\t}\n\t\t\t\t\treturn (sum / 1000).toString().substring(0, 4) + 'k';\n\t\t\t\t},\n\t\t\t\tcolor: COLORS.content.secondary,\n\t\t\t},\n\t\t},\n\t\tlayout: {\n\t\t\tpadding: {\n\t\t\t\t// Add right padding for horizontal orientation when showing totals\n\t\t\t\tright:\n\t\t\t\t\tprops.showTotal && props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? 50\n\t\t\t\t\t\t: 0,\n\t\t\t\t// Add top padding for non-horizontal orientation when showing totals\n\t\t\t\ttop:\n\t\t\t\t\tprops.showTotal && props.orientation != GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? 50\n\t\t\t\t\t\t: 0,\n\t\t\t},\n\t\t},\n\t\tresponsive: true,\n\t\tmaintainAspectRatio: false,\n\t\tlegend: {\n\t\t\tdisplay: !props.customLegend,\n\t\t\tlabels: {\n\t\t\t\tusePointStyle: true,\n\t\t\t},\n\t\t},\n\t\t// Set index axis based on orientation (y for horizontal, x for vertical)\n\t\tindexAxis: (props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t? 'y'\n\t\t\t: 'x') as 'y' | 'x',\n\t\tscales: {\n\t\t\tx: {\n\t\t\t\ttitle: {\n\t\t\t\t\t// For horizontal orientation, x-axis shows y-axis data and vice versa\n\t\t\t\t\tdisplay: !!(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? props.yAxis?.title\n\t\t\t\t\t\t: props.xAxis?.title),\n\t\t\t\t\ttext:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.yAxis?.title\n\t\t\t\t\t\t\t: props.xAxis?.title,\n\t\t\t\t\tcolor:\n\t\t\t\t\t\t(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.yAxis?.titleColor\n\t\t\t\t\t\t\t: props.xAxis?.titleColor) ?? COLORS.content.secondary,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\t// Show grid lines for horizontal orientation (default true unless specified)\n\t\t\t\t\tdisplay:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL &&\n\t\t\t\t\t\t(typeof props?.showGridLines?.x === 'undefined'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: props?.showGridLines?.x),\n\t\t\t\t\tcolor: COLORS.background.base,\n\t\t\t\t},\n\t\t\t\tticks: {\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.yAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t\t// Format tick labels based on orientation\n\t\t\t\t\tcallback:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? (value) => {\n\t\t\t\t\t\t\t\t\t// For horizontal, format and truncate based on store type\n\t\t\t\t\t\t\t\t\tlet formattedValue;\n\t\t\t\t\t\t\t\t\tif (props.isInternationalStore) {\n\t\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForInternationalStore(value);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForIndianStore(value);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tconst suffix = props.yAxis?.axisSuffix || '';\n\t\t\t\t\t\t\t\t\treturn `${formattedValue}${suffix}`;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: props.xAxis?.axisSuffix\n\t\t\t\t\t\t\t? (value) => `${value}${props.xAxis.axisSuffix}`\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t// Determine if x-axis should be stacked (default true)\n\t\t\t\tstacked:\n\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? typeof props.yAxis?.stacked === 'boolean'\n\t\t\t\t\t\t\t? props.yAxis?.stacked\n\t\t\t\t\t\t\t: true\n\t\t\t\t\t\t: typeof props.xAxis?.stacked === 'boolean'\n\t\t\t\t\t\t? props.xAxis?.stacked\n\t\t\t\t\t\t: true,\n\t\t\t},\n\t\t\ty: {\n\t\t\t\t// Set equal height if flag is enabled (for symmetric charts)\n\t\t\t\t...(props?.equalHeight?.flag\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tsuggestedMin: -props?.equalHeight.max, // Set negative side\n\t\t\t\t\t\t\tsuggestedMax: props?.equalHeight.max, // Set positive side\n\t\t\t\t\t }\n\t\t\t\t\t: {}),\n\t\t\t\tmax: props?.yAxis?.max,\n\t\t\t\ttitle: {\n\t\t\t\t\t// For horizontal orientation, y-axis shows x-axis data and vice versa\n\t\t\t\t\tdisplay: !!(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? props.xAxis?.title\n\t\t\t\t\t\t: props.yAxis?.title),\n\t\t\t\t\ttext:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.xAxis?.title\n\t\t\t\t\t\t\t: props.yAxis?.title,\n\t\t\t\t\tcolor:\n\t\t\t\t\t\t(props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.xAxis?.titleColor\n\t\t\t\t\t\t\t: props.yAxis?.titleColor) ?? COLORS.content.secondary,\n\t\t\t\t\tfont: { size: FONTS.caption.fontSize },\n\t\t\t\t},\n\t\t\t\tgrid: {\n\t\t\t\t\t// Show grid lines for non-horizontal orientation (default true unless specified)\n\t\t\t\t\tdisplay:\n\t\t\t\t\t\tprops.orientation !== GRAPH_ORIENTATION.HORIZONTAL &&\n\t\t\t\t\t\t(typeof props?.showGridLines?.y === 'undefined'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: props?.showGridLines?.y),\n\t\t\t\t\tcolor: COLORS.background.base,\n\t\t\t\t},\n\t\t\t\tticks: {\n\t\t\t\t\tstepSize:\n\t\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t\t? props.xAxis?.stepSize\n\t\t\t\t\t\t\t: props.yAxis?.stepSize,\n\t\t\t\t\tfontSize: FONTS.caption.fontSize,\n\t\t\t\t\tcolor: props.xAxis.labelColor ?? COLORS.content.secondary,\n\t\t\t\t\t// Apply no-data config if no data exists\n\t\t\t\t\t...(noDataPresent ? yAxisConfigForNoData : {}),\n\t\t\t\t\t// Use custom callback if provided, otherwise format based on orientation\n\t\t\t\t\tcallback: props?.ticksCallback\n\t\t\t\t\t\t? props?.ticksCallback\n\t\t\t\t\t\t: props.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? (value) => {\n\t\t\t\t\t\t\t\t// For horizontal, format and truncate based on store type\n\t\t\t\t\t\t\t\tlet formattedValue;\n\t\t\t\t\t\t\t\tif (props.isInternationalStore) {\n\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForInternationalStore(value);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tformattedValue = truncateValueForIndianStore(value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst suffix = props.xAxis?.axisSuffix || '';\n\t\t\t\t\t\t\t\treturn `${formattedValue}${suffix}`;\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: props.yAxis?.axisSuffix\n\t\t\t\t\t\t? (value) => `${value}${props.yAxis.axisSuffix}`\n\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t// Determine if y-axis should be stacked (default true)\n\t\t\t\tstacked:\n\t\t\t\t\tprops.orientation === GRAPH_ORIENTATION.HORIZONTAL\n\t\t\t\t\t\t? typeof props.xAxis?.stacked === 'boolean'\n\t\t\t\t\t\t\t? props.xAxis?.stacked\n\t\t\t\t\t\t\t: true\n\t\t\t\t\t\t: typeof props.yAxis?.stacked === 'boolean'\n\t\t\t\t\t\t? props.yAxis?.stacked\n\t\t\t\t\t\t: true,\n\t\t\t},\n\t\t},\n\t\t// Handle bar click events\n\t\tonClick: (e, activeEls) => {\n\t\t\tif (!props.onBarClick) return;\n\t\t\tconst datasetIndex = activeEls[0].datasetIndex;\n\t\t\tconst dataIndex = activeEls[0].index;\n\t\t\tconst yAxisLabel = e.chart.data.datasets[datasetIndex].label;\n\t\t\tconst xAxisLabel = e.chart.data.labels[dataIndex];\n\t\t\tprops.onBarClick(xAxisLabel, yAxisLabel);\n\t\t},\n\t\t// Change cursor to pointer on hover when bar is clickable\n\t\tonHover: (e, activeEls) => {\n\t\t\tif (!props.onBarClick) return;\n\t\t\tif (activeEls.length) e.native.target.style.cursor = 'pointer';\n\t\t},\n\t};\n\n\t// Clean up tick callbacks based on orientation\n\tif (!props.orientation || props.orientation === GRAPH_ORIENTATION.VERTICAL) {\n\t\tdelete options.scales.x.ticks['callback'];\n\t} else {\n\t\tdelete options.scales.y.ticks['callback'];\n\t}\n\n\t// Prepare data for the chart\n\tlet chartDatasets;\n\tif (noDataPresent) {\n\t\tchartDatasets = [{ data: dummyValues, backgroundColor: 'rgba(0,0,0,0)' }];\n\t} else {\n\t\tchartDatasets = reorderedYAxisData;\n\t}\n\n\tconst data = {\n\t\tlabels: labels,\n\t\tdatasets: chartDatasets,\n\t};\n\n\t// Prepare original chart data (used for popup modal)\n\tlet originalChartDatasets;\n\tif (noDataPresent) {\n\t\toriginalChartDatasets = [\n\t\t\t{ data: dummyValues, backgroundColor: 'rgba(0,0,0,0)' },\n\t\t];\n\t} else {\n\t\toriginalChartDatasets = originalData;\n\t}\n\n\tconst originalChartData = {\n\t\tlabels: props.xAxis.data.map((data) =>\n\t\t\ttypeof data === 'string' ? data : data.name,\n\t\t),\n\t\tdatasets: originalChartDatasets,\n\t};\n\n\t// Render custom legend with color boxes\n\tconst renderLegend = (isPopup = false) => {\n\t\t// Determine justification based on whether popup is allowed and current context\n\t\tlet justification;\n\t\tif (props.allowChartPopup && !isPopup) {\n\t\t\tjustification = 'flex-start';\n\t\t} else {\n\t\t\tjustification = 'flex-end';\n\t\t}\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\toverflowY: 'scroll',\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\tgap: '10px',\n\t\t\t\t\tpadding: '0px 24px 12px 24px',\n\t\t\t\t\tjustifyContent: justification,\n\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{yAxisStackedData.map((_item) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={_item.label.replace(' ', '_')}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\tgap: '8px',\n\t\t\t\t\t\t\t\tmarginTop: '4px',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tbackgroundColor: _item.backgroundColor,\n\t\t\t\t\t\t\t\t\twidth: '16px',\n\t\t\t\t\t\t\t\t\theight: '16px',\n\t\t\t\t\t\t\t\t\tborderRadius: '2px',\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<BodyTiny color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t{_item.label}\n\t\t\t\t\t\t\t</BodyTiny>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t);\n\t};\n\n\treturn (\n\t\t<GraphContainerWrapper\n\t\t\tstyle={props.wrapperStyle ?? {}}\n\t\t\tpadding={props.outerPadding}\n\t\t\tcustomLegend={props.customLegend}\n\t\t>\n\t\t\t{props.chartHeading && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tmarginBottom: 24,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tjustifyContent: props.hideHeading ? 'flex-end' : 'space-between',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{props.hideHeading !== true && (\n\t\t\t\t\t\t<TitleRegular\n\t\t\t\t\t\t\tcolor={props.chartHeading.color ?? COLORS.content.secondary}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{props.chartHeading.heading}\n\t\t\t\t\t\t</TitleRegular>\n\t\t\t\t\t)}\n\t\t\t\t\t{props.allowChartPopup && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\tIcon={MaximizeIcon}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tsetShowPopup(true);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{props.customLegend && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tflexDirection: legendsAndIconDirection,\n\t\t\t\t\t\tjustifyContent: 'space-between',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<HeaderIconWrapper>\n\t\t\t\t\t\t{headerIcons.map((icon, index) => (\n\t\t\t\t\t\t\t<div key={index}>\n\t\t\t\t\t\t\t\t<div>{icon}</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</HeaderIconWrapper>\n\t\t\t\t\t{renderLegend()}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className=\"graph__wrapper\">\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\theight: props.graphCanvasHeight ?? 500,\n\t\t\t\t\t\twidth: props.graphCanvasWidth ?? 'auto',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<Bar options={options} data={data} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{showPopup && (\n\t\t\t\t<StyledModal\n\t\t\t\t\topen={showPopup}\n\t\t\t\t\tonClose={() => setShowPopup(false)}\n\t\t\t\t\tcloseOnOutsideClick\n\t\t\t\t\theadingTitle={props.chartHeading?.heading}\n\t\t\t\t\twidth=\"85%\"\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"graph__wrapper\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tpadding: '8px',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.customLegend && renderLegend(true)}\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\theight: '70vh',\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\tpadding: '16px',\n\t\t\t\t\t\t\t\tborderRadius: '8px',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Bar options={options} data={originalChartData} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</StyledModal>\n\t\t\t)}\n\t\t</GraphContainerWrapper>\n\t);\n};\n"],"names":["ChartJS","CategoryScale","LinearScale","BarElement","Tooltip","Legend","ChartDataLabels","truncateBars","data","labels","limit","truncatedData","d","othersData","acc","curr","i","truncatedLabels","StackedBarChart","props","headerIcons","legendsAndIconDirection","showPopup","setShowPopup","useState","dummyValues","noDataPresent","yAxisConfigForNoData","colorScaleBrand","colourScalePastel","colourScale","COLOR_SCHEMA","hoverColourScale","barConfig","useMemo","dataSetMap","ele","obj","yAxisStackedData","key","ind","reorderedYAxisData","dataset","datasetIndex","sum","val","a","b","originalData","truncated","options","_","context","datasets","dataIndex","COLORS","GRAPH_ORIENTATION","FONTS","value","formattedValue","truncateValueForInternationalStore","truncateValueForIndianStore","suffix","e","activeEls","yAxisLabel","xAxisLabel","chartDatasets","originalChartDatasets","originalChartData","renderLegend","isPopup","justification","jsx","_item","jsxs","BodyTiny","GraphContainerWrapper","TitleRegular","IconButton","MaximizeIcon","HeaderIconWrapper","icon","index","Bar","StyledModal"],"mappings":";;;;;;;;;;;;;AA8BAA,EAAQ;AAAA,EACPC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AACD;AAEA,MAAMC,KAAe,CAACC,GAAMC,GAAQC,MAAU;AAC7C,MAAID,EAAO,UAAUC;AACpB,WAAO;AAAA,MACN,eAAeF;AAAA,MACf,iBAAiBC;AAAA,MACjB,cAAcD;AAAA,MACd,gBAAgBC;AAAA,IAAA;AAElB,QAAME,IAAgBH,EAAK,IAAI,CAACI,MAAMA,EAAE,MAAM,GAAGF,CAAK,CAAC,GACjDG,IAAaL,EAAK;AAAA,IAAI,CAACI,MAC5BA,EAAE,MAAMF,CAAK,EAAE,OAAO,CAACI,GAAKC,MAASD,IAAMC,GAAM,CAAC;AAAA,EAAA;AAEnD,EAAAJ,EAAc,QAAQ,CAACC,GAAGI,MAAMJ,EAAE,KAAKC,EAAWG,CAAC,CAAC,CAAC;AACrD,QAAMC,IAAkBR,EAAO,MAAM,GAAGC,CAAK;AAC7C,SAAAO,EAAgB,KAAK,QAAQ,GACtB;AAAA,IACN,eAAAN;AAAA,IACA,iBAAAM;AAAA,IACA,cAAcT;AAAA,IACd,gBAAgBC;AAAA,EAAA;AAElB,GAEaS,KAAkB,CAACC,MAA4B;AAC3D,QAAM,EAAE,aAAAC,IAAc,CAAA,GAAI,yBAAAC,IAA0B,UAAUF,GACxD,CAACG,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1CC,IAAc,CAAC,KAAK,KAAM,KAAK,MAAM,KAAK,GAAG,GAC7CC,IAAgBP,EAAM,MAAM,KAAK,WAAW,GAC5CQ,IAAuB;AAAA,IAC5B,KAAK;AAAA,IACL,KAAK;AAAA,IACL,UAAU;AAAA,EAAA,GAGLC,IAAkB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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,YAAA;AAAA,YAGlC,UAAA,gBAAAsD,EAACW,GAAA,EAAI,SAAAlC,GAAkB,MAAA1C,EAAA,CAAY;AAAA,UAAA;AAAA,QAAA,GAErC;AAAA,QACCc,KACA,gBAAAmD;AAAA,UAACY;AAAA,UAAA;AAAA,YACA,MAAM/D;AAAA,YACN,SAAS,MAAMC,EAAa,EAAK;AAAA,YACjC,qBAAmB;AAAA,YACnB,cAAcJ,EAAM,cAAc;AAAA,YAClC,OAAM;AAAA,YAEN,UAAA,gBAAAwD;AAAA,cAAC;AAAA,cAAA;AAAA,gBACA,WAAU;AAAA,gBACV,OAAO;AAAA,kBACN,SAAS;AAAA,gBAAA;AAAA,gBAGT,UAAA;AAAA,kBAAAxD,EAAM,gBAAgBmD,EAAa,EAAI;AAAA,kBACxC,gBAAAG;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACA,OAAO;AAAA,wBACN,QAAQ;AAAA,wBACR,OAAO;AAAA,wBACP,SAAS;AAAA,wBACT,cAAc;AAAA,sBAAA;AAAA,sBAGf,UAAA,gBAAAA,EAACW,GAAA,EAAI,SAAAlC,GAAkB,MAAMmB,EAAA,CAAmB;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACjD;AAAA,cAAA;AAAA,YAAA;AAAA,UACD;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
@@ -80,6 +80,7 @@ export interface StackedBarGraphI {
80
80
  max: number;
81
81
  };
82
82
  barPercentage?: number;
83
+ categoryPercentage?: number;
83
84
  addBarGap?: {
84
85
  flag: boolean;
85
86
  value: number;
@@ -1 +1 @@
1
- {"version":3,"file":"StackedBarChart.model.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.ts"],"sourcesContent":["import { FontSpec, TooltipItem } from 'chart.js';\n\nexport interface AxisDetailsI {\n\ttitle?: string;\n\ttitleColor?: string;\n\tdata: XAxisDataI[] | string[];\n\tlabelColor?: string;\n\tstepSize?: number;\n\tstacked?: boolean;\n\taxisSuffix?: string; // Suffix to append to axis values (e.g., '%', 'k', 'M')\n\tmax?: number;\n}\n\nexport interface XAxisDataI {\n\tname: string;\n\tvalue: number;\n}\n\nexport interface RGBColorI {\n\tr: number;\n\tg: number;\n\tb: number;\n\ta?: number;\n}\n\nexport interface ChartHeadingI {\n\theading: string;\n\tcolor?: string;\n}\n\nexport enum COLOR_SCHEMA {\n\tBRAND = 'brand',\n\tPASTEL = 'pastel',\n}\n\nexport enum GRAPH_ORIENTATION {\n\tVERTICAL = 'vertical',\n\tHORIZONTAL = 'horizontal',\n}\n\nexport interface StackedBarGraphI {\n\tgraphCanvasHeight?: number | string;\n\tgraphCanvasWidth?: string;\n\ttickColor?: string;\n\tlabelColor?: string;\n\tchartHeading?: ChartHeadingI;\n\txAxis: AxisDetailsI;\n\tyAxis: AxisDetailsI;\n\tbarColorRGBA: RGBColorI;\n\touterPadding?: string;\n\tonBarClick?: (xAxisLabel: string, yAxisLabel: string) => void;\n\tcolorSchema?: COLOR_SCHEMA;\n\torientation?: GRAPH_ORIENTATION;\n\tbarWidth?: number;\n\twrapperStyle?: React.CSSProperties;\n\tcustomLegend?: boolean;\n\tshowTotal?: boolean;\n\ttooltipConfig?: {\n\t\ttitleCallback?: (toolTipItems: TooltipItem<'bar'>[]) => string | string[];\n\t\tlabelCallback?: (toolTipItem: TooltipItem<'bar'>) => string | string[];\n\t\tfooterCallback?: (toolTipItems: TooltipItem<'bar'>[]) => string | string[];\n\t\tfooterStyles?: {\n\t\t\tfooterFont?: Partial<FontSpec>;\n\t\t};\n\t};\n\tcustomColourScaleBrand?: string[];\n\tcustomColourScalePastel?: string[];\n\tcustomHoverColour?: string[];\n\tcustomBarColors?: string[] /** Custom colors for individual bars in the stack */;\n\tisInternationalStore?: boolean;\n\ttruncateBars?: number;\n\tallowChartPopup?: boolean;\n\thideHeading?: boolean;\n\t/** borderRadius - if number passes only the top bar of the stack will be given radius. Send object to apply border in all the bars of the stack */\n\tborderRadius?:\n\t\t| number\n\t\t| {\n\t\t\t\ttopLeft?: number;\n\t\t\t\ttopRight?: number;\n\t\t\t\tbottomLeft?: number;\n\t\t\t\tbottomRight?: number;\n\t\t };\n\tshowGridLines?: { x?: boolean; y?: boolean };\n\tequalHeight?: { flag: boolean; max: number };\n\tbarPercentage?: number; // 0 to 1\n\taddBarGap?: { flag: boolean; value: number };\n\tticksCallback?: (value: number | string) => string;\n\tlegendsAndIconDirection?: 'row-reverse' | 'row';\n\theaderIcons?: React.ReactNode[];\n\trenderInHeightWiseManner?: boolean /** When true, renders smaller bars on top of larger bars */;\n}\n"],"names":["COLOR_SCHEMA","GRAPH_ORIENTATION"],"mappings":"AA8BO,IAAKA,sBAAAA,OACXA,EAAA,QAAQ,SACRA,EAAA,SAAS,UAFEA,IAAAA,KAAA,CAAA,CAAA,GAKAC,sBAAAA,OACXA,EAAA,WAAW,YACXA,EAAA,aAAa,cAFFA,IAAAA,KAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"StackedBarChart.model.js","sources":["../../../../../../src/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.ts"],"sourcesContent":["import { FontSpec, TooltipItem } from 'chart.js';\n\nexport interface AxisDetailsI {\n\ttitle?: string;\n\ttitleColor?: string;\n\tdata: XAxisDataI[] | string[];\n\tlabelColor?: string;\n\tstepSize?: number;\n\tstacked?: boolean;\n\taxisSuffix?: string; // Suffix to append to axis values (e.g., '%', 'k', 'M')\n\tmax?: number;\n}\n\nexport interface XAxisDataI {\n\tname: string;\n\tvalue: number;\n}\n\nexport interface RGBColorI {\n\tr: number;\n\tg: number;\n\tb: number;\n\ta?: number;\n}\n\nexport interface ChartHeadingI {\n\theading: string;\n\tcolor?: string;\n}\n\nexport enum COLOR_SCHEMA {\n\tBRAND = 'brand',\n\tPASTEL = 'pastel',\n}\n\nexport enum GRAPH_ORIENTATION {\n\tVERTICAL = 'vertical',\n\tHORIZONTAL = 'horizontal',\n}\n\nexport interface StackedBarGraphI {\n\tgraphCanvasHeight?: number | string;\n\tgraphCanvasWidth?: string;\n\ttickColor?: string;\n\tlabelColor?: string;\n\tchartHeading?: ChartHeadingI;\n\txAxis: AxisDetailsI;\n\tyAxis: AxisDetailsI;\n\tbarColorRGBA: RGBColorI;\n\touterPadding?: string;\n\tonBarClick?: (xAxisLabel: string, yAxisLabel: string) => void;\n\tcolorSchema?: COLOR_SCHEMA;\n\torientation?: GRAPH_ORIENTATION;\n\tbarWidth?: number;\n\twrapperStyle?: React.CSSProperties;\n\tcustomLegend?: boolean;\n\tshowTotal?: boolean;\n\ttooltipConfig?: {\n\t\ttitleCallback?: (toolTipItems: TooltipItem<'bar'>[]) => string | string[];\n\t\tlabelCallback?: (toolTipItem: TooltipItem<'bar'>) => string | string[];\n\t\tfooterCallback?: (toolTipItems: TooltipItem<'bar'>[]) => string | string[];\n\t\tfooterStyles?: {\n\t\t\tfooterFont?: Partial<FontSpec>;\n\t\t};\n\t};\n\tcustomColourScaleBrand?: string[];\n\tcustomColourScalePastel?: string[];\n\tcustomHoverColour?: string[];\n\tcustomBarColors?: string[] /** Custom colors for individual bars in the stack */;\n\tisInternationalStore?: boolean;\n\ttruncateBars?: number;\n\tallowChartPopup?: boolean;\n\thideHeading?: boolean;\n\t/** borderRadius - if number passes only the top bar of the stack will be given radius. Send object to apply border in all the bars of the stack */\n\tborderRadius?:\n\t\t| number\n\t\t| {\n\t\t\t\ttopLeft?: number;\n\t\t\t\ttopRight?: number;\n\t\t\t\tbottomLeft?: number;\n\t\t\t\tbottomRight?: number;\n\t\t };\n\tshowGridLines?: { x?: boolean; y?: boolean };\n\tequalHeight?: { flag: boolean; max: number };\n\tbarPercentage?: number; // 0 to 1\n\tcategoryPercentage?: number;\n\taddBarGap?: { flag: boolean; value: number };\n\tticksCallback?: (value: number | string) => string;\n\tlegendsAndIconDirection?: 'row-reverse' | 'row';\n\theaderIcons?: React.ReactNode[];\n\trenderInHeightWiseManner?: boolean /** When true, renders smaller bars on top of larger bars */;\n}\n"],"names":["COLOR_SCHEMA","GRAPH_ORIENTATION"],"mappings":"AA8BO,IAAKA,sBAAAA,OACXA,EAAA,QAAQ,SACRA,EAAA,SAAS,UAFEA,IAAAA,KAAA,CAAA,CAAA,GAKAC,sBAAAA,OACXA,EAAA,WAAW,YACXA,EAAA,aAAa,cAFFA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -0,0 +1,3 @@
1
+ export declare const FUNNEL_BAND_COLORS: string[];
2
+ export declare const COMPARISON_BAR_COLORS: string[];
3
+ export declare const pickColor: (colors: string[], index: number) => string | undefined;
@@ -0,0 +1,18 @@
1
+ import { COLORS as n } from "../../../constants/Theme.js";
2
+ const b = [
3
+ n.stroke.brandLightAlt,
4
+ n.background.brandLight,
5
+ n.background.brandTint,
6
+ n.background.brandVeryLight
7
+ ], a = [
8
+ n.background.brand,
9
+ n.stroke.brandSubdued,
10
+ n.stroke.brandLightAlt,
11
+ n.background.brandTint
12
+ ], o = (r, t) => r.length ? r[t % r.length] : void 0;
13
+ export {
14
+ a as COMPARISON_BAR_COLORS,
15
+ b as FUNNEL_BAND_COLORS,
16
+ o as pickColor
17
+ };
18
+ //# sourceMappingURL=chartPalette.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chartPalette.js","sources":["../../../../../src/components/analytics-chips-and-dropdowns/chart/chartPalette.ts"],"sourcesContent":["import { COLORS } from '@src/constants/Theme';\n\nexport const FUNNEL_BAND_COLORS = [\n\tCOLORS.stroke.brandLightAlt,\n\tCOLORS.background.brandLight,\n\tCOLORS.background.brandTint,\n\tCOLORS.background.brandVeryLight,\n];\n\nexport const COMPARISON_BAR_COLORS = [\n\tCOLORS.background.brand,\n\tCOLORS.stroke.brandSubdued,\n\tCOLORS.stroke.brandLightAlt,\n\tCOLORS.background.brandTint,\n];\n\nexport const pickColor = (colors: string[], index: number) =>\n\tcolors.length ? colors[index % colors.length] : undefined;\n"],"names":["FUNNEL_BAND_COLORS","COLORS","COMPARISON_BAR_COLORS","pickColor","colors","index"],"mappings":";AAEO,MAAMA,IAAqB;AAAA,EACjCC,EAAO,OAAO;AAAA,EACdA,EAAO,WAAW;AAAA,EAClBA,EAAO,WAAW;AAAA,EAClBA,EAAO,WAAW;AACnB,GAEaC,IAAwB;AAAA,EACpCD,EAAO,WAAW;AAAA,EAClBA,EAAO,OAAO;AAAA,EACdA,EAAO,OAAO;AAAA,EACdA,EAAO,WAAW;AACnB,GAEaE,IAAY,CAACC,GAAkBC,MAC3CD,EAAO,SAASA,EAAOC,IAAQD,EAAO,MAAM,IAAI;"}
@@ -0,0 +1,4 @@
1
+ export declare const toChartValue: (value: number | undefined) => number;
2
+ export declare const formatChartValue: (value: number, locale?: string) => string;
3
+ export declare const formatPercent: (value: number) => string;
4
+ export declare const clamp: (value: number, min: number, max: number) => number;
@@ -0,0 +1,13 @@
1
+ const e = (t) => typeof t == "number" && Number.isFinite(t) && t > 0 ? t : 0, o = (t, r = "en-IN") => Number.isFinite(t) ? new Intl.NumberFormat(r).format(t) : "0", i = (t) => {
2
+ if (!Number.isFinite(t))
3
+ return "0";
4
+ const r = Math.round(t * 10) / 10;
5
+ return Number.isInteger(r) ? `${r}` : r.toFixed(1);
6
+ }, m = (t, r, n) => Math.min(Math.max(t, r), n);
7
+ export {
8
+ m as clamp,
9
+ o as formatChartValue,
10
+ i as formatPercent,
11
+ e as toChartValue
12
+ };
13
+ //# sourceMappingURL=formatChartValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatChartValue.js","sources":["../../../../../src/components/analytics-chips-and-dropdowns/chart/formatChartValue.ts"],"sourcesContent":["export const toChartValue = (value: number | undefined): number =>\n\ttypeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;\n\nexport const formatChartValue = (value: number, locale = 'en-IN'): string =>\n\tNumber.isFinite(value) ? new Intl.NumberFormat(locale).format(value) : '0';\n\nexport const formatPercent = (value: number): string => {\n\tif (!Number.isFinite(value)) {\n\t\treturn '0';\n\t}\n\tconst rounded = Math.round(value * 10) / 10;\n\treturn Number.isInteger(rounded) ? `${rounded}` : rounded.toFixed(1);\n};\n\nexport const clamp = (value: number, min: number, max: number): number =>\n\tMath.min(Math.max(value, min), max);\n"],"names":["toChartValue","value","formatChartValue","locale","formatPercent","rounded","clamp","min","max"],"mappings":"AAAO,MAAMA,IAAe,CAACC,MAC5B,OAAOA,KAAU,YAAY,OAAO,SAASA,CAAK,KAAKA,IAAQ,IAAIA,IAAQ,GAE/DC,IAAmB,CAACD,GAAeE,IAAS,YACxD,OAAO,SAASF,CAAK,IAAI,IAAI,KAAK,aAAaE,CAAM,EAAE,OAAOF,CAAK,IAAI,KAE3DG,IAAgB,CAACH,MAA0B;AACvD,MAAI,CAAC,OAAO,SAASA,CAAK;AACzB,WAAO;AAER,QAAMI,IAAU,KAAK,MAAMJ,IAAQ,EAAE,IAAI;AACzC,SAAO,OAAO,UAAUI,CAAO,IAAI,GAAGA,CAAO,KAAKA,EAAQ,QAAQ,CAAC;AACpE,GAEaC,IAAQ,CAACL,GAAeM,GAAaC,MACjD,KAAK,IAAI,KAAK,IAAIP,GAAOM,CAAG,GAAGC,CAAG;"}
@@ -15,6 +15,10 @@ export * from './chart/StackedBarChart/StackedBarDistributionChart';
15
15
  export * from './chart/StackedBarChart/StackedBarDistributionChart.model';
16
16
  export * from './chart/VerticalBarGraph/VerticalGraph';
17
17
  export * from './chart/VerticalBarGraph/FunnelVerticalBarGraph';
18
+ export * from './chart/FunnelChart/FunnelChart';
19
+ export * from './chart/FunnelChart/FunnelChart.model';
20
+ export * from './chart/ComparisonBarChart/ComparisonBarChart';
21
+ export * from './chart/ComparisonBarChart/ComparisonBarChart.model';
18
22
  export * from './chart/heatmap/HeatMap';
19
23
  export * from './chart/heatmap/HeatMapVertical';
20
24
  export * from './chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph';