@mx-cartographer/experiences 9.7.133 → 9.7.135
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 +9 -0
- package/dist/core/types/Insights.d.ts +1 -0
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +25 -1
- package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandard.es.js +4 -4
- package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandardMUI.es.js +4 -4
- package/dist/insights/components/insights/MonthlySpendingComparisonV2/MonthlySpendingComparisonV2.es.js +4 -4
- package/dist/insights/components/insights/WeeklyNoSpendDays/WeeklyNoSpendDays.es.js +8 -8
- package/dist/insights/components/shared/Charts/EmptyBarChart.es.js +4 -4
- package/dist/insights/components/shared/ZeroState/LinedCardZeroState.es.js +4 -4
- package/dist/insights/index.es.js +84 -84
- package/dist/insights-v2/actionBlocks/QuizMerchantBlock/QuizMerchantBlock.d.ts +7 -0
- package/dist/insights-v2/actionBlocks/QuizMerchantBlock/QuizMerchantBlock.es.js +147 -0
- package/dist/insights-v2/actionBlocks/QuizMerchantBlock/QuizMerchantBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/QuizMerchantBlock/index.d.ts +1 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +1 -2
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +82 -89
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +62 -63
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +1 -2
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +153 -134
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js +3 -2
- package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.d.ts +6 -0
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +220 -0
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/index.d.ts +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/quiz.d.ts +39 -0
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/quiz.es.js +44 -0
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/quiz.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
- package/dist/insights-v2/components/shared/elevation.d.ts +2 -0
- package/dist/insights-v2/components/shared/elevation.es.js +3 -2
- package/dist/insights-v2/components/shared/elevation.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +41 -23
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaHandlers.d.ts +2 -0
- package/dist/insights-v2/ctaActions/ctaHandlers.es.js +32 -20
- package/dist/insights-v2/ctaActions/ctaHandlers.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/hostActions.d.ts +1 -1
- package/dist/insights-v2/ctaActions/hostActions.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +79 -77
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +2 -1
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +122 -114
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { buildDynamicCopy as S } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as v } from "../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { useActionContext as D, useGlobalCopyStore as L, useInsightsV2Store as k, useTransactionStore as I } from "../../../common/context/hooks.es.js";
|
|
4
|
+
import { TransactionType as R } from "../../../core/types/Transaction.es.js";
|
|
5
|
+
import { formatIsoDate as O } from "../../../core/utils/DateUtil.es.js";
|
|
6
|
+
import { CURRENCY_FORMAT as A, formatCurrency as w } from "../../../core/utils/NumberFormatting.es.js";
|
|
7
|
+
import z from "../../../common/components/drawer/Drawer.es.js";
|
|
8
|
+
import M from "../../../transactions/components/shared/TransactionList.es.js";
|
|
9
|
+
import { merchantTransactions as B, quizMerchantLogo as F } from "../../blocks/ComponentBlocks/QuizBlock/quiz.es.js";
|
|
10
|
+
import { selectTransactionsByGuids as G } from "../../CommonUtils.es.js";
|
|
11
|
+
import N from "../../components/LogoFromGuid.es.js";
|
|
12
|
+
import { SMALL_CARD_SHADOW as q } from "../../components/shared/elevation.es.js";
|
|
13
|
+
import { calendarDateOf as E } from "../TransactionHistoryBlock/utils.es.js";
|
|
14
|
+
import { TransactionDetailsBlock as W } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
|
|
15
|
+
import $ from "react";
|
|
16
|
+
import { observer as j } from "mobx-react-lite";
|
|
17
|
+
import i from "@mui/material/Stack";
|
|
18
|
+
import { Text as s } from "@mxenabled/mxui";
|
|
19
|
+
import { Icon as H } from "@mxenabled/mx-icons";
|
|
20
|
+
import { Fragment as Q, jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
21
|
+
import f from "@mui/material/Box";
|
|
22
|
+
import U from "@mui/material/Divider";
|
|
23
|
+
var V = (a) => a.reduce((r, { amount: e, transaction_type: c }) => c === R.CREDIT ? r - e : r + e, 0), x = ({ icon: a, label: r, value: e }) => /* @__PURE__ */ t(i, {
|
|
24
|
+
sx: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
gap: 4,
|
|
27
|
+
minWidth: 0,
|
|
28
|
+
px: 12,
|
|
29
|
+
py: 6
|
|
30
|
+
},
|
|
31
|
+
children: [/* @__PURE__ */ o(s, {
|
|
32
|
+
component: "p",
|
|
33
|
+
variant: "h3",
|
|
34
|
+
children: e
|
|
35
|
+
}), /* @__PURE__ */ t(i, {
|
|
36
|
+
direction: "row",
|
|
37
|
+
sx: {
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
color: "text.secondary",
|
|
40
|
+
gap: 4
|
|
41
|
+
},
|
|
42
|
+
children: [/* @__PURE__ */ o(H, {
|
|
43
|
+
"aria-hidden": !0,
|
|
44
|
+
name: a,
|
|
45
|
+
size: 12
|
|
46
|
+
}), /* @__PURE__ */ o(s, {
|
|
47
|
+
color: "text.secondary",
|
|
48
|
+
sx: { letterSpacing: "0.33px" },
|
|
49
|
+
uppercase: !0,
|
|
50
|
+
variant: "caption",
|
|
51
|
+
children: r
|
|
52
|
+
})]
|
|
53
|
+
})]
|
|
54
|
+
}), go = j(function({ beat: r }) {
|
|
55
|
+
const { common: e, insights_feed: c } = L(), l = c?.quiz_block, { setActionContext: p } = k(), m = I(), n = D()?.quiz_merchant, [g, h] = $.useState(!1);
|
|
56
|
+
if (!n) return null;
|
|
57
|
+
const d = B(G(m.detailedTransactions, r.transaction_guids), n), u = E(r.payload?.described_month), T = S(l?.placement ?? "", String(n.rank), u ? O(u, v.MONTH_LONG) : ""), _ = F(n, d), C = (y) => {
|
|
58
|
+
p({ transaction_guid: y }), h(!0);
|
|
59
|
+
}, b = () => {
|
|
60
|
+
h(!1), p({ transaction_guid: void 0 });
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ t(Q, { children: [
|
|
63
|
+
/* @__PURE__ */ o(f, {
|
|
64
|
+
sx: {
|
|
65
|
+
pb: 8,
|
|
66
|
+
pt: 24,
|
|
67
|
+
px: 24
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ t(i, {
|
|
70
|
+
sx: {
|
|
71
|
+
bgcolor: "background.paper",
|
|
72
|
+
borderRadius: "8px",
|
|
73
|
+
boxShadow: q,
|
|
74
|
+
gap: 12,
|
|
75
|
+
p: 16
|
|
76
|
+
},
|
|
77
|
+
children: [/* @__PURE__ */ t(i, {
|
|
78
|
+
direction: "row",
|
|
79
|
+
sx: {
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
gap: 12
|
|
82
|
+
},
|
|
83
|
+
children: [/* @__PURE__ */ o(f, {
|
|
84
|
+
"aria-hidden": !0,
|
|
85
|
+
sx: {
|
|
86
|
+
display: "flex",
|
|
87
|
+
flexShrink: 0
|
|
88
|
+
},
|
|
89
|
+
children: /* @__PURE__ */ o(N, {
|
|
90
|
+
logo: _,
|
|
91
|
+
size: 56
|
|
92
|
+
})
|
|
93
|
+
}), /* @__PURE__ */ t(i, {
|
|
94
|
+
sx: { minWidth: 0 },
|
|
95
|
+
children: [/* @__PURE__ */ o(s, {
|
|
96
|
+
component: "h3",
|
|
97
|
+
truncate: !0,
|
|
98
|
+
variant: "h2",
|
|
99
|
+
children: n.label
|
|
100
|
+
}), /* @__PURE__ */ o(s, {
|
|
101
|
+
color: "text.secondary",
|
|
102
|
+
variant: "subtitle2",
|
|
103
|
+
children: T
|
|
104
|
+
})]
|
|
105
|
+
})]
|
|
106
|
+
}), /* @__PURE__ */ t(i, {
|
|
107
|
+
direction: "row",
|
|
108
|
+
divider: /* @__PURE__ */ o(U, {
|
|
109
|
+
flexItem: !0,
|
|
110
|
+
orientation: "vertical"
|
|
111
|
+
}),
|
|
112
|
+
sx: {
|
|
113
|
+
border: 1,
|
|
114
|
+
borderColor: "divider",
|
|
115
|
+
borderRadius: "4px"
|
|
116
|
+
},
|
|
117
|
+
children: [/* @__PURE__ */ o(x, {
|
|
118
|
+
icon: "receipt_long",
|
|
119
|
+
label: l?.transactions ?? "",
|
|
120
|
+
value: String(n.count)
|
|
121
|
+
}), /* @__PURE__ */ o(x, {
|
|
122
|
+
icon: "payments",
|
|
123
|
+
label: l?.spent ?? "",
|
|
124
|
+
value: m.isTransactionDataLoaded ? w(V(d), A.cents) : "—"
|
|
125
|
+
})]
|
|
126
|
+
})]
|
|
127
|
+
})
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ o(M, {
|
|
130
|
+
onClick: C,
|
|
131
|
+
showLoader: !m.isTransactionDataLoaded,
|
|
132
|
+
transaction: d
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ o(z, {
|
|
135
|
+
ariaLabelClose: e.close_aria,
|
|
136
|
+
isOpen: g,
|
|
137
|
+
onClose: b,
|
|
138
|
+
title: c?.general.transaction_details_title,
|
|
139
|
+
children: /* @__PURE__ */ o(W, { beat: r })
|
|
140
|
+
})
|
|
141
|
+
] });
|
|
142
|
+
});
|
|
143
|
+
export {
|
|
144
|
+
go as QuizMerchantBlock
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
//# sourceMappingURL=QuizMerchantBlock.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuizMerchantBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/QuizMerchantBlock/QuizMerchantBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n useActionContext,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL } from '../../../core/constants'\nimport { TransactionType, type Beat, type Transaction } from '../../../core'\nimport { formatIsoDate } from '../../../core/utils/DateUtil'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { calendarDateOf } from '../TransactionHistoryBlock/utils'\nimport LogoFromGuid from '../../components/LogoFromGuid'\nimport { SMALL_CARD_SHADOW } from '../../components/shared/elevation'\nimport {\n merchantTransactions,\n quizMerchantLogo,\n type QuizDrawerContext,\n} from '../../blocks/ComponentBlocks/QuizBlock/quiz'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\n\n/** Spending is positive; a credit (a refund) takes away from it. */\nconst totalSpent = (transactions: Transaction[]) =>\n transactions.reduce(\n (sum, { amount, transaction_type }) =>\n transaction_type === TransactionType.CREDIT ? sum - amount : sum + amount,\n 0,\n )\n\nconst StatTile = ({ icon, label, value }: { icon: string; label: string; value: string }) => (\n <Stack sx={{ flex: 1, gap: 4, minWidth: 0, px: 12, py: 6 }}>\n <Text component=\"p\" variant=\"h3\">\n {value}\n </Text>\n <Stack direction=\"row\" sx={{ alignItems: 'center', color: 'text.secondary', gap: 4 }}>\n <Icon aria-hidden={true} name={icon} size={12} />\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.33px' }}\n uppercase={true}\n variant=\"caption\"\n >\n {label}\n </Text>\n </Stack>\n </Stack>\n)\n\n/** The drawer a quiz result row opens: the merchant's rank, totals and transactions. */\nexport const QuizMerchantBlock = observer(function QuizMerchantBlock({ beat }: { beat: Beat }) {\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n const copy = insightsCopy?.quiz_block\n const { setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n const merchant = useActionContext<QuizDrawerContext>()?.quiz_merchant\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n\n if (!merchant) return null\n\n const transactions = merchantTransactions(\n selectTransactionsByGuids(transactionStore.detailedTransactions, beat.transaction_guids),\n merchant,\n )\n const month = calendarDateOf(beat.payload?.described_month)\n const placement = buildDynamicCopy(\n copy?.placement ?? '',\n String(merchant.rank),\n month ? formatIsoDate(month, DATE_FORMATS_INTL.MONTH_LONG) : '',\n ) as string\n const logo = quizMerchantLogo(merchant, transactions)\n\n const handleRowClick = (guid: string) => {\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n <Box sx={{ pb: 8, pt: 24, px: 24 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: SMALL_CARD_SHADOW,\n gap: 12,\n p: 16,\n }}\n >\n <Stack direction=\"row\" sx={{ alignItems: 'center', gap: 12 }}>\n <Box aria-hidden={true} sx={{ display: 'flex', flexShrink: 0 }}>\n <LogoFromGuid logo={logo} size={56} />\n </Box>\n <Stack sx={{ minWidth: 0 }}>\n <Text component=\"h3\" truncate={true} variant=\"h2\">\n {merchant.label}\n </Text>\n <Text color=\"text.secondary\" variant=\"subtitle2\">\n {placement}\n </Text>\n </Stack>\n </Stack>\n <Stack\n direction=\"row\"\n divider={<Divider flexItem={true} orientation=\"vertical\" />}\n sx={{ border: 1, borderColor: 'divider', borderRadius: '4px' }}\n >\n <StatTile\n icon=\"receipt_long\"\n label={copy?.transactions ?? ''}\n value={String(merchant.count)}\n />\n <StatTile\n icon=\"payments\"\n label={copy?.spent ?? ''}\n value={\n transactionStore.isTransactionDataLoaded\n ? formatCurrency(totalSpent(transactions), CURRENCY_FORMAT.cents)\n : '—'\n }\n />\n </Stack>\n </Stack>\n </Box>\n <TransactionList\n onClick={handleRowClick}\n showLoader={!transactionStore.isTransactionDataLoaded}\n transaction={transactions}\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy?.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer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|
@@ -25,9 +25,8 @@ interface TransactionDrillDownProps {
|
|
|
25
25
|
transaction: Transaction;
|
|
26
26
|
};
|
|
27
27
|
hideListHeader?: boolean;
|
|
28
|
-
tipAboveSubTabs?: boolean;
|
|
29
28
|
}
|
|
30
|
-
export declare const TransactionDrillDown: (({ ariaLabel, heading, subHeadingText, icon, tabs, selectedIndex, top, onSelectionChange, transactionFilter, tipSection, onEachRowClick, baseTransactions, subTabs, projectedRow, hideListHeader,
|
|
29
|
+
export declare const TransactionDrillDown: (({ ariaLabel, heading, subHeadingText, icon, tabs, selectedIndex, top, onSelectionChange, transactionFilter, tipSection, onEachRowClick, baseTransactions, subTabs, projectedRow, hideListHeader, }: TransactionDrillDownProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
31
30
|
displayName: string;
|
|
32
31
|
};
|
|
33
32
|
export default TransactionDrillDown;
|
|
@@ -1,148 +1,141 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { exportTransactionsToCSV as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { TipSection as
|
|
8
|
-
import { SubTabs as
|
|
1
|
+
import { useGlobalCopyStore as G, useGlobalUiStore as N, useTransactionStore as U } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { exportTransactionsToCSV as j } from "../../../core/utils/TransactionUtils.es.js";
|
|
3
|
+
import z from "../../../common/components/Loader.es.js";
|
|
4
|
+
import O from "../../../transactions/components/shared/transactionlist/TransactionRow.es.js";
|
|
5
|
+
import V from "../../../common/components/SubheaderRow.es.js";
|
|
6
|
+
import q from "../../../transactions/components/shared/TransactionList.es.js";
|
|
7
|
+
import { TipSection as J } from "../../../insights/components/shared/ChartDrawerTemplate/TipSection.es.js";
|
|
8
|
+
import { SubTabs as K, subTabPanelProps as M } from "../../components/SubTabs.es.js";
|
|
9
9
|
import "react";
|
|
10
|
-
import { observer as
|
|
11
|
-
import
|
|
12
|
-
import { H3 as
|
|
13
|
-
import
|
|
14
|
-
import { Icon as
|
|
10
|
+
import { observer as Q } from "mobx-react-lite";
|
|
11
|
+
import f from "@mui/material/Stack";
|
|
12
|
+
import { H3 as X, Text as h } from "@mxenabled/mxui";
|
|
13
|
+
import Y from "@mui/material/Button";
|
|
14
|
+
import { Icon as Z } from "@mxenabled/mx-icons";
|
|
15
15
|
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
16
16
|
import t from "@mui/material/Box";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
var
|
|
17
|
+
import F from "@mui/material/Tab";
|
|
18
|
+
import H from "@mui/material/Tabs";
|
|
19
|
+
var rr = {
|
|
20
20
|
color: "primary",
|
|
21
21
|
name: "tips_and_updates",
|
|
22
22
|
size: 20
|
|
23
|
-
}, S = "transaction-drill-down-panel",
|
|
24
|
-
const { transactions:
|
|
25
|
-
if (!
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
},
|
|
23
|
+
}, S = "transaction-drill-down-panel", C = (x) => `transaction-details-tab-${x}`, D = "transaction-drill-down-series", _r = Q(function({ ariaLabel: I, heading: e, subHeadingText: l, icon: w, tabs: u, selectedIndex: s, top: v, onSelectionChange: B, transactionFilter: T, tipSection: _, onEachRowClick: k, baseTransactions: P, subTabs: g, projectedRow: c, hideListHeader: d = !1 }) {
|
|
24
|
+
const { transactions: m } = G(), { isCopyLoaded: W } = N(), { sortedTransactionsWithSplits: L, tags: $, detailedTransactions: A } = U();
|
|
25
|
+
if (!W) return /* @__PURE__ */ r(z, {});
|
|
26
|
+
const p = !!u?.length, a = g?.tabs.length ? g : void 0, R = I ?? m.transactions_title, E = (n, i) => {
|
|
27
|
+
B?.(i);
|
|
28
|
+
}, y = T ? (P ?? A).filter(T(s)) : void 0, b = y ?? L;
|
|
29
29
|
return /* @__PURE__ */ o(t, {
|
|
30
30
|
sx: {
|
|
31
31
|
bgcolor: "background.paper",
|
|
32
32
|
width: "100%"
|
|
33
33
|
},
|
|
34
|
-
children: [
|
|
35
|
-
"aria-label":
|
|
36
|
-
onChange:
|
|
34
|
+
children: [p && /* @__PURE__ */ r(H, {
|
|
35
|
+
"aria-label": R,
|
|
36
|
+
onChange: E,
|
|
37
37
|
sx: { mb: 0 },
|
|
38
|
-
value:
|
|
38
|
+
value: s,
|
|
39
39
|
variant: "fullWidth",
|
|
40
|
-
children:
|
|
40
|
+
children: u.map((n, i) => /* @__PURE__ */ r(F, {
|
|
41
41
|
"aria-controls": S,
|
|
42
|
-
"aria-label":
|
|
43
|
-
id:
|
|
44
|
-
label:
|
|
42
|
+
"aria-label": n.ariaLabel,
|
|
43
|
+
id: C(i),
|
|
44
|
+
label: n.label,
|
|
45
45
|
sx: {
|
|
46
46
|
minWidth: "auto",
|
|
47
47
|
px: 0
|
|
48
48
|
}
|
|
49
|
-
}, `${
|
|
49
|
+
}, `${n.label}-${i}`))
|
|
50
50
|
}), /* @__PURE__ */ o(t, {
|
|
51
|
-
"aria-labelledby":
|
|
51
|
+
"aria-labelledby": p ? C(s) : void 0,
|
|
52
52
|
id: S,
|
|
53
|
-
role:
|
|
53
|
+
role: p ? "tabpanel" : void 0,
|
|
54
54
|
children: [
|
|
55
|
-
(
|
|
55
|
+
(e || l) && /* @__PURE__ */ o(f, {
|
|
56
56
|
sx: {
|
|
57
57
|
gap: 4,
|
|
58
58
|
pt: 16,
|
|
59
59
|
px: 24
|
|
60
60
|
},
|
|
61
|
-
children: [
|
|
61
|
+
children: [e && /* @__PURE__ */ r(X, { children: e }), l && /* @__PURE__ */ o(f, {
|
|
62
62
|
sx: {
|
|
63
63
|
alignItems: "center",
|
|
64
64
|
flexDirection: "row",
|
|
65
65
|
gap: 8
|
|
66
66
|
},
|
|
67
|
-
children: [
|
|
67
|
+
children: [w, /* @__PURE__ */ r(h, {
|
|
68
68
|
color: "text.secondary",
|
|
69
69
|
sx: { letterSpacing: "0.52px" },
|
|
70
70
|
textTransform: "uppercase",
|
|
71
71
|
variant: "body2",
|
|
72
|
-
children:
|
|
72
|
+
children: l
|
|
73
73
|
})]
|
|
74
74
|
})]
|
|
75
75
|
}),
|
|
76
76
|
/* @__PURE__ */ r(t, {
|
|
77
77
|
sx: {
|
|
78
|
-
pb:
|
|
78
|
+
pb: v ? 16 : 0,
|
|
79
79
|
pt: 16
|
|
80
80
|
},
|
|
81
|
-
children:
|
|
81
|
+
children: v
|
|
82
82
|
}),
|
|
83
|
-
|
|
84
|
-
icon:
|
|
85
|
-
...
|
|
83
|
+
_ && /* @__PURE__ */ r(J, {
|
|
84
|
+
icon: rr,
|
|
85
|
+
..._
|
|
86
86
|
}),
|
|
87
|
-
|
|
88
|
-
...
|
|
89
|
-
id:
|
|
87
|
+
a && /* @__PURE__ */ r(K, {
|
|
88
|
+
...a,
|
|
89
|
+
id: D
|
|
90
90
|
}),
|
|
91
91
|
/* @__PURE__ */ o(t, {
|
|
92
|
-
...
|
|
93
|
-
children: [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
...a && M(D, a.selectedIndex),
|
|
93
|
+
children: [(!d || b.length > 0) && /* @__PURE__ */ o(f, {
|
|
94
|
+
sx: {
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
borderBottomColor: "divider",
|
|
97
|
+
borderBottomStyle: "solid",
|
|
98
|
+
borderBottomWidth: 1,
|
|
99
|
+
flexDirection: "row",
|
|
100
|
+
justifyContent: d ? "flex-end" : "space-between",
|
|
101
|
+
pb: 4,
|
|
102
|
+
pt: 16,
|
|
103
|
+
px: 24
|
|
104
|
+
},
|
|
105
|
+
children: [!d && /* @__PURE__ */ r(h, {
|
|
106
|
+
bold: !0,
|
|
107
|
+
variant: "body1",
|
|
108
|
+
children: m.transactions_title
|
|
109
|
+
}), b.length > 0 && /* @__PURE__ */ r(Y, {
|
|
110
|
+
onClick: () => {
|
|
111
|
+
j(b, $);
|
|
109
112
|
},
|
|
110
|
-
|
|
113
|
+
startIcon: /* @__PURE__ */ r(Z, { name: "ios_share" }),
|
|
114
|
+
sx: { height: 28 },
|
|
115
|
+
children: /* @__PURE__ */ r(h, {
|
|
111
116
|
bold: !0,
|
|
112
|
-
variant: "
|
|
113
|
-
children:
|
|
114
|
-
}), b.length > 0 && /* @__PURE__ */ r(F, {
|
|
115
|
-
onClick: () => {
|
|
116
|
-
V(b, E);
|
|
117
|
-
},
|
|
118
|
-
startIcon: /* @__PURE__ */ r(H, { name: "ios_share" }),
|
|
119
|
-
sx: { height: 28 },
|
|
120
|
-
children: /* @__PURE__ */ r(x, {
|
|
121
|
-
bold: !0,
|
|
122
|
-
variant: "body2",
|
|
123
|
-
children: p.export_csv_btn
|
|
124
|
-
})
|
|
125
|
-
})]
|
|
126
|
-
}),
|
|
127
|
-
d ? /* @__PURE__ */ o(t, { children: [/* @__PURE__ */ r(K, { children: d.heading }), /* @__PURE__ */ r(J, {
|
|
128
|
-
component: "div",
|
|
129
|
-
transaction: d.transaction
|
|
130
|
-
})] }) : /* @__PURE__ */ r(t, {
|
|
131
|
-
sx: { bgcolor: "background.default" },
|
|
132
|
-
children: /* @__PURE__ */ r(M, {
|
|
133
|
-
transaction: C,
|
|
134
|
-
onClick: L
|
|
117
|
+
variant: "body2",
|
|
118
|
+
children: m.export_csv_btn
|
|
135
119
|
})
|
|
120
|
+
})]
|
|
121
|
+
}), c ? /* @__PURE__ */ o(t, { children: [/* @__PURE__ */ r(V, { children: c.heading }), /* @__PURE__ */ r(O, {
|
|
122
|
+
component: "div",
|
|
123
|
+
transaction: c.transaction
|
|
124
|
+
})] }) : /* @__PURE__ */ r(t, {
|
|
125
|
+
sx: { bgcolor: "background.default" },
|
|
126
|
+
children: /* @__PURE__ */ r(q, {
|
|
127
|
+
transaction: y,
|
|
128
|
+
onClick: k
|
|
136
129
|
})
|
|
137
|
-
]
|
|
130
|
+
})]
|
|
138
131
|
})
|
|
139
132
|
]
|
|
140
133
|
})]
|
|
141
134
|
});
|
|
142
135
|
});
|
|
143
136
|
export {
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
_r as TransactionDrillDown,
|
|
138
|
+
_r as default
|
|
146
139
|
};
|
|
147
140
|
|
|
148
141
|
//# sourceMappingURL=TransactionDrillDown.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDrillDown.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { observer } from 'mobx-react-lite'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, Text } from '@mxenabled/mxui'\n\nimport {\n TipSection,\n type TipSectionIcon,\n type TipSectionProps,\n} from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { Loader, useGlobalCopyStore, useGlobalUiStore, useTransactionStore } from '../../../common'\nimport type { Transaction } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport { TransactionList, TransactionRow } from '../../../transactions'\nimport { SubTabs, subTabPanelProps, type SubTabsProps } from '../../components/SubTabs'\n\ninterface TabItem {\n label: string\n ariaLabel?: string\n}\n\n// Every Figma drawer tip draws this icon; the shared TipSection keeps its lightbulb for V1 insights.\nconst DRAWER_TIP_ICON: TipSectionIcon = { color: 'primary', name: 'tips_and_updates', size: 20 }\n\nconst PANEL_ID = 'transaction-drill-down-panel'\nconst tabId = (index: number) => `transaction-details-tab-${index}`\nconst SUB_TABS_ID = 'transaction-drill-down-series'\n\ninterface TransactionDrillDownProps {\n ariaLabel?: string\n heading?: string\n subHeadingText?: string\n icon?: React.ReactNode\n tabs?: TabItem[]\n selectedIndex: number\n top: React.ReactNode\n tipSection?: TipSectionProps | false\n onSelectionChange?: (selectedIndex: number) => void\n onEachRowClick?: (guid: string) => void\n transactionFilter?: (selectedIndex: number) => (transaction: Transaction) => boolean\n baseTransactions?: Transaction[]\n // A second row of tabs between the chart and the list (the double-bar drawer's main / comparison\n // series, e.g. Spend / Income). Omitted for every single-series drawer.\n subTabs?: Omit<SubTabsProps, 'id'>\n // Shown instead of the list: one inert row under its own heading (Upcoming Bill's projected bill,\n // headed \"Projected amount\", as legacy pulse shows it). Not exported to CSV.\n projectedRow?: { heading: string; transaction: Transaction }\n // Drops the Transactions heading above the list; the CSV export, when there is one, stays.\n hideListHeader?: boolean\n // Draws the tip between the chart and the sub-tabs (Debt vs. Income) instead of under the sub-tabs.\n tipAboveSubTabs?: boolean\n}\n\nexport const TransactionDrillDown = observer(function TransactionDrillDown({\n ariaLabel,\n heading,\n subHeadingText,\n icon,\n tabs,\n selectedIndex,\n top,\n onSelectionChange,\n transactionFilter,\n tipSection,\n onEachRowClick,\n baseTransactions,\n subTabs,\n projectedRow,\n hideListHeader = false,\n tipAboveSubTabs = false,\n}: TransactionDrillDownProps) {\n const { transactions: transactionsCopy } = useGlobalCopyStore()\n const { isCopyLoaded } = useGlobalUiStore()\n const { sortedTransactionsWithSplits, tags, detailedTransactions } = useTransactionStore()\n\n if (!isCopyLoaded) return <Loader />\n\n const hasTabs = !!tabs?.length\n // Only a non-empty row gets the tabs and their panel.\n const seriesTabs = subTabs?.tabs.length ? subTabs : undefined\n const tablistLabel = ariaLabel ?? transactionsCopy.transactions_title\n\n const handlePrimaryChange = (_event: React.SyntheticEvent, newValue: number) => {\n onSelectionChange?.(newValue)\n }\n\n const filteredTransactions = transactionFilter\n ? (baseTransactions ?? detailedTransactions).filter(transactionFilter(selectedIndex))\n : undefined\n\n const exportTransactions = filteredTransactions ?? sortedTransactionsWithSplits\n\n return (\n <Box sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {hasTabs && (\n <Tabs\n aria-label={tablistLabel}\n onChange={handlePrimaryChange}\n // The title sits 16px below the tab bar, as in every Figma chart drawer; the theme's 8px\n // gap under Tabs would make it 24.\n sx={{ mb: 0 }}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs!.map((tab, index) => (\n <Tab\n aria-controls={PANEL_ID}\n aria-label={tab.ariaLabel}\n id={tabId(index)}\n key={`${tab.label}-${index}`}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )}\n\n <Box\n aria-labelledby={hasTabs ? tabId(selectedIndex) : undefined}\n id={PANEL_ID}\n role={hasTabs ? 'tabpanel' : undefined}\n >\n {(heading || subHeadingText) && (\n <Stack sx={{ gap: 4, pt: 16, px: 24 }}>\n {heading && <H3>{heading}</H3>}\n {subHeadingText && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {icon}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n textTransform=\"uppercase\"\n variant=\"body2\"\n >\n {subHeadingText}\n </Text>\n </Stack>\n )}\n </Stack>\n )}\n\n {/* Figma's chart drawer pads the chart 16px above and below. */}\n <Box sx={{ pb: top ? 16 : 0, pt: 16 }}>{top}</Box>\n\n {tipAboveSubTabs && tipSection && <TipSection icon={DRAWER_TIP_ICON} {...tipSection} />}\n\n {seriesTabs && <SubTabs {...seriesTabs} id={SUB_TABS_ID} />}\n\n {/* The content the sub-tabs control, as the month tabs' panel above. */}\n <Box {...(seriesTabs && subTabPanelProps(SUB_TABS_ID, seriesTabs.selectedIndex))}>\n {/* TODO: need to use a nseperate compnent from insight-v2, for now using insights-shared component which will be shifted under insights-v2 in future */}\n {!tipAboveSubTabs && tipSection && <TipSection icon={DRAWER_TIP_ICON} {...tipSection} />}\n\n {(!hideListHeader || exportTransactions.length > 0) && (\n <Stack\n sx={{\n alignItems: 'center',\n borderBottomColor: 'divider',\n borderBottomStyle: 'solid',\n borderBottomWidth: 1,\n flexDirection: 'row',\n // Without the heading, the export keeps its place on the right.\n justifyContent: hideListHeader ? 'flex-end' : 'space-between',\n pb: 4,\n pt: 16,\n px: 24,\n }}\n >\n {!hideListHeader && (\n <Text bold={true} variant=\"body1\">\n {transactionsCopy.transactions_title}\n </Text>\n )}\n {exportTransactions.length > 0 && (\n <Button\n onClick={() => {\n exportTransactionsToCSV(exportTransactions, tags)\n }}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n )}\n\n {projectedRow ? (\n <Box>\n <SubheaderRow>{projectedRow.heading}</SubheaderRow>\n <TransactionRow component=\"div\" transaction={projectedRow.transaction} />\n </Box>\n ) : (\n // The list's scroll box is taller than its rows; Figma fills the space below the last\n // row with background.default, and each row paints its own paper.\n <Box sx={{ bgcolor: 'background.default' }}>\n <TransactionList transaction={filteredTransactions} onClick={onEachRowClick} />\n </Box>\n )}\n </Box>\n </Box>\n </Box>\n )\n})\n\nexport default TransactionDrillDown\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,IAAM,IAAkC;AAAA,EAAE,OAAO;AAAA,EAAW,MAAM;AAAA,EAAoB,MAAM;AAAG,GAEzF,IAAW,gCACX,IAAA,CAAS,MAAkB,2BAA2B,CAAA,IACtD,IAAc,iCA2BP,KAAuB,EAAS,SAA8B,EACzE,WAAA,GACA,SAAA,GACA,gBAAA,GACA,MAAA,GACA,MAAA,GACA,eAAA,GACA,KAAA,GACA,mBAAA,GACA,mBAAA,GACA,YAAA,GACA,gBAAA,GACA,kBAAA,GACA,SAAA,GACA,cAAA,GACA,gBAAA,IAAiB,IACjB,iBAAA,IAAkB,GAAA,GACU;AAC5B,QAAM,EAAE,cAAc,EAAA,IAAqB,EAAmB,GACxD,EAAE,cAAA,EAA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,UAAA,CAcG,CAAC,KACA,gBAAA,EAAC,GAAD;AAAA,gBAAM,MAAM;AAAA,gBAAM,SAAQ;AAAA,gBACvB,UAAA,EAAiB;AAAA,cACd,CAAA,GAEP,EAAmB,SAAS,KAC3B,gBAAA,EAAC,GAAD;AAAA,gBACE,SAAA,MAAe;AACb,kBAAA,EAAwB,GAAoB,CAAI;AAAA,gBAClD;AAAA,gBACA,WAAW,gBAAA,EAAC,GAAD,EAAM,MAAK,YAAa,CAAA;AAAA,gBACnC,IAAI,EAAE,QAAQ,GAAG;AAAA,gBAEjB,UAAA,gBAAA,EAAC,GAAD;AAAA,kBAAM,MAAM;AAAA,kBAAM,SAAQ;AAAA,kBACvB,UAAA,EAAiB;AAAA,gBACd,CAAA;AAAA,cACA,CAAA,CAEL;AAAA;YAGR,IACC,gBAAA,EAAC,GAAD,EAAA,UAAA,CACE,gBAAA,EAAC,GAAD,EAAA,UAAe,EAAa,QAAsB,CAAA,GAClD,gBAAA,EAAC,GAAD;AAAA,cAAgB,WAAU;AAAA,cAAM,aAAa,EAAa;AAAA,YAAc,CAAA,CACrE,EAAA,CAAA,IAIL,gBAAA,EAAC,GAAD;AAAA,cAAK,IAAI,EAAE,SAAS,qBAAqB;AAAA,cACvC,UAAA,gBAAA,EAAC,GAAD;AAAA,gBAAiB,aAAa;AAAA,gBAAsB,SAAS;AAAA,cAAiB,CAAA;AAAA,YAC3E,CAAA;AAAA,UAEJ;AAAA;MACF;AAAA,IACF,CAAA,CAAA;AAAA;AAET,CAAC"}
|
|
1
|
+
{"version":3,"file":"TransactionDrillDown.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { observer } from 'mobx-react-lite'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, Text } from '@mxenabled/mxui'\n\nimport {\n TipSection,\n type TipSectionIcon,\n type TipSectionProps,\n} from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { Loader, useGlobalCopyStore, useGlobalUiStore, useTransactionStore } from '../../../common'\nimport type { Transaction } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport { TransactionList, TransactionRow } from '../../../transactions'\nimport { SubTabs, subTabPanelProps, type SubTabsProps } from '../../components/SubTabs'\n\ninterface TabItem {\n label: string\n ariaLabel?: string\n}\n\n// Every Figma drawer tip draws this icon; the shared TipSection keeps its lightbulb for V1 insights.\nconst DRAWER_TIP_ICON: TipSectionIcon = { color: 'primary', name: 'tips_and_updates', size: 20 }\n\nconst PANEL_ID = 'transaction-drill-down-panel'\nconst tabId = (index: number) => `transaction-details-tab-${index}`\nconst SUB_TABS_ID = 'transaction-drill-down-series'\n\ninterface TransactionDrillDownProps {\n ariaLabel?: string\n heading?: string\n subHeadingText?: string\n icon?: React.ReactNode\n tabs?: TabItem[]\n selectedIndex: number\n top: React.ReactNode\n tipSection?: TipSectionProps | false\n onSelectionChange?: (selectedIndex: number) => void\n onEachRowClick?: (guid: string) => void\n transactionFilter?: (selectedIndex: number) => (transaction: Transaction) => boolean\n baseTransactions?: Transaction[]\n // A second row of tabs between the chart and the list (the double-bar drawer's main / comparison\n // series, e.g. Spend / Income). Omitted for every single-series drawer.\n subTabs?: Omit<SubTabsProps, 'id'>\n // Shown instead of the list: one inert row under its own heading (Upcoming Bill's projected bill,\n // headed \"Projected amount\", as legacy pulse shows it). Not exported to CSV.\n projectedRow?: { heading: string; transaction: Transaction }\n // Drops the Transactions heading above the list; the CSV export, when there is one, stays.\n hideListHeader?: boolean\n}\n\nexport const TransactionDrillDown = observer(function TransactionDrillDown({\n ariaLabel,\n heading,\n subHeadingText,\n icon,\n tabs,\n selectedIndex,\n top,\n onSelectionChange,\n transactionFilter,\n tipSection,\n onEachRowClick,\n baseTransactions,\n subTabs,\n projectedRow,\n hideListHeader = false,\n}: TransactionDrillDownProps) {\n const { transactions: transactionsCopy } = useGlobalCopyStore()\n const { isCopyLoaded } = useGlobalUiStore()\n const { sortedTransactionsWithSplits, tags, detailedTransactions } = useTransactionStore()\n\n if (!isCopyLoaded) return <Loader />\n\n const hasTabs = !!tabs?.length\n // Only a non-empty row gets the tabs and their panel.\n const seriesTabs = subTabs?.tabs.length ? subTabs : undefined\n const tablistLabel = ariaLabel ?? transactionsCopy.transactions_title\n\n const handlePrimaryChange = (_event: React.SyntheticEvent, newValue: number) => {\n onSelectionChange?.(newValue)\n }\n\n const filteredTransactions = transactionFilter\n ? (baseTransactions ?? detailedTransactions).filter(transactionFilter(selectedIndex))\n : undefined\n\n const exportTransactions = filteredTransactions ?? sortedTransactionsWithSplits\n\n return (\n <Box sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {hasTabs && (\n <Tabs\n aria-label={tablistLabel}\n onChange={handlePrimaryChange}\n // The title sits 16px below the tab bar, as in every Figma chart drawer; the theme's 8px\n // gap under Tabs would make it 24.\n sx={{ mb: 0 }}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs!.map((tab, index) => (\n <Tab\n aria-controls={PANEL_ID}\n aria-label={tab.ariaLabel}\n id={tabId(index)}\n key={`${tab.label}-${index}`}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )}\n\n <Box\n aria-labelledby={hasTabs ? tabId(selectedIndex) : undefined}\n id={PANEL_ID}\n role={hasTabs ? 'tabpanel' : undefined}\n >\n {(heading || subHeadingText) && (\n <Stack sx={{ gap: 4, pt: 16, px: 24 }}>\n {heading && <H3>{heading}</H3>}\n {subHeadingText && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {icon}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n textTransform=\"uppercase\"\n variant=\"body2\"\n >\n {subHeadingText}\n </Text>\n </Stack>\n )}\n </Stack>\n )}\n\n {/* Figma's chart drawer pads the chart 16px above and below. */}\n <Box sx={{ pb: top ? 16 : 0, pt: 16 }}>{top}</Box>\n\n {/* Every Figma chart drawer puts the tip under the chart, above any sub-tabs. */}\n {tipSection && <TipSection icon={DRAWER_TIP_ICON} {...tipSection} />}\n\n {seriesTabs && <SubTabs {...seriesTabs} id={SUB_TABS_ID} />}\n\n {/* The content the sub-tabs control, as the month tabs' panel above. */}\n <Box {...(seriesTabs && subTabPanelProps(SUB_TABS_ID, seriesTabs.selectedIndex))}>\n {(!hideListHeader || exportTransactions.length > 0) && (\n <Stack\n sx={{\n alignItems: 'center',\n borderBottomColor: 'divider',\n borderBottomStyle: 'solid',\n borderBottomWidth: 1,\n flexDirection: 'row',\n // Without the heading, the export keeps its place on the right.\n justifyContent: hideListHeader ? 'flex-end' : 'space-between',\n pb: 4,\n pt: 16,\n px: 24,\n }}\n >\n {!hideListHeader && (\n <Text bold={true} variant=\"body1\">\n {transactionsCopy.transactions_title}\n </Text>\n )}\n {exportTransactions.length > 0 && (\n <Button\n onClick={() => {\n exportTransactionsToCSV(exportTransactions, tags)\n }}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n )}\n\n {projectedRow ? (\n <Box>\n <SubheaderRow>{projectedRow.heading}</SubheaderRow>\n <TransactionRow component=\"div\" transaction={projectedRow.transaction} />\n </Box>\n ) : (\n // The list's scroll box is taller than its rows; Figma fills the space below the last\n // row with background.default, and each row paints its own paper.\n <Box sx={{ bgcolor: 'background.default' }}>\n <TransactionList transaction={filteredTransactions} onClick={onEachRowClick} />\n </Box>\n )}\n </Box>\n </Box>\n </Box>\n )\n})\n\nexport default TransactionDrillDown\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAkC;AA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