@mx-cartographer/experiences 9.7.189 → 9.7.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +31 -30
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +3 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +11 -9
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.d.ts +5 -3
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +34 -31
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.d.ts +8 -0
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.es.js +11 -0
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/components/CategoryTile.es.js.map +1 -1
- package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.d.ts +3 -1
- package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.es.js +63 -51
- package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.es.js.map +1 -1
- package/dist/insights-v2/components/LogoFromGuid.d.ts +3 -1
- package/dist/insights-v2/components/LogoFromGuid.es.js +12 -11
- package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
- package/dist/insights-v2/components/LogoMark.d.ts +3 -1
- package/dist/insights-v2/components/LogoMark.es.js +20 -19
- package/dist/insights-v2/components/LogoMark.es.js.map +1 -1
- package/dist/insights-v2/components/celebrationGradients.d.ts +5 -4
- package/dist/insights-v2/components/celebrationGradients.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +56 -55
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/core/types/InsightsInstanceSlotData.es.js +0 -8
- package/dist/core/types/InsightsInstanceSlotData.es.js.map +0 -1
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.d.ts +0 -7
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.es.js +0 -12
- package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.es.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [9.7.191] - 11-19-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Category Budget V2 card: `budget_block` renders the Insights 2.0 slots with the bar coloured by status (on track, near, off track) (WEC-2326)
|
|
4
|
+
|
|
5
|
+
## [9.7.190] - 11-19-2026
|
|
6
|
+
|
|
7
|
+
- **FIXED** - Insights 2.0 Unified Deposit and the deposit templates: the tile's amount is bold, the payer line is a one-line caption in secondary text, and the wash matches Figma (WEC-2367)
|
|
8
|
+
|
|
1
9
|
## [9.7.189] - 11-19-2026
|
|
2
10
|
|
|
3
11
|
- **FIXED** - Budget Details drawer header matches Figma: back arrow, larger month, divider, no status dot, thinner bar and larger labels (WEC-2366)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { slot as
|
|
1
|
+
import { slot as a } from "../../../../core/types/Insights.es.js";
|
|
2
2
|
import { CURRENCY_FORMAT as T, formatCurrency as k } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
3
|
import { resolveVariantConfig as j } from "../../resolveVariantConfig.es.js";
|
|
4
4
|
import { asLogoRef as I, asNumber as N, asText as x } from "../../slotReaders.es.js";
|
|
5
|
-
import { useContainerDimensions as
|
|
6
|
-
import
|
|
7
|
-
import { Confetti as
|
|
8
|
-
import { ReactComponent as
|
|
5
|
+
import { useContainerDimensions as O } from "../../../hooks/useContainerDimensions.es.js";
|
|
6
|
+
import P from "../../../components/LogoFromGuid.es.js";
|
|
7
|
+
import { Confetti as W } from "../../../components/shared/Confetti.es.js";
|
|
8
|
+
import { ReactComponent as E } from "../../../components/shared/images/PaidOffCard.es.js";
|
|
9
9
|
import { ReactComponent as G } from "../../../components/shared/images/SavingsAccountDeposit.es.js";
|
|
10
10
|
import { statusIconName as H } from "../../../components/statusIcon.es.js";
|
|
11
11
|
import { isDetailedAccountVariant as K } from "../DetailedAccountBlock/layout.es.js";
|
|
@@ -14,26 +14,26 @@ import { HeaderComponent as U } from "./HeaderComponent.es.js";
|
|
|
14
14
|
import { getLayoutConfig as Y } from "./layout.es.js";
|
|
15
15
|
import { IconComponent as q } from "./IconComponent.es.js";
|
|
16
16
|
import { useRef as J } from "react";
|
|
17
|
-
import
|
|
17
|
+
import r from "@mui/material/Stack";
|
|
18
18
|
import { Text as l } from "@mxenabled/mxui";
|
|
19
19
|
import { Icon as S } from "@mxenabled/mx-icons";
|
|
20
|
-
import { jsx as o, jsxs as
|
|
20
|
+
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
21
21
|
import { useTheme as Q } from "@mui/material/styles";
|
|
22
|
-
import
|
|
22
|
+
import s from "@mui/material/Box";
|
|
23
23
|
var vo = ({ payload: g }) => {
|
|
24
|
-
const h = Q(), b = J(null), { height: w, width: R } =
|
|
24
|
+
const h = Q(), b = J(null), { height: w, width: R } = O(b), { instance_slot: n } = g, { variant: p, institution_guid: z, institution_name: D, icon_name: L, merchant_name: A } = n;
|
|
25
25
|
if (K(p)) return /* @__PURE__ */ o(M, { payload: g });
|
|
26
|
-
const { data: i } = n, m = i !== void 0, u = m ? N(
|
|
26
|
+
const { data: i } = n, m = i !== void 0, u = m ? N(a(i, "amount")) : n.amount, v = x(a(i, "sub_text")), y = m ? v : n.sub_text, V = m ? v : n.label, c = m ? x(a(i, "header_text")) : n.header_text, d = I(a(i, "logo")) ?? I(a(i, "icon")), e = j(Y(h), p, "default", "AccountBlock");
|
|
27
27
|
if (e?.isConfetti) {
|
|
28
28
|
const f = H(d?.guid), B = {
|
|
29
|
-
paidOffCard: /* @__PURE__ */ o(
|
|
29
|
+
paidOffCard: /* @__PURE__ */ o(s, {
|
|
30
30
|
sx: {
|
|
31
31
|
flexShrink: 0,
|
|
32
32
|
height: 32,
|
|
33
33
|
position: "relative",
|
|
34
34
|
width: 48
|
|
35
35
|
},
|
|
36
|
-
children: /* @__PURE__ */ o(
|
|
36
|
+
children: /* @__PURE__ */ o(E, {
|
|
37
37
|
"aria-hidden": !0,
|
|
38
38
|
role: "presentation",
|
|
39
39
|
style: {
|
|
@@ -49,7 +49,7 @@ var vo = ({ payload: g }) => {
|
|
|
49
49
|
role: "presentation",
|
|
50
50
|
width: 55
|
|
51
51
|
}),
|
|
52
|
-
logo: /* @__PURE__ */ o(
|
|
52
|
+
logo: /* @__PURE__ */ o(s, {
|
|
53
53
|
sx: {
|
|
54
54
|
borderRadius: "4px",
|
|
55
55
|
flexShrink: 0,
|
|
@@ -57,7 +57,7 @@ var vo = ({ payload: g }) => {
|
|
|
57
57
|
overflow: "hidden",
|
|
58
58
|
width: 48
|
|
59
59
|
},
|
|
60
|
-
children: f ? /* @__PURE__ */ o(
|
|
60
|
+
children: f ? /* @__PURE__ */ o(r, {
|
|
61
61
|
"data-icon": f,
|
|
62
62
|
sx: {
|
|
63
63
|
alignItems: "center",
|
|
@@ -72,13 +72,14 @@ var vo = ({ payload: g }) => {
|
|
|
72
72
|
size: e.logo_icon_size ?? 24,
|
|
73
73
|
sx: { color: "success.contrastText" }
|
|
74
74
|
})
|
|
75
|
-
}) : d?.guid ? /* @__PURE__ */ o(
|
|
75
|
+
}) : d?.guid ? /* @__PURE__ */ o(P, {
|
|
76
76
|
logo: d,
|
|
77
77
|
size: 48
|
|
78
78
|
}) : null
|
|
79
79
|
})
|
|
80
|
-
}[e.graphic ?? "logo"], F = x(
|
|
80
|
+
}[e.graphic ?? "logo"], F = x(a(i, "secondary_text")) || (A ?? D), C = e.secondarySource === "merchant" ? F : V, _ = C ? /* @__PURE__ */ o(l, {
|
|
81
81
|
color: e.secondaryColor,
|
|
82
|
+
noWrap: e.secondaryOneLine,
|
|
82
83
|
variant: e.secondaryVariant,
|
|
83
84
|
children: C
|
|
84
85
|
}) : null, $ = u != null ? /* @__PURE__ */ o(l, {
|
|
@@ -87,7 +88,7 @@ var vo = ({ payload: g }) => {
|
|
|
87
88
|
variant: e.amountVariant,
|
|
88
89
|
children: `${e.amountPrefix ?? ""}${k(u, T.cents)}`
|
|
89
90
|
}) : null;
|
|
90
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ t(s, {
|
|
91
92
|
ref: b,
|
|
92
93
|
sx: {
|
|
93
94
|
backgroundImage: e.gradient,
|
|
@@ -97,19 +98,19 @@ var vo = ({ payload: g }) => {
|
|
|
97
98
|
p: 16,
|
|
98
99
|
width: "100%"
|
|
99
100
|
},
|
|
100
|
-
children: [/* @__PURE__ */ o(
|
|
101
|
+
children: [/* @__PURE__ */ o(s, {
|
|
101
102
|
sx: {
|
|
102
103
|
inset: 0,
|
|
103
104
|
pointerEvents: "none",
|
|
104
105
|
position: "absolute",
|
|
105
106
|
zIndex: 1
|
|
106
107
|
},
|
|
107
|
-
children: /* @__PURE__ */ o(
|
|
108
|
+
children: /* @__PURE__ */ o(W, {
|
|
108
109
|
height: w,
|
|
109
110
|
shouldRun: w > 0 && R > 0,
|
|
110
111
|
width: R
|
|
111
112
|
})
|
|
112
|
-
}), /* @__PURE__ */ r
|
|
113
|
+
}), /* @__PURE__ */ t(r, {
|
|
113
114
|
sx: {
|
|
114
115
|
borderRadius: "8px",
|
|
115
116
|
...e.cardShadow && { boxShadow: h.shadows[1] },
|
|
@@ -118,7 +119,7 @@ var vo = ({ payload: g }) => {
|
|
|
118
119
|
width: "100%",
|
|
119
120
|
zIndex: 2
|
|
120
121
|
},
|
|
121
|
-
children: [e.categoryStrip && c && /* @__PURE__ */ o(
|
|
122
|
+
children: [e.categoryStrip && c && /* @__PURE__ */ o(s, {
|
|
122
123
|
sx: {
|
|
123
124
|
bgcolor: "success.main",
|
|
124
125
|
px: 12,
|
|
@@ -129,7 +130,7 @@ var vo = ({ payload: g }) => {
|
|
|
129
130
|
variant: "caption",
|
|
130
131
|
children: c
|
|
131
132
|
})
|
|
132
|
-
}), /* @__PURE__ */ r
|
|
133
|
+
}), /* @__PURE__ */ t(r, {
|
|
133
134
|
sx: {
|
|
134
135
|
alignItems: "center",
|
|
135
136
|
bgcolor: "success.lighter",
|
|
@@ -144,13 +145,13 @@ var vo = ({ payload: g }) => {
|
|
|
144
145
|
flexDirection: "row",
|
|
145
146
|
...e.rowSx
|
|
146
147
|
},
|
|
147
|
-
children: [/* @__PURE__ */ o(
|
|
148
|
+
children: [/* @__PURE__ */ o(s, {
|
|
148
149
|
sx: {
|
|
149
150
|
display: "flex",
|
|
150
151
|
flexShrink: 0
|
|
151
152
|
},
|
|
152
153
|
children: B
|
|
153
|
-
}), /* @__PURE__ */ r
|
|
154
|
+
}), /* @__PURE__ */ t(r, {
|
|
154
155
|
sx: {
|
|
155
156
|
flex: "1 0 0",
|
|
156
157
|
minWidth: 0
|
|
@@ -165,18 +166,18 @@ var vo = ({ payload: g }) => {
|
|
|
165
166
|
})]
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
|
-
return /* @__PURE__ */ o(
|
|
169
|
+
return /* @__PURE__ */ o(r, {
|
|
169
170
|
sx: {
|
|
170
171
|
background: e.background,
|
|
171
172
|
p: 16
|
|
172
173
|
},
|
|
173
|
-
children: /* @__PURE__ */ r
|
|
174
|
+
children: /* @__PURE__ */ t(r, {
|
|
174
175
|
sx: {
|
|
175
176
|
borderRadius: "8px",
|
|
176
177
|
boxShadow: h.shadows[1],
|
|
177
178
|
width: "100%"
|
|
178
179
|
},
|
|
179
|
-
children: [c && /* @__PURE__ */ o(U, { headerText: c }), /* @__PURE__ */ r
|
|
180
|
+
children: [c && /* @__PURE__ */ o(U, { headerText: c }), /* @__PURE__ */ t(r, {
|
|
180
181
|
sx: {
|
|
181
182
|
alignItems: "center",
|
|
182
183
|
bgcolor: "background.paper",
|
|
@@ -188,16 +189,16 @@ var vo = ({ payload: g }) => {
|
|
|
188
189
|
borderTopLeftRadius: "0",
|
|
189
190
|
borderTopRightRadius: "0"
|
|
190
191
|
},
|
|
191
|
-
...(z ||
|
|
192
|
+
...(z || L || d?.guid) && { flexDirection: "row" }
|
|
192
193
|
},
|
|
193
194
|
children: [/* @__PURE__ */ o(q, {
|
|
194
195
|
logo: d,
|
|
195
196
|
slot: n,
|
|
196
197
|
variant: p
|
|
197
|
-
}), /* @__PURE__ */ r
|
|
198
|
+
}), /* @__PURE__ */ t(r, { children: [u != null && /* @__PURE__ */ o(l, {
|
|
198
199
|
variant: "h2",
|
|
199
200
|
children: k(u, T.cents)
|
|
200
|
-
}), /* @__PURE__ */ r
|
|
201
|
+
}), /* @__PURE__ */ t(r, {
|
|
201
202
|
sx: {
|
|
202
203
|
gap: 8,
|
|
203
204
|
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 // `icon` carries the tile glyph when the beat's `logo` is kept for its compact card (charges_summary).\n const logo = asLogoRef(slot(data, 'logo')) ?? asLogoRef(slot(data, 'icon'))\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,aAErE,IAAO,EAAU,EAAK,GAAM,MAAM,CAAC,KAAK,EAAU,EAAK,GAAM,MAAM,CAAC,GACpE,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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,SAAS,EACnD,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 // `icon` carries the tile glyph when the beat's `logo` is kept for its compact card (charges_summary).\n const logo = asLogoRef(slot(data, 'logo')) ?? asLogoRef(slot(data, 'icon'))\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\n color={layoutConfig.secondaryColor}\n noWrap={layoutConfig.secondaryOneLine}\n variant={layoutConfig.secondaryVariant}\n >\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,aAErE,IAAO,EAAU,EAAK,GAAM,MAAM,CAAC,KAAK,EAAU,EAAK,GAAM,MAAM,CAAC,GACpE,IAAe,EACnB,EAAgB,CAAK,GACrB,GACA,WACA,cACF;AAEA,MAAI,GAAc,YAAY;AAC5B,UAAM,IAAe,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A,UACd,KAAK;AAAA,UAEL,GAAG;AAAA,UACH,OAAO;AAAA,UACP,GAAI,KAAe;AAAA,YACjB,qBAAqB;AAAA,YACrB,sBAAsB;AAAA,UACxB;AAAA,UACA,IAAK,KAAoB,KAAa,GAAM,SAAS,EACnD,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"}
|
|
@@ -21,7 +21,7 @@ export interface BlockLayoutConfig {
|
|
|
21
21
|
gradient?: string;
|
|
22
22
|
/** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */
|
|
23
23
|
graphic?: 'paidOffCard' | 'savings' | 'logo';
|
|
24
|
-
/** Amount typography variant
|
|
24
|
+
/** Amount typography variant. */
|
|
25
25
|
amountVariant?: 'h2' | 'h3';
|
|
26
26
|
/** Prefix prepended to the formatted amount, e.g. `+` for deposits. */
|
|
27
27
|
amountPrefix?: string;
|
|
@@ -41,6 +41,8 @@ export interface BlockLayoutConfig {
|
|
|
41
41
|
secondaryVariant?: 'body2' | 'caption';
|
|
42
42
|
/** Theme color path for the secondary line. */
|
|
43
43
|
secondaryColor?: string;
|
|
44
|
+
/** Truncate the secondary line to one line with an ellipsis. */
|
|
45
|
+
secondaryOneLine?: boolean;
|
|
44
46
|
}
|
|
45
47
|
/** Glyph size in px on the standard icon tile (IconComponent). */
|
|
46
48
|
export declare const TILE_ICON_SIZE = 30;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CELEBRATION_GRADIENT as o, ERROR_WASH_GRADIENT as
|
|
2
|
-
var a = { background:
|
|
1
|
+
import { CELEBRATION_GRADIENT as o, DIRECT_DEPOSIT_COMPLETE_GRADIENT as t, ERROR_WASH_GRADIENT as r, FEES_WASH_GRADIENT as n, WARM_LIME_ACCENT_GRADIENT as i } from "../../../components/celebrationGradients.es.js";
|
|
2
|
+
var a = { background: r }, s = (e) => ({
|
|
3
3
|
overdraft_warning: {
|
|
4
|
-
background:
|
|
4
|
+
background: e.palette.warning.light,
|
|
5
5
|
sub_logo: "error"
|
|
6
6
|
},
|
|
7
7
|
low_balance_alert: a,
|
|
@@ -14,7 +14,7 @@ var a = { background: e }, c = (t) => ({
|
|
|
14
14
|
logo_bGcolor: "error.main",
|
|
15
15
|
logo_border_radius: "4px",
|
|
16
16
|
logo_icon_size: 24,
|
|
17
|
-
background:
|
|
17
|
+
background: r
|
|
18
18
|
},
|
|
19
19
|
charges_summary: {
|
|
20
20
|
category_tint: 0.25,
|
|
@@ -22,9 +22,10 @@ var a = { background: e }, c = (t) => ({
|
|
|
22
22
|
},
|
|
23
23
|
deposit_received: {
|
|
24
24
|
isConfetti: !0,
|
|
25
|
-
gradient:
|
|
25
|
+
gradient: t,
|
|
26
26
|
graphic: "logo",
|
|
27
27
|
amountVariant: "h2",
|
|
28
|
+
amountKeepsVariantWeight: !0,
|
|
28
29
|
amountPrefix: "+",
|
|
29
30
|
categoryStrip: !0,
|
|
30
31
|
cardShadow: !0,
|
|
@@ -34,12 +35,13 @@ var a = { background: e }, c = (t) => ({
|
|
|
34
35
|
},
|
|
35
36
|
secondarySource: "merchant",
|
|
36
37
|
secondaryPosition: "below",
|
|
37
|
-
secondaryVariant: "
|
|
38
|
-
secondaryColor: "text.
|
|
38
|
+
secondaryVariant: "caption",
|
|
39
|
+
secondaryColor: "text.secondary",
|
|
40
|
+
secondaryOneLine: !0
|
|
39
41
|
},
|
|
40
42
|
status_on_track: {
|
|
41
43
|
isConfetti: !0,
|
|
42
|
-
gradient:
|
|
44
|
+
gradient: i,
|
|
43
45
|
graphic: "logo",
|
|
44
46
|
amountVariant: "h2",
|
|
45
47
|
amountKeepsVariantWeight: !0,
|
|
@@ -84,7 +86,7 @@ var a = { background: e }, c = (t) => ({
|
|
|
84
86
|
default: {}
|
|
85
87
|
});
|
|
86
88
|
export {
|
|
87
|
-
|
|
89
|
+
s as getLayoutConfig
|
|
88
90
|
};
|
|
89
91
|
|
|
90
92
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { 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 /** Opacity of the category colour behind a `CAT-` tile, with a category-colour border; none = mxui's tile. */\n category_tint?: number\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
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n DIRECT_DEPOSIT_COMPLETE_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 /** Opacity of the category colour behind a `CAT-` tile, with a category-colour border; none = mxui's tile. */\n category_tint?: number\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. */\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 /** Truncate the secondary line to one line with an ellipsis. */\n secondaryOneLine?: boolean\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 // Monthly Credit Card Interest Summary's fees tile (ditto account_block `charges_summary`); its category\n // glyph rides in `icon`.\n charges_summary: {\n category_tint: 0.25,\n background: FEES_WASH_GRADIENT,\n },\n // Unified Deposit and its standalone deposit templates; Figma draws every state alike.\n deposit_received: {\n isConfetti: true,\n gradient: DIRECT_DEPOSIT_COMPLETE_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h2',\n amountKeepsVariantWeight: true,\n amountPrefix: '+',\n categoryStrip: true,\n cardShadow: true,\n rowSx: { gap: 12, p: 12 },\n secondarySource: 'merchant',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n secondaryOneLine: true,\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":";AA6DA,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,E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AA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EAGA,SAAS,CAAC;AACZ"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const BudgetBlock: ({ payload }:
|
|
1
|
+
import { InsightsPayload } from '../../../../core';
|
|
2
|
+
/** The budget card, from the Insights 2.0 slots on `instance_slot.data` (ditto budget_block.yml). */
|
|
3
|
+
export declare const BudgetBlock: ({ payload }: {
|
|
4
|
+
payload: InsightsPayload;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { jsx as
|
|
9
|
-
var
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
logo: { merchant_guid: s },
|
|
16
|
-
size: 48
|
|
17
|
-
}), g = l(o?.spent_label || "", r(u, e.cents)), b = l(o?.budgeted_label || "", r(d, e.cents)), f = /* @__PURE__ */ a(T, {
|
|
18
|
-
bold: !0,
|
|
19
|
-
variant: "h2",
|
|
20
|
-
children: t && t !== null ? l(o?.amount_left_label || "", r(n, e.cents)) : r(n, e.cents)
|
|
21
|
-
});
|
|
22
|
-
return /* @__PURE__ */ a(x, {
|
|
23
|
-
amount: f,
|
|
1
|
+
import { slot as o } from "../../../../core/types/Insights.es.js";
|
|
2
|
+
import { resolveVariantConfig as u } from "../../resolveVariantConfig.es.js";
|
|
3
|
+
import { asLogoRef as p, asNumber as c, asText as e } from "../../slotReaders.es.js";
|
|
4
|
+
import f from "../../../components/LogoFromGuid.es.js";
|
|
5
|
+
import d from "../../../components/ComponentBlocks/StatusIndicator.es.js";
|
|
6
|
+
import { BUDGET_BLOCK_FALLBACK_VARIANT as g, BUDGET_BLOCK_LAYOUT as _ } from "./layout.es.js";
|
|
7
|
+
import { H2 as x, P as T } from "@mxenabled/mxui";
|
|
8
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
9
|
+
var b = 48, B = 0.25, G = ({ payload: l }) => {
|
|
10
|
+
const { data: t, variant: i } = l.instance_slot, n = e(o(t, "amount_text"));
|
|
11
|
+
if (!n) return null;
|
|
12
|
+
const { barColor: m } = u(_, i, g, "BudgetBlock"), s = Math.min(100, Math.max(0, c(o(t, "percent")) ?? 0)), a = e(o(t, "sub_text"));
|
|
13
|
+
return /* @__PURE__ */ r(d, {
|
|
14
|
+
amount: /* @__PURE__ */ r(x, { children: n }),
|
|
24
15
|
borderRadius: "6px",
|
|
25
|
-
completeColor:
|
|
26
|
-
icon:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
completeColor: m,
|
|
17
|
+
icon: /* @__PURE__ */ r(f, {
|
|
18
|
+
categoryTint: B,
|
|
19
|
+
logo: p(o(t, "logo")),
|
|
20
|
+
size: b
|
|
21
|
+
}),
|
|
22
|
+
label: a ? /* @__PURE__ */ r(T, {
|
|
23
|
+
dangerouslySetInnerHTML: { __html: a },
|
|
24
|
+
sx: { "& .bold-copy": {
|
|
25
|
+
fontFamily: "inherit",
|
|
26
|
+
fontWeight: "fontWeightBold"
|
|
27
|
+
} },
|
|
28
|
+
variant: "body2"
|
|
29
|
+
}) : null,
|
|
30
|
+
labelBelowAmount: !0,
|
|
31
|
+
leftLabel: e(o(t, "spent_text")),
|
|
32
|
+
percentComplete: s,
|
|
33
|
+
rightLabel: e(o(t, "budgeted_text")),
|
|
34
|
+
sx: { gap: 12 }
|
|
32
35
|
});
|
|
33
36
|
};
|
|
34
37
|
export {
|
|
35
|
-
|
|
38
|
+
G as BudgetBlock
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
//# sourceMappingURL=BudgetBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import { H2, P } from '@mxenabled/mxui'\n\nimport { slot, type InsightsPayload } from '../../../../core'\n\nimport StatusIndicator from '../../../components/ComponentBlocks/StatusIndicator'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText } from '../../slotReaders'\n\nimport { BUDGET_BLOCK_FALLBACK_VARIANT, BUDGET_BLOCK_LAYOUT } from './layout'\n\nconst TILE_SIZE = 48\n\nconst CATEGORY_TINT = 0.25\n\n/** The budget card, from the Insights 2.0 slots on `instance_slot.data` (ditto budget_block.yml). */\nexport const BudgetBlock = ({ payload }: { payload: InsightsPayload }) => {\n const { data, variant } = payload.instance_slot\n const amountText = asText(slot(data, 'amount_text'))\n // Fail closed: without its amount the card says nothing true.\n if (!amountText) return null\n\n const { barColor } = resolveVariantConfig(\n BUDGET_BLOCK_LAYOUT,\n variant,\n BUDGET_BLOCK_FALLBACK_VARIANT,\n 'BudgetBlock',\n )\n const percent = Math.min(100, Math.max(0, asNumber(slot(data, 'percent')) ?? 0))\n const subText = asText(slot(data, 'sub_text'))\n\n // Figma 156:34790: 48px tile, h2 amount at 700 over its month line (\"to spend in **November**\",\n // body2 with the month bold), a 12px bar with 6px corners, 12px gaps.\n return (\n <StatusIndicator\n amount={<H2>{amountText}</H2>}\n borderRadius=\"6px\"\n completeColor={barColor}\n // A category's tile is tinted; a merchant's logo draws as itself.\n icon={\n <LogoFromGuid\n categoryTint={CATEGORY_TINT}\n logo={asLogoRef(slot(data, 'logo'))}\n size={TILE_SIZE}\n />\n }\n label={\n subText ? (\n // sub_text is mrs_content copy rendered server-side (its only markup the bold-copy span),\n // not user input; painted the same way the card paints description.html_text.\n <P\n dangerouslySetInnerHTML={{ __html: subText }}\n sx={{\n '& .bold-copy': {\n fontFamily: 'inherit',\n fontWeight: 'fontWeightBold',\n },\n }}\n variant=\"body2\"\n />\n ) : null\n }\n labelBelowAmount={true}\n leftLabel={asText(slot(data, 'spent_text'))}\n percentComplete={percent}\n rightLabel={asText(slot(data, 'budgeted_text'))}\n sx={{ gap: 12 }}\n />\n )\n}\n"],"mappings":";;;;;;;;AAYA,IAAM,IAAY,IAEZ,IAAgB,MAGT,IAAA,CAAe,EAAE,SAAA,EAAA,MAA4C;AACxE,QAAM,EAAE,MAAA,GAAM,SAAA,EAAA,IAAY,EAAQ,eAC5B,IAAa,EAAO,EAAK,GAAM,aAAa,CAAC;AAEnD,MAAI,CAAC,EAAY,QAAO;AAExB,QAAM,EAAE,UAAA,EAAA,IAAa,EACnB,GACA,GACA,GACA,aACF,GACM,IAAU,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,EAAS,EAAK,GAAM,SAAS,CAAC,KAAK,CAAC,CAAC,GACzE,IAAU,EAAO,EAAK,GAAM,UAAU,CAAC;AAI7C,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QAAQ,gBAAA,EAAC,GAAD,EAAA,UAAK,EAAe,CAAA;AAAA,IAC5B,cAAa;AAAA,IACb,eAAe;AAAA,IAEf,MACE,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc;AAAA,MACd,MAAM,EAAU,EAAK,GAAM,MAAM,CAAC;AAAA,MAClC,MAAM;AAAA,IACP,CAAA;AAAA,IAEH,OACE,IAGE,gBAAA,EAAC,GAAD;AAAA,MACE,yBAAyB,EAAE,QAAQ,EAAQ;AAAA,MAC3C,IAAI,EACF,gBAAgB;AAAA,QACd,YAAY;AAAA,QACZ,YAAY;AAAA,MACd,EACF;AAAA,MACA,SAAQ;AAAA,IACT,CAAA,IACC;AAAA,IAEN,kBAAkB;AAAA,IAClB,WAAW,EAAO,EAAK,GAAM,YAAY,CAAC;AAAA,IAC1C,iBAAiB;AAAA,IACjB,YAAY,EAAO,EAAK,GAAM,eAAe,CAAC;AAAA,IAC9C,IAAI,EAAE,KAAK,GAAG;AAAA,EACf,CAAA;AAEL"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Category Budget V2's bar colour per ditto layout variant (budget_block). */
|
|
2
|
+
export type BudgetBlockVariant = 'status_on_track' | 'status_near' | 'status_off_track';
|
|
3
|
+
export interface BudgetBlockLayoutConfig {
|
|
4
|
+
/** Theme colour path for the bar's fill. */
|
|
5
|
+
barColor: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const BUDGET_BLOCK_LAYOUT: Record<BudgetBlockVariant, BudgetBlockLayoutConfig>;
|
|
8
|
+
export declare const BUDGET_BLOCK_FALLBACK_VARIANT: BudgetBlockVariant;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var a = {
|
|
2
|
+
status_on_track: { barColor: "success.main" },
|
|
3
|
+
status_near: { barColor: "warning.main" },
|
|
4
|
+
status_off_track: { barColor: "error.main" }
|
|
5
|
+
}, r = "status_on_track";
|
|
6
|
+
export {
|
|
7
|
+
r as BUDGET_BLOCK_FALLBACK_VARIANT,
|
|
8
|
+
a as BUDGET_BLOCK_LAYOUT
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=layout.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.ts"],"sourcesContent":["/** Category Budget V2's bar colour per ditto layout variant (budget_block). */\nexport type BudgetBlockVariant = 'status_on_track' | 'status_near' | 'status_off_track'\n\nexport interface BudgetBlockLayoutConfig {\n /** Theme colour path for the bar's fill. */\n barColor: string\n}\n\nexport const BUDGET_BLOCK_LAYOUT: Record<BudgetBlockVariant, BudgetBlockLayoutConfig> = {\n status_on_track: { barColor: 'success.main' },\n status_near: { barColor: 'warning.main' },\n status_off_track: { barColor: 'error.main' },\n}\n\nexport const BUDGET_BLOCK_FALLBACK_VARIANT: BudgetBlockVariant = 'status_on_track'\n"],"mappings":"AAQA,IAAa,IAA2E;AAAA,EACtF,iBAAiB,EAAE,UAAU,eAAe;AAAA,EAC5C,aAAa,EAAE,UAAU,eAAe;AAAA,EACxC,kBAAkB,EAAE,UAAU,aAAa;AAC7C,GAEa,IAAoD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryTile.es.js","names":[],"sources":["../../../src/insights-v2/components/CategoryTile.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\n\ninterface CategoryTileProps {\n categoryGuid: string\n size: number\n /** Opacity of the category colour behind the glyph, with a category-colour border; none = mxui's tile. */\n tint?: number\n}\n\n/**\n * A category's icon tile. The guid walks up to its top-level parent first: `CategoryIcon` and\n * `getCategoryColor` only know those, and draw a sub-category as Uncategorized.\n */\nconst CategoryTile = observer(({ categoryGuid, size, tint }: CategoryTileProps) => {\n const theme = useTheme()\n const guid = useCategoryStore().getTopLevelCategoryGuid(categoryGuid)\n const color = getCategoryColor(guid, theme)\n\n return (\n <Box data-testid={`category-icon-${guid}`} sx={{ display: 'flex' }}>\n <CategoryIcon\n categoryGuid={guid}\n size={size}\n sx={\n tint === undefined\n ? undefined\n : { bgcolor: alpha(color, tint), border: `1px solid ${color}`, color: 'text.primary' }\n }\n />\n </Box>\n )\n})\n\nexport default CategoryTile\n"],"mappings":";;;;;;;AAqBA,IAAM,IAAe,EAAA,CAAU,EAAE,cAAA,GAAc,MAAA,GAAM,MAAA,EAAA,MAA8B;AACjF,QAAM,IAAQ,EAAS,GACjB,IAAO,EAAiB,EAAE,wBAAwB,CAAY,GAC9D,IAAQ,EAAiB,GAAM,CAAK;AAE1C,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,eAAa,iBAAiB,CAAA;AAAA,IAAQ,IAAI,EAAE,SAAS,OAAO;AAAA,IAC/D,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc;AAAA,MACR,MAAA;AAAA,MACN,IACE,MAAS,SACL,SACA;AAAA,QAAE,SAAS,EAAM,GAAO,CAAI;AAAA,QAAG,QAAQ,aAAa,CAAA;AAAA,QAAS,OAAO;AAAA,MAAe;AAAA,IAE1F,CAAA;AAAA,EACE,CAAA;AAET,CAAC"}
|
|
1
|
+
{"version":3,"file":"CategoryTile.es.js","names":[],"sources":["../../../src/insights-v2/components/CategoryTile.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common/context/hooks'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\n\ninterface CategoryTileProps {\n categoryGuid: string\n size: number\n /** Opacity of the category colour behind the glyph, with a category-colour border; none = mxui's tile. */\n tint?: number\n}\n\n/**\n * A category's icon tile. The guid walks up to its top-level parent first: `CategoryIcon` and\n * `getCategoryColor` only know those, and draw a sub-category as Uncategorized.\n */\nconst CategoryTile = observer(({ categoryGuid, size, tint }: CategoryTileProps) => {\n const theme = useTheme()\n const guid = useCategoryStore().getTopLevelCategoryGuid(categoryGuid)\n const color = getCategoryColor(guid, theme)\n\n return (\n <Box data-testid={`category-icon-${guid}`} sx={{ display: 'flex' }}>\n <CategoryIcon\n categoryGuid={guid}\n size={size}\n sx={\n tint === undefined\n ? undefined\n : { bgcolor: alpha(color, tint), border: `1px solid ${color}`, color: 'text.primary' }\n }\n />\n </Box>\n )\n})\n\nexport default CategoryTile\n"],"mappings":";;;;;;;AAqBA,IAAM,IAAe,EAAA,CAAU,EAAE,cAAA,GAAc,MAAA,GAAM,MAAA,EAAA,MAA8B;AACjF,QAAM,IAAQ,EAAS,GACjB,IAAO,EAAiB,EAAE,wBAAwB,CAAY,GAC9D,IAAQ,EAAiB,GAAM,CAAK;AAE1C,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,eAAa,iBAAiB,CAAA;AAAA,IAAQ,IAAI,EAAE,SAAS,OAAO;AAAA,IAC/D,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc;AAAA,MACR,MAAA;AAAA,MACN,IACE,MAAS,SACL,SACA;AAAA,QAAE,SAAS,EAAM,GAAO,CAAI;AAAA,QAAG,QAAQ,aAAa,CAAA;AAAA,QAAS,OAAO;AAAA,MAAe;AAAA,IAE1F,CAAA;AAAA,EACE,CAAA;AAET,CAAC"}
|
|
@@ -5,6 +5,8 @@ interface StatusIndicatorProps {
|
|
|
5
5
|
completeColor?: string;
|
|
6
6
|
icon: React.ReactNode;
|
|
7
7
|
label: string | React.ReactNode;
|
|
8
|
+
/** Draw the label under the amount instead of above it. Default false. */
|
|
9
|
+
labelBelowAmount?: boolean;
|
|
8
10
|
leftLabel?: string;
|
|
9
11
|
/** Type of `leftLabel` / `rightLabel` under the bar (not `label`): caption on the card, body2 in the drawer. */
|
|
10
12
|
labelVariant?: 'caption' | 'body2';
|
|
@@ -12,5 +14,5 @@ interface StatusIndicatorProps {
|
|
|
12
14
|
rightLabel?: string;
|
|
13
15
|
sx?: SxProps;
|
|
14
16
|
}
|
|
15
|
-
declare const StatusIndicator: ({ amount, borderRadius, completeColor, icon, label, leftLabel, labelVariant, percentComplete, rightLabel, sx, }: StatusIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const StatusIndicator: ({ amount, borderRadius, completeColor, icon, label, labelBelowAmount, leftLabel, labelVariant, percentComplete, rightLabel, sx, }: StatusIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
export default StatusIndicator;
|