@mx-cartographer/experiences 9.7.128 → 9.7.129
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 +4 -0
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +11 -15
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +5 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +77 -30
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.d.ts +26 -13
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js +107 -136
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.d.ts +21 -7
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +34 -17
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.d.ts +3 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js +10 -8
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.d.ts +10 -12
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js +20 -19
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.d.ts +3 -12
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js +8 -8
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.d.ts +9 -0
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js +27 -10
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +1 -7
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +49 -59
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +29 -75
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.d.ts +12 -0
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js +18 -9
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/AmountBreakdownCard.es.js +9 -8
- package/dist/insights-v2/components/AmountBreakdownCard.es.js.map +1 -1
- package/dist/insights-v2/components/InsightListRow.d.ts +31 -0
- package/dist/insights-v2/components/InsightListRow.es.js +111 -0
- package/dist/insights-v2/components/InsightListRow.es.js.map +1 -0
- package/dist/insights-v2/components/SubTabs.d.ts +2 -1
- package/dist/insights-v2/components/SubTabs.es.js +10 -10
- package/dist/insights-v2/components/SubTabs.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +12 -12
- package/dist/insights-v2/mappings/blocks.es.js +21 -21
- package/dist/recurringtransactions/components/RecurringTransactionDetails.d.ts +3 -1
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +169 -120
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js.map +1 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.d.ts +3 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js +151 -118
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -6
- package/dist/transactions/components/shared/TransactionDetails.es.js +149 -199
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/Description.d.ts +2 -0
- package/dist/transactions/components/shared/transactiondetails/Description.es.js +59 -50
- package/dist/transactions/components/shared/transactiondetails/Description.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.d.ts +10 -0
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js +68 -0
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"RemainingCashBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Loader,\n useAccountStore,\n useAppConfig,\n useCashflowStore,\n useGlobalCopyStore,\n} from '../../../common'\nimport getAccountDisplayName from '../../../common/utils/AccountDisplayName'\nimport { CategoryGuids } from '../../../core/constants/Category'\nimport { DEFAULT_INSTITUTION_LOGO_URL } from '../../../core/constants/InstitutionLogo'\nimport { getAccountStartingBalance } from '../../../core/utils/AccountUtils'\nimport CategoryTile from '../../components/CategoryTile'\nimport { ErrorCard } from '../../components/ErrorCard'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { useRecurringExpensesLoadState } from '../RecurringTransactionBlock'\n\nimport { foldOtherRows, getCaption } from './layout'\nimport RemainingCashContent from './RemainingCashContent'\n\n/** Remaining Cash drawer: today's figures from CashflowStore, not the card's (see docs/action-blocks/remaining-cash-block.md). */\nexport const RemainingCashBlock = observer(function RemainingCashBlock(_props: ActionBlockProps) {\n const { common: commonCopy, insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { config } = useAppConfig()\n const { uiStore } = useCashflowStore()\n const { accountsLoaded } = useAccountStore()\n const { failed, ready, retry } = useRecurringExpensesLoadState()\n const copy = insightsFeedCopy?.remaining_cash\n\n // Copy loads once, so a retry can't fix a missing namespace: a plain message, not ErrorCard.\n if (insightsFeedCopy?.general && !copy) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy?.error_message}</Text>\n </Stack>\n )\n }\n\n if (failed) return <ErrorCard onRetry={retry} />\n\n // `accountsLoaded` / `ready` cover another widget's request still in flight.\n if (!ready || !accountsLoaded || !copy) return <Loader />\n\n const accountRows = foldOtherRows(\n uiStore.selectedCashAccounts.map((account) => ({\n amount: getAccountStartingBalance(account, config.display_available_balance_in_accounts),\n key: account.guid,\n // Decorative: the row's visible name already says which account it is.\n leading: (\n <InstitutionLogo alt=\"\" institutionGuid={account.institution_guid ?? ''} size={32} />\n ),\n name: getAccountDisplayName(account),\n })),\n { multi: copy.other_accounts, one: copy.other_accounts_one },\n <InstitutionLogo alt=\"\" institutionGuid=\"\" logoUrl={DEFAULT_INSTITUTION_LOGO_URL} size={32} />,\n )\n const expenseRows = foldOtherRows(\n uiStore.expensesTilNextIncome.map((expense) => ({\n amount: expense.amount,\n key: `${expense.repeatingTransactionGuid}-${expense.expectedDate.getTime()}`,\n leading: <CategoryTile categoryGuid={expense.categoryGuid} size={32} />,\n name: expense.name,\n })),\n { multi: copy.other_expenses, one: copy.other_expenses_one },\n <CategoryTile categoryGuid={CategoryGuids.UNCATEGORIZED} size={32} />,\n )\n\n return (\n <RemainingCashContent\n accounts={{ header: copy.accounts_header, rows: accountRows }}\n expenses={{ header: copy.recurring_expenses_header, rows: expenseRows }}\n summary={{\n remaining: uiStore.hasUpcomingPayday\n ? {\n amount: uiStore.remainingUntilPayday,\n caption: getCaption(copy, uiStore.daysUntilNextIncome),\n }\n : undefined,\n cashOnHand: uiStore.selectedCashBalance,\n cashOnHandLabel: copy.cash_on_hand,\n upcomingExpenses: uiStore.upcomingExpensesTotal,\n upcomingExpensesLabel: copy.upcoming_expenses,\n }}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;AAyBA,IAAa,IAAqB,EAAS,SAA4B,GAA0B;AAC/F,QAAM,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAqB,EAAmB,GAC7E,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,EAAE,SAAA,EAAA,IAAY,EAAiB,GAC/B,EAAE,gBAAA,EAAA,IAAmB,EAAgB,GACrC,EAAE,QAAA,GAAQ,OAAA,GAAO,OAAA,EAAA,IAAU,EAA8B,GACzD,IAAO,GAAkB;AAG/B,MAAI,GAAkB,WAAW,CAAC,EAChC,QACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,GAAY,cAAoB,CAAA;AAAA,EAClC,CAAA;AAIX,MAAI,EAAQ,QAAO,gBAAA,EAAC,GAAD,EAAW,SAAS,EAAQ,CAAA;AAG/C,MAAI,CAAC,KAAS,CAAC,KAAkB,CAAC,EAAM,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAExD,QAAM,IAAc,EAClB,EAAQ,qBAAqB,IAAA,CAAK,OAAa;AAAA,IAC7C,QAAQ,EAA0B,GAAS,EAAO,qCAAqC;AAAA,IACvF,KAAK,EAAQ;AAAA,IAEb,SACE,gBAAA,EAAC,GAAD;AAAA,MAAiB,KAAI;AAAA,MAAG,iBAAiB,EAAQ,oBAAoB;AAAA,MAAI,MAAM;AAAA,IAAK,CAAA;AAAA,IAEtF,MAAM,EAAsB,CAAO;AAAA,EACrC,EAAE,GACF;AAAA,I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.es.js";
|
|
2
|
+
import { getLogoElevation as h } from "../../components/logoShadow.es.js";
|
|
3
|
+
import s from "../../components/InsightListRow.es.js";
|
|
3
4
|
import { createElement as b } from "react";
|
|
4
5
|
import i from "@mui/material/Stack";
|
|
5
6
|
import { Text as a } from "@mxenabled/mxui";
|
|
6
7
|
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
var
|
|
8
|
+
import u from "@mui/material/Box";
|
|
9
|
+
import x from "@mui/material/Divider";
|
|
10
|
+
var c = ({ label: t, value: o }) => /* @__PURE__ */ n(i, {
|
|
10
11
|
sx: {
|
|
11
12
|
alignItems: "center",
|
|
12
13
|
flexDirection: "row",
|
|
@@ -22,9 +23,9 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
22
23
|
bold: !0,
|
|
23
24
|
sx: { fontVariantNumeric: "tabular-nums" },
|
|
24
25
|
variant: "body1",
|
|
25
|
-
children:
|
|
26
|
+
children: o
|
|
26
27
|
})]
|
|
27
|
-
}),
|
|
28
|
+
}), f = ({ cashOnHand: t, cashOnHandLabel: o, remaining: e, upcomingExpenses: d, upcomingExpensesLabel: p }) => /* @__PURE__ */ r(i, {
|
|
28
29
|
sx: {
|
|
29
30
|
pb: 8,
|
|
30
31
|
pt: 24,
|
|
@@ -34,12 +35,12 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
34
35
|
sx: {
|
|
35
36
|
bgcolor: "background.paper",
|
|
36
37
|
borderRadius: "8px",
|
|
37
|
-
boxShadow:
|
|
38
|
+
boxShadow: h,
|
|
38
39
|
gap: 16,
|
|
39
40
|
p: 16
|
|
40
41
|
},
|
|
41
|
-
children: [
|
|
42
|
-
"aria-label": `${
|
|
42
|
+
children: [e && /* @__PURE__ */ n(i, {
|
|
43
|
+
"aria-label": `${l(e.amount)}, ${e.caption}`,
|
|
43
44
|
role: "group",
|
|
44
45
|
sx: {
|
|
45
46
|
alignItems: "center",
|
|
@@ -52,12 +53,12 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
52
53
|
bold: !0,
|
|
53
54
|
component: "p",
|
|
54
55
|
variant: "h2",
|
|
55
|
-
children:
|
|
56
|
+
children: l(e.amount)
|
|
56
57
|
}), /* @__PURE__ */ r(a, {
|
|
57
58
|
"aria-hidden": !0,
|
|
58
59
|
color: "text.secondary",
|
|
59
60
|
variant: "subtitle2",
|
|
60
|
-
children:
|
|
61
|
+
children: e.caption
|
|
61
62
|
})]
|
|
62
63
|
}), /* @__PURE__ */ n(i, {
|
|
63
64
|
sx: {
|
|
@@ -67,66 +68,19 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
67
68
|
overflow: "hidden"
|
|
68
69
|
},
|
|
69
70
|
children: [
|
|
70
|
-
/* @__PURE__ */ r(
|
|
71
|
-
label:
|
|
72
|
-
value:
|
|
71
|
+
/* @__PURE__ */ r(c, {
|
|
72
|
+
label: o,
|
|
73
|
+
value: l(t)
|
|
73
74
|
}),
|
|
74
|
-
/* @__PURE__ */ r(
|
|
75
|
-
/* @__PURE__ */ r(
|
|
76
|
-
label:
|
|
77
|
-
value:
|
|
75
|
+
/* @__PURE__ */ r(x, {}),
|
|
76
|
+
/* @__PURE__ */ r(c, {
|
|
77
|
+
label: p,
|
|
78
|
+
value: l(-d)
|
|
78
79
|
})
|
|
79
80
|
]
|
|
80
81
|
})]
|
|
81
82
|
})
|
|
82
|
-
}),
|
|
83
|
-
component: "li",
|
|
84
|
-
sx: { position: "relative" },
|
|
85
|
-
children: [/* @__PURE__ */ n(i, {
|
|
86
|
-
sx: {
|
|
87
|
-
alignItems: "center",
|
|
88
|
-
flexDirection: "row",
|
|
89
|
-
gap: 16,
|
|
90
|
-
px: 24,
|
|
91
|
-
py: 16
|
|
92
|
-
},
|
|
93
|
-
children: [/* @__PURE__ */ n(i, {
|
|
94
|
-
sx: {
|
|
95
|
-
alignItems: "center",
|
|
96
|
-
flexDirection: "row",
|
|
97
|
-
flexGrow: 1,
|
|
98
|
-
gap: 12,
|
|
99
|
-
minWidth: 0
|
|
100
|
-
},
|
|
101
|
-
children: [/* @__PURE__ */ r(p, {
|
|
102
|
-
sx: {
|
|
103
|
-
display: "flex",
|
|
104
|
-
flexShrink: 0,
|
|
105
|
-
height: 32,
|
|
106
|
-
width: 32
|
|
107
|
-
},
|
|
108
|
-
children: o
|
|
109
|
-
}), /* @__PURE__ */ r(a, {
|
|
110
|
-
truncate: !0,
|
|
111
|
-
variant: "body1",
|
|
112
|
-
children: l
|
|
113
|
-
})]
|
|
114
|
-
}), /* @__PURE__ */ r(a, {
|
|
115
|
-
bold: !0,
|
|
116
|
-
sx: {
|
|
117
|
-
flexShrink: 0,
|
|
118
|
-
fontVariantNumeric: "tabular-nums"
|
|
119
|
-
},
|
|
120
|
-
variant: "body1",
|
|
121
|
-
children: d(t)
|
|
122
|
-
})]
|
|
123
|
-
}), /* @__PURE__ */ r(s, { sx: {
|
|
124
|
-
bottom: 0,
|
|
125
|
-
left: e ? 0 : 24,
|
|
126
|
-
position: "absolute",
|
|
127
|
-
right: 0
|
|
128
|
-
} })]
|
|
129
|
-
}), m = ({ header: t, rows: e }) => /* @__PURE__ */ n(i, { children: [/* @__PURE__ */ r(p, {
|
|
83
|
+
}), m = ({ header: t, rows: o }) => /* @__PURE__ */ n(i, { children: [/* @__PURE__ */ r(u, {
|
|
130
84
|
sx: {
|
|
131
85
|
pb: 4,
|
|
132
86
|
pt: 16,
|
|
@@ -146,24 +100,24 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
146
100
|
m: 0,
|
|
147
101
|
p: 0
|
|
148
102
|
},
|
|
149
|
-
children:
|
|
150
|
-
...
|
|
151
|
-
isLast:
|
|
152
|
-
key:
|
|
103
|
+
children: o.map(({ key: e, ...d }, p) => /* @__PURE__ */ b(s, {
|
|
104
|
+
...d,
|
|
105
|
+
isLast: p === o.length - 1,
|
|
106
|
+
key: e
|
|
153
107
|
}))
|
|
154
|
-
})] }),
|
|
108
|
+
})] }), I = ({ accounts: t, expenses: o, summary: e }) => /* @__PURE__ */ n(i, {
|
|
155
109
|
sx: {
|
|
156
110
|
bgcolor: "background.default",
|
|
157
111
|
pb: 24
|
|
158
112
|
},
|
|
159
113
|
children: [
|
|
160
|
-
/* @__PURE__ */ r(
|
|
114
|
+
/* @__PURE__ */ r(f, { ...e }),
|
|
161
115
|
t.rows.length > 0 && /* @__PURE__ */ r(m, { ...t }),
|
|
162
|
-
|
|
116
|
+
o.rows.length > 0 && /* @__PURE__ */ r(m, { ...o })
|
|
163
117
|
]
|
|
164
118
|
});
|
|
165
119
|
export {
|
|
166
|
-
|
|
120
|
+
I as default
|
|
167
121
|
};
|
|
168
122
|
|
|
169
123
|
//# sourceMappingURL=RemainingCashContent.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemainingCashContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nexport interface RemainingCashRow {\n key: string\n name: string\n amount: number\n /** The row's 32px logo: an account's institution or an expense's category. */\n leading: ReactNode\n}\n\ninterface RemainingCashSectionProps {\n header: string\n /** Already grouped and ordered, including any \"Other (#)\" row. */\n rows: RemainingCashRow[]\n}\n\ninterface RemainingCashSummaryProps {\n /** Omitted when there is no upcoming payday: a \"remaining until payday\" figure has no meaning. */\n remaining?: { amount: number; caption: string }\n cashOnHand: number\n upcomingExpenses: number\n cashOnHandLabel: string\n upcomingExpensesLabel: string\n}\n\nexport interface RemainingCashContentProps {\n summary: RemainingCashSummaryProps\n accounts: RemainingCashSectionProps\n expenses: RemainingCashSectionProps\n}\n\nconst BreakdownRow = ({ label, value }: { label: string; value: string }) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 24 }}>\n <Text sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Text bold={true} sx={{ fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {value}\n </Text>\n </Stack>\n)\n\nconst Summary = ({\n cashOnHand,\n cashOnHandLabel,\n remaining,\n upcomingExpenses,\n upcomingExpensesLabel,\n}: RemainingCashSummaryProps) => (\n <Stack sx={{ pb: 8, pt: 24, px: 24 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 16,\n p: 16,\n }}\n >\n {remaining && (\n // One announcement (\"$2,350.00, Remaining until payday (7 days)\") instead of two loose text\n // nodes. The amount keeps the h2 look but is a paragraph: it is a value, not a heading.\n <Stack\n aria-label={`${formatSignedCurrency(remaining.amount)}, ${remaining.caption}`}\n role=\"group\"\n sx={{ alignItems: 'center', justifyContent: 'center', minHeight: 72, p: 12 }}\n >\n <Text aria-hidden={true} bold={true} component=\"p\" variant=\"h2\">\n {formatSignedCurrency(remaining.amount)}\n </Text>\n <Text aria-hidden={true} color=\"text.secondary\" variant=\"subtitle2\">\n {remaining.caption}\n </Text>\n </Stack>\n )}\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n <BreakdownRow label={cashOnHandLabel} value={formatSignedCurrency(cashOnHand)} />\n <Divider />\n {/* Shown as a deduction (-$1,200.00) per Figma; the expense rows below show positive amounts. */}\n <BreakdownRow\n label={upcomingExpensesLabel}\n value={formatSignedCurrency(-upcomingExpenses)}\n />\n </Stack>\n </Stack>\n </Stack>\n)\n\n
|
|
1
|
+
{"version":3,"file":"RemainingCashContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport InsightListRow from '../../components/InsightListRow'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nexport interface RemainingCashRow {\n key: string\n name: string\n amount: number\n /** The row's 32px logo: an account's institution or an expense's category. */\n leading: ReactNode\n}\n\ninterface RemainingCashSectionProps {\n header: string\n /** Already grouped and ordered, including any \"Other (#)\" row. */\n rows: RemainingCashRow[]\n}\n\ninterface RemainingCashSummaryProps {\n /** Omitted when there is no upcoming payday: a \"remaining until payday\" figure has no meaning. */\n remaining?: { amount: number; caption: string }\n cashOnHand: number\n upcomingExpenses: number\n cashOnHandLabel: string\n upcomingExpensesLabel: string\n}\n\nexport interface RemainingCashContentProps {\n summary: RemainingCashSummaryProps\n accounts: RemainingCashSectionProps\n expenses: RemainingCashSectionProps\n}\n\nconst BreakdownRow = ({ label, value }: { label: string; value: string }) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 24 }}>\n <Text sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Text bold={true} sx={{ fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {value}\n </Text>\n </Stack>\n)\n\nconst Summary = ({\n cashOnHand,\n cashOnHandLabel,\n remaining,\n upcomingExpenses,\n upcomingExpensesLabel,\n}: RemainingCashSummaryProps) => (\n <Stack sx={{ pb: 8, pt: 24, px: 24 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 16,\n p: 16,\n }}\n >\n {remaining && (\n // One announcement (\"$2,350.00, Remaining until payday (7 days)\") instead of two loose text\n // nodes. The amount keeps the h2 look but is a paragraph: it is a value, not a heading.\n <Stack\n aria-label={`${formatSignedCurrency(remaining.amount)}, ${remaining.caption}`}\n role=\"group\"\n sx={{ alignItems: 'center', justifyContent: 'center', minHeight: 72, p: 12 }}\n >\n <Text aria-hidden={true} bold={true} component=\"p\" variant=\"h2\">\n {formatSignedCurrency(remaining.amount)}\n </Text>\n <Text aria-hidden={true} color=\"text.secondary\" variant=\"subtitle2\">\n {remaining.caption}\n </Text>\n </Stack>\n )}\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n <BreakdownRow label={cashOnHandLabel} value={formatSignedCurrency(cashOnHand)} />\n <Divider />\n {/* Shown as a deduction (-$1,200.00) per Figma; the expense rows below show positive amounts. */}\n <BreakdownRow\n label={upcomingExpensesLabel}\n value={formatSignedCurrency(-upcomingExpenses)}\n />\n </Stack>\n </Stack>\n </Stack>\n)\n\n// The drawer title is the h2, so section headers are h3 and each section is a real list.\nconst Section = ({ header, rows }: RemainingCashSectionProps) => (\n <Stack>\n <Box sx={{ pb: 4, pt: 16, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {header}\n </Text>\n </Box>\n <Stack component=\"ul\" sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}>\n {rows.map(({ key, ...row }, index) => (\n <InsightListRow {...row} isLast={index === rows.length - 1} key={key} />\n ))}\n </Stack>\n </Stack>\n)\n\n/** Presentational body of the Remaining Cash drawer (Figma 9936:39163, minus the drawer header). */\nconst RemainingCashContent = ({ accounts, expenses, summary }: RemainingCashContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n <Summary {...summary} />\n {accounts.rows.length > 0 && <Section {...accounts} />}\n {expenses.rows.length > 0 && <Section {...expenses} />}\n </Stack>\n)\n\nexport default RemainingCashContent\n"],"mappings":";;;;;;;;;AAyCA,IAAM,IAAA,CAAgB,EAAE,OAAA,GAAO,OAAA,EAAA,MAC7B,gBAAA,EAAC,GAAD;AAAA,EA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A,GAAU,SAAA,EAAA,MAClD,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,SAAS;AAAA,IAAsB,IAAI;AAAA,EAAG;AAAA,EAAnD,UAAA;AAAA,IACE,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAU,CAAA;AAAA,IACtB,EAAS,KAAK,SAAS,KAAK,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAW,CAAA;AAAA,IACpD,EAAS,KAAK,SAAS,KAAK,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAW,CAAA;AAAA,EAChD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { RemainingCashCopy } from '../../../core';
|
|
2
3
|
/** Rows shown per section before the rest fold into an "Other (#)" row (Figma shows two). */
|
|
3
4
|
export declare const ROW_LIMIT = 2;
|
|
@@ -12,5 +13,16 @@ export interface GroupedRows<T> {
|
|
|
12
13
|
export declare const groupRows: <T extends {
|
|
13
14
|
amount: number;
|
|
14
15
|
}>(rows: T[]) => GroupedRows<T>;
|
|
16
|
+
export interface FoldableRow {
|
|
17
|
+
key: string;
|
|
18
|
+
name: string;
|
|
19
|
+
amount: number;
|
|
20
|
+
leading: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** Top rows by amount, then one "Other (#)" row with the rest's count and total. */
|
|
23
|
+
export declare const foldOtherRows: <T extends FoldableRow>(rows: T[], otherLabel: {
|
|
24
|
+
one: string;
|
|
25
|
+
multi: string;
|
|
26
|
+
}, otherLeading: ReactNode) => (T | FoldableRow)[];
|
|
15
27
|
export declare const getCaption: (copy: RemainingCashCopy, days: number) => string;
|
|
16
28
|
export declare const getOtherLabel: (templateOne: string, templateMulti: string, count: number) => string;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { buildDynamicCopy as a, buildPluralCopy as i } from "../../../core/utils/Localization.es.js";
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
5
|
-
const n =
|
|
2
|
+
var u = (r) => {
|
|
3
|
+
const t = [...r].sort((e, o) => o.amount - e.amount);
|
|
4
|
+
if (t.length <= 2) return { shown: t };
|
|
5
|
+
const n = t.slice(2);
|
|
6
6
|
return {
|
|
7
|
-
shown:
|
|
7
|
+
shown: t.slice(0, 2),
|
|
8
8
|
others: {
|
|
9
9
|
count: n.length,
|
|
10
10
|
total: n.reduce((e, o) => e + o.amount, 0)
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
},
|
|
13
|
+
}, m = (r, t, n) => {
|
|
14
|
+
const { others: e, shown: o } = u(r);
|
|
15
|
+
return e ? [...o, {
|
|
16
|
+
amount: e.total,
|
|
17
|
+
key: "other",
|
|
18
|
+
leading: n,
|
|
19
|
+
name: l(t.one, t.multi, e.count)
|
|
20
|
+
}] : o;
|
|
21
|
+
}, g = (r, t) => t === 1 ? r.remaining_until_payday_one : a(r.remaining_until_payday, String(t)), l = (r, t, n) => i(r, t, n, String(n));
|
|
14
22
|
export {
|
|
15
|
-
|
|
16
|
-
g as
|
|
17
|
-
l as
|
|
23
|
+
m as foldOtherRows,
|
|
24
|
+
g as getCaption,
|
|
25
|
+
l as getOtherLabel,
|
|
26
|
+
u as groupRows
|
|
18
27
|
};
|
|
19
28
|
|
|
20
29
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/layout.ts"],"sourcesContent":["import type { RemainingCashCopy } from '../../../core'\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\n\n/** Rows shown per section before the rest fold into an \"Other (#)\" row (Figma shows two). */\nexport const ROW_LIMIT = 2\n\nexport interface GroupedRows<T> {\n shown: T[]\n others?: { count: number; total: number }\n}\n\n/** Largest rows first (stable for ties), capped at `ROW_LIMIT`; the remainder as a count and total. */\nexport const groupRows = <T extends { amount: number }>(rows: T[]): GroupedRows<T> => {\n const sorted = [...rows].sort((a, b) => b.amount - a.amount)\n\n if (sorted.length <= ROW_LIMIT) return { shown: sorted }\n\n const rest = sorted.slice(ROW_LIMIT)\n\n return {\n shown: sorted.slice(0, ROW_LIMIT),\n others: { count: rest.length, total: rest.reduce((total, r) => total + r.amount, 0) },\n }\n}\n\nexport const getCaption = (copy: RemainingCashCopy, days: number): string => {\n if (days === 1) return copy.remaining_until_payday_one\n\n return buildDynamicCopy(copy.remaining_until_payday, String(days)) as string\n}\n\nexport const getOtherLabel = (templateOne: string, templateMulti: string, count: number): string =>\n buildPluralCopy(templateOne, templateMulti, count, String(count)) as string\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/layout.ts"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport type { RemainingCashCopy } from '../../../core'\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\n\n/** Rows shown per section before the rest fold into an \"Other (#)\" row (Figma shows two). */\nexport const ROW_LIMIT = 2\n\nexport interface GroupedRows<T> {\n shown: T[]\n others?: { count: number; total: number }\n}\n\n/** Largest rows first (stable for ties), capped at `ROW_LIMIT`; the remainder as a count and total. */\nexport const groupRows = <T extends { amount: number }>(rows: T[]): GroupedRows<T> => {\n const sorted = [...rows].sort((a, b) => b.amount - a.amount)\n\n if (sorted.length <= ROW_LIMIT) return { shown: sorted }\n\n const rest = sorted.slice(ROW_LIMIT)\n\n return {\n shown: sorted.slice(0, ROW_LIMIT),\n others: { count: rest.length, total: rest.reduce((total, r) => total + r.amount, 0) },\n }\n}\n\nexport interface FoldableRow {\n key: string\n name: string\n amount: number\n leading: ReactNode\n}\n\n/** Top rows by amount, then one \"Other (#)\" row with the rest's count and total. */\nexport const foldOtherRows = <T extends FoldableRow>(\n rows: T[],\n otherLabel: { one: string; multi: string },\n otherLeading: ReactNode,\n): (T | FoldableRow)[] => {\n const { others, shown } = groupRows(rows)\n\n if (!others) return shown\n\n return [\n ...shown,\n {\n amount: others.total,\n key: 'other',\n leading: otherLeading,\n name: getOtherLabel(otherLabel.one, otherLabel.multi, others.count),\n },\n ]\n}\n\nexport const getCaption = (copy: RemainingCashCopy, days: number): string => {\n if (days === 1) return copy.remaining_until_payday_one\n\n return buildDynamicCopy(copy.remaining_until_payday, String(days)) as string\n}\n\nexport const getOtherLabel = (templateOne: string, templateMulti: string, count: number): string =>\n buildPluralCopy(templateOne, templateMulti, count, String(count)) as string\n"],"mappings":";AAcA,IAAa,IAAA,CAA2C,MAA8B;AACpF,QAAM,IAAS,CAAC,GAAG,CAAI,EAAE,KAAA,CAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM;AAE3D,MAAI,EAAO,UAAA,EAAqB,QAAO,EAAE,OAAO,EAAO;AAEvD,QAAM,IAAO,EAAO,MAAA,CAAe;AAEnC,SAAO;AAAA,IACL,OAAO,EAAO,MAAM,GAAA,CAAY;AAAA,IAChC,QAAQ;AAAA,MAAE,OAAO,EAAK;AAAA,MAAQ,OAAO,EAAK,OAAA,CAAQ,GAAO,MAAM,IAAQ,EAAE,QAAQ,CAAC;AAAA,IAAE;AAAA,EACtF;AACF,GAUa,IAAA,CACX,GACA,GACA,MACwB;AACxB,QAAM,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAU,CAAI;AAExC,SAAK,IAEE,CACL,GAAG,GACH;AAAA,IACE,QAAQ,EAAO;AAAA,IACf,KAAK;AAAA,IACL,SAAS;AAAA,IACT,MAAM,EAAc,EAAW,KAAK,EAAW,OAAO,EAAO,KAAK;AAAA,EACpE,CACF,IAVoB;AAWtB,GAEa,IAAA,CAAc,GAAyB,MAC9C,MAAS,IAAU,EAAK,6BAErB,EAAiB,EAAK,wBAAwB,OAAO,CAAI,CAAC,GAGtD,IAAA,CAAiB,GAAqB,GAAuB,MACxE,EAAgB,GAAa,GAAe,GAAO,OAAO,CAAK,CAAC"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getLogoElevation as c } from "./logoShadow.es.js";
|
|
2
|
+
import { useId as p } from "react";
|
|
2
3
|
import e from "@mui/material/Stack";
|
|
3
4
|
import { Text as t } from "@mxenabled/mxui";
|
|
4
5
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
import
|
|
6
|
-
var
|
|
7
|
-
const a =
|
|
6
|
+
import m from "@mui/material/Divider";
|
|
7
|
+
var g = ({ rows: o, total: n }) => {
|
|
8
|
+
const a = p();
|
|
8
9
|
return o.length === 0 ? null : /* @__PURE__ */ i(e, {
|
|
9
10
|
sx: {
|
|
10
11
|
bgcolor: "background.paper",
|
|
11
12
|
borderRadius: "8px",
|
|
12
|
-
boxShadow:
|
|
13
|
+
boxShadow: c,
|
|
13
14
|
gap: 16,
|
|
14
15
|
p: 16,
|
|
15
16
|
width: "100%"
|
|
16
17
|
},
|
|
17
18
|
children: [/* @__PURE__ */ r(e, {
|
|
18
|
-
divider: /* @__PURE__ */ r(
|
|
19
|
+
divider: /* @__PURE__ */ r(m, {
|
|
19
20
|
"aria-hidden": !0,
|
|
20
21
|
role: "presentation"
|
|
21
22
|
}),
|
|
@@ -58,7 +59,7 @@ var h = ({ rows: o, total: n }) => {
|
|
|
58
59
|
}), /* @__PURE__ */ i(e, {
|
|
59
60
|
sx: {
|
|
60
61
|
alignItems: "center",
|
|
61
|
-
bgcolor: "
|
|
62
|
+
bgcolor: "action.hover",
|
|
62
63
|
borderRadius: "8px",
|
|
63
64
|
justifyContent: "center",
|
|
64
65
|
minHeight: 72,
|
|
@@ -84,7 +85,7 @@ var h = ({ rows: o, total: n }) => {
|
|
|
84
85
|
});
|
|
85
86
|
};
|
|
86
87
|
export {
|
|
87
|
-
|
|
88
|
+
g as default
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
//# sourceMappingURL=AmountBreakdownCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmountBreakdownCard.es.js","names":[],"sources":["../../../src/insights-v2/components/AmountBreakdownCard.tsx"],"sourcesContent":["import { useId, type ReactNode } from 'react'\n\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nexport interface AmountBreakdownRow {\n label: ReactNode\n amount: ReactNode\n}\n\nexport interface AmountBreakdownTotal {\n amount: ReactNode\n label: ReactNode\n}\n\nexport interface AmountBreakdownCardProps {\n rows: AmountBreakdownRow[]\n total: AmountBreakdownTotal\n}\n\nconst AmountBreakdownCard = ({ rows, total }: AmountBreakdownCardProps) => {\n const totalLabelId = useId()\n\n if (rows.length === 0) return null\n\n return (\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow:
|
|
1
|
+
{"version":3,"file":"AmountBreakdownCard.es.js","names":[],"sources":["../../../src/insights-v2/components/AmountBreakdownCard.tsx"],"sourcesContent":["import { useId, type ReactNode } from 'react'\n\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { getLogoElevation } from './logoShadow'\n\nexport interface AmountBreakdownRow {\n label: ReactNode\n amount: ReactNode\n}\n\nexport interface AmountBreakdownTotal {\n amount: ReactNode\n label: ReactNode\n}\n\nexport interface AmountBreakdownCardProps {\n rows: AmountBreakdownRow[]\n total: AmountBreakdownTotal\n}\n\nconst AmountBreakdownCard = ({ rows, total }: AmountBreakdownCardProps) => {\n const totalLabelId = useId()\n\n if (rows.length === 0) return null\n\n return (\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 16,\n p: 16,\n width: '100%',\n }}\n >\n <Stack\n divider={<Divider aria-hidden={true} role=\"presentation\" />}\n role=\"list\"\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {rows.map((row, index) => (\n <Stack\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n role=\"listitem\"\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 16,\n justifyContent: 'space-between',\n minHeight: 44,\n px: 12,\n py: 14,\n }}\n >\n <Text color=\"text.primary\" truncate={true} variant=\"body1\">\n {row.label}\n </Text>\n <Text\n bold={true}\n color=\"text.primary\"\n sx={{ flexShrink: 0, fontVariantNumeric: 'tabular-nums', letterSpacing: '-0.15px' }}\n variant=\"body1\"\n >\n {row.amount}\n </Text>\n </Stack>\n ))}\n </Stack>\n\n <Stack\n sx={{\n alignItems: 'center',\n // A theme overlay, so the grey box (Figma) still shows on dark mode's black card.\n bgcolor: 'action.hover',\n borderRadius: '8px',\n justifyContent: 'center',\n minHeight: 72,\n p: 12,\n width: '100%',\n }}\n >\n <Text\n aria-describedby={totalLabelId}\n color=\"text.primary\"\n component=\"p\"\n sx={{ fontVariantNumeric: 'tabular-nums' }}\n variant=\"h2\"\n >\n {total.amount}\n </Text>\n <Text\n color=\"text.secondary\"\n component=\"p\"\n id={totalLabelId}\n sx={{ fontWeight: 400 }}\n variant=\"subtitle2\"\n >\n {total.label}\n </Text>\n </Stack>\n </Stack>\n )\n}\n\nexport default AmountBreakdownCard\n"],"mappings":";;;;;;AAwBA,IAAM,IAAA,CAAuB,EAAE,MAAA,GAAM,OAAA,EAAA,MAAsC;AACzE,QAAM,IAAe,EAAM;AAE3B,SAAI,EAAK,WAAW,IAAU,OAG5B,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,SAAS;AAAA,MACT,cAAc;AAAA,MACd,WAAW;AAAA,MACX,KAAK;AAAA,MACL,GAAG;AAAA,MACH,OAAO;AAAA,IACT;AAAA,IARF,UAAA,CAUE,gBAAA,EAAC,GAAD;AAAA,MACE,SAAS,gBAAA,EAAC,GAAD;AAAA,QAAS,eAAa;AAAA,QAAM,MAAK;AAAA,MAAgB,CAAA;AAAA,MAC1D,MAAK;AAAA,MACL,IAAI;AAAA,QACF,QAAQ;AAAA,QACR,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MACH,CAAA,CACD;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface InsightListRowProps {
|
|
3
|
+
amount: number;
|
|
4
|
+
isLast: boolean;
|
|
5
|
+
/** The row's 32px logo or icon. */
|
|
6
|
+
leading: ReactNode;
|
|
7
|
+
name: string;
|
|
8
|
+
account?: {
|
|
9
|
+
institutionGuid: string;
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
/** Figma: account balances are body2 (13/16); expense amounts keep body1. */
|
|
13
|
+
amountVariant?: 'body1' | 'body2';
|
|
14
|
+
/** Bold name (Account List); Remaining Cash rows use the regular weight. */
|
|
15
|
+
boldName?: boolean;
|
|
16
|
+
caption?: string;
|
|
17
|
+
/** Makes the row a button. */
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
subtitle?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Where a non-last divider starts: under the logo (24px, the default) or under the text
|
|
22
|
+
* (68px = 24 padding + 32 logo + 12 gap), as the Account List Figma draws it.
|
|
23
|
+
*/
|
|
24
|
+
dividerInset?: 'logo' | 'text';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The 64px Figma list row shared by the Remaining Cash and Account List drawers: a 32px leading slot,
|
|
28
|
+
* name over a subtitle or account line, amount over a caption, and a divider (inset unless last).
|
|
29
|
+
*/
|
|
30
|
+
declare const InsightListRow: ({ account, amount, amountVariant, boldName, caption, dividerInset, isLast, leading, name, onClick, subtitle, }: InsightListRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default InsightListRow;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { formatSignedCurrency as u } from "../../core/utils/NumberFormatting.es.js";
|
|
2
|
+
import o from "@mui/material/Stack";
|
|
3
|
+
import { InstitutionLogo as g, Text as i } from "@mxenabled/mxui";
|
|
4
|
+
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import s from "@mui/material/Box";
|
|
6
|
+
import v from "@mui/material/Divider";
|
|
7
|
+
import b from "@mui/material/ButtonBase";
|
|
8
|
+
var y = {
|
|
9
|
+
logo: 24,
|
|
10
|
+
text: 68
|
|
11
|
+
}, V = ({ account: e, amount: d, amountVariant: m = "body1", boldName: x = !1, caption: l, dividerInset: c = "logo", isLast: h, leading: f, name: p, onClick: n, subtitle: a }) => /* @__PURE__ */ r(s, {
|
|
12
|
+
component: "li",
|
|
13
|
+
sx: { position: "relative" },
|
|
14
|
+
children: [/* @__PURE__ */ r(o, {
|
|
15
|
+
component: n ? b : "div",
|
|
16
|
+
onClick: n,
|
|
17
|
+
sx: {
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
flexDirection: "row",
|
|
20
|
+
gap: 12,
|
|
21
|
+
minHeight: 64,
|
|
22
|
+
px: 24,
|
|
23
|
+
py: 12,
|
|
24
|
+
textAlign: "left",
|
|
25
|
+
width: "100%",
|
|
26
|
+
...n && {
|
|
27
|
+
"&:hover": { bgcolor: "action.hover" },
|
|
28
|
+
"&.Mui-focusVisible": { bgcolor: "action.focus" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ t(s, {
|
|
33
|
+
sx: {
|
|
34
|
+
display: "flex",
|
|
35
|
+
flexShrink: 0,
|
|
36
|
+
height: 32,
|
|
37
|
+
width: 32
|
|
38
|
+
},
|
|
39
|
+
children: f
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ r(o, {
|
|
42
|
+
sx: {
|
|
43
|
+
flexGrow: 1,
|
|
44
|
+
minWidth: 0
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ t(i, {
|
|
48
|
+
bold: x,
|
|
49
|
+
truncate: !0,
|
|
50
|
+
variant: "body1",
|
|
51
|
+
children: p
|
|
52
|
+
}),
|
|
53
|
+
a && /* @__PURE__ */ t(i, {
|
|
54
|
+
color: "text.primary",
|
|
55
|
+
variant: "caption",
|
|
56
|
+
children: a
|
|
57
|
+
}),
|
|
58
|
+
e && /* @__PURE__ */ r(o, {
|
|
59
|
+
sx: {
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
flexDirection: "row",
|
|
62
|
+
gap: 6,
|
|
63
|
+
minWidth: 0
|
|
64
|
+
},
|
|
65
|
+
children: [e.institutionGuid && /* @__PURE__ */ t(g, {
|
|
66
|
+
alt: "",
|
|
67
|
+
institutionGuid: e.institutionGuid,
|
|
68
|
+
size: 12
|
|
69
|
+
}), /* @__PURE__ */ t(i, {
|
|
70
|
+
color: "text.secondary",
|
|
71
|
+
truncate: !0,
|
|
72
|
+
variant: "caption",
|
|
73
|
+
children: e.name
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ r(o, {
|
|
79
|
+
sx: {
|
|
80
|
+
alignItems: "flex-end",
|
|
81
|
+
flexShrink: 0
|
|
82
|
+
},
|
|
83
|
+
children: [/* @__PURE__ */ t(i, {
|
|
84
|
+
bold: !0,
|
|
85
|
+
sx: {
|
|
86
|
+
flexShrink: 0,
|
|
87
|
+
fontVariantNumeric: "tabular-nums"
|
|
88
|
+
},
|
|
89
|
+
variant: m,
|
|
90
|
+
children: u(d)
|
|
91
|
+
}), l && /* @__PURE__ */ t(i, {
|
|
92
|
+
bold: !0,
|
|
93
|
+
color: "text.secondary",
|
|
94
|
+
sx: { textTransform: "uppercase" },
|
|
95
|
+
variant: "caption",
|
|
96
|
+
children: l
|
|
97
|
+
})]
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
}), /* @__PURE__ */ t(v, { sx: {
|
|
101
|
+
bottom: 0,
|
|
102
|
+
left: h ? 0 : y[c],
|
|
103
|
+
position: "absolute",
|
|
104
|
+
right: 0
|
|
105
|
+
} })]
|
|
106
|
+
});
|
|
107
|
+
export {
|
|
108
|
+
V as default
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=InsightListRow.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightListRow.es.js","names":[],"sources":["../../../src/insights-v2/components/InsightListRow.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, Text } from '@mxenabled/mxui'\n\nimport { formatSignedCurrency } from '../../core/utils/NumberFormatting'\n\nexport interface InsightListRowProps {\n amount: number\n isLast: boolean\n /** The row's 32px logo or icon. */\n leading: ReactNode\n name: string\n account?: { institutionGuid: string; name: string }\n /** Figma: account balances are body2 (13/16); expense amounts keep body1. */\n amountVariant?: 'body1' | 'body2'\n /** Bold name (Account List); Remaining Cash rows use the regular weight. */\n boldName?: boolean\n caption?: string\n /** Makes the row a button. */\n onClick?: () => void\n subtitle?: string\n /**\n * Where a non-last divider starts: under the logo (24px, the default) or under the text\n * (68px = 24 padding + 32 logo + 12 gap), as the Account List Figma draws it.\n */\n dividerInset?: 'logo' | 'text'\n}\n\nconst DIVIDER_INSET = { logo: 24, text: 68 } as const\n\n/**\n * The 64px Figma list row shared by the Remaining Cash and Account List drawers: a 32px leading slot,\n * name over a subtitle or account line, amount over a caption, and a divider (inset unless last).\n */\nconst InsightListRow = ({\n account,\n amount,\n amountVariant = 'body1',\n boldName = false,\n caption,\n dividerInset = 'logo',\n isLast,\n leading,\n name,\n onClick,\n subtitle,\n}: InsightListRowProps) => (\n <Box component=\"li\" sx={{ position: 'relative' }}>\n <Stack\n component={onClick ? ButtonBase : 'div'}\n onClick={onClick}\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 12,\n minHeight: 64,\n px: 24,\n py: 12,\n textAlign: 'left',\n width: '100%',\n ...(onClick && {\n '&:hover': { bgcolor: 'action.hover' },\n '&.Mui-focusVisible': { bgcolor: 'action.focus' },\n }),\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0, height: 32, width: 32 }}>{leading}</Box>\n <Stack sx={{ flexGrow: 1, minWidth: 0 }}>\n <Text bold={boldName} truncate={true} variant=\"body1\">\n {name}\n </Text>\n {subtitle && (\n // Figma: the \"Available Balance\" subtitle is text.primary, unlike the expense account line.\n <Text color=\"text.primary\" variant=\"caption\">\n {subtitle}\n </Text>\n )}\n {account && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 6, minWidth: 0 }}>\n {account.institutionGuid && (\n <InstitutionLogo alt=\"\" institutionGuid={account.institutionGuid} size={12} />\n )}\n <Text color=\"text.secondary\" truncate={true} variant=\"caption\">\n {account.name}\n </Text>\n </Stack>\n )}\n </Stack>\n <Stack sx={{ alignItems: 'flex-end', flexShrink: 0 }}>\n <Text\n bold={true}\n sx={{ flexShrink: 0, fontVariantNumeric: 'tabular-nums' }}\n variant={amountVariant}\n >\n {formatSignedCurrency(amount)}\n </Text>\n {caption && (\n <Text\n bold={true}\n color=\"text.secondary\"\n sx={{ textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {caption}\n </Text>\n )}\n </Stack>\n </Stack>\n <Divider\n sx={{\n bottom: 0,\n left: isLast ? 0 : DIVIDER_INSET[dividerInset],\n position: 'absolute',\n right: 0,\n }}\n />\n </Box>\n)\n\nexport default InsightListRow\n"],"mappings":";;;;;;;AAiCA,IAAM,IAAgB;AAAA,EAAE,MAAM;AAAA,EAAI,MAAM;AAAG,GAMrC,IAAA,CAAkB,EACtB,SAAA,GACA,QAAA,GACA,eAAA,IAAgB,SAChB,UAAA,IAAW,IACX,SAAA,GACA,cAAA,IAAe,QACf,QAAA,GACA,SAAA,GACA,MAAA,GACA,SAAA,GACA,UAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EAAK,WAAU;AAAA,EAAK,IAAI,EAAE,UAAU,WAAW;AAAA,EAA/C,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,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A,EAAQ;AAAA,YACL,CAAA,CACD;AAAA;QAEJ;AAAA;MACP,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,YAAY;AAAA,UAAY,YAAY;AAAA,QAAE;AAAA,QAAnD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UACE,MAAM;AAAA,UACN,IAAI;AAAA,YAAE,YAAY;AAAA,YAAG,oBAAoB;AAAA,UAAe;AAAA,UACxD,SAAS;AAAA,UAER,UAAA,EAAqB,CAAM;AAAA,QACxB,CAAA,GACL,KACC,gBAAA,EAAC,GAAD;AAAA,UACE,MAAM;AAAA,UACN,OAAM;AAAA,UACN,IAAI,EAAE,eAAe,YAAY;AAAA,UACjC,SAAQ;AAAA,UAEP,UAAA;AAAA,QACG,CAAA,CAEH;AAAA;IACF;AAAA,EACP,CAAA,GAAA,gBAAA,EAAC,GAAD,EACE,IAAI;AAAA,IACF,QAAQ;AAAA,IACR,MAAM,IAAS,IAAI,EAAc,CAAA;AAAA,IACjC,UAAU;AAAA,IACV,OAAO;AAAA,EACT,EACD,CAAA,CACE"}
|
|
@@ -8,6 +8,7 @@ export interface SubTabsProps {
|
|
|
8
8
|
selectedIndex: number;
|
|
9
9
|
onChange: (index: number) => void;
|
|
10
10
|
ariaLabel?: string;
|
|
11
|
+
isTypeFilter?: boolean;
|
|
11
12
|
}
|
|
12
13
|
/** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */
|
|
13
14
|
export declare const subTabPanelProps: (id: string, selectedIndex: number) => {
|
|
@@ -19,4 +20,4 @@ export declare const subTabPanelProps: (id: string, selectedIndex: number) => {
|
|
|
19
20
|
* The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's
|
|
20
21
|
* "Transactions Filtered By Type" on a change, so every drawer that uses it keeps legacy analytics.
|
|
21
22
|
*/
|
|
22
|
-
export declare const SubTabs: ({ id, tabs, selectedIndex, onChange, ariaLabel }: SubTabsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export declare const SubTabs: ({ id, tabs, selectedIndex, onChange, ariaLabel, isTypeFilter, }: SubTabsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ANALYTICS_EVENTS_CONFIG as
|
|
2
|
-
import { useAnalyticsEvent as
|
|
1
|
+
import { ANALYTICS_EVENTS_CONFIG as T } from "../analytics/analyticsEventsConfig.es.js";
|
|
2
|
+
import { useAnalyticsEvent as f } from "../analytics/useAnalyticsEvent.es.js";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
import v from "@mui/material/Tab";
|
|
5
5
|
import E from "@mui/material/Tabs";
|
|
6
|
-
var i = (a, l) => `${a}-tab-${l}`, o = (a) => `${a}-panel`,
|
|
6
|
+
var i = (a, l) => `${a}-tab-${l}`, o = (a) => `${a}-panel`, _ = (a, l) => ({
|
|
7
7
|
"aria-labelledby": i(a, l),
|
|
8
8
|
id: o(a),
|
|
9
9
|
role: "tabpanel"
|
|
10
|
-
}),
|
|
11
|
-
const
|
|
10
|
+
}), x = ({ id: a, tabs: l, selectedIndex: t, onChange: b, ariaLabel: m, isTypeFilter: p = !0 }) => {
|
|
11
|
+
const s = f();
|
|
12
12
|
if (!l.length) return null;
|
|
13
|
-
const
|
|
14
|
-
p(
|
|
13
|
+
const u = (r, e) => {
|
|
14
|
+
p && s(T.TYPE_FILTER_SELECTED), b(e);
|
|
15
15
|
};
|
|
16
16
|
return /* @__PURE__ */ n(E, {
|
|
17
17
|
"aria-label": m ?? l.map((r) => r.label).join(" / "),
|
|
18
|
-
onChange:
|
|
18
|
+
onChange: u,
|
|
19
19
|
value: t,
|
|
20
20
|
variant: "fullWidth",
|
|
21
21
|
children: l.map((r, e) => /* @__PURE__ */ n(v, {
|
|
@@ -31,8 +31,8 @@ var i = (a, l) => `${a}-tab-${l}`, o = (a) => `${a}-panel`, I = (a, l) => ({
|
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
33
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
x as SubTabs,
|
|
35
|
+
_ as subTabPanelProps
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
//# sourceMappingURL=SubTabs.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubTabs.es.js","names":[],"sources":["../../../src/insights-v2/components/SubTabs.tsx"],"sourcesContent":["import type React from 'react'\n\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../analytics'\n\nexport interface SubTabItem {\n label: string\n // Screen-reader name when it differs from the visible label (legacy pulse: \"Spend transactions\").\n ariaLabel?: string\n}\n\nexport interface SubTabsProps {\n // Base id: tab N is `${id}-tab-N` and controls `${id}-panel`; render that panel with subTabPanelProps.\n id: string\n tabs: SubTabItem[]\n selectedIndex: number\n onChange: (index: number) => void\n // Tablist name; defaults to the visible labels joined (\"Spend / Income\").\n ariaLabel?: string\n}\n\nconst subTabId = (id: string, index: number) => `${id}-tab-${index}`\nconst subPanelId = (id: string) => `${id}-panel`\n\n/** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */\nexport const subTabPanelProps = (id: string, selectedIndex: number) => ({\n 'aria-labelledby': subTabId(id, selectedIndex),\n id: subPanelId(id),\n role: 'tabpanel' as const,\n})\n\n/**\n * The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's\n * \"Transactions Filtered By Type\" on a change, so every drawer that uses it keeps legacy analytics.\n */\nexport const SubTabs = ({
|
|
1
|
+
{"version":3,"file":"SubTabs.es.js","names":[],"sources":["../../../src/insights-v2/components/SubTabs.tsx"],"sourcesContent":["import type React from 'react'\n\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../analytics'\n\nexport interface SubTabItem {\n label: string\n // Screen-reader name when it differs from the visible label (legacy pulse: \"Spend transactions\").\n ariaLabel?: string\n}\n\nexport interface SubTabsProps {\n // Base id: tab N is `${id}-tab-N` and controls `${id}-panel`; render that panel with subTabPanelProps.\n id: string\n tabs: SubTabItem[]\n selectedIndex: number\n onChange: (index: number) => void\n // Tablist name; defaults to the visible labels joined (\"Spend / Income\").\n ariaLabel?: string\n // False for tabs that aren't a transaction-type filter: no \"Filtered By Type\" event.\n isTypeFilter?: boolean\n}\n\nconst subTabId = (id: string, index: number) => `${id}-tab-${index}`\nconst subPanelId = (id: string) => `${id}-panel`\n\n/** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */\nexport const subTabPanelProps = (id: string, selectedIndex: number) => ({\n 'aria-labelledby': subTabId(id, selectedIndex),\n id: subPanelId(id),\n role: 'tabpanel' as const,\n})\n\n/**\n * The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's\n * \"Transactions Filtered By Type\" on a change, so every drawer that uses it keeps legacy analytics.\n */\nexport const SubTabs = ({\n id,\n tabs,\n selectedIndex,\n onChange,\n ariaLabel,\n isTypeFilter = true,\n}: SubTabsProps) => {\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!tabs.length) return null\n\n // MUI only calls onChange for a different tab, never on mount (legacy parity).\n const handleChange = (_event: React.SyntheticEvent, index: number) => {\n if (isTypeFilter) fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TYPE_FILTER_SELECTED)\n onChange(index)\n }\n\n return (\n <Tabs\n aria-label={ariaLabel ?? tabs.map((tab) => tab.label).join(' / ')}\n onChange={handleChange}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs.map((tab, index) => (\n <Tab\n aria-controls={subPanelId(id)}\n aria-label={tab.ariaLabel}\n id={subTabId(id, index)}\n key={tab.label}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )\n}\n"],"mappings":";;;;;AAyBA,IAAM,IAAA,CAAY,GAAY,MAAkB,GAAG,CAAA,QAAU,CAAA,IACvD,IAAA,CAAc,MAAe,GAAG,CAAA,UAGzB,IAAA,CAAoB,GAAY,OAA2B;AAAA,EACtE,mBAAmB,EAAS,GAAI,CAAa;AAAA,EAC7C,IAAI,EAAW,CAAE;AAAA,EACjB,MAAM;AACR,IAMa,IAAA,CAAW,EACtB,IAAA,GACA,MAAA,GACA,eAAA,GACA,UAAA,GACA,WAAA,GACA,cAAA,IAAe,GAAA,MACG;AAClB,QAAM,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EAAK,OAAQ,QAAO;AAGzB,QAAM,IAAA,CAAgB,GAA8B,MAAkB;AACpE,IAAI,KAAc,EAAmB,EAAwB,oBAAoB,GACjF,EAAS,CAAK;AAAA,EAChB;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY,KAAa,EAAK,IAAA,CAAK,MAAQ,EAAI,KAAK,EAAE,KAAK,KAAK;AAAA,IAChE,UAAU;AAAA,IACV,OAAO;AAAA,IACP,SAAQ;AAAA,IAEP,UAAA,EAAK,IAAA,CAAK,GAAK,MACd,gBAAA,EAAC,GAAD;AAAA,MACE,iBAAe,EAAW,CAAE;AAAA,MAC5B,cAAY,EAAI;AAAA,MAChB,IAAI,EAAS,GAAI,CAAK;AAAA,MAEtB,OAAO,EAAI;AAAA,MACX,IAAI;AAAA,QAAE,UAAU;AAAA,QAAQ,IAAI;AAAA,MAAE;AAAA,IAC/B,GAHM,EAAI,KAGV,CACF;AAAA,EACG,CAAA;AAEV"}
|