@mx-cartographer/experiences 9.7.158 → 9.7.160

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 (62) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/common/components/ErrorBoundary.d.ts +1 -0
  3. package/dist/common/components/ErrorBoundary.es.js +1 -1
  4. package/dist/common/components/ErrorBoundary.es.js.map +1 -1
  5. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +2 -0
  6. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +39 -39
  7. package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/AccountListBlock/index.d.ts +1 -1
  9. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +40 -35
  10. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
  11. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.d.ts +2 -0
  12. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js +73 -74
  13. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/BudgetDetailsBlock.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/index.d.ts +1 -1
  15. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.d.ts +2 -0
  16. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js +20 -21
  17. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/CreditUtilizationBlock.es.js.map +1 -1
  18. package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/index.d.ts +1 -1
  19. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.d.ts +2 -0
  20. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +36 -38
  21. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/index.d.ts +1 -1
  23. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.d.ts +2 -0
  24. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js +29 -30
  25. package/dist/insights-v2/actionBlocks/OverdraftBlock/OverdraftBlock.es.js.map +1 -1
  26. package/dist/insights-v2/actionBlocks/OverdraftBlock/index.d.ts +1 -1
  27. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.d.ts +2 -0
  28. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +60 -59
  29. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
  30. package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/index.d.ts +1 -1
  31. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.d.ts +2 -0
  32. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js +20 -20
  33. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/PayoffStrategiesBlock.es.js.map +1 -1
  34. package/dist/insights-v2/actionBlocks/PayoffStrategiesBlock/index.d.ts +1 -1
  35. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -1
  36. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +2 -0
  37. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +36 -36
  38. package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
  39. package/dist/insights-v2/actionBlocks/RemainingCashBlock/index.d.ts +1 -1
  40. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.d.ts +2 -1
  41. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +77 -76
  42. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  43. package/dist/insights-v2/actionBlocks/useRequiredCopy.d.ts +3 -0
  44. package/dist/insights-v2/actionBlocks/useRequiredCopy.es.js +11 -0
  45. package/dist/insights-v2/actionBlocks/useRequiredCopy.es.js.map +1 -0
  46. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js +13 -12
  47. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map +1 -1
  48. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +6 -3
  49. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js +8 -3
  50. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
  51. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +33 -33
  52. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  53. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +2 -0
  54. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +1 -0
  55. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  56. package/dist/insights-v2/components/chartblocks/DoubleBarChart.d.ts +8 -1
  57. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js +56 -42
  58. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js.map +1 -1
  59. package/dist/insights-v2/mappings/blocks.d.ts +1 -0
  60. package/dist/insights-v2/mappings/blocks.es.js +190 -178
  61. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  62. package/package.json +1 -1
@@ -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\n// One palette per comparison; ditto's snake_case variant shares the legacy PascalCase entry's palette.\n// Spend chart2, Income chart1 (Figma 1941:137446); the card and its drawer both read it. boldLabel: Figma\n// bolds the legend label (\"Spend:\") on these three beats; any other variant leaves it unset (regular).\nconst spendToIncome = (theme: Theme) => ({\n boldLabel: true,\n color: [theme.palette.chart.chart2, theme.palette.chart.chart1] as string[],\n})\n\nconst savingsToIncome = (theme: Theme) => ({\n boldLabel: true,\n color: [theme.palette.chartMono.chartMono5, theme.palette.chartMono.chartMono3] 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 // Insights 2.0: ditto's layout variant for Monthly Debt to Income Comparison. Debt (main) chart5,\n // Income chart1 (Figma 1117:8564); the card and its drawer both read it.\n debt_to_income: {\n boldLabel: true,\n color: [theme.palette.chart.chart5, theme.palette.chart.chart1] as string[],\n },\n SavingsToIncome: savingsToIncome(theme),\n // Insights 2.0: ditto's layout variant for Monthly Savings to Income Comparison.\n savings_to_income: savingsToIncome(theme),\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":"AAKA,IAAM,IAAA,CAAiB,OAAkB;AAAA,EACvC,WAAW;AAAA,EACX,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM;AAChE,IAEM,IAAA,CAAmB,OAAkB;AAAA,EACzC,WAAW;AAAA,EACX,OAAO,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU;AAChF,IAEa,IAAA,CAAmB,GAAc,MAA4B;AACxE,QAAM,IAAS;AAAA,IACb,eAAe,EAAc,CAAK;AAAA,IAElC,iBAAiB,EAAc,CAAK;AAAA,IAGpC,gBAAgB;AAAA,MACd,WAAW;AAAA,MACX,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM;AAAA,IAChE;AAAA,IACA,iBAAiB,EAAgB,CAAK;AAAA,IAEtC,mBAAmB,EAAgB,CAAK;AAAA,EAC1C;AAGA,SAAO,KAAW,OAAO,OAAO,GAAQ,CAAO,IAC3C,EAAO,CAAA,IACP;AACN"}
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\nimport type { PlotSize } from '../../../components/chartblocks/DoubleBarChart'\n\nexport interface DoubleBarLayoutConfig {\n boldLabel?: boolean\n color: string[]\n plotSize?: PlotSize\n}\n\n// One palette per comparison; ditto's snake_case variant shares the legacy PascalCase entry's palette.\n// Spend chart2, Income chart1 (Figma 1941:137446); the card and its drawer both read it. boldLabel: Figma\n// bolds the legend label (\"Spend:\") on these three beats; any other variant leaves it unset (regular).\nconst spendToIncome = (theme: Theme): DoubleBarLayoutConfig => ({\n boldLabel: true,\n color: [theme.palette.chart.chart2, theme.palette.chart.chart1] as string[],\n})\n\nconst savingsToIncome = (theme: Theme): DoubleBarLayoutConfig => ({\n boldLabel: true,\n color: [theme.palette.chartMono.chartMono5, theme.palette.chartMono.chartMono3] as string[],\n // Figma 1243:73833's full card plot.\n plotSize: { height: 144, top: 14, bottom: 6 },\n})\n\nexport const getLayoutConfig = (\n theme: Theme,\n variant?: string | null,\n): DoubleBarLayoutConfig | undefined => {\n const config: Record<string, DoubleBarLayoutConfig> = {\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 // Insights 2.0: ditto's layout variant for Monthly Debt to Income Comparison. Debt (main) chart5,\n // Income chart1 (Figma 1117:8564); the card and its drawer both read it.\n debt_to_income: {\n boldLabel: true,\n color: [theme.palette.chart.chart5, theme.palette.chart.chart1] as string[],\n },\n SavingsToIncome: savingsToIncome(theme),\n // Insights 2.0: ditto's layout variant for Monthly Savings to Income Comparison.\n savings_to_income: savingsToIncome(theme),\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) ? config[variant] : undefined\n}\n"],"mappings":"AAaA,IAAM,IAAA,CAAiB,OAAyC;AAAA,EAC9D,WAAW;AAAA,EACX,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM;AAChE,IAEM,IAAA,CAAmB,OAAyC;AAAA,EAChE,WAAW;AAAA,EACX,OAAO,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU;AAAA,EAE9E,UAAU;AAAA,IAAE,QAAQ;AAAA,IAAK,KAAK;AAAA,IAAI,QAAQ;AAAA,EAAE;AAC9C,IAEa,IAAA,CACX,GACA,MACsC;AACtC,QAAM,IAAgD;AAAA,IACpD,eAAe,EAAc,CAAK;AAAA,IAElC,iBAAiB,EAAc,CAAK;AAAA,IAGpC,gBAAgB;AAAA,MACd,WAAW;AAAA,MACX,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM;AAAA,IAChE;AAAA,IACA,iBAAiB,EAAgB,CAAK;AAAA,IAEtC,mBAAmB,EAAgB,CAAK;AAAA,EAC1C;AAGA,SAAO,KAAW,OAAO,OAAO,GAAQ,CAAO,IAAI,EAAO,CAAA,IAAW;AACvE"}
@@ -5,27 +5,27 @@ import { asLogoRef as j, asNumber as N, asText as x } from "../../slotReaders.es
5
5
  import { useContainerDimensions as P } from "../../../hooks/useContainerDimensions.es.js";
6
6
  import E from "../../../components/LogoFromGuid.es.js";
7
7
  import { Confetti as O } from "../../../components/shared/Confetti.es.js";
8
- import { ReactComponent as G } from "../../../components/shared/images/PaidOffCard.es.js";
9
- import { ReactComponent as H } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
10
- import { statusIconName as M } from "../../../components/statusIcon.es.js";
11
- import { isDetailedAccountVariant as U } from "../DetailedAccountBlock/layout.es.js";
12
- import W from "../DetailedAccountBlock/DetailedAccountBlock.es.js";
13
- import { HeaderComponent as Y } from "./HeaderComponent.es.js";
14
- import { getLayoutConfig as q } from "./layout.es.js";
15
- import { IconComponent as J } from "./IconComponent.es.js";
16
- import { useRef as K } from "react";
17
- import r from "@mui/material/Stack";
8
+ import { ReactComponent as W } from "../../../components/shared/images/PaidOffCard.es.js";
9
+ import { ReactComponent as G } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
10
+ import { statusIconName as H } from "../../../components/statusIcon.es.js";
11
+ import { isDetailedAccountVariant as K } from "../DetailedAccountBlock/layout.es.js";
12
+ import M from "../DetailedAccountBlock/DetailedAccountBlock.es.js";
13
+ import { HeaderComponent as U } from "./HeaderComponent.es.js";
14
+ import { getLayoutConfig as Y } from "./layout.es.js";
15
+ import { IconComponent as q } from "./IconComponent.es.js";
16
+ import { useRef as J } from "react";
17
+ import t from "@mui/material/Stack";
18
18
  import { Text as l } from "@mxenabled/mxui";
19
19
  import { Icon as I } from "@mxenabled/mx-icons";
20
- import { jsx as o, jsxs as t } from "react/jsx-runtime";
20
+ import { jsx as o, jsxs as r } from "react/jsx-runtime";
21
21
  import { useTheme as Q } from "@mui/material/styles";
22
22
  import s from "@mui/material/Box";
23
23
  var vo = ({ payload: g }) => {
24
- const h = Q(), b = K(null), { height: w, width: R } = P(b), { instance_slot: n } = g, { variant: p, institution_guid: S, institution_name: z, icon_name: D, merchant_name: A } = n;
25
- if (U(p)) return /* @__PURE__ */ o(W, { payload: g });
26
- const { data: i } = n, m = i !== void 0, u = m ? N(d(i, "amount")) : n.amount, v = x(d(i, "sub_text")), y = m ? v : n.sub_text, L = m ? v : n.label, a = m ? x(d(i, "header_text")) : n.header_text, c = j(d(i, "logo")), e = $(q(h), p, "default", "AccountBlock");
24
+ const h = Q(), b = J(null), { height: w, width: R } = P(b), { instance_slot: n } = g, { variant: p, institution_guid: S, institution_name: z, icon_name: D, merchant_name: A } = n;
25
+ if (K(p)) return /* @__PURE__ */ o(M, { payload: g });
26
+ const { data: i } = n, m = i !== void 0, u = m ? N(d(i, "amount")) : n.amount, v = x(d(i, "sub_text")), y = m ? v : n.sub_text, L = m ? v : n.label, a = m ? x(d(i, "header_text")) : n.header_text, c = j(d(i, "logo")), e = $(Y(h), p, "default", "AccountBlock");
27
27
  if (e?.isConfetti) {
28
- const f = M(c?.guid), B = {
28
+ const f = H(c?.guid), V = {
29
29
  paidOffCard: /* @__PURE__ */ o(s, {
30
30
  sx: {
31
31
  flexShrink: 0,
@@ -33,7 +33,7 @@ var vo = ({ payload: g }) => {
33
33
  position: "relative",
34
34
  width: 48
35
35
  },
36
- children: /* @__PURE__ */ o(G, {
36
+ children: /* @__PURE__ */ o(W, {
37
37
  "aria-hidden": !0,
38
38
  role: "presentation",
39
39
  style: {
@@ -43,7 +43,7 @@ var vo = ({ payload: g }) => {
43
43
  }
44
44
  })
45
45
  }),
46
- savings: /* @__PURE__ */ o(H, {
46
+ savings: /* @__PURE__ */ o(G, {
47
47
  "aria-hidden": !0,
48
48
  height: 55,
49
49
  role: "presentation",
@@ -57,7 +57,7 @@ var vo = ({ payload: g }) => {
57
57
  overflow: "hidden",
58
58
  width: 48
59
59
  },
60
- children: f ? /* @__PURE__ */ o(r, {
60
+ children: f ? /* @__PURE__ */ o(t, {
61
61
  "data-icon": f,
62
62
  sx: {
63
63
  alignItems: "center",
@@ -77,17 +77,17 @@ var vo = ({ payload: g }) => {
77
77
  size: 48
78
78
  }) : null
79
79
  })
80
- }[e.graphic ?? "logo"], F = x(d(i, "secondary_text")) || (A ?? z), C = e.secondarySource === "merchant" ? F : L, _ = C ? /* @__PURE__ */ o(l, {
80
+ }[e.graphic ?? "logo"], B = x(d(i, "secondary_text")) || (A ?? z), C = e.secondarySource === "merchant" ? B : L, _ = C ? /* @__PURE__ */ o(l, {
81
81
  color: e.secondaryColor,
82
82
  variant: e.secondaryVariant,
83
83
  children: C
84
- }) : null, V = u != null ? /* @__PURE__ */ o(l, {
85
- bold: !0,
84
+ }) : null, F = u != null ? /* @__PURE__ */ o(l, {
85
+ bold: !e.amountKeepsVariantWeight,
86
86
  color: "success.dark",
87
87
  variant: e.amountVariant,
88
88
  children: `${e.amountPrefix ?? ""}${k(u, T.cents)}`
89
89
  }) : null;
90
- return /* @__PURE__ */ t(s, {
90
+ return /* @__PURE__ */ r(s, {
91
91
  ref: b,
92
92
  sx: {
93
93
  backgroundImage: e.gradient,
@@ -109,7 +109,7 @@ var vo = ({ payload: g }) => {
109
109
  shouldRun: w > 0 && R > 0,
110
110
  width: R
111
111
  })
112
- }), /* @__PURE__ */ t(r, {
112
+ }), /* @__PURE__ */ r(t, {
113
113
  sx: {
114
114
  borderRadius: "8px",
115
115
  ...e.cardShadow && { boxShadow: h.shadows[1] },
@@ -129,7 +129,7 @@ var vo = ({ payload: g }) => {
129
129
  variant: "caption",
130
130
  children: a
131
131
  })
132
- }), /* @__PURE__ */ t(r, {
132
+ }), /* @__PURE__ */ r(t, {
133
133
  sx: {
134
134
  alignItems: "center",
135
135
  bgcolor: "success.lighter",
@@ -149,15 +149,15 @@ var vo = ({ payload: g }) => {
149
149
  display: "flex",
150
150
  flexShrink: 0
151
151
  },
152
- children: B
153
- }), /* @__PURE__ */ t(r, {
152
+ children: V
153
+ }), /* @__PURE__ */ r(t, {
154
154
  sx: {
155
155
  flex: "1 0 0",
156
156
  minWidth: 0
157
157
  },
158
158
  children: [
159
159
  e.secondaryPosition === "above" && _,
160
- V,
160
+ F,
161
161
  e.secondaryPosition === "below" && _
162
162
  ]
163
163
  })]
@@ -165,18 +165,18 @@ var vo = ({ payload: g }) => {
165
165
  })]
166
166
  });
167
167
  }
168
- return /* @__PURE__ */ o(r, {
168
+ return /* @__PURE__ */ o(t, {
169
169
  sx: {
170
170
  background: e.background,
171
171
  p: 16
172
172
  },
173
- children: /* @__PURE__ */ t(r, {
173
+ children: /* @__PURE__ */ r(t, {
174
174
  sx: {
175
175
  borderRadius: "8px",
176
176
  boxShadow: h.shadows[1],
177
177
  width: "100%"
178
178
  },
179
- children: [a && /* @__PURE__ */ o(Y, { headerText: a }), /* @__PURE__ */ t(r, {
179
+ children: [a && /* @__PURE__ */ o(U, { headerText: a }), /* @__PURE__ */ r(t, {
180
180
  sx: {
181
181
  alignItems: "center",
182
182
  bgcolor: "background.paper",
@@ -190,14 +190,14 @@ var vo = ({ payload: g }) => {
190
190
  },
191
191
  ...(S || D || c?.guid) && { flexDirection: "row" }
192
192
  },
193
- children: [/* @__PURE__ */ o(J, {
193
+ children: [/* @__PURE__ */ o(q, {
194
194
  logo: c,
195
195
  slot: n,
196
196
  variant: p
197
- }), /* @__PURE__ */ t(r, { children: [u != null && /* @__PURE__ */ o(l, {
197
+ }), /* @__PURE__ */ r(t, { children: [u != null && /* @__PURE__ */ o(l, {
198
198
  variant: "h2",
199
199
  children: k(u, T.cents)
200
- }), /* @__PURE__ */ t(r, {
200
+ }), /* @__PURE__ */ r(t, {
201
201
  sx: {
202
202
  gap: 8,
203
203
  flexDirection: "row",
@@ -1 +1 @@
1
- {"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload } from '../../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText } from '../../slotReaders'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V1 beats send no `data`. V2 reads only `data` (no `slotOrFlat`): its stale flat fields must never show.\n const { data } = instance_slot\n const v2 = data !== undefined\n const amount = v2 ? asNumber(slot(data, 'amount')) : instance_slot.amount\n // One V2 slot; V1 named it `sub_text` on the standard tile and `label` on the confetti one.\n const v2SubText = asText(slot(data, 'sub_text'))\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const header_text = v2 ? asText(slot(data, 'header_text')) : instance_slot.header_text\n const logo = asLogoRef(slot(data, 'logo'))\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // The 58x46 SVG's card sits 14px down (its check badge overflows top-right); box it to the\n // 48x32 frame so it lines up with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // The payer: V2's `secondary_text`, else the merchant, else the institution.\n const payer = asText(slot(data, 'secondary_text')) || (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, CURRENCY_FORMAT.cents)}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && (\n <Text variant=\"h2\">{formatCurrency(amount, CURRENCY_FORMAT.cents)}</Text>\n )}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAGvF,QAAM,EAAE,MAAA,EAAA,IAAS,GACX,IAAK,MAAS,QACd,IAAS,IAAK,EAAS,EAAK,GAAM,QAAQ,CAAC,IAAI,EAAc,QAE7D,IAAY,EAAO,EAAK,GAAM,UAAU,CAAC,GACzC,IAAW,IAAK,IAAY,EAAc,UAC1C,IAAQ,IAAK,IAAY,EAAc,OACvC,IAAc,IAAK,EAAO,EAAK,GAAM,aAAa,CAAC,IAAI,EAAc,aACrE,IAAO,EAAU,EAAK,GAAM,MAAM,CAAC,GACnC,IAAe,EACnB,EAAgB,CAAK,GACrB,GACA,WACA,cACF;AAEA,MAAI,GAAc,YAAY;AAC5B,UAAM,IAAe,EAAe,GAAM,IAAI,GAmDxC,IAAU;AAAA,MAjDd,aAGE,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI;AAAA,UAAE,YAAY;AAAA,UAAG,QAAQ;AAAA,UAAI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ACnD,eAAe,MACjB;AAAA,QACF;AAAA,QAhBF,UAAA,CAkBE,gBAAA,EAAC,GAAD;AAAA,UAAqB,MAAA;AAAA,UAAM,MAAM;AAAA,UAAwB,SAAA;AAAA,QAAU,CAAA,GAEnE,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KAAU,QACT,gBAAA,EAAC,GAAD;AAAA,UAAM,SAAQ;AAAA,UAAM,UAAA,EAAe,GAAQ,EAAgB,KAAK;AAAA,QAAQ,CAAA,GAE1E,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,eAAe;AAAA,YAAO,YAAY;AAAA,UAAS;AAAA,UAAhE,UAAA,CACG,EAAa,YACZ,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAU,MAAM;AAAA,YAAM,MAAM,EAAa;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA,GAE3E,KACC,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
1
+ {"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload } from '../../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText } from '../../slotReaders'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V1 beats send no `data`. V2 reads only `data` (no `slotOrFlat`): its stale flat fields must never show.\n const { data } = instance_slot\n const v2 = data !== undefined\n const amount = v2 ? asNumber(slot(data, 'amount')) : instance_slot.amount\n // One V2 slot; V1 named it `sub_text` on the standard tile and `label` on the confetti one.\n const v2SubText = asText(slot(data, 'sub_text'))\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const header_text = v2 ? asText(slot(data, 'header_text')) : instance_slot.header_text\n const logo = asLogoRef(slot(data, 'logo'))\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // The 58x46 SVG's card sits 14px down (its check badge overflows top-right); box it to the\n // 48x32 frame so it lines up with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 48 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // The payer: V2's `secondary_text`, else the merchant, else the institution.\n const payer = asText(slot(data, 'secondary_text')) || (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text\n bold={!layoutConfig.amountKeepsVariantWeight}\n color=\"success.dark\"\n variant={layoutConfig.amountVariant}\n >\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, CURRENCY_FORMAT.cents)}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n // Figma's standard tile: 16px on every side, 80px tall in the 112px slot.\n p: 16,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && (\n <Text variant=\"h2\">{formatCurrency(amount, CURRENCY_FORMAT.cents)}</Text>\n )}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAGvF,QAAM,EAAE,MAAA,EAAA,IAAS,GACX,IAAK,MAAS,QACd,IAAS,IAAK,EAAS,EAAK,GAAM,QAAQ,CAAC,IAAI,EAAc,QAE7D,IAAY,EAAO,EAAK,GAAM,UAAU,CAAC,GACzC,IAAW,IAAK,IAAY,EAAc,UAC1C,IAAQ,IAAK,IAAY,EAAc,OACvC,IAAc,IAAK,EAAO,EAAK,GAAM,aAAa,CAAC,IAAI,EAAc,aACrE,IAAO,EAAU,EAAK,GAAM,MAAM,CAAC,GACnC,IAAe,EACnB,EAAgB,CAAK,GACrB,GACA,WACA,cACF;AAEA,MAAI,GAAc,YAAY;AAC5B,UAAM,IAAe,EAAe,GAAM,IAAI,GAmDxC,IAAU;AAAA,MAjDd,aAGE,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI;AAAA,UAAE,YAAY;AAAA,UAAG,QAAQ;AAAA,UAAI,UAAU;AAAA,UAAY,OA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jB;AAAA,QACF;AAAA,QAhBF,UAAA,CAkBE,gBAAA,EAAC,GAAD;AAAA,UAAqB,MAAA;AAAA,UAAM,MAAM;AAAA,UAAwB,SAAA;AAAA,QAAU,CAAA,GAEnE,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KAAU,QACT,gBAAA,EAAC,GAAD;AAAA,UAAM,SAAQ;AAAA,UAAM,UAAA,EAAe,GAAQ,EAAgB,KAAK;AAAA,QAAQ,CAAA,GAE1E,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,eAAe;AAAA,YAAO,YAAY;AAAA,UAAS;AAAA,UAAhE,UAAA,CACG,EAAa,YACZ,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAU,MAAM;AAAA,YAAM,MAAM,EAAa;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA,GAE3E,KACC,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
@@ -23,6 +23,8 @@ export interface BlockLayoutConfig {
23
23
  amountVariant?: 'h2' | 'h3';
24
24
  /** Prefix prepended to the formatted amount, e.g. `+` for deposits. */
25
25
  amountPrefix?: string;
26
+ /** Keep the variant's own weight (h2 is 700) instead of the confetti tile's semi bold. */
27
+ amountKeepsVariantWeight?: boolean;
26
28
  /** Render the colored category strip (`header_text`) at the top of the card. */
27
29
  categoryStrip?: boolean;
28
30
  /** Raise the strip and body together with elevation/1. */
@@ -45,6 +45,7 @@ var e = { background: t }, d = (o) => ({
45
45
  gradient: a,
46
46
  graphic: "logo",
47
47
  amountVariant: "h2",
48
+ amountKeepsVariantWeight: !0,
48
49
  rowSx: {
49
50
  gap: 16,
50
51
  p: 16
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { alpha, type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n ERROR_WASH_GRADIENT,\n FEES_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo). Defaults to 6px. */\n logo_border_radius?: string\n /** Glyph size in px for an `ICO-` logo: on the confetti tile (default 24) and on the standard\n * icon tile (default `TILE_ICON_SIZE`). */\n logo_icon_size?: number\n /** mx-icons glyph shown before `sub_text` (e.g. a warning icon on overdraft_warning). */\n sub_logo?: string\n /** mx-icons glyph badged on the logo's corner (e.g. `error` on Low Account Balance's V2 tile). */\n badge?: string\n /** When true, AccountBlock renders the confetti-backed celebration card using the fields below. */\n isConfetti?: boolean\n /** Gradient wash layered over `background.paper` for the confetti card. */\n gradient?: string\n /** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */\n graphic?: 'paidOffCard' | 'savings' | 'logo'\n /** Amount typography variant — `h2` for milestones, `h3` for deposits. */\n amountVariant?: 'h2' | 'h3'\n /** Prefix prepended to the formatted amount, e.g. `+` for deposits. */\n amountPrefix?: string\n /** Render the colored category strip (`header_text`) at the top of the card. */\n categoryStrip?: boolean\n /** Raise the strip and body together with elevation/1. */\n cardShadow?: boolean\n /** Layout overrides for the graphic+text row (padding, gap). */\n rowSx?: SxProps\n /** Which payload field feeds the secondary line beside the amount. */\n secondarySource?: 'merchant' | 'label'\n /** Whether the secondary line sits above or below the amount. */\n secondaryPosition?: 'above' | 'below'\n /** Typography variant for the secondary line. */\n secondaryVariant?: 'body2' | 'caption'\n /** Theme color path for the secondary line. */\n secondaryColor?: string\n}\n\n/** Glyph size in px on the standard icon tile (IconComponent). */\nexport const TILE_ICON_SIZE = 30\n\n// Low Account Balance's red tile, shared by its legacy (`low_balance_alert`) and V2 (`low_balance`)\n// variant names.\nconst LOW_BALANCE_TILE: BlockLayoutConfig = {\n background: ERROR_WASH_GRADIENT,\n}\n\nexport const getLayoutConfig = (theme: Theme): Record<string, BlockLayoutConfig> => {\n return {\n overdraft_warning: {\n background: theme.palette.warning.light,\n sub_logo: 'error',\n },\n low_balance_alert: LOW_BALANCE_TILE,\n // V2 name for the same tile: content from `instance_slot.data`, the logo badged with `badge`.\n low_balance: { ...LOW_BALANCE_TILE, badge: 'error' },\n // Shared on/off-track status pair — used by Monthly Obligations Status and\n // Payday Cash Left Over Status (identical designs, different copy).\n status_off_track: {\n logo_color: 'background.paper',\n logo_bGcolor: 'error.main',\n // Figma 9936:39145: the money icon's tile has 4px corners.\n logo_border_radius: '4px',\n // Figma draws the money glyph at 24px in both status tiles (9936:39156).\n logo_icon_size: 24,\n background: ERROR_WASH_GRADIENT,\n },\n interest_charges_summary: {\n logo_color: 'text.primary',\n logo_bGcolor: alpha(theme.palette.categories?.feesCharges || '', 0.25),\n logo_border_color: 'categories.feesCharges',\n background: FEES_WASH_GRADIENT,\n },\n // Shared deposit-celebration card — used by both the standard deposit and the emergency-fund\n // deposit beats (identical design, different copy), so one design-named variant serves both.\n deposit_received: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n // Figma: the hero amount is h2 (23px), consistent with the other confetti tiles. Design sign-off:\n // https://mxenabled.slack.com/archives/C0C0F6V8TAQ/p1793864013010539\n amountVariant: 'h2',\n amountPrefix: '+',\n categoryStrip: true,\n cardShadow: true,\n rowSx: { gap: 12, p: 12 },\n secondarySource: 'merchant',\n secondaryPosition: 'below',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n status_on_track: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n payoff_celebration: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'paidOffCard',\n amountVariant: 'h2',\n rowSx: { gap: 16, px: 24, py: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n savings_deposit: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'savings',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'above',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n // Neutral fallback for an unknown/unmatched variant: renders the plain standard card (no\n // confetti, no special background). `resolveVariantConfig` warns before falling back here.\n default: {},\n }\n}\n"],"mappings":";;AAsDA,IAAM,IAAsC,EAC1C,YAAY,EACd,GAEa,IAAA,CAAmB,OACvB;AAAA,EACL,mBAAmB;AAAA,IACjB,YAAY,EAAM,QAAQ,QAAQ;AAAA,IAClC,UAAU;AAAA,EACZ;AAAA,EACA,mBAAmB;AAAA,EAEnB,aAAa;AAAA,IAAE,GAAG;AAAA,IAAkB,OAAO;AAAA,EAAQ;AAAA,EAGnD,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,cAAc;AAAA,IAEd,oBAAoB;AAAA,IAEpB,gBAAgB;AAAA,IAChB,YAAY;AAAA,EACd;AAAA,EACA,0BAA0B;AAAA,IACxB,YAAY;AAAA,IACZ,cAAc,EAAM,EAAM,QAAQ,YAAY,eAAe,IAAI,IAAI;AAAA,IACrE,mBAAmB;AAAA,IACnB,YAAY;AAAA,EACd;AAAA,EAGA,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IAGT,eAAe;AAAA,IACf,cAAc;AAAA,IACd,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,oBAAoB;AAAA,IAClB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,IAAI;AAAA,MAAI,IAAI;AAAA,IAAG;AAAA,IACjC,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EAGA,SAAS,CAAC;AACZ"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { alpha, type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n ERROR_WASH_GRADIENT,\n FEES_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo). Defaults to 6px. */\n logo_border_radius?: string\n /** Glyph size in px for an `ICO-` logo: on the confetti tile (default 24) and on the standard\n * icon tile (default `TILE_ICON_SIZE`). */\n logo_icon_size?: number\n /** mx-icons glyph shown before `sub_text` (e.g. a warning icon on overdraft_warning). */\n sub_logo?: string\n /** mx-icons glyph badged on the logo's corner (e.g. `error` on Low Account Balance's V2 tile). */\n badge?: string\n /** When true, AccountBlock renders the confetti-backed celebration card using the fields below. */\n isConfetti?: boolean\n /** Gradient wash layered over `background.paper` for the confetti card. */\n gradient?: string\n /** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */\n graphic?: 'paidOffCard' | 'savings' | 'logo'\n /** Amount typography variant — `h2` for milestones, `h3` for deposits. */\n amountVariant?: 'h2' | 'h3'\n /** Prefix prepended to the formatted amount, e.g. `+` for deposits. */\n amountPrefix?: string\n /** Keep the variant's own weight (h2 is 700) instead of the confetti tile's semi bold. */\n amountKeepsVariantWeight?: boolean\n /** Render the colored category strip (`header_text`) at the top of the card. */\n categoryStrip?: boolean\n /** Raise the strip and body together with elevation/1. */\n cardShadow?: boolean\n /** Layout overrides for the graphic+text row (padding, gap). */\n rowSx?: SxProps\n /** Which payload field feeds the secondary line beside the amount. */\n secondarySource?: 'merchant' | 'label'\n /** Whether the secondary line sits above or below the amount. */\n secondaryPosition?: 'above' | 'below'\n /** Typography variant for the secondary line. */\n secondaryVariant?: 'body2' | 'caption'\n /** Theme color path for the secondary line. */\n secondaryColor?: string\n}\n\n/** Glyph size in px on the standard icon tile (IconComponent). */\nexport const TILE_ICON_SIZE = 30\n\n// Low Account Balance's red tile, shared by its legacy (`low_balance_alert`) and V2 (`low_balance`)\n// variant names.\nconst LOW_BALANCE_TILE: BlockLayoutConfig = {\n background: ERROR_WASH_GRADIENT,\n}\n\nexport const getLayoutConfig = (theme: Theme): Record<string, BlockLayoutConfig> => {\n return {\n overdraft_warning: {\n background: theme.palette.warning.light,\n sub_logo: 'error',\n },\n low_balance_alert: LOW_BALANCE_TILE,\n // V2 name for the same tile: content from `instance_slot.data`, the logo badged with `badge`.\n low_balance: { ...LOW_BALANCE_TILE, badge: 'error' },\n // Shared on/off-track status pair — used by Monthly Obligations Status and\n // Payday Cash Left Over Status (identical designs, different copy).\n status_off_track: {\n logo_color: 'background.paper',\n logo_bGcolor: 'error.main',\n // Figma 9936:39145: the money icon's tile has 4px corners.\n logo_border_radius: '4px',\n // Figma draws the money glyph at 24px in both status tiles (9936:39156).\n logo_icon_size: 24,\n background: ERROR_WASH_GRADIENT,\n },\n interest_charges_summary: {\n logo_color: 'text.primary',\n logo_bGcolor: alpha(theme.palette.categories?.feesCharges || '', 0.25),\n logo_border_color: 'categories.feesCharges',\n background: FEES_WASH_GRADIENT,\n },\n // Shared deposit-celebration card — used by both the standard deposit and the emergency-fund\n // deposit beats (identical design, different copy), so one design-named variant serves both.\n deposit_received: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n // Figma: the hero amount is h2 (23px), consistent with the other confetti tiles. Design sign-off:\n // https://mxenabled.slack.com/archives/C0C0F6V8TAQ/p1793864013010539\n amountVariant: 'h2',\n amountPrefix: '+',\n categoryStrip: true,\n cardShadow: true,\n rowSx: { gap: 12, p: 12 },\n secondarySource: 'merchant',\n secondaryPosition: 'below',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n status_on_track: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h2',\n amountKeepsVariantWeight: true,\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n payoff_celebration: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'paidOffCard',\n amountVariant: 'h2',\n rowSx: { gap: 16, px: 24, py: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n savings_deposit: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'savings',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'above',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n // Neutral fallback for an unknown/unmatched variant: renders the plain standard card (no\n // confetti, no special background). `resolveVariantConfig` warns before falling back here.\n default: {},\n }\n}\n"],"mappings":";;AAwDA,IAAM,IAAsC,EAC1C,YAAY,EACd,GAEa,IAAA,CAAmB,OACvB;AAAA,EACL,mBAAmB;AAAA,IACjB,YAAY,EAAM,QAAQ,QAAQ;AAAA,IAClC,UAAU;AAAA,EACZ;AAAA,EACA,mBAAmB;AAAA,EAEnB,aAAa;AAAA,IAAE,GAAG;AAAA,IAAkB,OAAO;AAAA,EAAQ;AAAA,EAGnD,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,cAAc;AAAA,IAEd,oBAAoB;AAAA,IAEpB,gBAAgB;AAAA,IAChB,YAAY;AAAA,EACd;AAAA,EACA,0BAA0B;AAAA,IACxB,YAAY;AAAA,IACZ,cAAc,EAAM,EAAM,QAAQ,YAAY,eAAe,IAAI,IAAI;AAAA,IACrE,mBAAmB;AAAA,IACnB,YAAY;AAAA,EACd;AAAA,EAGA,kBAAkB;AAAA,IAChB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IAGT,eAAe;AAAA,IACf,cAAc;AAAA,IACd,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,0BAA0B;AAAA,IAC1B,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,oBAAoB;AAAA,IAClB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,IAAI;AAAA,MAAI,IAAI;AAAA,IAAG;AAAA,IACjC,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EAGA,SAAS,CAAC;AACZ"}
@@ -1,5 +1,11 @@
1
1
  import { Legends } from '../../../core';
2
2
  import { DataSet } from '../../../core/types/InsightsInstanceSlotData';
3
+ /** A full card's plot box; when set, the y-axis also ends at the tallest bar (Figma 1243:73833). */
4
+ export interface PlotSize {
5
+ height: number;
6
+ top: number;
7
+ bottom: number;
8
+ }
3
9
  interface DoubleBarChartProps {
4
10
  bars: DataSet[];
5
11
  colors: string[];
@@ -7,6 +13,7 @@ interface DoubleBarChartProps {
7
13
  isMini?: boolean;
8
14
  legendPosition?: 'top' | 'bottom';
9
15
  boldLabel?: boolean;
16
+ plotSize?: PlotSize;
10
17
  selectedIndex?: number;
11
18
  onBarClick: (columnIndex: number, subIndex: number) => void;
12
19
  }
@@ -16,5 +23,5 @@ interface DoubleBarChartProps {
16
23
  * selection, or data-shaping of its own. This mirrors BarChartV2; the DoubleBarChartBlock card
17
24
  * wrapper builds the data and injects the store behavior, exactly as BarchartBlock wraps BarChartV2.
18
25
  */
19
- export declare const DoubleBarChart: ({ bars, colors, legends, isMini, legendPosition, boldLabel, selectedIndex, onBarClick, }: DoubleBarChartProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const DoubleBarChart: ({ bars, colors, legends, isMini, legendPosition, boldLabel, plotSize, selectedIndex, onBarClick, }: DoubleBarChartProps) => import("react/jsx-runtime").JSX.Element;
20
27
  export {};
@@ -1,37 +1,48 @@
1
- import { EmptyBarChart as w } from "./EmptyBarChart.es.js";
2
- import { useContainerDimensions as I } from "../../hooks/useContainerDimensions.es.js";
3
- import { CustomDoubleBarPlotMXUI as A } from "./CustomDoubleBar.es.js";
4
- import { Legend as B } from "./ChartLegend.es.js";
1
+ import { EmptyBarChart as A } from "./EmptyBarChart.es.js";
2
+ import { useContainerDimensions as T } from "../../hooks/useContainerDimensions.es.js";
3
+ import { CustomDoubleBarPlotMXUI as v } from "./CustomDoubleBar.es.js";
4
+ import { Legend as N } from "./ChartLegend.es.js";
5
5
  import R from "react";
6
- import L from "@mui/material/Stack";
7
- import { jsx as o, jsxs as d } from "react/jsx-runtime";
8
- import T from "@mui/material/Box";
9
- import { BarPlot as D } from "@mui/x-charts/BarChart";
10
- import { ChartContainer as K } from "@mui/x-charts/ChartContainer";
11
- import { ChartsXAxis as j } from "@mui/x-charts/ChartsXAxis";
12
- var $ = ({ bars: r, colors: i, legends: h, isMini: p = !1, legendPosition: n = "bottom", boldLabel: f = !1, selectedIndex: x, onBarClick: y }) => {
13
- const l = x ?? r.length - 1, b = 5e-3, g = 0.16, s = R.useRef(null), { height: u, width: C } = I(s), k = ({ dataIndex: e, seriesId: t }) => {
14
- y(e, Number(t.split("-").pop()));
15
- }, m = h?.map((e, t) => ({
16
- color: i[t] ?? "transparent",
6
+ import M from "@mui/material/Stack";
7
+ import { jsx as o, jsxs as b } from "react/jsx-runtime";
8
+ import D from "@mui/material/Box";
9
+ import { BarPlot as K } from "@mui/x-charts/BarChart";
10
+ import { ChartContainer as P } from "@mui/x-charts/ChartContainer";
11
+ import { ChartsXAxis as _ } from "@mui/x-charts/ChartsXAxis";
12
+ var j = {
13
+ height: 172,
14
+ top: 0,
15
+ bottom: 16
16
+ }, G = {
17
+ height: 120,
18
+ top: 0,
19
+ bottom: 16
20
+ }, Q = ({ bars: r, colors: n, legends: x, isMini: l = !1, legendPosition: s = "bottom", boldLabel: g = !1, plotSize: y, selectedIndex: u, onBarClick: C }) => {
21
+ const m = u ?? r.length - 1, I = 5e-3, k = 0.16, c = l ? void 0 : y, i = l ? G : {
22
+ ...j,
23
+ ...c
24
+ }, h = c ? Math.max(0, ...r.flatMap(({ main: e, comparison: t }) => [Number(e) || 0, Number(t) || 0])) : 0, d = R.useRef(null), { height: w, width: L } = T(d), S = ({ dataIndex: e, seriesId: t }) => {
25
+ C(e, Number(t.split("-").pop()));
26
+ }, p = x?.map((e, t) => ({
27
+ color: n[t] ?? "transparent",
17
28
  ...e
18
- })), c = !!m?.length && /* @__PURE__ */ o(B, {
19
- boldLabel: f,
20
- legendItems: m,
29
+ })), f = !!p?.length && /* @__PURE__ */ o(N, {
30
+ boldLabel: g,
31
+ legendItems: p,
21
32
  legendStyle: { ml: 24 }
22
33
  });
23
- return r.length > 0 ? /* @__PURE__ */ d(L, {
34
+ return r.length > 0 ? /* @__PURE__ */ b(M, {
24
35
  sx: {
25
36
  mb: 0,
26
37
  width: "100%",
27
38
  p: 0
28
39
  },
29
40
  children: [
30
- n === "top" && c,
31
- /* @__PURE__ */ o(T, {
32
- ref: s,
41
+ s === "top" && f,
42
+ /* @__PURE__ */ o(D, {
43
+ ref: d,
33
44
  sx: {
34
- height: p ? 120 : 172,
45
+ height: i.height,
35
46
  touchAction: "pan-y",
36
47
  width: "100%",
37
48
  p: 0,
@@ -41,15 +52,15 @@ var $ = ({ bars: r, colors: i, legends: h, isMini: p = !1, legendPosition: n = "
41
52
  userSelect: "none"
42
53
  }
43
54
  },
44
- children: /* @__PURE__ */ d(K, {
45
- colors: i,
55
+ children: /* @__PURE__ */ b(P, {
56
+ colors: n,
46
57
  dataset: r,
47
- height: u,
58
+ height: w,
48
59
  margin: {
49
- bottom: 16,
60
+ bottom: i.bottom,
50
61
  left: 24,
51
62
  right: 24,
52
- top: 0
63
+ top: i.top
53
64
  },
54
65
  series: [{
55
66
  dataKey: "main",
@@ -58,18 +69,21 @@ var $ = ({ bars: r, colors: i, legends: h, isMini: p = !1, legendPosition: n = "
58
69
  dataKey: "comparison",
59
70
  type: "bar"
60
71
  }],
61
- width: C,
72
+ width: L,
62
73
  xAxis: [{
63
- barGapRatio: b,
64
- categoryGapRatio: g,
74
+ barGapRatio: I,
75
+ categoryGapRatio: k,
65
76
  dataKey: "label",
66
77
  scaleType: "band"
67
78
  }],
68
- yAxis: [{ width: 0 }],
69
- children: [/* @__PURE__ */ o(j, {
79
+ yAxis: [h > 0 ? {
80
+ width: 0,
81
+ max: h
82
+ } : { width: 0 }],
83
+ children: [/* @__PURE__ */ o(_, {
70
84
  disableTicks: !1,
71
85
  slots: { axisTickLabel: ({ text: e, ...t }) => {
72
- const a = r[l]?.label;
86
+ const a = r[m]?.label;
73
87
  return /* @__PURE__ */ o("text", {
74
88
  ...t,
75
89
  style: {
@@ -85,16 +99,16 @@ var $ = ({ bars: r, colors: i, legends: h, isMini: p = !1, legendPosition: n = "
85
99
  fill: "text.secondary",
86
100
  fontWeight: 400
87
101
  }
88
- }), /* @__PURE__ */ o(D, {
89
- onItemClick: (e, { dataIndex: t, seriesId: a }) => k({
102
+ }), /* @__PURE__ */ o(K, {
103
+ onItemClick: (e, { dataIndex: t, seriesId: a }) => S({
90
104
  dataIndex: t,
91
105
  seriesId: a.toString()
92
106
  }),
93
107
  slots: { bar: (e) => {
94
- const { ownerState: t, ...a } = e, S = l === t.dataIndex ? t.color : `${t.color}50`;
95
- return /* @__PURE__ */ o(A, {
108
+ const { ownerState: t, ...a } = e, B = m === t.dataIndex ? t.color : `${t.color}50`;
109
+ return /* @__PURE__ */ o(v, {
96
110
  ...a,
97
- color: S,
111
+ color: B,
98
112
  data: r,
99
113
  series: {
100
114
  index: t.dataIndex,
@@ -111,12 +125,12 @@ var $ = ({ bars: r, colors: i, legends: h, isMini: p = !1, legendPosition: n = "
111
125
  })]
112
126
  })
113
127
  }),
114
- n === "bottom" && c
128
+ s === "bottom" && f
115
129
  ]
116
- }) : /* @__PURE__ */ o(w, {});
130
+ }) : /* @__PURE__ */ o(A, {});
117
131
  };
118
132
  export {
119
- $ as DoubleBarChart
133
+ Q as DoubleBarChart
120
134
  };
121
135
 
122
136
  //# 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 // 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 // Bold the legend label (\"Spend:\"), keeping the amount regular. Off by default.\n boldLabel?: boolean\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 boldLabel = false,\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 boldLabel={boldLabel} 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":";;;;;;;;;;;AA6CA,IAAa,IAAA,CAAkB,EAC7B,MAAA,GACA,QAAA,GACA,SAAA,GACA,QAAA,IAAS,IACT,gBAAA,IAAiB,UAC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AAA,kBACN,OAAO,EAAW;AAAA,kBAClB,MAAM,OAAO,EAAW,IAAI,SAAS,EAAE,MAAM,GAAG,EAAE,IAAI,KAAK,CAAC;AAAA,gBAC9D;AAAA,gBACA,OAAO;AAAA,kBACL,QAAQ,EAAM;AAAA,kBACd,GAAG,EAAM;AAAA,kBACT,GAAG,EAAM;AAAA,kBACT,OAAO,EAAM;AAAA,gBACf;AAAA,cACD,CAAA;AAAA,YAEL,EACF;AAAA,UACD,CAAA,CACa;AAAA;MACb,CAAA;AAAA,MAEJ,MAAmB,YAAY;AAAA,IAC3B;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\n/** A full card's plot box; when set, the y-axis also ends at the tallest bar (Figma 1243:73833). */\nexport interface PlotSize {\n height: number\n top: number\n bottom: number\n}\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 // Bold the legend label (\"Spend:\"), keeping the amount regular. Off by default.\n boldLabel?: boolean\n // A variant's full-card plot box (mini ignores it).\n plotSize?: PlotSize\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\nconst FULL_PLOT: PlotSize = { height: 172, top: 0, bottom: 16 }\nconst MINI_PLOT: PlotSize = { height: 120, top: 0, bottom: 16 }\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 boldLabel = false,\n plotSize,\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 fitted = isMini ? undefined : plotSize\n const plot = isMini ? MINI_PLOT : { ...FULL_PLOT, ...fitted }\n const tallestBar = fitted\n ? Math.max(\n 0,\n ...bars.flatMap(({ main, comparison }) => [Number(main) || 0, Number(comparison) || 0]),\n )\n : 0\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 boldLabel={boldLabel} 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: plot.height,\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: plot.bottom,\n left: 24,\n right: 24,\n top: plot.top,\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={[tallestBar > 0 ? { width: 0, max: tallestBar } : { 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":";;;;;;;;;;;AAgDA,IAAM,IAAsB;AAAA,EAAE,QAAQ;AAAA,EAAK,KAAK;AAAA,EAAG,QAAQ;AAAG,GACxD,IAAsB;AAAA,EAAE,QAAQ;AAAA,EAAK,KAAK;AAAA,EAAG,QAAQ;AAAG,GAQjD,IAAA,CAAkB,EAC7B,MAAA,GACA,QAAA,GACA,SAAA,GACA,QAAA,IAAS,IACT,gBAAA,IAAiB,UACjB,WAAA,IAAY,IACZ,UAAA,GACA,eAAA,GACA,YAAA,EAAA,MACyB;AAEzB,QAAM,IAAmB,KAAiB,EAAK,SAAS,GAClD,IAAc,MACd,IAAmB,MAEnB,IAAS,IAAS,SAAY,GAC9B,IAAO,IAAS,IAAY;AAAA,IAAE,GAAG;AAAA,IAAW,GAAG;AAAA,EAAO,GACtD,IAAa,IACf,KAAK,IACH,GACA,GAAG,EAAK,QAAA,CAAS,EAAE,MAAA,GAAM,YAAA,EAAA,MAAiB,CAAC,OAAO,CAAI,KAAK,GAAG,OAAO,CAAU,KAAK,CAAC,CAAC,CACxF,IACA,GAEE,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,IACn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MAEJ,MAAmB,YAAY;AAAA,IAC3B;AAAA,EAEP,CAAA,IAAA,gBAAA,EAAC,GAAD,CAAgB,CAAA;AAEpB"}
@@ -7,6 +7,7 @@ export interface ActionBlockEntry {
7
7
  Component: React.ComponentType<ActionBlockProps>;
8
8
  usePrepare: (props: ActionBlockProps) => void;
9
9
  title?: (variant: string | null | undefined, copy: GlobalCopy, beat?: Beat) => string;
10
+ copy?: (copy: GlobalCopy) => unknown;
10
11
  presentation?: 'drawer' | 'modal';
11
12
  headerAction?: 'back' | 'close';
12
13
  }