@mx-cartographer/experiences 7.2.30 → 7.3.0
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/{Account-vp_TAbGt.mjs → Account-YwUMFz93.mjs} +1 -1
- package/dist/{AccountDetailsContent-B6ZFRZ8l.mjs → AccountDetailsContent-BgCST7mK.mjs} +8 -8
- package/dist/AccountDetailsHeader-jAFWoHj7.mjs +87 -0
- package/dist/{AccountFields-DUToRRqW.mjs → AccountFields-DPxMPBF0.mjs} +2 -2
- package/dist/{AccountListItem-CeY_WIpj.mjs → AccountListItem-D6rWAreC.mjs} +4 -4
- package/dist/{AccountStore-BzqNrhw4.mjs → AccountStore-B5E98oM1.mjs} +2 -2
- package/dist/{Accounts-C1QxUB-e.mjs → Accounts-UIlYCmHb.mjs} +1 -1
- package/dist/{BudgetUtil-B2ZXyw-g.mjs → BudgetUtil-CXvenbdN.mjs} +1 -1
- package/dist/{CategorySelectorDrawer-BXnLseqP.mjs → CategorySelectorDrawer-Buy70Y3V.mjs} +1 -1
- package/dist/{ConnectDrawer-Bw5s6Dw1.mjs → ConnectDrawer-CbxHKlRv.mjs} +1 -1
- package/dist/{ConnectionsDrawer-BDvVuJQf.mjs → ConnectionsDrawer-C6kanU7I.mjs} +2 -2
- package/dist/{CurrencyInput-DUsQbkXb.mjs → CurrencyInput-lSC7oPDg.mjs} +1 -1
- package/dist/{DebtsStore-BD_XwsI7.mjs → DebtsStore-DgIcphe_.mjs} +1 -1
- package/dist/{ExportCsvAction-DTO_UotC.mjs → ExportCsvAction-DZ10CbWd.mjs} +3 -3
- package/dist/{GoalStore-BgFV554B.mjs → GoalStore-CAlmSu4U.mjs} +2 -2
- package/dist/{Help-B6dIcujh.mjs → Help-hi9I9EYP.mjs} +1 -1
- package/dist/{LineChart-4Zi8Z8PR.mjs → LineChart-eK4IQImU.mjs} +1 -1
- package/dist/{ListItemAction-DHa3KJPs.mjs → ListItemAction-BmL5buOf.mjs} +1 -1
- package/dist/{ManageIncome-CXeJPfjE.mjs → ManageIncome-Cypo9qY4.mjs} +4 -4
- package/dist/{MicroWidgetContainer-DpeqN9n3.mjs → MicroWidgetContainer-CFdMGJKg.mjs} +1 -1
- package/dist/{MiniWidgetContainer-D0gfmbaF.mjs → MiniWidgetContainer-BdgBvpga.mjs} +1 -1
- package/dist/{NetWorthStore-D1NiDUcc.mjs → NetWorthStore-CxqIxAgN.mjs} +2 -2
- package/dist/{NotificationSettings-CLAV8YEa.mjs → NotificationSettings-DxytNHlN.mjs} +3 -3
- package/dist/{OriginalBalanceAction-CWuVvRq9.mjs → OriginalBalanceAction-V6FEoIDe.mjs} +3 -3
- package/dist/{RecurringSettings-D7476j-N.mjs → RecurringSettings-iIupYxJW.mjs} +3 -3
- package/dist/{TransactionDetails-Cscyr17P.mjs → TransactionDetails-BUoNbsu-.mjs} +5 -5
- package/dist/{TransactionStore-DCH-rl8p.mjs → TransactionStore-C1oyQCZK.mjs} +2 -2
- package/dist/TrendsStore-5PvDT_o6.mjs +182 -0
- package/dist/{User-BQUxBeZV.mjs → User-Bj34_i8g.mjs} +1 -1
- package/dist/{WidgetContainer-EbrN1oIo.mjs → WidgetContainer-BnTgAfQn.mjs} +2 -2
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +4 -1
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.d.ts +2 -1
- package/dist/accounts/index.es.js +241 -205
- package/dist/analytics/index.es.js +2 -2
- package/dist/budgets/index.es.js +10 -10
- package/dist/cashflow/index.es.js +7 -7
- package/dist/categories/index.es.js +1 -1
- package/dist/common/components/charts/index.d.ts +0 -2
- package/dist/common/index.es.js +122 -125
- package/dist/dashboard/index.es.js +2 -2
- package/dist/debts/index.es.js +9 -9
- package/dist/{exportTransactionsToCSV-BwwmL4pM.mjs → exportTransactionsToCSV-B8qpk5MU.mjs} +1 -1
- package/dist/finstrong/index.es.js +6 -6
- package/dist/goals/index.es.js +12 -12
- package/dist/help/index.es.js +3 -3
- package/dist/{hooks-D6XlXHf4.mjs → hooks-Cy8JnjCg.mjs} +2 -2
- package/dist/investments/index.es.js +3 -3
- package/dist/merchants/index.es.js +1 -1
- package/dist/networth/index.es.js +14 -14
- package/dist/notifications/index.es.js +2 -2
- package/dist/recurringtransactions/index.es.js +8 -8
- package/dist/settings/index.es.js +6 -6
- package/dist/spending/index.es.js +4 -4
- package/dist/transactions/index.es.js +13 -13
- package/dist/trends/index.es.js +948 -583
- package/dist/{useAccountDisplayName-jS05A6-6.mjs → useAccountDisplayName-D6sQsNNQ.mjs} +2 -2
- package/dist/{useInsightsEnabled-DBpwEq10.mjs → useInsightsEnabled-BxytCjq5.mjs} +1 -1
- package/package.json +1 -1
- package/dist/AccountDetailsHeader-vPzGb1RZ.mjs +0 -120
- package/dist/TrendsStore-DCYbpXPO.mjs +0 -559
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import s from "react";
|
|
2
|
-
import { g as e } from "./ConnectDrawer-
|
|
3
|
-
import { a as n } from "./hooks-
|
|
2
|
+
import { g as e } from "./ConnectDrawer-CbxHKlRv.mjs";
|
|
3
|
+
import { a as n } from "./hooks-Cy8JnjCg.mjs";
|
|
4
4
|
const i = (o) => {
|
|
5
5
|
const { config: a } = n();
|
|
6
6
|
return s.useMemo(
|
package/package.json
CHANGED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { observer as p } from "mobx-react-lite";
|
|
3
|
-
import d from "@mui/material/Stack";
|
|
4
|
-
import { H3 as w, InstitutionLogo as I, Text as m, H2 as L } from "@mxenabled/mxui";
|
|
5
|
-
import { g as v } from "./AccountFields-DUToRRqW.mjs";
|
|
6
|
-
import h from "react";
|
|
7
|
-
import { G as E, d as y, m as S, u as _, f as G } from "./hooks-D6XlXHf4.mjs";
|
|
8
|
-
import O from "@mui/material/Card";
|
|
9
|
-
import P from "@mui/material/CardContent";
|
|
10
|
-
import M from "@mui/material/CardHeader";
|
|
11
|
-
import { useTheme as B } from "@mui/material/styles";
|
|
12
|
-
import { g as H, a as U, b as j } from "./SpendingData-D5vsfYKo.mjs";
|
|
13
|
-
import { L as z } from "./LineChart-4Zi8Z8PR.mjs";
|
|
14
|
-
import { I as f, P as g, S as C } from "./Account-vp_TAbGt.mjs";
|
|
15
|
-
import { A } from "./ConnectDrawer-Bw5s6Dw1.mjs";
|
|
16
|
-
import { L as Y } from "./Loader-DUaFpDGv.mjs";
|
|
17
|
-
import { f as R, D as $ } from "./Dialog-CWW597AF.mjs";
|
|
18
|
-
import { u as k } from "./useAccountDisplayName-jS05A6-6.mjs";
|
|
19
|
-
import { f as F } from "./NumberFormatting-Buh7u8Oi.mjs";
|
|
20
|
-
const b = () => {
|
|
21
|
-
if (!h.useContext(E))
|
|
22
|
-
throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
|
|
23
|
-
return y().uiStore;
|
|
24
|
-
}, V = (o, n) => {
|
|
25
|
-
const t = f.includes(n) ? H(o) : [], a = g.includes(n) ? U(o) : [], r = C.includes(n) ? j(o) : [];
|
|
26
|
-
return [t, a, r].filter((s) => s.length > 0);
|
|
27
|
-
}, W = (o, n, t) => {
|
|
28
|
-
const [a, r] = o, s = a, c = r ?? a, i = [];
|
|
29
|
-
if (s && c && f.includes(n)) {
|
|
30
|
-
const l = s[s.length - 1].y;
|
|
31
|
-
i.push({ label: t.income_label, amount: l });
|
|
32
|
-
} else if (g.includes(n)) {
|
|
33
|
-
const l = s[s.length - 1].y;
|
|
34
|
-
i.push({ label: t.payments_label, amount: l });
|
|
35
|
-
}
|
|
36
|
-
if (c && C.includes(n)) {
|
|
37
|
-
const l = c[c.length - 1].y;
|
|
38
|
-
i.push({ label: t.spending_label, amount: l });
|
|
39
|
-
}
|
|
40
|
-
return i;
|
|
41
|
-
}, q = () => {
|
|
42
|
-
const o = B(), { selectedAccount: n } = b(), { monthlyCategoryTotals: t } = S(), { trends: a } = _(), r = [o.palette.chart?.chart1, o.palette.chart?.chart2], s = V(t, n.account_type), c = W(s, n.account_type, a), i = [A.LOAN, A.MORTGAGE].includes(n.account_type);
|
|
43
|
-
return /* @__PURE__ */ e("div", { "data-testid": "TrendsChart", children: /* @__PURE__ */ e(
|
|
44
|
-
z,
|
|
45
|
-
{
|
|
46
|
-
colors: r,
|
|
47
|
-
datasets: s,
|
|
48
|
-
height: 185,
|
|
49
|
-
labels: c,
|
|
50
|
-
showAverage: i,
|
|
51
|
-
showBars: i,
|
|
52
|
-
showLegend: !0,
|
|
53
|
-
valueFormatterString: "0,0"
|
|
54
|
-
}
|
|
55
|
-
) });
|
|
56
|
-
}, J = p(q), K = ({ sx: o }) => {
|
|
57
|
-
const { loadMonthlyCategoryTotals: n } = S(), { isInitialized: t } = G(), { selectedAccount: a } = b(), [r, s] = h.useState(!1);
|
|
58
|
-
return h.useEffect(() => {
|
|
59
|
-
t && n([a]).finally(() => {
|
|
60
|
-
s(!0);
|
|
61
|
-
});
|
|
62
|
-
}, [t, a]), !t || !r ? /* @__PURE__ */ e(Y, {}) : /* @__PURE__ */ u(
|
|
63
|
-
O,
|
|
64
|
-
{
|
|
65
|
-
sx: {
|
|
66
|
-
"& .MuiCardContent-root:last-child": {
|
|
67
|
-
pb: 0
|
|
68
|
-
},
|
|
69
|
-
...o
|
|
70
|
-
},
|
|
71
|
-
children: [
|
|
72
|
-
/* @__PURE__ */ e(
|
|
73
|
-
M,
|
|
74
|
-
{
|
|
75
|
-
sx: { pb: 0 },
|
|
76
|
-
title: /* @__PURE__ */ e(w, { sx: { pb: 4 }, children: R(/* @__PURE__ */ new Date(), $.MONTH_LONG) })
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
/* @__PURE__ */ e(P, { sx: { p: 0 }, children: /* @__PURE__ */ e(J, {}) })
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
}, Q = p(K), X = ({ customDetailsChart: o }) => {
|
|
84
|
-
const { institutions: n } = y(), { selectedAccount: t } = b(), { accounts: a } = _(), { firstSubtitle: r, firstValue: s, hasAvailableBalance: c, secondSubtitle: i, secondValue: l } = v(t, a), T = n.find(
|
|
85
|
-
(N) => N.guid === t?.institution_guid
|
|
86
|
-
), D = [
|
|
87
|
-
...f,
|
|
88
|
-
...g,
|
|
89
|
-
...C
|
|
90
|
-
].includes(t.account_type), x = k(t);
|
|
91
|
-
return /* @__PURE__ */ u(d, { bgcolor: "background.default", p: 24, children: [
|
|
92
|
-
/* @__PURE__ */ u(d, { gap: 12, children: [
|
|
93
|
-
/* @__PURE__ */ e(
|
|
94
|
-
I,
|
|
95
|
-
{
|
|
96
|
-
alt: a.institution_logo_alt,
|
|
97
|
-
institutionGuid: t.institution_guid || "",
|
|
98
|
-
size: 64
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ e(m, { variant: "Small", children: T?.name })
|
|
102
|
-
] }),
|
|
103
|
-
/* @__PURE__ */ u(d, { gap: 8, mb: 24, mt: 4, children: [
|
|
104
|
-
/* @__PURE__ */ e(L, { children: x }),
|
|
105
|
-
/* @__PURE__ */ u(d, { direction: "row", justifyContent: "space-between", children: [
|
|
106
|
-
/* @__PURE__ */ e(m, { bold: c, variant: "Body", children: r }),
|
|
107
|
-
/* @__PURE__ */ e(m, { bold: !0, variant: "Body", children: F(s, "0,0.00") })
|
|
108
|
-
] }),
|
|
109
|
-
/* @__PURE__ */ u(d, { direction: "row", justifyContent: "space-between", children: [
|
|
110
|
-
/* @__PURE__ */ e(m, { variant: "Small", children: i }),
|
|
111
|
-
/* @__PURE__ */ e(m, { variant: "Small", children: l })
|
|
112
|
-
] })
|
|
113
|
-
] }),
|
|
114
|
-
D && /* @__PURE__ */ e(d, { children: o || /* @__PURE__ */ e(Q, {}) })
|
|
115
|
-
] });
|
|
116
|
-
}, bt = p(X);
|
|
117
|
-
export {
|
|
118
|
-
bt as A,
|
|
119
|
-
b as u
|
|
120
|
-
};
|
|
@@ -1,559 +0,0 @@
|
|
|
1
|
-
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import M, { useRef as Ct, useState as bt, useEffect as vt } from "react";
|
|
3
|
-
import L from "@mui/material/Box";
|
|
4
|
-
import T from "@mui/material/Stack";
|
|
5
|
-
import { useTheme as J } from "@mui/material/styles";
|
|
6
|
-
import { LineChart as St } from "@mui/x-charts";
|
|
7
|
-
import { u as K } from "./useScreenSize-B6JyS_Lj.mjs";
|
|
8
|
-
import { u as _t } from "./useDimensions-27p2evRx.mjs";
|
|
9
|
-
import { observer as Mt } from "mobx-react-lite";
|
|
10
|
-
import Tt from "@mui/material/Card";
|
|
11
|
-
import Dt from "@mui/material/CardContent";
|
|
12
|
-
import P from "@mui/material/Divider";
|
|
13
|
-
import X from "@mui/material/Grid";
|
|
14
|
-
import { CategoryIcon as At, Text as S } from "@mxenabled/mxui";
|
|
15
|
-
import { u as Lt, m as Q } from "./hooks-D6XlXHf4.mjs";
|
|
16
|
-
import { b as Rt } from "./Localization-2MODESHW.mjs";
|
|
17
|
-
import { C as O } from "./CurrencyText-kyC1aseI.mjs";
|
|
18
|
-
import { useTheme as wt, Card as Ht, CardContent as It, Box as kt } from "@mui/material";
|
|
19
|
-
import { f as R, D as w } from "./Dialog-CWW597AF.mjs";
|
|
20
|
-
import Et from "@mui/material/Button";
|
|
21
|
-
import { C as A, b as Gt, c as Nt } from "./Category-CevNQ03n.mjs";
|
|
22
|
-
import { f as V } from "./NumberFormatting-Buh7u8Oi.mjs";
|
|
23
|
-
import Bt from "@mui/material/ListItem";
|
|
24
|
-
import Ot from "@mui/material/ListItemButton";
|
|
25
|
-
import z from "@mui/material/ListItemIcon";
|
|
26
|
-
import $t from "@mui/material/ListItemText";
|
|
27
|
-
import { makeAutoObservable as Wt } from "mobx";
|
|
28
|
-
import { addSeconds as jt } from "date-fns/addSeconds";
|
|
29
|
-
import { differenceInCalendarMonths as Ft } from "date-fns/differenceInCalendarMonths";
|
|
30
|
-
import { endOfMonth as q } from "date-fns/endOfMonth";
|
|
31
|
-
import { subMonths as Yt } from "date-fns/subMonths";
|
|
32
|
-
const U = ({ categoryGuid: r, topLevelCategoryGuid: e }) => {
|
|
33
|
-
const { categories: o } = Lt(), { getCategoryName: a } = Q(), n = a(r);
|
|
34
|
-
return /* @__PURE__ */ f(T, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
|
|
35
|
-
/* @__PURE__ */ s(
|
|
36
|
-
L,
|
|
37
|
-
{
|
|
38
|
-
"aria-label": Rt(o.category_icon_label_aria, n),
|
|
39
|
-
mb: 4,
|
|
40
|
-
role: "img",
|
|
41
|
-
children: /* @__PURE__ */ s(At, { categoryGuid: e })
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
/* @__PURE__ */ s(S, { variant: "Body", children: n })
|
|
45
|
-
] });
|
|
46
|
-
}, Pt = ({
|
|
47
|
-
categoryGuids: { guid: r, topLevelGuid: e },
|
|
48
|
-
hoveredAreaData: o,
|
|
49
|
-
cursorPosition: a,
|
|
50
|
-
chartContainerRef: n
|
|
51
|
-
}) => {
|
|
52
|
-
const i = J(), l = Ct(null), [h, g] = bt({ x: a.x, y: a.y });
|
|
53
|
-
if (vt(() => {
|
|
54
|
-
(() => {
|
|
55
|
-
const u = l.current, x = n.current;
|
|
56
|
-
if (!u || !x) return;
|
|
57
|
-
const y = u.getBoundingClientRect(), b = x.getBoundingClientRect();
|
|
58
|
-
let p = a.x, v = a.y;
|
|
59
|
-
p + y.width * 2 > b.right ? p = a.x - y.width : p - y.width < b.left && (p = a.x), v + y.height * 2 > b.bottom && (v = a.y - y.height), g({ x: p, y: v });
|
|
60
|
-
})();
|
|
61
|
-
}, [a, n]), !o) return null;
|
|
62
|
-
const C = o.reduce((d, u) => d + u.y, 0);
|
|
63
|
-
return /* @__PURE__ */ s(
|
|
64
|
-
Tt,
|
|
65
|
-
{
|
|
66
|
-
ref: l,
|
|
67
|
-
sx: {
|
|
68
|
-
position: "absolute",
|
|
69
|
-
top: h.y,
|
|
70
|
-
left: h.x,
|
|
71
|
-
width: 250,
|
|
72
|
-
pointerEvents: "none"
|
|
73
|
-
},
|
|
74
|
-
children: /* @__PURE__ */ f(Dt, { children: [
|
|
75
|
-
/* @__PURE__ */ f(L, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
76
|
-
/* @__PURE__ */ s(U, { categoryGuid: r, topLevelCategoryGuid: e }),
|
|
77
|
-
/* @__PURE__ */ s(S, { variant: "Small", children: `${o.length}-month total` }),
|
|
78
|
-
/* @__PURE__ */ s(O, { amount: C, bold: !0, formatString: "0,0", variant: "body2" })
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ s(P, { sx: { my: 16, width: "100%" } }),
|
|
81
|
-
/* @__PURE__ */ s(X, { container: !0, children: o.map((d, u) => /* @__PURE__ */ f(M.Fragment, { children: [
|
|
82
|
-
u > 0 && u % 3 === 0 && /* @__PURE__ */ s(P, { sx: { my: 16, width: "100%" } }),
|
|
83
|
-
/* @__PURE__ */ s(X, { item: !0, xs: 4, children: /* @__PURE__ */ f(L, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
84
|
-
/* @__PURE__ */ s(S, { color: i.palette.text.secondary, variant: "XSmall", children: d.x }),
|
|
85
|
-
/* @__PURE__ */ s(
|
|
86
|
-
O,
|
|
87
|
-
{
|
|
88
|
-
amount: d.y,
|
|
89
|
-
bold: !0,
|
|
90
|
-
formatString: "0,0",
|
|
91
|
-
variant: "Body"
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
] }) })
|
|
95
|
-
] }, u)) })
|
|
96
|
-
] })
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
}, Xt = Mt(Pt), Vt = ({
|
|
100
|
-
categoryGuids: { guid: r, topLevelGuid: e },
|
|
101
|
-
itemData: { dataIndex: o },
|
|
102
|
-
series: a,
|
|
103
|
-
xData: n
|
|
104
|
-
}) => {
|
|
105
|
-
const i = wt(), l = a.data[o], h = n[o];
|
|
106
|
-
return l === void 0 || !h ? null : /* @__PURE__ */ s(Ht, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ s(It, { children: /* @__PURE__ */ f(kt, { alignItems: "center", display: "flex", flexDirection: "column", children: [
|
|
107
|
-
/* @__PURE__ */ s(U, { categoryGuid: r, topLevelCategoryGuid: e }),
|
|
108
|
-
/* @__PURE__ */ s(S, { color: i.palette.text.secondary, variant: "Small", children: R(h, w.MONTH_SHORT_YEAR) }),
|
|
109
|
-
/* @__PURE__ */ s(O, { amount: String(l), bold: !0, formatString: "0,0", variant: "Body" })
|
|
110
|
-
] }) }) });
|
|
111
|
-
}, zt = ({
|
|
112
|
-
sx: r,
|
|
113
|
-
categoryGuids: e,
|
|
114
|
-
hoveredLegend: o,
|
|
115
|
-
legendRef: a,
|
|
116
|
-
onHoverLegend: n,
|
|
117
|
-
onClickLegend: i
|
|
118
|
-
}) => {
|
|
119
|
-
const { isMobile: l } = K(), { getCategoryName: h } = Q();
|
|
120
|
-
return /* @__PURE__ */ s(
|
|
121
|
-
T,
|
|
122
|
-
{
|
|
123
|
-
direction: "row",
|
|
124
|
-
flexWrap: "wrap",
|
|
125
|
-
gap: l ? 2 : 6,
|
|
126
|
-
justifyContent: "start",
|
|
127
|
-
ref: a,
|
|
128
|
-
sx: r,
|
|
129
|
-
children: e.map(({ guid: g, top_level_guid: C }) => {
|
|
130
|
-
const d = o === g, u = A[g], x = A[C], y = u ?? x ?? A.default, b = y + "33";
|
|
131
|
-
return /* @__PURE__ */ f(
|
|
132
|
-
Et,
|
|
133
|
-
{
|
|
134
|
-
onClick: () => i(g),
|
|
135
|
-
onMouseEnter: () => n(g),
|
|
136
|
-
onMouseLeave: () => n(null),
|
|
137
|
-
sx: {
|
|
138
|
-
color: "text.primary",
|
|
139
|
-
fontWeight: "normal",
|
|
140
|
-
display: "flex",
|
|
141
|
-
justifyContent: "center",
|
|
142
|
-
alignItems: "center",
|
|
143
|
-
paddingX: 8,
|
|
144
|
-
paddingY: 4,
|
|
145
|
-
borderRadius: 1,
|
|
146
|
-
opacity: d ? 1 : 0.7
|
|
147
|
-
},
|
|
148
|
-
children: [
|
|
149
|
-
/* @__PURE__ */ s(
|
|
150
|
-
L,
|
|
151
|
-
{
|
|
152
|
-
sx: {
|
|
153
|
-
width: 16,
|
|
154
|
-
height: 16,
|
|
155
|
-
marginRight: l ? 5 : 10,
|
|
156
|
-
borderRadius: "2px",
|
|
157
|
-
backgroundColor: o ? d ? y : b : y
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
/* @__PURE__ */ s(S, { variant: "Body", children: h(g) })
|
|
162
|
-
]
|
|
163
|
-
},
|
|
164
|
-
g
|
|
165
|
-
);
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
}, Ie = ({
|
|
170
|
-
onHoverArea: r,
|
|
171
|
-
onHoverPoint: e,
|
|
172
|
-
onHoverLegend: o,
|
|
173
|
-
onClickLegend: a,
|
|
174
|
-
stackedDatasets: n,
|
|
175
|
-
unstackedDatasets: i = [],
|
|
176
|
-
availableHeight: l = 0,
|
|
177
|
-
minimumHeight: h = 350
|
|
178
|
-
}) => {
|
|
179
|
-
const g = J(), { isMobile: C } = K(), [d, { height: u }] = _t(), x = M.useRef(null), [y, b] = M.useState(0);
|
|
180
|
-
M.useEffect(() => {
|
|
181
|
-
const t = Math.max(l - u, h);
|
|
182
|
-
b(t);
|
|
183
|
-
}, [l, u]);
|
|
184
|
-
const [p, v] = M.useState(null), [Z, H] = M.useState({
|
|
185
|
-
hoveredSeriesId: null,
|
|
186
|
-
hoveredAreaData: null,
|
|
187
|
-
isAreaHovered: !1,
|
|
188
|
-
cursorPos: { x: 0, y: 0 }
|
|
189
|
-
}), { hoveredSeriesId: D, hoveredAreaData: $, isAreaHovered: tt, cursorPos: I } = Z, W = tt && D && $, j = !W, G = [...n, ...i], et = G[0]?.dataset.length ?? 0, N = G.flatMap((t) => t.dataset.map((c) => c.x)), ot = G.flatMap((t) => t.dataset.map((c) => c.y)), rt = n[0]?.dataset?.map(
|
|
190
|
-
(t, c) => n.reduce((m, _) => m + _.dataset[c]?.y || 0, 0)
|
|
191
|
-
) ?? [0], at = Math.max(...rt), nt = Math.max(
|
|
192
|
-
...i.flatMap((t) => t.dataset.map((c) => c.y))
|
|
193
|
-
), st = Math.floor(Math.min(...ot) / 100) * 100, it = Math.ceil(Math.max(at, nt) / 100) * 100, k = n.map((t, c) => ({
|
|
194
|
-
id: `stacked-${c}`,
|
|
195
|
-
guid: t.category_guid,
|
|
196
|
-
top_level_guid: t.top_level_category_guid,
|
|
197
|
-
area: !0,
|
|
198
|
-
color: n[c].category_color ?? g.palette.primary.main,
|
|
199
|
-
data: t.dataset.map((m) => m.y),
|
|
200
|
-
label: n[c].category_name,
|
|
201
|
-
stack: "total",
|
|
202
|
-
type: "line",
|
|
203
|
-
highlightScope: { highlight: "item" },
|
|
204
|
-
valueFormatter: (m) => V(m, "0,0")
|
|
205
|
-
})), F = i.map((t, c) => ({
|
|
206
|
-
id: `unstacked-${c}`,
|
|
207
|
-
guid: t.category_guid,
|
|
208
|
-
top_level_guid: t.top_level_category_guid,
|
|
209
|
-
area: !1,
|
|
210
|
-
color: t.category_color,
|
|
211
|
-
data: t.dataset.map((m) => m.y),
|
|
212
|
-
label: t.category_name,
|
|
213
|
-
type: "line",
|
|
214
|
-
valueFormatter: (m) => V(m, "0,0")
|
|
215
|
-
})), Y = [...k, ...F], ct = [
|
|
216
|
-
...k.map(({ guid: t, top_level_guid: c }) => ({
|
|
217
|
-
guid: t,
|
|
218
|
-
top_level_guid: c
|
|
219
|
-
})),
|
|
220
|
-
...F.map(({ guid: t, top_level_guid: c }) => ({
|
|
221
|
-
guid: t,
|
|
222
|
-
top_level_guid: c
|
|
223
|
-
}))
|
|
224
|
-
], E = (t) => {
|
|
225
|
-
const m = t.startsWith("stacked-") ? n[parseInt(t.split("-")[1])] : i[parseInt(t.split("-")[1])];
|
|
226
|
-
return {
|
|
227
|
-
guid: m?.category_guid,
|
|
228
|
-
topLevelGuid: m?.top_level_category_guid
|
|
229
|
-
};
|
|
230
|
-
}, lt = (t) => {
|
|
231
|
-
v(t), o?.(t ?? "");
|
|
232
|
-
}, dt = (t) => {
|
|
233
|
-
a?.(t ?? "");
|
|
234
|
-
}, ut = () => {
|
|
235
|
-
const t = E(String(D)).guid;
|
|
236
|
-
t && a?.(t);
|
|
237
|
-
}, mt = (t) => {
|
|
238
|
-
const c = String(t?.seriesId), m = E(c).guid, _ = Y.find((B) => B.id === c), pt = _ && t?.dataIndex !== void 0, yt = _ && t?.dataIndex === void 0;
|
|
239
|
-
if (pt)
|
|
240
|
-
H({
|
|
241
|
-
hoveredSeriesId: c,
|
|
242
|
-
hoveredAreaData: null,
|
|
243
|
-
isAreaHovered: !1,
|
|
244
|
-
cursorPos: I
|
|
245
|
-
}), e?.(m);
|
|
246
|
-
else if (yt) {
|
|
247
|
-
const B = _?.data.map((ft, xt) => ({
|
|
248
|
-
x: N[xt],
|
|
249
|
-
y: ft
|
|
250
|
-
})) ?? [];
|
|
251
|
-
H({
|
|
252
|
-
hoveredSeriesId: c,
|
|
253
|
-
hoveredAreaData: B,
|
|
254
|
-
isAreaHovered: !0,
|
|
255
|
-
cursorPos: I
|
|
256
|
-
}), r?.(m);
|
|
257
|
-
} else
|
|
258
|
-
H({
|
|
259
|
-
hoveredSeriesId: null,
|
|
260
|
-
hoveredAreaData: null,
|
|
261
|
-
isAreaHovered: !1,
|
|
262
|
-
cursorPos: I
|
|
263
|
-
});
|
|
264
|
-
}, gt = (t) => {
|
|
265
|
-
const c = t.currentTarget.getBoundingClientRect();
|
|
266
|
-
H((m) => ({
|
|
267
|
-
...m,
|
|
268
|
-
cursorPos: {
|
|
269
|
-
x: t.clientX - c.left,
|
|
270
|
-
y: t.clientY - c.top
|
|
271
|
-
}
|
|
272
|
-
}));
|
|
273
|
-
}, ht = {
|
|
274
|
-
p: 4,
|
|
275
|
-
"& .MuiBarLabel-root": {
|
|
276
|
-
fontSize: 10,
|
|
277
|
-
fontWeight: 600
|
|
278
|
-
},
|
|
279
|
-
"& .MuiAreaElement-root": {
|
|
280
|
-
opacity: 0.4,
|
|
281
|
-
transition: "opacity 0.3s ease"
|
|
282
|
-
},
|
|
283
|
-
"& .MuiAreaElement-root:hover": {
|
|
284
|
-
opacity: 1
|
|
285
|
-
},
|
|
286
|
-
'& [class*="MuiLineElement-series-unstacked-"]': {
|
|
287
|
-
strokeWidth: 3
|
|
288
|
-
},
|
|
289
|
-
...p && k.reduce((t, c, m) => {
|
|
290
|
-
const _ = `.MuiAreaElement-series-stacked-${m}`;
|
|
291
|
-
return t[_] = {
|
|
292
|
-
opacity: k[m].guid === p ? 0.9 : 0.2
|
|
293
|
-
}, t;
|
|
294
|
-
}, {})
|
|
295
|
-
};
|
|
296
|
-
return /* @__PURE__ */ s(
|
|
297
|
-
L,
|
|
298
|
-
{
|
|
299
|
-
onMouseMove: gt,
|
|
300
|
-
ref: x,
|
|
301
|
-
sx: {
|
|
302
|
-
position: "relative",
|
|
303
|
-
touchAction: "pan-y",
|
|
304
|
-
"& svg": {
|
|
305
|
-
touchAction: "pan-y",
|
|
306
|
-
userSelect: "none"
|
|
307
|
-
},
|
|
308
|
-
"& .recharts-wrapper": {
|
|
309
|
-
touchAction: "pan-y"
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
children: /* @__PURE__ */ f(
|
|
313
|
-
T,
|
|
314
|
-
{
|
|
315
|
-
direction: { xs: "column", md: "column" },
|
|
316
|
-
spacing: { xs: 0, md: 4 },
|
|
317
|
-
sx: { width: "100%", position: "relative" },
|
|
318
|
-
children: [
|
|
319
|
-
/* @__PURE__ */ s(
|
|
320
|
-
St,
|
|
321
|
-
{
|
|
322
|
-
height: y,
|
|
323
|
-
margin: { bottom: 50 },
|
|
324
|
-
onAreaClick: ut,
|
|
325
|
-
onHighlightChange: mt,
|
|
326
|
-
series: Y,
|
|
327
|
-
skipAnimation: !0,
|
|
328
|
-
slotProps: {
|
|
329
|
-
legend: {
|
|
330
|
-
hidden: !0
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
slots: {
|
|
334
|
-
itemContent: (t) => j && D ? /* @__PURE__ */ s(
|
|
335
|
-
Vt,
|
|
336
|
-
{
|
|
337
|
-
categoryGuids: E(D),
|
|
338
|
-
xData: N,
|
|
339
|
-
...t
|
|
340
|
-
}
|
|
341
|
-
) : null
|
|
342
|
-
},
|
|
343
|
-
sx: ht,
|
|
344
|
-
tooltip: {
|
|
345
|
-
trigger: j ? "item" : "none"
|
|
346
|
-
},
|
|
347
|
-
xAxis: [
|
|
348
|
-
{
|
|
349
|
-
data: N,
|
|
350
|
-
scaleType: "time",
|
|
351
|
-
valueFormatter: (t) => R(t, w.MONTH_SHORT_YEAR),
|
|
352
|
-
tickNumber: et
|
|
353
|
-
// How many ticks to show on the x-axis
|
|
354
|
-
}
|
|
355
|
-
],
|
|
356
|
-
yAxis: [
|
|
357
|
-
{
|
|
358
|
-
min: st,
|
|
359
|
-
max: it || 100
|
|
360
|
-
}
|
|
361
|
-
]
|
|
362
|
-
}
|
|
363
|
-
),
|
|
364
|
-
/* @__PURE__ */ s(
|
|
365
|
-
zt,
|
|
366
|
-
{
|
|
367
|
-
categoryGuids: ct,
|
|
368
|
-
hoveredLegend: p,
|
|
369
|
-
legendRef: d,
|
|
370
|
-
onClickLegend: dt,
|
|
371
|
-
onHoverLegend: lt,
|
|
372
|
-
sx: { px: C ? 0 : 24 }
|
|
373
|
-
}
|
|
374
|
-
),
|
|
375
|
-
W && /* @__PURE__ */ s(
|
|
376
|
-
Xt,
|
|
377
|
-
{
|
|
378
|
-
categoryGuids: E(D),
|
|
379
|
-
chartContainerRef: x,
|
|
380
|
-
cursorPosition: I,
|
|
381
|
-
hoveredAreaData: $.map((t) => ({
|
|
382
|
-
...t,
|
|
383
|
-
x: R(t.x, w.MONTH_SHORT_YEAR)
|
|
384
|
-
}))
|
|
385
|
-
}
|
|
386
|
-
)
|
|
387
|
-
]
|
|
388
|
-
}
|
|
389
|
-
)
|
|
390
|
-
}
|
|
391
|
-
);
|
|
392
|
-
}, ke = ({
|
|
393
|
-
onClick: r,
|
|
394
|
-
leftIcon: e,
|
|
395
|
-
rightIcon: o,
|
|
396
|
-
title: a,
|
|
397
|
-
subtitle: n,
|
|
398
|
-
rightContent: i,
|
|
399
|
-
titleBold: l = !0,
|
|
400
|
-
rightContentBold: h = !0
|
|
401
|
-
}) => {
|
|
402
|
-
const g = /* @__PURE__ */ f(M.Fragment, { children: [
|
|
403
|
-
e && /* @__PURE__ */ s(z, { sx: { ml: 0 }, children: e }),
|
|
404
|
-
/* @__PURE__ */ s($t, { children: /* @__PURE__ */ f(
|
|
405
|
-
T,
|
|
406
|
-
{
|
|
407
|
-
sx: {
|
|
408
|
-
alignItems: "center",
|
|
409
|
-
flexDirection: "row",
|
|
410
|
-
marginLeft: 12
|
|
411
|
-
},
|
|
412
|
-
children: [
|
|
413
|
-
/* @__PURE__ */ f(T, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
414
|
-
/* @__PURE__ */ s(S, { bold: l, variant: "body1", children: a }),
|
|
415
|
-
n && /* @__PURE__ */ s(S, { variant: "caption", children: n })
|
|
416
|
-
] }),
|
|
417
|
-
/* @__PURE__ */ f(T, { sx: { flexDirection: "row", alignItems: "center", gap: 1 }, children: [
|
|
418
|
-
i && /* @__PURE__ */ s(S, { bold: h, display: "flex", variant: "body1", children: i }),
|
|
419
|
-
o && /* @__PURE__ */ s(z, { children: o })
|
|
420
|
-
] })
|
|
421
|
-
]
|
|
422
|
-
}
|
|
423
|
-
) })
|
|
424
|
-
] });
|
|
425
|
-
return /* @__PURE__ */ s(Bt, { sx: { bgcolor: "background.paper" }, children: r ? /* @__PURE__ */ s(
|
|
426
|
-
Ot,
|
|
427
|
-
{
|
|
428
|
-
onClick: r,
|
|
429
|
-
sx: {
|
|
430
|
-
py: 14
|
|
431
|
-
},
|
|
432
|
-
children: g
|
|
433
|
-
}
|
|
434
|
-
) : /* @__PURE__ */ s(
|
|
435
|
-
T,
|
|
436
|
-
{
|
|
437
|
-
sx: {
|
|
438
|
-
py: 14,
|
|
439
|
-
px: 24,
|
|
440
|
-
width: "100%",
|
|
441
|
-
flexDirection: "row",
|
|
442
|
-
alignItems: "center"
|
|
443
|
-
},
|
|
444
|
-
children: g
|
|
445
|
-
}
|
|
446
|
-
) });
|
|
447
|
-
}, qt = (r) => A[r] ?? A.default, Jt = (r) => Nt[r];
|
|
448
|
-
function Kt(r, e) {
|
|
449
|
-
const o = [], a = new Date(r);
|
|
450
|
-
for (; a <= e; ) {
|
|
451
|
-
const n = a.getFullYear(), i = String(a.getMonth() + 1).padStart(2, "0");
|
|
452
|
-
o.push(+`${n}${i}`), a.setMonth(a.getMonth() + 1);
|
|
453
|
-
}
|
|
454
|
-
return o;
|
|
455
|
-
}
|
|
456
|
-
const Qt = (r) => r.reduce((o, a) => {
|
|
457
|
-
const n = {
|
|
458
|
-
top_level_category_guid: a.top_level_category_guid,
|
|
459
|
-
category_guid: a.category_guid,
|
|
460
|
-
amount: a.total,
|
|
461
|
-
year_month: a.year_month
|
|
462
|
-
}, { top_level_category_guid: i, category_guid: l } = n;
|
|
463
|
-
return o[l] || (o[l] = []), o[l].push(n), i !== l && (o[i] || (o[i] = []), o[i].push(n)), o;
|
|
464
|
-
}, {}), Ee = (r, e, o) => {
|
|
465
|
-
const a = Qt(r), n = Kt(e, o);
|
|
466
|
-
return Object.entries(a).map(([l, h]) => {
|
|
467
|
-
const g = h[0].top_level_category_guid, C = n.map((d) => {
|
|
468
|
-
const u = h.filter((p) => p.year_month === d).reduce((p, v) => p + Math.abs(v.amount), 0), x = Number(String(d).slice(0, 4)), y = Number(String(d).slice(4));
|
|
469
|
-
return { x: new Date(x, y - 1), y: u };
|
|
470
|
-
}).sort((d, u) => d.x.getTime() - u.x.getTime());
|
|
471
|
-
return {
|
|
472
|
-
top_level_category_guid: g,
|
|
473
|
-
category_guid: l,
|
|
474
|
-
category_name: Jt(l),
|
|
475
|
-
category_color: qt(g),
|
|
476
|
-
dataset: C
|
|
477
|
-
};
|
|
478
|
-
});
|
|
479
|
-
}, Ge = (r, e) => {
|
|
480
|
-
const o = typeof r == "string" ? parseFloat(r.replace(/[^0-9.-]+/g, "")) : r, a = typeof e == "string" ? parseFloat(e.replace(/[^0-9.-]+/g, "")) : e;
|
|
481
|
-
return (o || 0) - (a || 0);
|
|
482
|
-
}, Ut = (r, e) => {
|
|
483
|
-
const o = r.subCategories.filter((i) => i.currentAmount !== 0), a = r.totalMonthlyAmounts.slice(-e), n = (i) => i.substring(0, 3) + " " + i.slice(-4);
|
|
484
|
-
return a.map((i) => {
|
|
485
|
-
const l = n(i.label), h = o.map((d) => {
|
|
486
|
-
const u = d.monthlyAmounts.slice(-e).find((x) => n(x.label) === l);
|
|
487
|
-
return {
|
|
488
|
-
label: d.name,
|
|
489
|
-
amount: Math.abs(u?.amount || 0),
|
|
490
|
-
header: l
|
|
491
|
-
};
|
|
492
|
-
}), g = r.monthlyAmounts.slice(-e).find((d) => n(d.label) === l);
|
|
493
|
-
return [{
|
|
494
|
-
label: r.name,
|
|
495
|
-
amount: Math.abs(g?.amount || 0),
|
|
496
|
-
header: l
|
|
497
|
-
}, ...h].sort((d, u) => u.amount - d.amount);
|
|
498
|
-
});
|
|
499
|
-
}, Zt = (r, e) => {
|
|
500
|
-
const o = r ? r.totalMonthlyAmounts.slice(-e).map((n) => ({
|
|
501
|
-
x: n.label.substring(0, 3),
|
|
502
|
-
y: Math.abs(n.amount)
|
|
503
|
-
})) : [], a = r ? Ut(r, e) : [];
|
|
504
|
-
return { monthlyAmounts: o, tooltipLabels: a };
|
|
505
|
-
}, te = (r) => r.slice().filter(
|
|
506
|
-
(e) => e.totalAmount !== 0 && e.isTransfer === !1 && e.guid !== Gt.INVESTMENTS
|
|
507
|
-
).sort((e, o) => Math.abs(o.totalAmount) - Math.abs(e.totalAmount));
|
|
508
|
-
class Ne {
|
|
509
|
-
globalStore;
|
|
510
|
-
selectedCategoryData = null;
|
|
511
|
-
selectedDateRange;
|
|
512
|
-
visibleListLength = 5;
|
|
513
|
-
constructor(e) {
|
|
514
|
-
this.globalStore = e, this.selectedDateRange = {
|
|
515
|
-
start: jt(q(Yt(/* @__PURE__ */ new Date(), 6)), 1),
|
|
516
|
-
end: q(/* @__PURE__ */ new Date())
|
|
517
|
-
}, Wt(this);
|
|
518
|
-
}
|
|
519
|
-
setSelectedCategoryData = (e) => {
|
|
520
|
-
this.selectedCategoryData = e;
|
|
521
|
-
};
|
|
522
|
-
setSelectedDateRange = (e) => {
|
|
523
|
-
this.selectedDateRange = e;
|
|
524
|
-
};
|
|
525
|
-
setVisibleListLength = (e) => {
|
|
526
|
-
this.visibleListLength = e;
|
|
527
|
-
};
|
|
528
|
-
get sortedDetailedCategoriesWithTransactions() {
|
|
529
|
-
return te(
|
|
530
|
-
this.globalStore.categoryStore.detailedCategoriesWithTransactions
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
get selectedDateRangeMonthCount() {
|
|
534
|
-
return Ft(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
|
|
535
|
-
}
|
|
536
|
-
get selectedDateRangeMonthRange() {
|
|
537
|
-
const e = R(this.selectedDateRange.start, w.MONTH_LONG), o = R(this.selectedDateRange.end, w.MONTH_LONG);
|
|
538
|
-
return `${e} - ${o}`;
|
|
539
|
-
}
|
|
540
|
-
get visibleCategories() {
|
|
541
|
-
return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
|
|
542
|
-
}
|
|
543
|
-
get collapsedCategories() {
|
|
544
|
-
return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
|
|
545
|
-
}
|
|
546
|
-
get categoryDetailsChartData() {
|
|
547
|
-
return Zt(
|
|
548
|
-
this.selectedCategoryData,
|
|
549
|
-
this.selectedDateRangeMonthCount
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
export {
|
|
554
|
-
ke as L,
|
|
555
|
-
Ie as S,
|
|
556
|
-
Ne as T,
|
|
557
|
-
Ge as a,
|
|
558
|
-
Ee as g
|
|
559
|
-
};
|