@mx-cartographer/experiences 7.0.0-alpha.mega1 → 7.0.1-alpha.al0

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{Account-DY6nxO7y.mjs → Account-BFol-JYA.mjs} +1 -1
  3. package/dist/{AccountDetailsContent-DvPs81kL.mjs → AccountDetailsContent-Do3z1FnQ.mjs} +8 -8
  4. package/dist/{AccountDetailsHeader-W2U7ZVm_.mjs → AccountDetailsHeader-DnEyQMpX.mjs} +12 -12
  5. package/dist/{AccountFields-DAVcbZy5.mjs → AccountFields-CeHZrIQe.mjs} +2 -2
  6. package/dist/{AccountListItem-DFlbdcmT.mjs → AccountListItem-C7JzYpqf.mjs} +3 -3
  7. package/dist/{AccountStore-CU7qV3vg.mjs → AccountStore-Cu3GoLh-.mjs} +1 -1
  8. package/dist/{Accounts-BLlrQA5m.mjs → Accounts-BuYXUMhP.mjs} +1 -1
  9. package/dist/{BudgetUtil-Ci1TN0J5.mjs → BudgetUtil-spowPvBM.mjs} +2 -2
  10. package/dist/{Category-5S6uwuXz.mjs → Category-CevNQ03n.mjs} +4 -4
  11. package/dist/{CategorySelectorDrawer-rHyHHYuh.mjs → CategorySelectorDrawer-Dyzb3UDU.mjs} +1 -1
  12. package/dist/{CategoryStore-B5EW6I1d.mjs → CategoryStore-BOyzQjQp.mjs} +2 -2
  13. package/dist/{CategoryUtil-DRyruNgi.mjs → CategoryUtil-BR3H5i6n.mjs} +1 -1
  14. package/dist/{ConnectDrawer-D9cR5phc.mjs → ConnectDrawer-WfKHsHSF.mjs} +1 -1
  15. package/dist/{ConnectionsDrawer-BzGqljSp.mjs → ConnectionsDrawer-Czp-E0-m.mjs} +2 -2
  16. package/dist/{CurrencyInput-D74cemI2.mjs → CurrencyInput-CSZjO22Z.mjs} +1 -1
  17. package/dist/{DebtsStore-S0l9kr0r.mjs → DebtsStore-D9holN8L.mjs} +1 -1
  18. package/dist/ExportCsvAction-dpvaZxbS.mjs +24 -0
  19. package/dist/{GoalStore-DioeeL-s.mjs → GoalStore-Drf76ell.mjs} +4 -4
  20. package/dist/{Help-DpYRO8oA.mjs → Help-DRUwVDvo.mjs} +1 -1
  21. package/dist/{LineChart-CcyX38kK.mjs → LineChart-CYiUS-px.mjs} +88 -85
  22. package/dist/{ListItemAction-BabpYivr.mjs → ListItemAction-BzmbPuNp.mjs} +1 -1
  23. package/dist/{ManageIncome-ndMuhJMG.mjs → ManageIncome-B6kmMN_z.mjs} +178 -186
  24. package/dist/{MicroWidgetContainer-CsvHLYKX.mjs → MicroWidgetContainer-DmYiksbT.mjs} +1 -1
  25. package/dist/{MiniWidgetContainer-BoOp-A05.mjs → MiniWidgetContainer-DqKQNubH.mjs} +1 -1
  26. package/dist/{NetWorthStore-PD-RUe09.mjs → NetWorthStore-BK1_NbXW.mjs} +2 -2
  27. package/dist/{Notification-AMGWM1Al.mjs → Notification-ByMBpJ5u.mjs} +33 -22
  28. package/dist/{NotificationSettings-VhHuMAFU.mjs → NotificationSettings-BznqGVQ2.mjs} +35 -34
  29. package/dist/{OriginalBalanceAction-D39mx6uE.mjs → OriginalBalanceAction-CSu5brQE.mjs} +3 -3
  30. package/dist/RecurringSettings-Be1dzkMz.mjs +57 -0
  31. package/dist/ResponsiveButton-DZFp78fJ.mjs +45 -0
  32. package/dist/{SettingsStore-CE7jDVFL.mjs → SettingsStore-B4gi6oOw.mjs} +1 -1
  33. package/dist/{SpendingData-BkrxzHdr.mjs → SpendingData-D5vsfYKo.mjs} +5 -5
  34. package/dist/{Transaction-CA0FW2Ij.mjs → Transaction-CyqrHmAA.mjs} +1 -1
  35. package/dist/{TransactionDetails-WBHFmbxL.mjs → TransactionDetails-D4B9DSWo.mjs} +421 -417
  36. package/dist/{TransactionStore-CeLdmVnC.mjs → TransactionStore-DSyXtPek.mjs} +8 -8
  37. package/dist/TrendsStore-DR8etTL2.mjs +547 -0
  38. package/dist/{ViewMoreMicroCard-CAPFNz-J.mjs → ViewMoreMicroCard-BZI5VMNW.mjs} +476 -468
  39. package/dist/{WidgetContainer-DWCusxYI.mjs → WidgetContainer-BG-fdDOf.mjs} +110 -104
  40. package/dist/accounts/index.es.js +12 -12
  41. package/dist/analytics/index.es.js +8 -8
  42. package/dist/budgets/index.es.js +10 -10
  43. package/dist/cashflow/index.es.js +7 -7
  44. package/dist/categories/index.es.js +2 -2
  45. package/dist/common/components/WidgetContainer.d.ts +1 -1
  46. package/dist/common/components/charts/LineChart.d.ts +1 -0
  47. package/dist/common/components/index.d.ts +1 -0
  48. package/dist/common/components/listitems/ToggleButtonListItem.d.ts +2 -1
  49. package/dist/common/constants/Analytics.d.ts +16 -10
  50. package/dist/common/index.es.js +432 -469
  51. package/dist/dashboard/index.es.js +13 -13
  52. package/dist/debts/index.es.js +66 -66
  53. package/dist/{exportTransactionsToCSV-CmwsKl2D.mjs → exportTransactionsToCSV-BlVifaOG.mjs} +2 -2
  54. package/dist/finstrong/index.es.js +6 -6
  55. package/dist/goals/index.es.js +32 -32
  56. package/dist/help/index.es.js +3 -3
  57. package/dist/{hooks-30y_BLwc.mjs → hooks-02T565vf.mjs} +10 -10
  58. package/dist/investments/index.es.js +3 -3
  59. package/dist/merchants/index.es.js +1 -1
  60. package/dist/microinsights/components/carouselheader/CarouselHeader.d.ts +1 -0
  61. package/dist/microinsights/components/microBeatCarousel/MicroBeatCarousel.d.ts +1 -0
  62. package/dist/microinsights/index.es.js +1 -1
  63. package/dist/networth/index.es.js +7 -7
  64. package/dist/notifications/index.es.js +9 -9
  65. package/dist/recurringtransactions/index.es.js +8 -8
  66. package/dist/settings/index.es.js +25 -25
  67. package/dist/spending/index.es.js +13 -13
  68. package/dist/transactions/components/shared/TransactionList.d.ts +2 -0
  69. package/dist/transactions/components/transactionwidget/actions/ExportCsvAction.d.ts +5 -1
  70. package/dist/transactions/index.d.ts +1 -0
  71. package/dist/transactions/index.es.js +143 -141
  72. package/dist/trends/constants/TrendsWidget.d.ts +3 -0
  73. package/dist/trends/index.es.js +579 -642
  74. package/package.json +1 -1
  75. package/dist/RecurringSettings-D_HnMYZP.mjs +0 -57
  76. package/dist/TrendsStore-BHJUapXF.mjs +0 -487
  77. package/dist/index.d.ts +0 -0
  78. package/dist/trends/components/TransactionsList.d.ts +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.0.0-alpha.mega1",
3
+ "version": "7.0.1-alpha.al0",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -1,57 +0,0 @@
1
- import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
- import p from "react";
3
- import { observer as d } from "mobx-react-lite";
4
- import _ from "@mui/material/Box";
5
- import g from "@mui/material/Tab";
6
- import R from "@mui/material/Tabs";
7
- import T from "@mui/material/Divider";
8
- import b from "@mui/material/List";
9
- import { R as f, A as h, M as C } from "./ManageIncome-ndMuhJMG.mjs";
10
- import { u as l, f as E, g as u } from "./hooks-30y_BLwc.mjs";
11
- import { R as S, F as A } from "./RepeatingTransaction-BPWfaB3f.mjs";
12
- import { A as m } from "./WidgetContainer-DWCusxYI.mjs";
13
- const v = d(() => {
14
- const { recurring: n } = l(), { repeatingTransactions: a } = E(), { onEvent: o } = u(), t = (e) => {
15
- o(m.RECURRING_TRANSACTIONS_CLICK_EXPENSE, {
16
- repeating_transaction_guid: e.guid
17
- });
18
- }, c = () => {
19
- o(m.RECURRING_TRANSACTIONS_CLICK_ADD_EXPENSE);
20
- };
21
- return /* @__PURE__ */ s(b, { sx: { bgcolor: "background.paper" }, children: [
22
- a.filter(
23
- (e) => e.repeating_transaction_type !== S.Income && (e.transactions.length > 0 || e.recurrence_type === A.EveryYear)
24
- ).map((e, i) => /* @__PURE__ */ s(p.Fragment, { children: [
25
- /* @__PURE__ */ r(f, { onClick: t, repeatingTransaction: e }),
26
- /* @__PURE__ */ r(T, { variant: i < a.length - 1 ? "inset" : "fullWidth" })
27
- ] }, e.guid)),
28
- /* @__PURE__ */ r(h, { label: n.add_expense, onAddRecurringTransaction: c })
29
- ] });
30
- }), K = d(() => {
31
- const [n, a] = p.useState(0), { onEvent: o } = u(), { recurring: t } = l();
32
- return /* @__PURE__ */ s(_, { bgcolor: "background.default", height: "100%", children: [
33
- /* @__PURE__ */ s(
34
- R,
35
- {
36
- onChange: (e, i) => {
37
- a(i), o(
38
- i === 0 ? "recurring_transactions_widget_manage_expenses" : "recurring_transactions_widget_edit_income"
39
- );
40
- },
41
- sx: { bgcolor: "background.paper" },
42
- value: n,
43
- variant: "fullWidth",
44
- children: [
45
- /* @__PURE__ */ r(g, { label: t.manage_expenses }),
46
- /* @__PURE__ */ r(g, { label: t.manage_income })
47
- ]
48
- }
49
- ),
50
- n === 0 && /* @__PURE__ */ r(v, {}),
51
- n === 1 && /* @__PURE__ */ r(C, {})
52
- ] });
53
- });
54
- export {
55
- v as M,
56
- K as R
57
- };
@@ -1,487 +0,0 @@
1
- import _, { useState as q, useEffect as J, useRef as vt } from "react";
2
- import { l as St, u as xt, k as K } from "./hooks-30y_BLwc.mjs";
3
- import { jsxs as S, jsx as i } from "react/jsx-runtime";
4
- import D from "@mui/material/Box";
5
- import O from "@mui/material/Stack";
6
- import { useTheme as Q } from "@mui/material/styles";
7
- import { LineChart as _t } from "@mui/x-charts";
8
- import { u as U } from "./useScreenSize-B6JyS_Lj.mjs";
9
- import { u as Mt } from "./useDimensions-27p2evRx.mjs";
10
- import { observer as Tt } from "mobx-react-lite";
11
- import Dt from "@mui/material/Card";
12
- import At from "@mui/material/CardContent";
13
- import P from "@mui/material/Divider";
14
- import X from "@mui/material/Grid";
15
- import { CategoryIcon as Lt, Text as A } from "@mxenabled/mxui";
16
- import { b as Rt } from "./Localization-2MODESHW.mjs";
17
- import { C as B } from "./CurrencyText-YUhH2caW.mjs";
18
- import { useTheme as Ht, Card as Et, CardContent as kt, Box as Gt } from "@mui/material";
19
- import { f as L, D as R } from "./Dialog-CWW597AF.mjs";
20
- import It from "@mui/material/Button";
21
- import { a as T, c as wt, C as Nt } from "./Category-5S6uwuXz.mjs";
22
- import { f as z } from "./NumberFormatting-CtWHhyBX.mjs";
23
- import { makeAutoObservable as Bt } from "mobx";
24
- import { addSeconds as Ot } from "date-fns/addSeconds";
25
- import { differenceInCalendarMonths as $t } from "date-fns/differenceInCalendarMonths";
26
- import { endOfMonth as V } from "date-fns/endOfMonth";
27
- import { subMonths as jt } from "date-fns/subMonths";
28
- const Te = () => {
29
- const { isInitialized: o, appDataStore: e } = St(), [r, a] = q(!1);
30
- return J(() => {
31
- o && e.clientInsightProfile?.is_enabled && a(!0);
32
- }, [o, e.clientInsightProfile]), r;
33
- }, Z = ({ categoryGuid: o, topLevelCategoryGuid: e }) => {
34
- const { categories: r } = xt(), { getCategoryName: a } = K(), n = a(o);
35
- return /* @__PURE__ */ S(O, { alignItems: "center", direction: "column", gap: "8", justifyContent: "center", mb: 4, children: [
36
- /* @__PURE__ */ i(
37
- D,
38
- {
39
- "aria-label": Rt(r.category_icon_label_aria, n),
40
- mb: 4,
41
- role: "img",
42
- children: /* @__PURE__ */ i(Lt, { categoryGuid: e })
43
- }
44
- ),
45
- /* @__PURE__ */ i(A, { variant: "Body", children: n })
46
- ] });
47
- }, Wt = ({
48
- categoryGuids: { guid: o, topLevelGuid: e },
49
- hoveredAreaData: r,
50
- cursorPosition: a,
51
- chartContainerRef: n
52
- }) => {
53
- const l = Q(), c = vt(null), [h, m] = q({ x: a.x, y: a.y });
54
- if (J(() => {
55
- (() => {
56
- const u = c.current, f = n.current;
57
- if (!u || !f) return;
58
- const y = u.getBoundingClientRect(), b = f.getBoundingClientRect();
59
- let p = a.x, v = a.y;
60
- 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), m({ x: p, y: v });
61
- })();
62
- }, [a, n]), !r) return null;
63
- const C = r.reduce((d, u) => d + u.y, 0);
64
- return /* @__PURE__ */ i(
65
- Dt,
66
- {
67
- ref: c,
68
- sx: {
69
- position: "absolute",
70
- top: h.y,
71
- left: h.x,
72
- width: 250,
73
- pointerEvents: "none"
74
- },
75
- children: /* @__PURE__ */ S(At, { children: [
76
- /* @__PURE__ */ S(D, { alignItems: "center", display: "flex", flexDirection: "column", children: [
77
- /* @__PURE__ */ i(Z, { categoryGuid: o, topLevelCategoryGuid: e }),
78
- /* @__PURE__ */ i(A, { variant: "Small", children: `${r.length}-month total` }),
79
- /* @__PURE__ */ i(B, { amount: C, bold: !0, formatString: "0,0", variant: "body2" })
80
- ] }),
81
- /* @__PURE__ */ i(P, { sx: { my: 16, width: "100%" } }),
82
- /* @__PURE__ */ i(X, { container: !0, children: r.map((d, u) => /* @__PURE__ */ S(_.Fragment, { children: [
83
- u > 0 && u % 3 === 0 && /* @__PURE__ */ i(P, { sx: { my: 16, width: "100%" } }),
84
- /* @__PURE__ */ i(X, { item: !0, xs: 4, children: /* @__PURE__ */ S(D, { alignItems: "center", display: "flex", flexDirection: "column", children: [
85
- /* @__PURE__ */ i(A, { color: l.palette.text.secondary, variant: "XSmall", children: d.x }),
86
- /* @__PURE__ */ i(
87
- B,
88
- {
89
- amount: d.y,
90
- bold: !0,
91
- formatString: "0,0",
92
- variant: "Body"
93
- }
94
- )
95
- ] }) })
96
- ] }, u)) })
97
- ] })
98
- }
99
- );
100
- }, Ft = Tt(Wt), Yt = ({
101
- categoryGuids: { guid: o, topLevelGuid: e },
102
- itemData: { dataIndex: r },
103
- series: a,
104
- xData: n
105
- }) => {
106
- const l = Ht(), c = a.data[r], h = n[r];
107
- return c === void 0 || !h ? null : /* @__PURE__ */ i(Et, { sx: { pt: 4, px: 8 }, children: /* @__PURE__ */ i(kt, { children: /* @__PURE__ */ S(Gt, { alignItems: "center", display: "flex", flexDirection: "column", children: [
108
- /* @__PURE__ */ i(Z, { categoryGuid: o, topLevelCategoryGuid: e }),
109
- /* @__PURE__ */ i(A, { color: l.palette.text.secondary, variant: "Small", children: L(h, R.MONTH_SHORT_YEAR) }),
110
- /* @__PURE__ */ i(B, { amount: String(c), bold: !0, formatString: "0,0", variant: "Body" })
111
- ] }) }) });
112
- }, Pt = ({
113
- sx: o,
114
- categoryGuids: e,
115
- hoveredLegend: r,
116
- legendRef: a,
117
- onHoverLegend: n,
118
- onClickLegend: l
119
- }) => {
120
- const { isMobile: c } = U(), { getCategoryName: h } = K();
121
- return /* @__PURE__ */ i(
122
- O,
123
- {
124
- direction: "row",
125
- flexWrap: "wrap",
126
- gap: c ? 2 : 6,
127
- justifyContent: "start",
128
- ref: a,
129
- sx: o,
130
- children: e.map(({ guid: m, top_level_guid: C }) => {
131
- const d = r === m, u = T[m], f = T[C], y = u ?? f ?? T.default, b = y + "33";
132
- return /* @__PURE__ */ S(
133
- It,
134
- {
135
- onClick: () => l(m),
136
- onMouseEnter: () => n(m),
137
- onMouseLeave: () => n(null),
138
- sx: {
139
- color: "text.primary",
140
- fontWeight: "normal",
141
- display: "flex",
142
- justifyContent: "center",
143
- alignItems: "center",
144
- paddingX: 8,
145
- paddingY: 4,
146
- borderRadius: 1,
147
- opacity: d ? 1 : 0.7
148
- },
149
- children: [
150
- /* @__PURE__ */ i(
151
- D,
152
- {
153
- sx: {
154
- width: 16,
155
- height: 16,
156
- marginRight: c ? 5 : 10,
157
- borderRadius: "2px",
158
- backgroundColor: r ? d ? y : b : y
159
- }
160
- }
161
- ),
162
- /* @__PURE__ */ i(A, { variant: "Body", children: h(m) })
163
- ]
164
- },
165
- m
166
- );
167
- })
168
- }
169
- );
170
- }, De = ({
171
- onHoverArea: o,
172
- onHoverPoint: e,
173
- onHoverLegend: r,
174
- onClickLegend: a,
175
- stackedDatasets: n,
176
- unstackedDatasets: l = [],
177
- availableHeight: c = 0,
178
- minimumHeight: h = 350
179
- }) => {
180
- const m = Q(), { isMobile: C } = U(), [d, { height: u }] = Mt(), f = _.useRef(null), [y, b] = _.useState(0);
181
- _.useEffect(() => {
182
- const t = Math.max(c - u, h);
183
- b(t);
184
- }, [c, u]);
185
- const [p, v] = _.useState(null), [tt, H] = _.useState({
186
- hoveredSeriesId: null,
187
- hoveredAreaData: null,
188
- isAreaHovered: !1,
189
- cursorPos: { x: 0, y: 0 }
190
- }), { hoveredSeriesId: M, hoveredAreaData: $, isAreaHovered: et, cursorPos: E } = tt, j = et && M && $, W = !j, I = [...n, ...l], ot = I[0]?.dataset.length ?? 0, w = I.flatMap((t) => t.dataset.map((s) => s.x)), rt = I.flatMap((t) => t.dataset.map((s) => s.y)), at = n[0]?.dataset?.map(
191
- (t, s) => n.reduce((g, x) => g + x.dataset[s]?.y || 0, 0)
192
- ) ?? [0], nt = Math.max(...at), st = Math.max(
193
- ...l.flatMap((t) => t.dataset.map((s) => s.y))
194
- ), it = Math.floor(Math.min(...rt) / 100) * 100, lt = Math.ceil(Math.max(nt, st) / 100) * 100, k = n.map((t, s) => ({
195
- id: `stacked-${s}`,
196
- guid: t.category_guid,
197
- top_level_guid: t.top_level_category_guid,
198
- area: !0,
199
- color: n[s].category_color ?? m.palette.primary.main,
200
- data: t.dataset.map((g) => g.y),
201
- label: n[s].category_name,
202
- stack: "total",
203
- type: "line",
204
- highlightScope: { highlight: "item" },
205
- valueFormatter: (g) => z(g, "0,0")
206
- })), F = l.map((t, s) => ({
207
- id: `unstacked-${s}`,
208
- guid: t.category_guid,
209
- top_level_guid: t.top_level_category_guid,
210
- area: !1,
211
- color: t.category_color,
212
- data: t.dataset.map((g) => g.y),
213
- label: t.category_name,
214
- type: "line",
215
- valueFormatter: (g) => z(g, "0,0")
216
- })), Y = [...k, ...F], ct = [
217
- ...k.map(({ guid: t, top_level_guid: s }) => ({
218
- guid: t,
219
- top_level_guid: s
220
- })),
221
- ...F.map(({ guid: t, top_level_guid: s }) => ({
222
- guid: t,
223
- top_level_guid: s
224
- }))
225
- ], G = (t) => {
226
- const g = t.startsWith("stacked-") ? n[parseInt(t.split("-")[1])] : l[parseInt(t.split("-")[1])];
227
- return {
228
- guid: g?.category_guid,
229
- topLevelGuid: g?.top_level_category_guid
230
- };
231
- }, dt = (t) => {
232
- v(t), r?.(t ?? "");
233
- }, ut = (t) => {
234
- a?.(t ?? "");
235
- }, gt = () => {
236
- const t = G(String(M)).guid;
237
- t && a?.(t);
238
- }, mt = (t) => {
239
- const s = String(t?.seriesId), g = G(s).guid, x = Y.find((N) => N.id === s), yt = x && t?.dataIndex !== void 0, ft = x && t?.dataIndex === void 0;
240
- if (yt)
241
- H({
242
- hoveredSeriesId: s,
243
- hoveredAreaData: null,
244
- isAreaHovered: !1,
245
- cursorPos: E
246
- }), e?.(g);
247
- else if (ft) {
248
- const N = x?.data.map((Ct, bt) => ({
249
- x: w[bt],
250
- y: Ct
251
- })) ?? [];
252
- H({
253
- hoveredSeriesId: s,
254
- hoveredAreaData: N,
255
- isAreaHovered: !0,
256
- cursorPos: E
257
- }), o?.(g);
258
- } else
259
- H({
260
- hoveredSeriesId: null,
261
- hoveredAreaData: null,
262
- isAreaHovered: !1,
263
- cursorPos: E
264
- });
265
- }, ht = (t) => {
266
- const s = t.currentTarget.getBoundingClientRect();
267
- H((g) => ({
268
- ...g,
269
- cursorPos: {
270
- x: t.clientX - s.left,
271
- y: t.clientY - s.top
272
- }
273
- }));
274
- }, pt = {
275
- p: 4,
276
- "& .MuiBarLabel-root": {
277
- fontSize: 10,
278
- fontWeight: 600
279
- },
280
- "& .MuiAreaElement-root": {
281
- opacity: 0.4,
282
- transition: "opacity 0.3s ease"
283
- },
284
- "& .MuiAreaElement-root:hover": {
285
- opacity: 1
286
- },
287
- '& [class*="MuiLineElement-series-unstacked-"]': {
288
- strokeWidth: 3
289
- },
290
- ...p && k.reduce((t, s, g) => {
291
- const x = `.MuiAreaElement-series-stacked-${g}`;
292
- return t[x] = {
293
- opacity: k[g].guid === p ? 0.9 : 0.2
294
- }, t;
295
- }, {})
296
- };
297
- return /* @__PURE__ */ i(D, { onMouseMove: ht, ref: f, style: { position: "relative" }, children: /* @__PURE__ */ S(
298
- O,
299
- {
300
- direction: { xs: "column", md: "column" },
301
- spacing: { xs: 0, md: 4 },
302
- sx: { width: "100%", position: "relative" },
303
- children: [
304
- /* @__PURE__ */ i(
305
- _t,
306
- {
307
- height: y,
308
- margin: { bottom: 50 },
309
- onAreaClick: gt,
310
- onHighlightChange: mt,
311
- series: Y,
312
- skipAnimation: !0,
313
- slotProps: {
314
- legend: {
315
- hidden: !0
316
- }
317
- },
318
- slots: {
319
- itemContent: (t) => W && M ? /* @__PURE__ */ i(
320
- Yt,
321
- {
322
- categoryGuids: G(M),
323
- xData: w,
324
- ...t
325
- }
326
- ) : null
327
- },
328
- sx: pt,
329
- tooltip: {
330
- trigger: W ? "item" : "none"
331
- },
332
- xAxis: [
333
- {
334
- data: w,
335
- scaleType: "time",
336
- valueFormatter: (t) => L(t, R.MONTH_SHORT_YEAR),
337
- tickNumber: ot
338
- // How many ticks to show on the x-axis
339
- }
340
- ],
341
- yAxis: [
342
- {
343
- min: it,
344
- max: lt || 100
345
- }
346
- ]
347
- }
348
- ),
349
- /* @__PURE__ */ i(
350
- Pt,
351
- {
352
- categoryGuids: ct,
353
- hoveredLegend: p,
354
- legendRef: d,
355
- onClickLegend: ut,
356
- onHoverLegend: dt,
357
- sx: { px: C ? 0 : 24 }
358
- }
359
- ),
360
- j && /* @__PURE__ */ i(
361
- Ft,
362
- {
363
- categoryGuids: G(M),
364
- chartContainerRef: f,
365
- cursorPosition: E,
366
- hoveredAreaData: $.map((t) => ({
367
- ...t,
368
- x: L(t.x, R.MONTH_SHORT_YEAR)
369
- }))
370
- }
371
- )
372
- ]
373
- }
374
- ) });
375
- }, Xt = (o) => T[o] ?? T.default, zt = (o) => Nt[o];
376
- function Vt(o, e) {
377
- const r = [], a = new Date(o);
378
- for (; a <= e; ) {
379
- const n = a.getFullYear(), l = String(a.getMonth() + 1).padStart(2, "0");
380
- r.push(+`${n}${l}`), a.setMonth(a.getMonth() + 1);
381
- }
382
- return r;
383
- }
384
- const qt = (o) => o.reduce((r, a) => {
385
- const n = {
386
- top_level_category_guid: a.top_level_category_guid,
387
- category_guid: a.category_guid,
388
- amount: a.total,
389
- year_month: a.year_month
390
- }, { top_level_category_guid: l, category_guid: c } = n;
391
- return r[c] || (r[c] = []), r[c].push(n), l !== c && (r[l] || (r[l] = []), r[l].push(n)), r;
392
- }, {}), Ae = (o, e, r) => {
393
- const a = qt(o), n = Vt(e, r);
394
- return Object.entries(a).map(([c, h]) => {
395
- const m = h[0].top_level_category_guid, C = n.map((d) => {
396
- const u = h.filter((p) => p.year_month === d).reduce((p, v) => p + Math.abs(v.amount), 0), f = Number(String(d).slice(0, 4)), y = Number(String(d).slice(4));
397
- return { x: new Date(f, y - 1), y: u };
398
- }).sort((d, u) => d.x.getTime() - u.x.getTime());
399
- return {
400
- top_level_category_guid: m,
401
- category_guid: c,
402
- category_name: zt(c),
403
- category_color: Xt(m),
404
- dataset: C
405
- };
406
- });
407
- }, Le = (o, e) => {
408
- const r = typeof o == "string" ? parseFloat(o.replace(/[^0-9.-]+/g, "")) : o, a = typeof e == "string" ? parseFloat(e.replace(/[^0-9.-]+/g, "")) : e;
409
- return (r || 0) - (a || 0);
410
- }, Jt = (o, e) => {
411
- const r = o.subCategories.filter((l) => l.currentAmount !== 0), a = o.totalMonthlyAmounts.slice(-e), n = (l) => l.substring(0, 3) + " " + l.slice(-4);
412
- return a.map((l) => {
413
- const c = n(l.label), h = r.map((d) => {
414
- const u = d.monthlyAmounts.slice(-e).find((f) => n(f.label) === c);
415
- return {
416
- label: d.name,
417
- amount: Math.abs(u?.amount || 0),
418
- header: c
419
- };
420
- }), m = o.monthlyAmounts.slice(-e).find((d) => n(d.label) === c);
421
- return [{
422
- label: o.name,
423
- amount: Math.abs(m?.amount || 0),
424
- header: c
425
- }, ...h].sort((d, u) => u.amount - d.amount);
426
- });
427
- }, Kt = (o, e) => {
428
- const r = o ? o.totalMonthlyAmounts.slice(-e).map((n) => ({
429
- x: n.label.substring(0, 3),
430
- y: Math.abs(n.amount)
431
- })) : [], a = o ? Jt(o, e) : [];
432
- return { monthlyAmounts: r, tooltipLabels: a };
433
- }, Qt = (o) => o.slice().filter(
434
- (e) => e.totalAmount !== 0 && e.isTransfer === !1 && e.guid !== wt.INVESTMENTS
435
- ).sort((e, r) => Math.abs(r.totalAmount) - Math.abs(e.totalAmount));
436
- class Re {
437
- globalStore;
438
- selectedCategoryData = null;
439
- selectedDateRange;
440
- visibleListLength = 5;
441
- constructor(e) {
442
- this.globalStore = e, this.selectedDateRange = {
443
- start: Ot(V(jt(/* @__PURE__ */ new Date(), 6)), 1),
444
- end: V(/* @__PURE__ */ new Date())
445
- }, Bt(this);
446
- }
447
- setSelectedCategoryData = (e) => {
448
- this.selectedCategoryData = e;
449
- };
450
- setSelectedDateRange = (e) => {
451
- this.selectedDateRange = e;
452
- };
453
- setVisibleListLength = (e) => {
454
- this.visibleListLength = e;
455
- };
456
- get sortedDetailedCategoriesWithTransactions() {
457
- return Qt(
458
- this.globalStore.categoryStore.detailedCategoriesWithTransactions
459
- );
460
- }
461
- get selectedDateRangeMonthCount() {
462
- return $t(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
463
- }
464
- get selectedDateRangeMonthRange() {
465
- const e = L(this.selectedDateRange.start, R.MONTH_LONG), r = L(this.selectedDateRange.end, R.MONTH_LONG);
466
- return `${e} - ${r}`;
467
- }
468
- get visibleCategories() {
469
- return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
470
- }
471
- get collapsedCategories() {
472
- return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
473
- }
474
- get categoryDetailsChartData() {
475
- return Kt(
476
- this.selectedCategoryData,
477
- this.selectedDateRangeMonthCount
478
- );
479
- }
480
- }
481
- export {
482
- De as S,
483
- Re as T,
484
- Le as a,
485
- Ae as g,
486
- Te as u
487
- };
package/dist/index.d.ts DELETED
File without changes
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- import { Transaction } from '../../common';
3
- interface TransactionsListProps {
4
- transactions: Transaction[];
5
- }
6
- declare const TransactionsList: React.FC<TransactionsListProps>;
7
- export default TransactionsList;