@mx-cartographer/experiences 9.7.42 → 9.7.44

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 (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsDrawer.es.js +3 -3
  3. package/dist/accounts/index.es.js +4 -4
  4. package/dist/core/types/InsightsInstanceSlotData.d.ts +3 -0
  5. package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
  6. package/dist/core/types/localization/InsightsFeedCopy.d.ts +3 -0
  7. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.d.ts +12 -0
  8. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js +32 -0
  9. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/AccountDetailsBlock.es.js.map +1 -0
  10. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/index.d.ts +2 -0
  11. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/layout.d.ts +3 -0
  12. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/layout.es.js +10 -0
  13. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/layout.es.js.map +1 -0
  14. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/useAccountDetailsPrepare.d.ts +2 -0
  15. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/useAccountDetailsPrepare.es.js +20 -0
  16. package/dist/insights-v2/actionBlocks/AccountDetailsBlock/useAccountDetailsPrepare.es.js.map +1 -0
  17. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +3 -1
  18. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +85 -75
  19. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +115 -93
  21. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +3 -1
  23. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +66 -44
  24. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  25. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +1 -1
  26. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +49 -44
  27. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
  28. package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +4 -0
  29. package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +4 -0
  30. package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
  31. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.d.ts +1 -1
  32. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js +19 -19
  33. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map +1 -1
  34. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.d.ts +8 -1
  35. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js +47 -31
  36. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js.map +1 -1
  37. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +1 -5
  38. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js +10 -6
  39. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
  40. package/dist/insights-v2/components/SubTabs.d.ts +22 -0
  41. package/dist/insights-v2/components/SubTabs.es.js +38 -0
  42. package/dist/insights-v2/components/SubTabs.es.js.map +1 -0
  43. package/dist/insights-v2/components/chartblocks/ChartLegend.es.js +14 -18
  44. package/dist/insights-v2/components/chartblocks/ChartLegend.es.js.map +1 -1
  45. package/dist/insights-v2/components/chartblocks/DoubleBarChart.d.ts +5 -3
  46. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js +108 -104
  47. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js.map +1 -1
  48. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  49. package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
  50. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  51. package/dist/insights-v2/mappings/blocks.es.js +73 -66
  52. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  53. package/package.json +1 -1
@@ -1,10 +1,14 @@
1
- var a = (t, o) => ({
2
- SpendToIncome: { color: [t.palette.categories.billsUtilities, t.palette.chart.chart1] },
3
- DebtToIncome: { color: [t.palette.chart.chart5, t.palette.chart.chart1] },
4
- SavingsToIncome: { color: [t.palette.chartMono.chartMono5, t.palette.chartMono.chartMono3] }
5
- })[o];
1
+ var a = (o) => ({ color: [o.palette.categories.billsUtilities, o.palette.chart.chart1] }), r = (o, t) => {
2
+ const c = {
3
+ SpendToIncome: a(o),
4
+ spend_to_income: a(o),
5
+ DebtToIncome: { color: [o.palette.chart.chart5, o.palette.chart.chart1] },
6
+ SavingsToIncome: { color: [o.palette.chartMono.chartMono5, o.palette.chartMono.chartMono3] }
7
+ };
8
+ return t && Object.hasOwn(c, t) ? c[t] : void 0;
9
+ };
6
10
  export {
7
- a as getLayoutConfig
11
+ r as getLayoutConfig
8
12
  };
9
13
 
10
14
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nexport const getLayoutConfig = (theme: Theme, variant?: string | null) => {\n const config = {\n SpendToIncome: {\n color: [theme.palette.categories.billsUtilities, theme.palette.chart.chart1] as string[],\n },\n DebtToIncome: {\n color: [theme.palette.chart.chart5, theme.palette.chart.chart1] as string[],\n },\n SavingsToIncome: {\n color: [theme.palette.chartMono.chartMono5, theme.palette.chartMono.chartMono3] as string[],\n },\n }\n return config[variant as keyof typeof config]\n}\n"],"mappings":"AAEA,IAAa,IAAA,CAAmB,GAAc,OAYrC;AAAA,EAVL,eAAe,EACb,OAAO,CAAC,EAAM,QAAQ,WAAW,gBAAgB,EAAM,QAAQ,MAAM,MAAM,EAC7E;AAAA,EACA,cAAc,EACZ,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM,EAChE;AAAA,EACA,iBAAiB,EACf,OAAO,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU,EAChF;AAEK,GAAO,CAAA"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\n// One palette per comparison; ditto's snake_case variant shares the legacy PascalCase entry's palette.\nconst spendToIncome = (theme: Theme) => ({\n color: [theme.palette.categories.billsUtilities, theme.palette.chart.chart1] as string[],\n})\n\nexport const getLayoutConfig = (theme: Theme, variant?: string | null) => {\n const config = {\n SpendToIncome: spendToIncome(theme),\n // Insights 2.0: ditto's layout variant for Monthly Spend to Income Comparison.\n spend_to_income: spendToIncome(theme),\n DebtToIncome: {\n color: [theme.palette.chart.chart5, theme.palette.chart.chart1] as string[],\n },\n SavingsToIncome: {\n color: [theme.palette.chartMono.chartMono5, theme.palette.chartMono.chartMono3] as string[],\n },\n }\n // Object.hasOwn: the variant is backend-controlled, and an inherited name like `constructor`\n // would otherwise return a truthy non-config.\n return variant && Object.hasOwn(config, variant)\n ? config[variant as keyof typeof config]\n : undefined\n}\n"],"mappings":"AAGA,IAAM,IAAA,CAAiB,OAAkB,EACvC,OAAO,CAAC,EAAM,QAAQ,WAAW,gBAAgB,EAAM,QAAQ,MAAM,MAAM,EAC7E,IAEa,IAAA,CAAmB,GAAc,MAA4B;AACxE,QAAM,IAAS;AAAA,IACb,eAAe,EAAc,CAAK;AAAA,IAElC,iBAAiB,EAAc,CAAK;AAAA,IACpC,cAAc,EACZ,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM,EAChE;AAAA,IACA,iBAAiB,EACf,OAAO,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU,EAChF;AAAA,EACF;AAGA,SAAO,KAAW,OAAO,OAAO,GAAQ,CAAO,IAC3C,EAAO,CAAA,IACP;AACN"}
@@ -0,0 +1,22 @@
1
+ export interface SubTabItem {
2
+ label: string;
3
+ ariaLabel?: string;
4
+ }
5
+ export interface SubTabsProps {
6
+ id: string;
7
+ tabs: SubTabItem[];
8
+ selectedIndex: number;
9
+ onChange: (index: number) => void;
10
+ ariaLabel?: string;
11
+ }
12
+ /** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */
13
+ export declare const subTabPanelProps: (id: string, selectedIndex: number) => {
14
+ 'aria-labelledby': string;
15
+ id: string;
16
+ role: "tabpanel";
17
+ };
18
+ /**
19
+ * The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's
20
+ * "Transactions Filtered By Type" on a change, so every drawer that uses it keeps legacy analytics.
21
+ */
22
+ export declare const SubTabs: ({ id, tabs, selectedIndex, onChange, ariaLabel }: SubTabsProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,38 @@
1
+ import { ANALYTICS_EVENTS_CONFIG as u } from "../analytics/analyticsEventsConfig.es.js";
2
+ import { useAnalyticsEvent as T } from "../analytics/useAnalyticsEvent.es.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import v from "@mui/material/Tab";
5
+ import E from "@mui/material/Tabs";
6
+ var i = (a, l) => `${a}-tab-${l}`, o = (a) => `${a}-panel`, I = (a, l) => ({
7
+ "aria-labelledby": i(a, l),
8
+ id: o(a),
9
+ role: "tabpanel"
10
+ }), _ = ({ id: a, tabs: l, selectedIndex: t, onChange: b, ariaLabel: m }) => {
11
+ const p = T();
12
+ if (!l.length) return null;
13
+ const s = (r, e) => {
14
+ p(u.TYPE_FILTER_SELECTED), b(e);
15
+ };
16
+ return /* @__PURE__ */ n(E, {
17
+ "aria-label": m ?? l.map((r) => r.label).join(" / "),
18
+ onChange: s,
19
+ value: t,
20
+ variant: "fullWidth",
21
+ children: l.map((r, e) => /* @__PURE__ */ n(v, {
22
+ "aria-controls": o(a),
23
+ "aria-label": r.ariaLabel,
24
+ id: i(a, e),
25
+ label: r.label,
26
+ sx: {
27
+ minWidth: "auto",
28
+ px: 0
29
+ }
30
+ }, r.label))
31
+ });
32
+ };
33
+ export {
34
+ _ as SubTabs,
35
+ I as subTabPanelProps
36
+ };
37
+
38
+ //# sourceMappingURL=SubTabs.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubTabs.es.js","names":[],"sources":["../../../src/insights-v2/components/SubTabs.tsx"],"sourcesContent":["import type React from 'react'\n\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../analytics'\n\nexport interface SubTabItem {\n label: string\n // Screen-reader name when it differs from the visible label (legacy pulse: \"Spend transactions\").\n ariaLabel?: string\n}\n\nexport interface SubTabsProps {\n // Base id: tab N is `${id}-tab-N` and controls `${id}-panel`; render that panel with subTabPanelProps.\n id: string\n tabs: SubTabItem[]\n selectedIndex: number\n onChange: (index: number) => void\n // Tablist name; defaults to the visible labels joined (\"Spend / Income\").\n ariaLabel?: string\n}\n\nconst subTabId = (id: string, index: number) => `${id}-tab-${index}`\nconst subPanelId = (id: string) => `${id}-panel`\n\n/** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */\nexport const subTabPanelProps = (id: string, selectedIndex: number) => ({\n 'aria-labelledby': subTabId(id, selectedIndex),\n id: subPanelId(id),\n role: 'tabpanel' as const,\n})\n\n/**\n * The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's\n * \"Transactions Filtered By Type\" on a change, so every drawer that uses it keeps legacy analytics.\n */\nexport const SubTabs = ({ id, tabs, selectedIndex, onChange, ariaLabel }: SubTabsProps) => {\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!tabs.length) return null\n\n // MUI only calls onChange for a different tab, never on mount (legacy parity).\n const handleChange = (_event: React.SyntheticEvent, index: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TYPE_FILTER_SELECTED)\n onChange(index)\n }\n\n return (\n <Tabs\n aria-label={ariaLabel ?? tabs.map((tab) => tab.label).join(' / ')}\n onChange={handleChange}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs.map((tab, index) => (\n <Tab\n aria-controls={subPanelId(id)}\n aria-label={tab.ariaLabel}\n id={subTabId(id, index)}\n key={tab.label}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )\n}\n"],"mappings":";;;;;AAuBA,IAAM,IAAA,CAAY,GAAY,MAAkB,GAAG,CAAA,QAAU,CAAA,IACvD,IAAA,CAAc,MAAe,GAAG,CAAA,UAGzB,IAAA,CAAoB,GAAY,OAA2B;AAAA,EACtE,mBAAmB,EAAS,GAAI,CAAa;AAAA,EAC7C,IAAI,EAAW,CAAE;AAAA,EACjB,MAAM;AACR,IAMa,IAAA,CAAW,EAAE,IAAA,GAAI,MAAA,GAAM,eAAA,GAAe,UAAA,GAAU,WAAA,EAAA,MAA8B;AACzF,QAAM,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EAAK,OAAQ,QAAO;AAGzB,QAAM,IAAA,CAAgB,GAA8B,MAAkB;AACpE,IAAA,EAAmB,EAAwB,oBAAoB,GAC/D,EAAS,CAAK;AAAA,EAChB;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY,KAAa,EAAK,IAAA,CAAK,MAAQ,EAAI,KAAK,EAAE,KAAK,KAAK;AAAA,IAChE,UAAU;AAAA,IACV,OAAO;AAAA,IACP,SAAQ;AAAA,IAEP,UAAA,EAAK,IAAA,CAAK,GAAK,MACd,gBAAA,EAAC,GAAD;AAAA,MACE,iBAAe,EAAW,CAAE;AAAA,MAC5B,cAAY,EAAI;AAAA,MAChB,IAAI,EAAS,GAAI,CAAK;AAAA,MAEtB,OAAO,EAAI;AAAA,MACX,IAAI;AAAA,QAAE,UAAU;AAAA,QAAQ,IAAI;AAAA,MAAE;AAAA,IAC/B,GAHM,EAAI,KAGV,CACF;AAAA,EACG,CAAA;AAEV"}
@@ -1,7 +1,7 @@
1
1
  import n from "@mui/material/Stack";
2
- import { Text as l } from "@mxenabled/mxui";
3
- import { jsx as t, jsxs as a } from "react/jsx-runtime";
4
- var f = ({ legendItems: h, legendStyle: o }) => /* @__PURE__ */ t(n, {
2
+ import { Text as c } from "@mxenabled/mxui";
3
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
4
+ var l = ({ legendItems: a, legendStyle: h }) => /* @__PURE__ */ e(n, {
5
5
  sx: {
6
6
  alignItems: "flex-start",
7
7
  flexDirection: "row",
@@ -9,40 +9,36 @@ var f = ({ legendItems: h, legendStyle: o }) => /* @__PURE__ */ t(n, {
9
9
  justifyContent: "flex-start",
10
10
  py: 4,
11
11
  width: "100%",
12
- ...o
12
+ ...h
13
13
  },
14
- children: h.map(({ color: c, label: r, formattedAmount: i }, e) => r && /* @__PURE__ */ a(n, {
14
+ children: a.map(({ color: o, label: r, formattedAmount: i }, t) => r && /* @__PURE__ */ d(n, {
15
15
  sx: {
16
16
  alignItems: "center",
17
17
  flexDirection: "row",
18
18
  gap: 8
19
19
  },
20
- children: [/* @__PURE__ */ t("svg", {
20
+ children: [/* @__PURE__ */ e("svg", {
21
21
  "aria-hidden": "true",
22
- "aria-labelledby": e === 0 ? "chartLegendLabel" : r,
22
+ "aria-labelledby": t === 0 ? "chartLegendLabel" : r,
23
23
  fill: "none",
24
24
  height: "12",
25
25
  role: "figure",
26
26
  width: "12",
27
- children: /* @__PURE__ */ t("rect", {
28
- fill: c,
27
+ children: /* @__PURE__ */ e("rect", {
28
+ fill: o,
29
29
  height: "12",
30
30
  rx: "2",
31
31
  width: "12"
32
32
  })
33
- }), /* @__PURE__ */ a(l, {
34
- id: e === 0 ? "chartLegendLabel" : r,
33
+ }), /* @__PURE__ */ e(c, {
34
+ id: t === 0 ? "chartLegendLabel" : r,
35
35
  variant: "caption",
36
- children: [
37
- r,
38
- " ",
39
- i ? `: ${i}` : ""
40
- ]
36
+ children: i ? `${r}: ${i}` : r
41
37
  })]
42
- }, r ?? e))
38
+ }, r ?? t))
43
39
  });
44
40
  export {
45
- f as Legend
41
+ l as Legend
46
42
  };
47
43
 
48
44
  //# sourceMappingURL=ChartLegend.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartLegend.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/ChartLegend.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport Stack from '@mui/material/Stack'\n\nimport type { SxProps } from '@mui/material/styles'\nimport type { LegendProps } from '../../../core/types/InsightsInstanceSlotData'\n\nexport interface LegendComponentProps {\n legendItems: LegendProps[]\n legendStyle?: SxProps\n}\n\nexport const Legend = ({ legendItems, legendStyle }: LegendComponentProps) => {\n return (\n <Stack\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 24,\n justifyContent: 'flex-start',\n py: 4,\n width: '100%',\n ...legendStyle,\n }}\n >\n {legendItems.map(\n ({ color, label, formattedAmount }, index) =>\n label && (\n <Stack key={label ?? index} sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby={index === 0 ? 'chartLegendLabel' : label}\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={color} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id={index === 0 ? 'chartLegendLabel' : label} variant=\"caption\">\n {label} {formattedAmount ? `: ${formattedAmount}` : ''}\n </Text>\n </Stack>\n ),\n )}\n </Stack>\n )\n}\n"],"mappings":";;;AAYA,IAAa,IAAA,CAAU,EAAE,aAAA,GAAa,aAAA,EAAA,MAElC,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AAAA,EAEC,UAAA,EAAY,IAAA,CACV,EAAE,OAAA,GAAO,OAAA,GAAO,iBAAA,EAAA,GAAmB,MAClC,KACE,gBAAA,EAAC,GAAD;AAAA,IAA4B,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,KAAK;AAAA,IAAE;AAAA,IAArF,UAAA,CACE,gBAAA,EAAC,OAAD;AAAA,MACE,eAAY;AAAA,MACZ,mBAAiB,MAAU,IAAI,qBAAqB;AAAA,MACpD,MAAK;AAAA,MACL,QAAO;AAAA,MACP,MAAK;AAAA,MACL,OAAM;AAAA,MAEN,UAAA,gBAAA,EAAC,QAAD;AAAA,QAAM,MAAM;AAAA,QAAO,QAAO;AAAA,QAAK,IAAG;AAAA,QAAI,OAAM;AAAA,MAAM,CAAA;AAAA,IAC/C,CAAA,GACL,gBAAA,EAAC,GAAD;AAAA,MAAM,IAAI,MAAU,IAAI,qBAAqB;AAAA,MAAO,SAAQ;AAAA,MAA5D,UAAA;AAAA,QACG;AAAA,QAAM;AAAA,QAAE,IAAkB,KAAK,CAAA,KAAoB;AAAA,MAChD;AAAA,IACD,CAAA,CAAA;AAAA,EAdK,GAAA,KAAS,CAcd,CAEb;AACK,CAAA"}
1
+ {"version":3,"file":"ChartLegend.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/ChartLegend.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport Stack from '@mui/material/Stack'\n\nimport type { SxProps } from '@mui/material/styles'\nimport type { LegendProps } from '../../../core/types/InsightsInstanceSlotData'\n\nexport interface LegendComponentProps {\n legendItems: LegendProps[]\n legendStyle?: SxProps\n}\n\nexport const Legend = ({ legendItems, legendStyle }: LegendComponentProps) => {\n return (\n <Stack\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 24,\n justifyContent: 'flex-start',\n py: 4,\n width: '100%',\n ...legendStyle,\n }}\n >\n {legendItems.map(\n ({ color, label, formattedAmount }, index) =>\n label && (\n <Stack key={label ?? index} sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby={index === 0 ? 'chartLegendLabel' : label}\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={color} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id={index === 0 ? 'chartLegendLabel' : label} variant=\"caption\">\n {formattedAmount ? `${label}: ${formattedAmount}` : label}\n </Text>\n </Stack>\n ),\n )}\n </Stack>\n )\n}\n"],"mappings":";;;AAYA,IAAa,IAAA,CAAU,EAAE,aAAA,GAAa,aAAA,EAAA,MAElC,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AAAA,EAEC,UAAA,EAAY,IAAA,CACV,EAAE,OAAA,GAAO,OAAA,GAAO,iBAAA,EAAA,GAAmB,MAClC,KACE,gBAAA,EAAC,GAAD;AAAA,IAA4B,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,KAAK;AAAA,IAAE;AAAA,IAArF,UAAA,CACE,gBAAA,EAAC,OAAD;AAAA,MACE,eAAY;AAAA,MACZ,mBAAiB,MAAU,IAAI,qBAAqB;AAAA,MACpD,MAAK;AAAA,MACL,QAAO;AAAA,MACP,MAAK;AAAA,MACL,OAAM;AAAA,MAEN,UAAA,gBAAA,EAAC,QAAD;AAAA,QAAM,MAAM;AAAA,QAAO,QAAO;AAAA,QAAK,IAAG;AAAA,QAAI,OAAM;AAAA,MAAM,CAAA;AAAA,IAC/C,CAAA,GACL,gBAAA,EAAC,GAAD;AAAA,MAAM,IAAI,MAAU,IAAI,qBAAqB;AAAA,MAAO,SAAQ;AAAA,MACzD,UAAA,IAAkB,GAAG,CAAA,KAAU,CAAA,KAAoB;AAAA,IAChD,CAAA,CACD;AAAA,EAdK,GAAA,KAAS,CAcd,CAEb;AACK,CAAA"}
@@ -1,10 +1,12 @@
1
1
  import { Legends } from '../../../core';
2
- import { DataSet, LegendProps } from '../../../core/types/InsightsInstanceSlotData';
2
+ import { DataSet } from '../../../core/types/InsightsInstanceSlotData';
3
3
  interface DoubleBarChartProps {
4
4
  bars: DataSet[];
5
5
  colors: string[];
6
- legends?: (Legends | LegendProps)[];
6
+ legends?: Legends[];
7
7
  isMini?: boolean;
8
+ legendPosition?: 'top' | 'bottom';
9
+ selectedIndex?: number;
8
10
  onBarClick: (columnIndex: number, subIndex: number) => void;
9
11
  }
10
12
  /**
@@ -13,5 +15,5 @@ interface DoubleBarChartProps {
13
15
  * selection, or data-shaping of its own. This mirrors BarChartV2; the DoubleBarChartBlock card
14
16
  * wrapper builds the data and injects the store behavior, exactly as BarchartBlock wraps BarChartV2.
15
17
  */
16
- export declare const DoubleBarChart: ({ bars, colors, legends, isMini, onBarClick, }: DoubleBarChartProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const DoubleBarChart: ({ bars, colors, legends, isMini, legendPosition, selectedIndex, onBarClick, }: DoubleBarChartProps) => import("react/jsx-runtime").JSX.Element;
17
19
  export {};
@@ -1,117 +1,121 @@
1
- import { EmptyBarChart as u } from "./EmptyBarChart.es.js";
2
- import { useContainerDimensions as C } from "../../hooks/useContainerDimensions.es.js";
3
- import { CustomDoubleBarPlotMXUI as k } from "./CustomDoubleBar.es.js";
4
- import { Legend as S } from "./ChartLegend.es.js";
5
- import w from "react";
6
- import I from "@mui/material/Stack";
7
- import { jsx as o, jsxs as c } from "react/jsx-runtime";
8
- import A from "@mui/material/Box";
9
- import { BarPlot as B } from "@mui/x-charts/BarChart";
10
- import { ChartContainer as R } from "@mui/x-charts/ChartContainer";
11
- import { ChartsXAxis as L } from "@mui/x-charts/ChartsXAxis";
12
- var E = ({ bars: r, colors: n, legends: d, isMini: l = !1, onBarClick: h }) => {
13
- const s = r.length - 1, p = 5e-3, f = 0.16, m = w.useRef(null), { height: x, width: y } = C(m), g = ({ dataIndex: e, seriesId: t }) => {
14
- h(e, Number(t.split("-").pop()));
15
- }, i = d?.map((e, t) => ({
16
- color: n[t] ?? "transparent",
1
+ import { EmptyBarChart as S } from "./EmptyBarChart.es.js";
2
+ import { useContainerDimensions as w } from "../../hooks/useContainerDimensions.es.js";
3
+ import { CustomDoubleBarPlotMXUI as I } from "./CustomDoubleBar.es.js";
4
+ import { Legend as A } from "./ChartLegend.es.js";
5
+ import B from "react";
6
+ import R from "@mui/material/Stack";
7
+ import { jsx as o, jsxs as d } from "react/jsx-runtime";
8
+ import L from "@mui/material/Box";
9
+ import { BarPlot as T } from "@mui/x-charts/BarChart";
10
+ import { ChartContainer as D } from "@mui/x-charts/ChartContainer";
11
+ import { ChartsXAxis as K } from "@mui/x-charts/ChartsXAxis";
12
+ var _ = ({ bars: r, colors: a, legends: h, isMini: p = !1, legendPosition: n = "bottom", selectedIndex: f, onBarClick: x }) => {
13
+ const l = f ?? r.length - 1, y = 5e-3, b = 0.16, s = B.useRef(null), { height: g, width: u } = w(s), C = ({ dataIndex: e, seriesId: t }) => {
14
+ x(e, Number(t.split("-").pop()));
15
+ }, m = h?.map((e, t) => ({
16
+ color: a[t] ?? "transparent",
17
17
  ...e
18
- }));
19
- return r.length > 0 ? /* @__PURE__ */ c(I, {
18
+ })), c = !!m?.length && /* @__PURE__ */ o(A, {
19
+ legendItems: m,
20
+ legendStyle: { ml: 24 }
21
+ });
22
+ return r.length > 0 ? /* @__PURE__ */ d(R, {
20
23
  sx: {
21
24
  mb: 0,
22
25
  width: "100%",
23
26
  p: 0
24
27
  },
25
- children: [/* @__PURE__ */ o(A, {
26
- ref: m,
27
- sx: {
28
- height: l ? 120 : 172,
29
- touchAction: "pan-y",
30
- width: "100%",
31
- p: 0,
32
- m: 0,
33
- "& svg": {
28
+ children: [
29
+ n === "top" && c,
30
+ /* @__PURE__ */ o(L, {
31
+ ref: s,
32
+ sx: {
33
+ height: p ? 120 : 172,
34
34
  touchAction: "pan-y",
35
- userSelect: "none"
36
- }
37
- },
38
- children: /* @__PURE__ */ c(R, {
39
- colors: n,
40
- dataset: r,
41
- height: x,
42
- margin: {
43
- bottom: 16,
44
- left: 24,
45
- right: 24,
46
- top: 0
47
- },
48
- series: [{
49
- dataKey: "main",
50
- type: "bar"
51
- }, {
52
- dataKey: "comparison",
53
- type: "bar"
54
- }],
55
- width: y,
56
- xAxis: [{
57
- barGapRatio: p,
58
- categoryGapRatio: f,
59
- dataKey: "label",
60
- scaleType: "band"
61
- }],
62
- yAxis: [{ width: 0 }],
63
- children: [/* @__PURE__ */ o(L, {
64
- disableTicks: !1,
65
- slots: { axisTickLabel: ({ text: e, ...t }) => {
66
- const a = r[s]?.label;
67
- return /* @__PURE__ */ o("text", {
68
- ...t,
69
- style: {
70
- ...t.style,
71
- fontWeight: a === e ? 700 : 400
72
- },
73
- children: e
74
- });
75
- } },
76
- sx: { ".MuiChartsAxis-line": { stroke: "border.darker" } },
77
- tickLabelStyle: {
78
- fontSize: 11,
79
- fill: "text.secondary",
80
- fontWeight: 400
35
+ width: "100%",
36
+ p: 0,
37
+ m: 0,
38
+ "& svg": {
39
+ touchAction: "pan-y",
40
+ userSelect: "none"
81
41
  }
82
- }), /* @__PURE__ */ o(B, {
83
- onItemClick: (e, { dataIndex: t, seriesId: a }) => g({
84
- dataIndex: t,
85
- seriesId: a.toString()
86
- }),
87
- slots: { bar: (e) => {
88
- const { ownerState: t, ...a } = e, b = s === t.dataIndex ? t.color : `${t.color}50`;
89
- return /* @__PURE__ */ o(k, {
90
- ...a,
91
- color: b,
92
- data: r,
93
- series: {
94
- index: t.dataIndex,
95
- type: Number(t.id?.toString().split("-").pop() ?? 0)
96
- },
97
- style: {
98
- height: e.height,
99
- x: e.x,
100
- y: e.y,
101
- width: e.width
102
- }
103
- });
104
- } }
105
- })]
106
- })
107
- }), i && !l && i.length > 0 && /* @__PURE__ */ o(S, {
108
- legendItems: i,
109
- legendStyle: { ml: 24 }
110
- })]
111
- }) : /* @__PURE__ */ o(u, {});
42
+ },
43
+ children: /* @__PURE__ */ d(D, {
44
+ colors: a,
45
+ dataset: r,
46
+ height: g,
47
+ margin: {
48
+ bottom: 16,
49
+ left: 24,
50
+ right: 24,
51
+ top: 0
52
+ },
53
+ series: [{
54
+ dataKey: "main",
55
+ type: "bar"
56
+ }, {
57
+ dataKey: "comparison",
58
+ type: "bar"
59
+ }],
60
+ width: u,
61
+ xAxis: [{
62
+ barGapRatio: y,
63
+ categoryGapRatio: b,
64
+ dataKey: "label",
65
+ scaleType: "band"
66
+ }],
67
+ yAxis: [{ width: 0 }],
68
+ children: [/* @__PURE__ */ o(K, {
69
+ disableTicks: !1,
70
+ slots: { axisTickLabel: ({ text: e, ...t }) => {
71
+ const i = r[l]?.label;
72
+ return /* @__PURE__ */ o("text", {
73
+ ...t,
74
+ style: {
75
+ ...t.style,
76
+ fontWeight: i === e ? 700 : 400
77
+ },
78
+ children: e
79
+ });
80
+ } },
81
+ sx: { ".MuiChartsAxis-line": { stroke: "border.darker" } },
82
+ tickLabelStyle: {
83
+ fontSize: 11,
84
+ fill: "text.secondary",
85
+ fontWeight: 400
86
+ }
87
+ }), /* @__PURE__ */ o(T, {
88
+ onItemClick: (e, { dataIndex: t, seriesId: i }) => C({
89
+ dataIndex: t,
90
+ seriesId: i.toString()
91
+ }),
92
+ slots: { bar: (e) => {
93
+ const { ownerState: t, ...i } = e, k = l === t.dataIndex ? t.color : `${t.color}50`;
94
+ return /* @__PURE__ */ o(I, {
95
+ ...i,
96
+ color: k,
97
+ data: r,
98
+ series: {
99
+ index: t.dataIndex,
100
+ type: Number(t.id?.toString().split("-").pop() ?? 0)
101
+ },
102
+ style: {
103
+ height: e.height,
104
+ x: e.x,
105
+ y: e.y,
106
+ width: e.width
107
+ }
108
+ });
109
+ } }
110
+ })]
111
+ })
112
+ }),
113
+ n === "bottom" && c
114
+ ]
115
+ }) : /* @__PURE__ */ o(S, {});
112
116
  };
113
117
  export {
114
- E as DoubleBarChart
118
+ _ as DoubleBarChart
115
119
  };
116
120
 
117
121
  //# sourceMappingURL=DoubleBarChart.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DoubleBarChart.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/DoubleBarChart.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { BarPlot } from '@mui/x-charts/BarChart'\nimport { ChartContainer } from '@mui/x-charts/ChartContainer'\nimport { ChartsXAxis } from '@mui/x-charts/ChartsXAxis'\n\nimport { useContainerDimensions } from '../../hooks/useContainerDimensions'\nimport type { Legends } from '../../../core'\nimport type { DataSet, LegendProps } from '../../../core/types/InsightsInstanceSlotData'\n\nimport { CustomDoubleBarPlotMXUI } from './CustomDoubleBar'\nimport { Legend } from './ChartLegend'\nimport { EmptyBarChart } from './EmptyBarChart'\n\ninterface DoubleBarChartProps {\n // Shaped comparison series (one entry per month column), built by the caller (buildComparisonSeries)\n // \\u2014 mirroring how BarchartBlock builds `data` for BarChartV2.\n bars: DataSet[]\n // Two-entry palette [main, comparison]. Resolved by the caller (the card via getLayoutConfig). This\n // prop is the only color hook \\u2014 getLayoutConfig itself is never modified.\n colors: string[]\n // Same shape as instance_slot_data.legends; mapped onto the palette below.\n legends?: (Legends | LegendProps)[]\n isMini?: boolean\n // Called on a bar click with the clicked column and its sub-series (0 = main, 1 = comparison); the\n // caller decides what a click does (card opens the drawer, drill-down updates its selection).\n onBarClick: (columnIndex: number, subIndex: number) => void\n}\n\n/**\n * Pure double-bar chart (month columns x main/comparison). Presentational and self-contained \\u2014 it\n * receives shaped data + palette as props and reports clicks via onBarClick, holding no store,\n * selection, or data-shaping of its own. This mirrors BarChartV2; the DoubleBarChartBlock card\n * wrapper builds the data and injects the store behavior, exactly as BarchartBlock wraps BarChartV2.\n */\nexport const DoubleBarChart = ({\n bars,\n colors,\n legends,\n isMini = false,\n onBarClick,\n}: DoubleBarChartProps) => {\n // The most recent (last) column is emphasized; the others are dimmed.\n const selectedTabIndex = bars.length - 1\n const barGapRatio = 0.005\n const categoryGapRatio = 0.16\n\n const containerRef = React.useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n\n const handleBarClick = ({ dataIndex, seriesId }: { dataIndex: number; seriesId: string }) => {\n const seriesType = Number(seriesId.split('-').pop())\n onBarClick(dataIndex, seriesType)\n }\n\n // colors can be empty for an unregistered variant (getLayoutConfig miss); fall back to transparent\n // so a swatch never renders as default-black.\n const legendItems = legends?.map((legend, index) => ({\n color: colors[index] ?? 'transparent',\n ...legend,\n })) as LegendProps[]\n\n return bars.length > 0 ? (\n <Stack sx={{ mb: 0, width: '100%', p: 0 }}>\n <Box\n ref={containerRef}\n sx={{\n height: isMini ? 120 : 172,\n touchAction: 'pan-y',\n width: '100%',\n p: 0,\n m: 0,\n '& svg': {\n touchAction: 'pan-y',\n userSelect: 'none',\n },\n }}\n >\n <ChartContainer\n colors={colors}\n dataset={bars as any[]}\n height={height}\n margin={{\n bottom: 16,\n left: 24,\n right: 24,\n top: 0,\n }}\n series={[\n { dataKey: 'main', type: 'bar' },\n { dataKey: 'comparison', type: 'bar' },\n ]}\n width={width}\n xAxis={[\n {\n barGapRatio,\n categoryGapRatio,\n dataKey: 'label',\n scaleType: 'band',\n },\n ]}\n yAxis={[{ width: 0 }]}\n >\n <ChartsXAxis\n disableTicks={false}\n slots={{\n axisTickLabel: ({ text, ...restProps }) => {\n const selectedLabel = bars[selectedTabIndex]?.label\n return (\n <text\n {...restProps}\n style={\n {\n ...restProps.style,\n fontWeight: selectedLabel === text ? 700 : 400,\n } as React.CSSProperties\n }\n >\n {text}\n </text>\n )\n },\n }}\n sx={{\n '.MuiChartsAxis-line': {\n stroke: 'border.darker',\n },\n }}\n tickLabelStyle={{\n fontSize: 11,\n fill: 'text.secondary',\n fontWeight: 400,\n }}\n />\n <BarPlot\n onItemClick={(_, { dataIndex, seriesId }) =>\n handleBarClick({ dataIndex, seriesId: seriesId.toString() })\n }\n slots={{\n bar: (props) => {\n const { ownerState, ...defaultProps } = props\n const isSelected = selectedTabIndex === ownerState.dataIndex\n const barColor = isSelected ? ownerState.color : `${ownerState.color}50`\n\n return (\n <CustomDoubleBarPlotMXUI\n {...defaultProps}\n color={barColor}\n data={bars}\n series={{\n index: ownerState.dataIndex,\n type: Number(ownerState.id?.toString().split('-').pop() ?? 0),\n }}\n style={{\n height: props.height,\n x: props.x,\n y: props.y,\n width: props.width,\n }}\n />\n )\n },\n }}\n />\n </ChartContainer>\n </Box>\n\n {legendItems && !isMini && legendItems.length > 0 && (\n <Legend legendItems={legendItems} legendStyle={{ ml: 24 }} />\n )}\n </Stack>\n ) : (\n <EmptyBarChart />\n )\n}\n"],"mappings":";;;;;;;;;;;AAsCA,IAAa,IAAA,CAAkB,EAC7B,MAAA,GACA,QAAA,GACA,SAAA,GACA,QAAA,IAAS,IACT,YAAA,EAAA,MACyB;AAEzB,QAAM,IAAmB,EAAK,SAAS,GACjC,IAAc,MACd,IAAmB,MAEnB,IAAe,EAAM,OAAuB,IAAI,GAChD,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GAEvD,IAAA,CAAkB,EAAE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AAE,IAAI,GAAG;AAAA,IAAI,CAAA,CAEzD;AAAA,EAEP,CAAA,IAAA,gBAAA,EAAC,GAAD,CAAgB,CAAA;AAEpB"}
1
+ {"version":3,"file":"DoubleBarChart.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/DoubleBarChart.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { BarPlot } from '@mui/x-charts/BarChart'\nimport { ChartContainer } from '@mui/x-charts/ChartContainer'\nimport { ChartsXAxis } from '@mui/x-charts/ChartsXAxis'\n\nimport { useContainerDimensions } from '../../hooks/useContainerDimensions'\nimport type { Legends } from '../../../core'\nimport type { DataSet, LegendProps } from '../../../core/types/InsightsInstanceSlotData'\n\nimport { CustomDoubleBarPlotMXUI } from './CustomDoubleBar'\nimport { Legend } from './ChartLegend'\nimport { EmptyBarChart } from './EmptyBarChart'\n\ninterface DoubleBarChartProps {\n // Shaped comparison series (one entry per month column), built by the caller (buildComparisonSeries)\n // \\u2014 mirroring how BarchartBlock builds `data` for BarChartV2.\n bars: DataSet[]\n // Two-entry palette [main, comparison]. Resolved by the caller (the card via getLayoutConfig). This\n // prop is the only color hook \\u2014 getLayoutConfig itself is never modified.\n colors: string[]\n // Legend items (toLegendItems over the block's additional_data); mapped onto the palette below.\n legends?: Legends[]\n isMini?: boolean\n // Where the legend sits, as BarChartV2's prop of the same name: below the chart (card) by default,\n // above it in the drawer.\n legendPosition?: 'top' | 'bottom'\n // The emphasized column (the drawer's selected month); defaults to the most recent (last) column.\n selectedIndex?: number\n // Called on a bar click with the clicked column and its sub-series (0 = main, 1 = comparison); the\n // caller decides what a click does (card opens the drawer, drill-down updates its selection).\n onBarClick: (columnIndex: number, subIndex: number) => void\n}\n\n/**\n * Pure double-bar chart (month columns x main/comparison). Presentational and self-contained \\u2014 it\n * receives shaped data + palette as props and reports clicks via onBarClick, holding no store,\n * selection, or data-shaping of its own. This mirrors BarChartV2; the DoubleBarChartBlock card\n * wrapper builds the data and injects the store behavior, exactly as BarchartBlock wraps BarChartV2.\n */\nexport const DoubleBarChart = ({\n bars,\n colors,\n legends,\n isMini = false,\n legendPosition = 'bottom',\n selectedIndex,\n onBarClick,\n}: DoubleBarChartProps) => {\n // The selected column (default: the most recent, last) is emphasized; the others are dimmed.\n const selectedTabIndex = selectedIndex ?? bars.length - 1\n const barGapRatio = 0.005\n const categoryGapRatio = 0.16\n\n const containerRef = React.useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n\n const handleBarClick = ({ dataIndex, seriesId }: { dataIndex: number; seriesId: string }) => {\n const seriesType = Number(seriesId.split('-').pop())\n onBarClick(dataIndex, seriesType)\n }\n\n // colors can be empty for an unregistered variant (getLayoutConfig miss); fall back to transparent\n // so a swatch never renders as default-black.\n const legendItems = legends?.map((legend, index) => ({\n color: colors[index] ?? 'transparent',\n ...legend,\n })) as LegendProps[]\n\n const legend = !!legendItems?.length && (\n <Legend legendItems={legendItems} legendStyle={{ ml: 24 }} />\n )\n\n return bars.length > 0 ? (\n <Stack sx={{ mb: 0, width: '100%', p: 0 }}>\n {legendPosition === 'top' && legend}\n <Box\n ref={containerRef}\n sx={{\n height: isMini ? 120 : 172,\n touchAction: 'pan-y',\n width: '100%',\n p: 0,\n m: 0,\n '& svg': {\n touchAction: 'pan-y',\n userSelect: 'none',\n },\n }}\n >\n <ChartContainer\n colors={colors}\n dataset={bars as any[]}\n height={height}\n margin={{\n bottom: 16,\n left: 24,\n right: 24,\n top: 0,\n }}\n series={[\n { dataKey: 'main', type: 'bar' },\n { dataKey: 'comparison', type: 'bar' },\n ]}\n width={width}\n xAxis={[\n {\n barGapRatio,\n categoryGapRatio,\n dataKey: 'label',\n scaleType: 'band',\n },\n ]}\n yAxis={[{ width: 0 }]}\n >\n <ChartsXAxis\n disableTicks={false}\n slots={{\n axisTickLabel: ({ text, ...restProps }) => {\n const selectedLabel = bars[selectedTabIndex]?.label\n return (\n <text\n {...restProps}\n style={\n {\n ...restProps.style,\n fontWeight: selectedLabel === text ? 700 : 400,\n } as React.CSSProperties\n }\n >\n {text}\n </text>\n )\n },\n }}\n sx={{\n '.MuiChartsAxis-line': {\n stroke: 'border.darker',\n },\n }}\n tickLabelStyle={{\n fontSize: 11,\n fill: 'text.secondary',\n fontWeight: 400,\n }}\n />\n <BarPlot\n onItemClick={(_, { dataIndex, seriesId }) =>\n handleBarClick({ dataIndex, seriesId: seriesId.toString() })\n }\n slots={{\n bar: (props) => {\n const { ownerState, ...defaultProps } = props\n const isSelected = selectedTabIndex === ownerState.dataIndex\n const barColor = isSelected ? ownerState.color : `${ownerState.color}50`\n\n return (\n <CustomDoubleBarPlotMXUI\n {...defaultProps}\n color={barColor}\n data={bars}\n series={{\n index: ownerState.dataIndex,\n type: Number(ownerState.id?.toString().split('-').pop() ?? 0),\n }}\n style={{\n height: props.height,\n x: props.x,\n y: props.y,\n width: props.width,\n }}\n />\n )\n },\n }}\n />\n </ChartContainer>\n </Box>\n\n {legendPosition === 'bottom' && legend}\n </Stack>\n ) : (\n <EmptyBarChart />\n )\n}\n"],"mappings":";;;;;;;;;;;AA2CA,IAAa,IAAA,CAAkB,EAC7B,MAAA,GACA,QAAA,GACA,SAAA,GACA,QAAA,IAAS,IACT,gBAAA,IAAiB,UACjB,eAAA,GACA,YAAA,EAAA,MACyB;AAEzB,QAAM,IAAmB,KAAiB,EAAK,SAAS,GAClD,IAAc,MACd,IAAmB,MAEnB,IAAe,EAAM,OAAuB,IAAI,GAChD,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GAEvD,IAAA,CAAkB,EAAE,WAAA,GAAW,UAAA,EAAA,MAAwD;AAE3F,IAAA,EAAW,GADQ,OAAO,EAAS,MAAM,GAAG,EAAE,IAAI,CAC5B,CAAU;AAAA,EAClC,GAIM,IAAc,GAAS,IAAA,CAAK,GAAQ,OAAW;AAAA,IACnD,OAAO,EAAO,CAAA,KAAU;AAAA,IACxB,GAAG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{
17
17
  EMERGENCY_SAVINGS_ACTION_BLOCK: string;
18
18
  PAYOFF_CALCULATOR_ACTION_BLOCK: string;
19
19
  BUDGET_DETAILS_ACTION_BLOCK: string;
20
+ ACCOUNT_DETAILS_ACTION_BLOCK: string;
20
21
  ACCOUNT_LIST_ACTION_BLOCK: string;
21
22
  };
@@ -17,6 +17,7 @@ var _ = {
17
17
  EMERGENCY_SAVINGS_ACTION_BLOCK: "emergency_savings_block",
18
18
  PAYOFF_CALCULATOR_ACTION_BLOCK: "payoff_calculator_block",
19
19
  BUDGET_DETAILS_ACTION_BLOCK: "budget_details_block",
20
+ ACCOUNT_DETAILS_ACTION_BLOCK: "account_details_block",
20
21
  ACCOUNT_LIST_ACTION_BLOCK: "account_list_block"
21
22
  };
22
23
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n OVERDRAFT_ACTION_BLOCK: 'transparent_overdraft_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n BUDGET_DETAILS_ACTION_BLOCK: 'budget_details_block',\n ACCOUNT_LIST_ACTION_BLOCK: 'account_list_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAC7B"}
1
+ {"version":3,"file":"actionBlocksKey.es.js","names":[],"sources":["../../../src/insights-v2/mappings/actionBlocksKey.ts"],"sourcesContent":["// Keys for the drawer drilldown registry in `blocks.ts`, extracted into their own module.\n//\n// Why: chart blocks (e.g. BarchartBlock, DoubleBarChartBlock) need\n// `TRANSCATION_HISTORY_ACTION_BLOCK` to tag a chart bar's drilldown context, but they are\n// themselves re-exported through `../blocks` -> `mappings/blocks.ts` imports from that same\n// barrel to build its `blocks` registry. Importing the key straight from `mappings/blocks.ts`\n// closed that loop into a circular import: evaluating `mappings/blocks.ts` pulled in the\n// `blocks` barrel, which (before it got to `ComponentBlocks`/`AccountBlock`) loaded\n// `BarchartBlock`, which imported back into the still-initializing `mappings/blocks.ts` —\n// tripping a \"Cannot access 'AccountBlock' before initialization\" TDZ error in Storybook/Vite.\n//\n// Keeping the keys here (no dependency on `mappings/blocks.ts`) lets chart blocks reference\n// them without re-entering that module.\n//\n// Names follow ditto: its registry ends every CTA block in `_block` and the V2 envelope copies those\n// names verbatim (`transaction_details_block`, `contact_support_block`, `make_transfer_block`).\nexport const actionBlocksKey = {\n PLACEHOLDER_ACTION_BLOCK: 'placeholder_block',\n MAKE_TRANSFER_ACTION_BLOCK: 'make_transfer_block',\n TRANSCATION_HISTORY_ACTION_BLOCK: 'transaction_history_block',\n TRANSACTION_DETAILS_ACTION_BLOCK: 'transaction_details_block',\n CONTACT_SUPPORT_ACTION_BLOCK: 'contact_support_block',\n FEEDBACK_MODAL_ACTION_BLOCK: 'feedback_modal_block',\n CONNECTION_DETAIL_ACTION_BLOCK: 'connection_detail_block',\n CONNECT_WIDGET_ACTION_BLOCK: 'connect_widget_block',\n SURVEY_MODAL_ACTION_BLOCK: 'survey_modal_block',\n RECURRING_TRANSACTION_ACTION_BLOCK: 'recurring_transaction_block',\n TRANSACTION_LIST_ACTION_BLOCK: 'transaction_list_block',\n REMAINING_CASH_ACTION_BLOCK: 'remaining_cash_block',\n AMOUNT_INPUT_MODAL_ACTION_BLOCK: 'amount_input_modal_block',\n OVERDRAFT_ACTION_BLOCK: 'transparent_overdraft_block',\n CREDIT_UTILIZATION_ACTION_BLOCK: 'credit_utilization_block',\n EMERGENCY_SAVINGS_ACTION_BLOCK: 'emergency_savings_block',\n PAYOFF_CALCULATOR_ACTION_BLOCK: 'payoff_calculator_block',\n BUDGET_DETAILS_ACTION_BLOCK: 'budget_details_block',\n ACCOUNT_DETAILS_ACTION_BLOCK: 'account_details_block',\n ACCOUNT_LIST_ACTION_BLOCK: 'account_list_block',\n}\n"],"mappings":"AAgBA,IAAa,IAAkB;AAAA,EAC7B,0BAA0B;AAAA,EAC1B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,kCAAkC;AAAA,EAClC,8BAA8B;AAAA,EAC9B,6BAA6B;AAAA,EAC7B,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,oCAAoC;AAAA,EACpC,+BAA+B;AAAA,EAC/B,6BAA6B;AAAA,EAC7B,iCAAiC;AAAA,EACjC,wBAAwB;AAAA,EACxB,iCAAiC;AAAA,EACjC,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,2BAA2B;AAC7B"}