@mx-cartographer/experiences 9.7.24 → 9.7.26
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/common/components/MiniWidgetContainer.es.js +35 -45
- package/dist/common/components/MiniWidgetContainer.es.js.map +1 -1
- package/dist/common/components/charts/LineChart.es.js +86 -85
- package/dist/common/components/charts/LineChart.es.js.map +1 -1
- package/dist/common/constants/Styles.d.ts +2 -0
- package/dist/common/constants/Styles.es.js +17 -0
- package/dist/common/constants/Styles.es.js.map +1 -0
- package/dist/common/constants/index.d.ts +1 -0
- package/dist/common/hooks/useAriaLive.es.js +12 -22
- package/dist/common/hooks/useAriaLive.es.js.map +1 -1
- package/dist/common/index.es.js +111 -109
- package/dist/core/stores/TrendsStore.d.ts +5 -0
- package/dist/core/utils/DateUtil.d.ts +2 -0
- package/dist/core/utils/DateUtil.es.js +37 -35
- package/dist/core/utils/DateUtil.es.js.map +1 -1
- package/dist/core/utils/NumberFormatting.d.ts +1 -0
- package/dist/core/utils/NumberFormatting.es.js +14 -13
- package/dist/core/utils/NumberFormatting.es.js.map +1 -1
- package/dist/core/utils/TrendsUtil.d.ts +5 -0
- package/dist/core/utils/TrendsUtil.es.js +67 -59
- package/dist/core/utils/TrendsUtil.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +47 -48
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionList.d.ts +4 -0
- package/dist/transactions/components/shared/TransactionList.es.js +138 -84
- package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
- package/dist/trends/components/CategoryDetailChart.d.ts +2 -1
- package/dist/trends/components/CategoryDetailChart.es.js +55 -35
- package/dist/trends/components/CategoryDetailChart.es.js.map +1 -1
- package/dist/trends/components/CategoryDetails.es.js +68 -71
- package/dist/trends/components/CategoryDetails.es.js.map +1 -1
- package/dist/trends/utils/TrendsTable.es.js +25 -25
- package/dist/trends/utils/TrendsTable.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,97 +1,151 @@
|
|
|
1
|
-
import { useEvent as
|
|
2
|
-
import { fromUnixUTCToDayOfWeekAndDate as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
1
|
+
import { useEvent as Q, useGlobalCopyStore as W, useTransactionStore as ee } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { fromUnixUTCToDayOfWeekAndDate as te } from "../../../core/utils/DateUtil.es.js";
|
|
3
|
+
import { VISUALLY_HIDDEN_SX as oe } from "../../../common/constants/Styles.es.js";
|
|
4
|
+
import { ANALYTICS_EVENTS as ne } from "../../../common/constants/Analytics.es.js";
|
|
5
|
+
import re from "../../../common/components/Loader.es.js";
|
|
6
|
+
import se from "../../../common/components/ZeroState.es.js";
|
|
7
|
+
import { useTransactionsUiStore as ie } from "../../context/hooks.es.js";
|
|
8
|
+
import ae from "./transactionlist/TransactionRow.es.js";
|
|
9
|
+
import ce from "../../../common/components/SubheaderRow.es.js";
|
|
10
|
+
import { hasInsetBorder as le, shouldShowDate as H } from "../../utils/Transactions.es.js";
|
|
11
|
+
import o from "react";
|
|
12
|
+
import { observer as ue } from "mobx-react-lite";
|
|
13
|
+
import { Fragment as de, jsx as s, jsxs as b } from "react/jsx-runtime";
|
|
13
14
|
import u from "@mui/material/Box";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { useVirtualizer as
|
|
17
|
-
var
|
|
15
|
+
import fe from "@mui/material/Divider";
|
|
16
|
+
import me from "@mui/material/List";
|
|
17
|
+
import { useVirtualizer as pe } from "@tanstack/react-virtual";
|
|
18
|
+
var z = 65, y = 32, ge = (h) => {
|
|
19
|
+
for (let r = h?.parentElement; r; r = r.parentElement) if (/(auto|scroll)/.test(getComputedStyle(r).overflowY)) return r;
|
|
20
|
+
return null;
|
|
21
|
+
}, he = ({ bgcolor: h, filter: r, height: N = "calc(100dvh - 36px)", isRowDisabled: O, loader: k = /* @__PURE__ */ s(re, {
|
|
18
22
|
label: "Loading",
|
|
19
23
|
size: 40
|
|
20
|
-
}), onClick:
|
|
21
|
-
const { isLoading:
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
+
}), onClick: E, scrollsWithParent: a = !1, showInsights: I = !1, showLoader: B = !1, stickyHeader: x, transaction: _, width: S = "100%", zeroState: U = /* @__PURE__ */ s(se, {}) }) => {
|
|
25
|
+
const { isLoading: V, sortedTransactions: v } = ee(), n = o.useMemo(() => {
|
|
26
|
+
const e = r ? v.filter(r) : v;
|
|
27
|
+
return _ ?? e;
|
|
24
28
|
}, [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
]), { clearExpandedSplits:
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
|
|
29
|
+
v,
|
|
30
|
+
r,
|
|
31
|
+
_
|
|
32
|
+
]), { clearExpandedSplits: $, setShowInsights: F, toggleSplit: M } = ie(), { onEvent: Y } = Q(), { common: G } = W(), [d, C] = o.useState(null), j = (e) => {
|
|
33
|
+
const t = n.find((i) => i.guid === e);
|
|
34
|
+
if (t?.has_been_split) {
|
|
35
|
+
M(t.guid);
|
|
32
36
|
return;
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
account_guid:
|
|
36
|
-
transaction_guid:
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
Y(ne.ACCOUNT_DETAILS_CLICK_TRANSACTION, {
|
|
39
|
+
account_guid: t?.account_guid,
|
|
40
|
+
transaction_guid: e
|
|
41
|
+
}), E?.(e);
|
|
42
|
+
}, f = o.useRef(null), q = !!x, [R, K] = o.useState(null), [L, X] = o.useState(0), m = o.useRef(null), [w, Z] = o.useState(0);
|
|
43
|
+
o.useLayoutEffect(() => {
|
|
44
|
+
if (!a) return;
|
|
45
|
+
const e = f.current;
|
|
46
|
+
if (!e) return;
|
|
47
|
+
const t = ge(e) ?? e, i = () => {
|
|
48
|
+
X(e.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop), Z(m.current?.offsetHeight ?? 0);
|
|
49
|
+
};
|
|
50
|
+
K(t), i();
|
|
51
|
+
const l = new ResizeObserver(i);
|
|
52
|
+
return l.observe(t.firstElementChild ?? t), m.current && l.observe(m.current), () => l.disconnect();
|
|
53
|
+
}, [a, q]);
|
|
54
|
+
const p = pe({
|
|
55
|
+
count: n.length,
|
|
56
|
+
getScrollElement: () => a ? R : f.current,
|
|
57
|
+
estimateSize: (e) => z + (H(e, n) ? y : 0),
|
|
58
|
+
overscan: 5,
|
|
59
|
+
scrollMargin: L,
|
|
60
|
+
scrollPaddingStart: w
|
|
61
|
+
}), g = p.getVirtualItems(), c = g.at(-1)?.index ?? -1, A = n.length - (c + 1), T = !V && !B, D = T && g.length > 0, J = () => {
|
|
62
|
+
const e = c + 1;
|
|
63
|
+
p.scrollToIndex(e, { align: "start" }), C({
|
|
64
|
+
index: e,
|
|
65
|
+
from: c
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return o.useEffect(() => {
|
|
69
|
+
if (!d) return;
|
|
70
|
+
const e = f.current?.querySelector(`[data-index="${d.index}"]`);
|
|
71
|
+
e?.focus(), (e || c !== d.from) && C(null);
|
|
72
|
+
}, [d, c]), o.useEffect(() => p.measure(), [n, R]), o.useEffect(() => F(I), [I]), o.useEffect(() => () => $(), []), /* @__PURE__ */ b(de, { children: [
|
|
73
|
+
x && /* @__PURE__ */ s(u, {
|
|
74
|
+
ref: m,
|
|
75
|
+
sx: {
|
|
76
|
+
bgcolor: "background.paper",
|
|
77
|
+
position: a ? "sticky" : void 0,
|
|
78
|
+
top: 0,
|
|
79
|
+
width: S,
|
|
80
|
+
zIndex: 1
|
|
81
|
+
},
|
|
82
|
+
children: x
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ s(me, {
|
|
85
|
+
component: "div",
|
|
86
|
+
role: "list",
|
|
87
|
+
sx: { width: S },
|
|
88
|
+
children: /* @__PURE__ */ s(u, {
|
|
89
|
+
height: a ? void 0 : N,
|
|
90
|
+
overflow: a ? void 0 : "auto",
|
|
91
|
+
ref: f,
|
|
57
92
|
role: "presentation",
|
|
58
|
-
width:
|
|
59
|
-
children:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
width: S,
|
|
94
|
+
children: /* @__PURE__ */ b(u, {
|
|
95
|
+
height: g.length === 0 ? "auto" : p.getTotalSize(),
|
|
96
|
+
position: "relative",
|
|
97
|
+
role: "presentation",
|
|
98
|
+
width: "100%",
|
|
99
|
+
children: [
|
|
100
|
+
!T && k,
|
|
101
|
+
T && n.length === 0 && U,
|
|
102
|
+
D && g.map((e) => {
|
|
103
|
+
const t = n[e.index], i = H(e.index, n), l = le(e.index, n), P = z + (i ? y : 0);
|
|
104
|
+
return /* @__PURE__ */ b(u, {
|
|
105
|
+
"aria-posinset": e.index + 1,
|
|
106
|
+
"aria-setsize": n.length,
|
|
107
|
+
"data-index": e.index,
|
|
108
|
+
role: "listitem",
|
|
109
|
+
tabIndex: -1,
|
|
110
|
+
sx: {
|
|
111
|
+
height: P,
|
|
112
|
+
position: "absolute",
|
|
113
|
+
scrollMarginTop: w,
|
|
114
|
+
transform: `translateY(${e.start - L}px)`,
|
|
115
|
+
width: "100%",
|
|
116
|
+
bgcolor: "background.paper"
|
|
117
|
+
},
|
|
118
|
+
children: [
|
|
119
|
+
i && /* @__PURE__ */ s(ce, {
|
|
120
|
+
bgcolor: h,
|
|
121
|
+
children: te(t.date)
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ s(ae, {
|
|
124
|
+
component: "div",
|
|
125
|
+
disabled: O?.(t),
|
|
126
|
+
...E && { onClick: j },
|
|
127
|
+
transaction: t
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ s(fe, { sx: { ml: l ? 68 : 0 } })
|
|
130
|
+
]
|
|
131
|
+
}, t.guid);
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
})
|
|
89
135
|
})
|
|
136
|
+
}),
|
|
137
|
+
D && A > 0 && /* @__PURE__ */ s(u, {
|
|
138
|
+
component: "button",
|
|
139
|
+
onClick: J,
|
|
140
|
+
sx: oe,
|
|
141
|
+
tabIndex: -1,
|
|
142
|
+
type: "button",
|
|
143
|
+
children: `${G.view_more} (${A})`
|
|
90
144
|
})
|
|
91
|
-
});
|
|
92
|
-
},
|
|
145
|
+
] });
|
|
146
|
+
}, Ne = ue(he);
|
|
93
147
|
export {
|
|
94
|
-
|
|
148
|
+
Ne as default
|
|
95
149
|
};
|
|
96
150
|
|
|
97
151
|
//# sourceMappingURL=TransactionList.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionList.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\n\nimport { ANALYTICS_EVENTS, Loader, useEvent, ZeroState } from '../../../common'\nimport { type Transaction } from '../../../core'\n\nimport { useTransactionsUiStore } from '../../context/hooks'\nimport { useTransactionStore } from '../../../common'\n\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport TransactionRow from './transactionlist/TransactionRow'\n\nimport { hasInsetBorder, shouldShowDate } from '../../utils/Transactions'\nimport { fromUnixUTCToDayOfWeekAndDate } from '../../../core/utils/DateUtil'\n\nconst ROW_HEIGHT = 65\nconst DATE_ROW_HEIGHT = 32\n\nexport interface TransactionListProps {\n bgcolor?: string\n filter?: (t: Transaction) => boolean\n height?: number | string\n /**\n * Marks rows that stay in the list but cannot be acted on. Disabled rows are rendered greyed\n * out and inert instead of being removed, so list membership and ordering are unaffected.\n */\n isRowDisabled?: (t: Transaction) => boolean\n loader?: React.JSX.Element\n onClick?: (guid: string) => void\n showInsights?: boolean\n showLoader?: boolean\n transaction?: Transaction[]\n width?: number | string\n zeroState?: React.JSX.Element\n}\n\nconst TransactionList: React.FC<TransactionListProps> = ({\n bgcolor,\n filter,\n height = 'calc(100dvh - 36px)',\n isRowDisabled,\n loader = <Loader label=\"Loading\" size={40} />,\n onClick,\n showInsights = false,\n showLoader = false,\n transaction,\n width = '100%',\n zeroState = <ZeroState />,\n}) => {\n const { isLoading, sortedTransactions: allTransactions } = useTransactionStore()\n const transactions = React.useMemo(() => {\n const updatedTransactions = filter ? allTransactions.filter(filter) : allTransactions\n return transaction ?? updatedTransactions\n }, [allTransactions, filter, transaction])\n\n const { clearExpandedSplits, setShowInsights, toggleSplit } = useTransactionsUiStore()\n const { onEvent } = useEvent()\n\n const handleClick = (guid: string) => {\n const transaction = transactions.find((t) => t.guid === guid)\n\n if (transaction?.has_been_split) {\n toggleSplit(transaction.guid)\n return\n }\n\n onEvent(ANALYTICS_EVENTS.ACCOUNT_DETAILS_CLICK_TRANSACTION, {\n account_guid: transaction?.account_guid,\n transaction_guid: guid,\n })\n onClick?.(guid)\n }\n\n const parentRef = React.useRef<HTMLDivElement>(null)\n const rowVirtualizer = useVirtualizer({\n count: transactions.length,\n getScrollElement: () => parentRef.current,\n estimateSize: (i) => ROW_HEIGHT + (shouldShowDate(i, transactions) ? DATE_ROW_HEIGHT : 0),\n overscan: 5,\n })\n\n React.useEffect(() => rowVirtualizer.measure(), [transactions])\n React.useEffect(() => setShowInsights(showInsights), [showInsights])\n\n React.useEffect(() => {\n return () => clearExpandedSplits()\n }, [])\n\n return (\n <List component=\"div\" role=\"list\" sx={{ width: width }}>\n <Box height={height} overflow=\"auto\" ref={parentRef} role=\"presentation\" width={width}>\n <Box\n height={\n // set the height to auto when there are no transactions so the zero state isn't set to 0\n rowVirtualizer.getVirtualItems().length === 0 ? 'auto' : rowVirtualizer.getTotalSize()\n }\n position=\"relative\"\n role=\"presentation\"\n width=\"100%\"\n >\n {(isLoading || showLoader) && loader}\n {!isLoading && !showLoader && rowVirtualizer.getVirtualItems().length === 0 && zeroState}\n {!isLoading &&\n !showLoader &&\n rowVirtualizer.getVirtualItems().length > 0 &&\n rowVirtualizer.getVirtualItems().map((row) => {\n const transaction = transactions[row.index]\n const showDate = shouldShowDate(row.index, transactions)\n const isInset = hasInsetBorder(row.index, transactions)\n const rowHeight = ROW_HEIGHT + (showDate ? DATE_ROW_HEIGHT : 0)\n\n return (\n <Box\n key={transaction.guid}\n role=\"listitem\"\n sx={{\n height: rowHeight,\n position: 'absolute',\n transform: `translateY(${row.start}px)`,\n width: '100%',\n bgcolor: 'background.paper',\n }}\n >\n {showDate && (\n <SubheaderRow bgcolor={bgcolor}>\n {fromUnixUTCToDayOfWeekAndDate(transaction.date)}\n </SubheaderRow>\n )}\n <TransactionRow\n component=\"div\"\n disabled={isRowDisabled?.(transaction)}\n {...(onClick && { onClick: handleClick })}\n transaction={transaction}\n />\n <Divider sx={{ ml: isInset ? 68 : 0 }} />\n </Box>\n )\n })}\n </Box>\n </Box>\n </List>\n )\n}\n\n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A,gBAEhB,gBAAA,EAAC,GAAD;AAAA,kBACE,WAAU;AAAA,kBACV,UAAU,IAAgB,CAAW;AAAA,kBACrC,GAAK,KAAW,EAAE,SAAS,EAAY;AAAA,kBAC1B,aAAA;AAAA,gBACd,CAAA;AAAA,gBACD,gBAAA,EAAC,GAAD,EAAS,IAAI,EAAE,IAAI,IAAU,KAAK,EAAE,EAAI,CAAA;AAAA,cACrC;AAAA,YAtBE,GAAA,EAAY,IAsBd;AAAA,UAET,CAAC;AAAA,QACA;AAAA;IACF,CAAA;AAAA,EACD,CAAA;AAEV,GAEA,KAAe,EAAS,CAAe"}
|
|
1
|
+
{"version":3,"file":"TransactionList.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useEvent,\n useGlobalCopyStore,\n VISUALLY_HIDDEN_SX,\n ZeroState,\n} from '../../../common'\nimport { type Transaction } from '../../../core'\n\nimport { useTransactionsUiStore } from '../../context/hooks'\nimport { useTransactionStore } from '../../../common'\n\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport TransactionRow from './transactionlist/TransactionRow'\n\nimport { hasInsetBorder, shouldShowDate } from '../../utils/Transactions'\nimport { fromUnixUTCToDayOfWeekAndDate } from '../../../core/utils/DateUtil'\n\nconst ROW_HEIGHT = 65\nconst DATE_ROW_HEIGHT = 32\n\nconst findScrollParent = (node: HTMLElement | null): HTMLElement | null => {\n for (let el = node?.parentElement; el; el = el.parentElement) {\n if (/(auto|scroll)/.test(getComputedStyle(el).overflowY)) return el\n }\n return null\n}\n\nexport interface TransactionListProps {\n bgcolor?: string\n filter?: (t: Transaction) => boolean\n height?: number | string\n /**\n * Marks rows that stay in the list but cannot be acted on. Disabled rows are rendered greyed\n * out and inert instead of being removed, so list membership and ordering are unaffected.\n */\n isRowDisabled?: (t: Transaction) => boolean\n loader?: React.JSX.Element\n onClick?: (guid: string) => void\n /** Virtualize against the nearest scrolling ancestor instead of an own fixed-height scroll box. */\n scrollsWithParent?: boolean\n /** Rendered above the rows; stays at the top of the scroll area when used with scrollsWithParent. */\n stickyHeader?: React.ReactNode\n showInsights?: boolean\n showLoader?: boolean\n transaction?: Transaction[]\n width?: number | string\n zeroState?: React.JSX.Element\n}\n\nconst TransactionList: React.FC<TransactionListProps> = ({\n bgcolor,\n filter,\n height = 'calc(100dvh - 36px)',\n isRowDisabled,\n loader = <Loader label=\"Loading\" size={40} />,\n onClick,\n scrollsWithParent = false,\n showInsights = false,\n showLoader = false,\n stickyHeader,\n transaction,\n width = '100%',\n zeroState = <ZeroState />,\n}) => {\n const { isLoading, sortedTransactions: allTransactions } = useTransactionStore()\n const transactions = React.useMemo(() => {\n const updatedTransactions = filter ? allTransactions.filter(filter) : allTransactions\n return transaction ?? updatedTransactions\n }, [allTransactions, filter, transaction])\n\n const { clearExpandedSplits, setShowInsights, toggleSplit } = useTransactionsUiStore()\n const { onEvent } = useEvent()\n const { common: commonCopy } = useGlobalCopyStore()\n const [pendingFocus, setPendingFocus] = React.useState<{ index: number; from: number } | null>(\n null,\n )\n\n const handleClick = (guid: string) => {\n const transaction = transactions.find((t) => t.guid === guid)\n\n if (transaction?.has_been_split) {\n toggleSplit(transaction.guid)\n return\n }\n\n onEvent(ANALYTICS_EVENTS.ACCOUNT_DETAILS_CLICK_TRANSACTION, {\n account_guid: transaction?.account_guid,\n transaction_guid: guid,\n })\n onClick?.(guid)\n }\n\n const parentRef = React.useRef<HTMLDivElement>(null)\n const hasStickyHeader = Boolean(stickyHeader)\n const [scrollParent, setScrollParent] = React.useState<HTMLElement | null>(null)\n const [scrollMargin, setScrollMargin] = React.useState(0)\n const headerRef = React.useRef<HTMLDivElement>(null)\n const [headerHeight, setHeaderHeight] = React.useState(0)\n\n React.useLayoutEffect(() => {\n if (!scrollsWithParent) return\n const list = parentRef.current\n if (!list) return\n // With no scrolling ancestor the list itself is the viewport, so every row renders.\n const scroller = findScrollParent(list) ?? list\n\n const measureOffset = () => {\n setScrollMargin(\n list.getBoundingClientRect().top -\n scroller.getBoundingClientRect().top +\n scroller.scrollTop,\n )\n setHeaderHeight(headerRef.current?.offsetHeight ?? 0)\n }\n\n setScrollParent(scroller)\n measureOffset()\n const observer = new ResizeObserver(measureOffset)\n observer.observe(scroller.firstElementChild ?? scroller)\n if (headerRef.current) observer.observe(headerRef.current)\n return () => observer.disconnect()\n }, [scrollsWithParent, hasStickyHeader])\n\n const rowVirtualizer = useVirtualizer({\n count: transactions.length,\n getScrollElement: () => (scrollsWithParent ? scrollParent : parentRef.current),\n estimateSize: (i) => ROW_HEIGHT + (shouldShowDate(i, transactions) ? DATE_ROW_HEIGHT : 0),\n overscan: 5,\n scrollMargin,\n scrollPaddingStart: headerHeight,\n })\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n const lastRenderedIndex = virtualItems.at(-1)?.index ?? -1\n const unrenderedCount = transactions.length - (lastRenderedIndex + 1)\n const isSettled = !isLoading && !showLoader\n const showRows = isSettled && virtualItems.length > 0\n\n // Screen reader reading modes do not scroll the list, so rows past the rendered window\n // are unreachable without this control.\n const showNextRows = () => {\n const nextIndex = lastRenderedIndex + 1\n rowVirtualizer.scrollToIndex(nextIndex, { align: 'start' })\n setPendingFocus({ index: nextIndex, from: lastRenderedIndex })\n }\n\n React.useEffect(() => {\n if (!pendingFocus) return\n const row = parentRef.current?.querySelector<HTMLElement>(\n `[data-index=\"${pendingFocus.index}\"]`,\n )\n row?.focus()\n // Give up once the window moves, so a missed row cannot take focus later.\n if (row || lastRenderedIndex !== pendingFocus.from) setPendingFocus(null)\n }, [pendingFocus, lastRenderedIndex])\n\n React.useEffect(() => rowVirtualizer.measure(), [transactions, scrollParent])\n React.useEffect(() => setShowInsights(showInsights), [showInsights])\n\n React.useEffect(() => {\n return () => clearExpandedSplits()\n }, [])\n\n return (\n <>\n {stickyHeader && (\n <Box\n ref={headerRef}\n sx={{\n bgcolor: 'background.paper',\n position: scrollsWithParent ? 'sticky' : undefined,\n top: 0,\n width,\n zIndex: 1,\n }}\n >\n {stickyHeader}\n </Box>\n )}\n <List component=\"div\" role=\"list\" sx={{ width: width }}>\n <Box\n height={scrollsWithParent ? undefined : height}\n overflow={scrollsWithParent ? undefined : 'auto'}\n ref={parentRef}\n role=\"presentation\"\n width={width}\n >\n <Box\n height={\n // set the height to auto when there are no transactions so the zero state isn't set to 0\n virtualItems.length === 0 ? 'auto' : rowVirtualizer.getTotalSize()\n }\n position=\"relative\"\n role=\"presentation\"\n width=\"100%\"\n >\n {!isSettled && loader}\n {isSettled && transactions.length === 0 && zeroState}\n {showRows &&\n virtualItems.map((row) => {\n const transaction = transactions[row.index]\n const showDate = shouldShowDate(row.index, transactions)\n const isInset = hasInsetBorder(row.index, transactions)\n const rowHeight = ROW_HEIGHT + (showDate ? DATE_ROW_HEIGHT : 0)\n\n return (\n <Box\n aria-posinset={row.index + 1}\n aria-setsize={transactions.length}\n data-index={row.index}\n key={transaction.guid}\n role=\"listitem\"\n tabIndex={-1}\n sx={{\n height: rowHeight,\n position: 'absolute',\n // Keeps a focused row from scrolling under the sticky header.\n scrollMarginTop: headerHeight,\n transform: `translateY(${row.start - scrollMargin}px)`,\n width: '100%',\n bgcolor: 'background.paper',\n }}\n >\n {showDate && (\n <SubheaderRow bgcolor={bgcolor}>\n {fromUnixUTCToDayOfWeekAndDate(transaction.date)}\n </SubheaderRow>\n )}\n <TransactionRow\n component=\"div\"\n disabled={isRowDisabled?.(transaction)}\n {...(onClick && { onClick: handleClick })}\n transaction={transaction}\n />\n <Divider sx={{ ml: isInset ? 68 : 0 }} />\n </Box>\n )\n })}\n </Box>\n </Box>\n </List>\n {showRows && unrenderedCount > 0 && (\n <Box\n component=\"button\"\n onClick={showNextRows}\n sx={VISUALLY_HIDDEN_SX}\n tabIndex={-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U;AAAA,MACV,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,MAAK;AAAA,MAEJ,UAAA,GAAG,EAAW,SAAA,KAAc,CAAA;AAAA,IAC1B,CAAA;AAAA,EAEP,EAAA,CAAA;AAEN,GAEA,KAAe,GAAS,EAAe"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
interface CategoryDetailChartProps {
|
|
2
2
|
chartColor: string;
|
|
3
3
|
chartLabel: string;
|
|
4
|
+
chartTitle: string;
|
|
4
5
|
}
|
|
5
|
-
declare const CategoryDetailChart: (({ chartLabel,
|
|
6
|
+
declare const CategoryDetailChart: (({ chartColor, chartLabel, chartTitle }: CategoryDetailChartProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
8
9
|
export default CategoryDetailChart;
|
|
@@ -1,45 +1,65 @@
|
|
|
1
|
-
import { useEvent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useEvent as T, useGlobalCopyStore as C, useTrendsStore as f } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { formatCurrency as s } from "../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { VISUALLY_HIDDEN_SX as w } from "../../common/constants/Styles.es.js";
|
|
4
|
+
import { ANALYTICS_EVENTS as S } from "../../common/constants/Analytics.es.js";
|
|
5
|
+
import { LineChart as x } from "../../common/components/charts/LineChart.es.js";
|
|
6
|
+
import { TRENDS_ANALYTICS_METADATA as g } from "../constants/TrendsWidget.es.js";
|
|
7
|
+
import { observer as v } from "mobx-react-lite";
|
|
8
|
+
import y from "@mui/material/Stack";
|
|
9
|
+
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
10
|
+
import m from "@mui/material/Box";
|
|
11
|
+
var e = "0,0", M = v(({ chartColor: o, chartLabel: n, chartTitle: a }) => {
|
|
12
|
+
const { onEvent: h } = T(), { common: l } = C(), { categoryDetailsChartData: { average: c, monthlyAmounts: d, monthlyTotals: p, tooltipLabels: u } } = f();
|
|
13
|
+
return /* @__PURE__ */ r(y, {
|
|
11
14
|
sx: {
|
|
12
15
|
pt: 12,
|
|
13
16
|
width: "100%"
|
|
14
17
|
},
|
|
15
|
-
children: /* @__PURE__ */
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
18
|
+
children: [/* @__PURE__ */ t(m, {
|
|
19
|
+
"aria-hidden": !0,
|
|
20
|
+
children: /* @__PURE__ */ t(x, {
|
|
21
|
+
baseline: "min",
|
|
22
|
+
colors: [o],
|
|
23
|
+
curveType: "bump",
|
|
24
|
+
customTooltipLabels: u,
|
|
25
|
+
datasets: [d],
|
|
26
|
+
height: 265,
|
|
27
|
+
labels: [n],
|
|
28
|
+
markStyles: () => ({ stroke: o }),
|
|
29
|
+
onItemClick: () => {
|
|
30
|
+
h(S.TRENDS_CLICK_CHART, g);
|
|
31
|
+
},
|
|
32
|
+
showArea: !0,
|
|
33
|
+
showAverage: !0,
|
|
34
|
+
showAxisHighlight: !0,
|
|
35
|
+
showLegend: !0,
|
|
36
|
+
showTooltip: !0,
|
|
37
|
+
showXAxis: !0,
|
|
38
|
+
showXAxisTicks: !0,
|
|
39
|
+
showYAxis: !0,
|
|
40
|
+
showYAxisTicks: !0,
|
|
41
|
+
useCustomMark: !0,
|
|
42
|
+
valueFormatterString: e
|
|
43
|
+
})
|
|
44
|
+
}), /* @__PURE__ */ r(m, {
|
|
45
|
+
component: "table",
|
|
46
|
+
sx: w,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ t("caption", { children: a }),
|
|
49
|
+
/* @__PURE__ */ t("tbody", { children: p.map(({ amount: A, label: i }) => /* @__PURE__ */ r("tr", { children: [/* @__PURE__ */ t("th", {
|
|
50
|
+
scope: "row",
|
|
51
|
+
children: i
|
|
52
|
+
}), /* @__PURE__ */ t("td", { children: s(A, e) })] }, i)) }),
|
|
53
|
+
/* @__PURE__ */ t("tfoot", { children: /* @__PURE__ */ r("tr", { children: [/* @__PURE__ */ t("th", {
|
|
54
|
+
scope: "row",
|
|
55
|
+
children: l.average
|
|
56
|
+
}), /* @__PURE__ */ t("td", { children: s(c, e) })] }) })
|
|
57
|
+
]
|
|
58
|
+
})]
|
|
39
59
|
});
|
|
40
60
|
});
|
|
41
61
|
export {
|
|
42
|
-
|
|
62
|
+
M as default
|
|
43
63
|
};
|
|
44
64
|
|
|
45
65
|
//# sourceMappingURL=CategoryDetailChart.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryDetailChart.es.js","names":[],"sources":["../../../src/trends/components/CategoryDetailChart.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Stack from '@mui/material/Stack'\n\nimport {
|
|
1
|
+
{"version":3,"file":"CategoryDetailChart.es.js","names":[],"sources":["../../../src/trends/components/CategoryDetailChart.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport {\n ANALYTICS_EVENTS,\n useEvent,\n useGlobalCopyStore,\n useTrendsStore,\n VISUALLY_HIDDEN_SX,\n} from '../../common'\nimport { LineChart } from '../../common/components/charts/LineChart'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\nimport { TRENDS_ANALYTICS_METADATA } from '../constants/TrendsWidget'\n\nconst VALUE_FORMAT = '0,0'\n\ninterface CategoryDetailChartProps {\n chartColor: string\n chartLabel: string\n chartTitle: string\n}\nconst CategoryDetailChart = observer(\n ({ chartColor, chartLabel, chartTitle }: CategoryDetailChartProps) => {\n const { onEvent } = useEvent()\n const { common: commonCopy } = useGlobalCopyStore()\n const {\n categoryDetailsChartData: { average, monthlyAmounts, monthlyTotals, tooltipLabels },\n } = useTrendsStore()\n\n const handleItemClick = () => {\n onEvent(ANALYTICS_EVENTS.TRENDS_CLICK_CHART, TRENDS_ANALYTICS_METADATA)\n }\n\n return (\n <Stack sx={{ pt: 12, width: '100%' }}>\n <Box aria-hidden={true}>\n <LineChart\n baseline=\"min\"\n colors={[chartColor]}\n curveType=\"bump\"\n customTooltipLabels={tooltipLabels}\n datasets={[monthlyAmounts]}\n height={265}\n labels={[chartLabel]}\n markStyles={() => ({\n stroke: chartColor,\n })}\n onItemClick={handleItemClick}\n showArea={true}\n showAverage={true}\n showAxisHighlight={true}\n showLegend={true}\n showTooltip={true}\n showXAxis={true}\n showXAxisTicks={true}\n showYAxis={true}\n showYAxisTicks={true}\n useCustomMark={true}\n valueFormatterString={VALUE_FORMAT}\n />\n </Box>\n <Box component=\"table\" sx={VISUALLY_HIDDEN_SX}>\n <caption>{chartTitle}</caption>\n <tbody>\n {monthlyTotals.map(({ amount, label }) => (\n <tr key={label}>\n <th scope=\"row\">{label}</th>\n <td>{formatCurrency(amount, VALUE_FORMAT)}</td>\n </tr>\n ))}\n </tbody>\n <tfoot>\n <tr>\n <th scope=\"row\">{commonCopy.average}</th>\n <td>{formatCurrency(average, VALUE_FORMAT)}</td>\n </tr>\n </tfoot>\n </Box>\n </Stack>\n )\n },\n)\nexport default CategoryDetailChart\n"],"mappings":";;;;;;;;;;AAiBA,IAAM,IAAe,OAOf,IAAsB,EAAA,CACzB,EAAE,YAAA,GAAY,YAAA,GAAY,YAAA,EAAA,MAA2C;AACpE,QAAM,EAAE,SAAA,EAAA,IAAY,EAAS,GACvB,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EACJ,0BAA0B,EAAE,SAA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EACI,CAAA;AAAA,QACP,gBAAA,EAAC,SAAD,EAAA,UACE,gBAAA,EAAC,MAAD,EAAA,UAAA,CACE,gBAAA,EAAC,MAAD;AAAA,UAAI,OAAM;AAAA,UAAO,UAAA,EAAW;AAAA,QAAY,CAAA,GACxC,gBAAA,EAAC,MAAD,EAAA,UAAK,EAAe,GAAS,CAAY,EAAM,CAAA,CAC7C,EAAA,CAAA,EACC,CAAA;AAAA,MACJ;AAAA,IACA,CAAA,CAAA;AAAA;AAEX,CACF"}
|
|
@@ -1,104 +1,101 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
1
|
+
import { useAppConfig as k, useGlobalCopyStore as $, useTransactionStore as A, useTrendsStore as G } from "../../common/context/hooks.es.js";
|
|
2
2
|
import { useScreenSize as R } from "../../common/hooks/useScreenSize.es.js";
|
|
3
3
|
import { formatCurrency as j } from "../../core/utils/NumberFormatting.es.js";
|
|
4
4
|
import z from "../../common/components/drawer/Drawer.es.js";
|
|
5
5
|
import { getCategoryColor as M } from "../../core/utils/CategoryUtil.es.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { observer as
|
|
6
|
+
import B from "../../transactions/components/transactionwidget/actions/ExportCsvAction.es.js";
|
|
7
|
+
import E from "../../transactions/components/shared/TransactionList.es.js";
|
|
8
|
+
import P from "../../transactions/components/shared/TransactionDetails.es.js";
|
|
9
|
+
import W from "./CategoryDetailChart.es.js";
|
|
10
|
+
import u from "react";
|
|
11
|
+
import { observer as F } from "mobx-react-lite";
|
|
12
12
|
import c from "@mui/material/Stack";
|
|
13
|
-
import { CategoryIcon as
|
|
13
|
+
import { CategoryIcon as H, Text as h } from "@mxenabled/mxui";
|
|
14
14
|
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
15
|
-
import { useTheme as
|
|
15
|
+
import { useTheme as O } from "@mui/material/styles";
|
|
16
16
|
import q from "@mui/material/List";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
var
|
|
21
|
-
const
|
|
17
|
+
import J from "@mui/material/ListItem";
|
|
18
|
+
import K from "@mui/material/ListItemAvatar";
|
|
19
|
+
import N from "@mui/material/ListItemText";
|
|
20
|
+
var ft = F(() => {
|
|
21
|
+
const g = O(), { is_mobile_webview: y } = k(), { isDesktop: b, isSmallTablet: C, isTablet: _ } = R(), { common: x, trends: o } = $(), { selectedCategoryData: e, selectedDateRangeMonthRange: v } = G(), { sortedTransactions: a } = A(), [m, l] = u.useState(null);
|
|
22
22
|
if (!e) return null;
|
|
23
|
-
const { guid: r, name:
|
|
23
|
+
const { guid: r, name: p, is_income: d, totalAmount: T } = e, S = M(r, g), L = d ? o.income_label : o.spending_label, w = `${p}, ${d ? o.monthly_income : o.monthly_spending}`, D = ` ${e.transactions.length === 1 ? o.transaction : o.transactions} (${e.transactions.length})`, s = u.useMemo(() => a.find((n) => n.guid === m), [m, a]), I = a.length > 0 && !y && (b || _ && !C), f = (n) => n.category_guid === r || n.top_level_category_guid === r;
|
|
24
24
|
return /* @__PURE__ */ i(c, {
|
|
25
|
-
sx: {
|
|
26
|
-
alignItems: "center",
|
|
27
|
-
height: "100%"
|
|
28
|
-
},
|
|
25
|
+
sx: { alignItems: "center" },
|
|
29
26
|
children: [
|
|
30
27
|
/* @__PURE__ */ i(c, {
|
|
31
28
|
sx: {
|
|
32
29
|
bgcolor: "background.paper",
|
|
33
30
|
borderRadius: 0,
|
|
34
|
-
pb: 4,
|
|
35
31
|
pt: 16,
|
|
36
32
|
px: 12,
|
|
37
33
|
width: "100%"
|
|
38
34
|
},
|
|
39
|
-
children: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
fontSize: 13
|
|
58
|
-
}
|
|
35
|
+
children: [/* @__PURE__ */ t(q, {
|
|
36
|
+
sx: { px: 12 },
|
|
37
|
+
children: /* @__PURE__ */ i(J, { children: [
|
|
38
|
+
/* @__PURE__ */ t(K, { children: /* @__PURE__ */ t(H, { categoryGuid: r }) }),
|
|
39
|
+
/* @__PURE__ */ t(N, {
|
|
40
|
+
primary: p,
|
|
41
|
+
secondary: v,
|
|
42
|
+
slotProps: {
|
|
43
|
+
primary: {
|
|
44
|
+
component: "div",
|
|
45
|
+
variant: "h3",
|
|
46
|
+
fontSize: 18,
|
|
47
|
+
fontWeight: 700
|
|
48
|
+
},
|
|
49
|
+
secondary: {
|
|
50
|
+
component: "div",
|
|
51
|
+
variant: "body2",
|
|
52
|
+
fontSize: 13
|
|
59
53
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
alignItems: "center",
|
|
74
|
-
direction: "row",
|
|
75
|
-
justifyContent: "space-between",
|
|
76
|
-
sx: { mx: 12 },
|
|
77
|
-
children: [/* @__PURE__ */ t(f, {
|
|
78
|
-
bold: !0,
|
|
79
|
-
variant: "body1",
|
|
80
|
-
children: w
|
|
81
|
-
}), D && /* @__PURE__ */ t($, { filter: p })]
|
|
82
|
-
})
|
|
83
|
-
]
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ t(h, {
|
|
57
|
+
component: "div",
|
|
58
|
+
variant: "h3",
|
|
59
|
+
children: j(Math.abs(T), "0,0.00")
|
|
60
|
+
})
|
|
61
|
+
] })
|
|
62
|
+
}), /* @__PURE__ */ t(W, {
|
|
63
|
+
chartColor: S,
|
|
64
|
+
chartLabel: L,
|
|
65
|
+
chartTitle: w
|
|
66
|
+
})]
|
|
84
67
|
}),
|
|
85
|
-
/* @__PURE__ */ t(
|
|
86
|
-
filter:
|
|
87
|
-
|
|
88
|
-
|
|
68
|
+
/* @__PURE__ */ t(E, {
|
|
69
|
+
filter: f,
|
|
70
|
+
onClick: l,
|
|
71
|
+
scrollsWithParent: !0,
|
|
72
|
+
stickyHeader: /* @__PURE__ */ i(c, {
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
direction: "row",
|
|
75
|
+
justifyContent: "space-between",
|
|
76
|
+
sx: {
|
|
77
|
+
px: 24,
|
|
78
|
+
py: 4
|
|
79
|
+
},
|
|
80
|
+
children: [/* @__PURE__ */ t(h, {
|
|
81
|
+
bold: !0,
|
|
82
|
+
variant: "body1",
|
|
83
|
+
children: D
|
|
84
|
+
}), I && /* @__PURE__ */ t(B, { filter: f })]
|
|
85
|
+
})
|
|
89
86
|
}),
|
|
90
87
|
/* @__PURE__ */ t(z, {
|
|
91
|
-
ariaLabelClose:
|
|
88
|
+
ariaLabelClose: x.close_aria,
|
|
92
89
|
isOpen: !!s,
|
|
93
90
|
onClose: () => l(""),
|
|
94
91
|
title: o.transaction,
|
|
95
|
-
children: s && /* @__PURE__ */ t(
|
|
92
|
+
children: s && /* @__PURE__ */ t(P, { transaction: s })
|
|
96
93
|
})
|
|
97
94
|
]
|
|
98
95
|
});
|
|
99
96
|
});
|
|
100
97
|
export {
|
|
101
|
-
|
|
98
|
+
ft as CategoryDetails
|
|
102
99
|
};
|
|
103
100
|
|
|
104
101
|
//# sourceMappingURL=CategoryDetails.es.js.map
|