@mx-cartographer/experiences 8.0.0-alpha.v1 → 8.0.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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  - **UPDATED** - types by moving from common/types to core/types (BREAKING CHANGE)
4
4
 
5
+ ## [7.13.21] - 04-03-2026
6
+
7
+ - **FIXED** - `Spending` widget treating negative transactions as expenses
8
+
5
9
  ## [7.13.20] - 04-02-2026
6
10
 
7
11
  - **ADDED** - DonutChartV2 component for Insights MUI Refresh.
@@ -13,31 +13,31 @@ import { u as R } from "./useAriaLive-MkYebyUR.mjs";
13
13
  import { u as v } from "./hooks-BxkfR-Ff.mjs";
14
14
  import { u as V } from "./useScreenSize-B6JyS_Lj.mjs";
15
15
  import { f as b } from "./NumberFormatting-QCaNwbjv.mjs";
16
- const D = 5, B = (i, l, g, c) => c.reduce((o, n) => {
16
+ const D = 5, B = (i, l, g, m) => m.reduce((o, n) => {
17
17
  const a = i.find((s) => s.guid === n.category_guid);
18
18
  if (!a) return o;
19
19
  const t = a.parent_guid ?? a.guid, r = i.find((s) => s.guid === t);
20
- if (!r) return o;
21
- const m = {
20
+ if (!r || n.total <= 0) return o;
21
+ const c = {
22
22
  guid: a.guid,
23
23
  name: a.guid === t ? `${l.parent_category_totals_label_general} ${a.name}` : a.name,
24
24
  color: _(r.guid, g),
25
25
  amount: n.total
26
26
  }, e = o.find((s) => s.guid === t);
27
- return e ? (e.amount += n.total, e.categoryTotals?.push(m)) : o.push({
27
+ return e ? (e.amount += n.total, e.categoryTotals?.push(c)) : o.push({
28
28
  guid: t,
29
29
  name: r.name,
30
30
  color: _(r.guid, g),
31
- categoryTotals: [m],
31
+ categoryTotals: [c],
32
32
  amount: n.total
33
33
  }), o;
34
- }, []), nt = (i, l, g, c) => {
35
- const n = B(i, l, g, c).filter(
34
+ }, []), nt = (i, l, g, m) => {
35
+ const n = B(i, l, g, m).filter(
36
36
  (e) => e.guid !== p.INCOME && e.guid !== p.INVESTMENTS && e.guid !== p.TRANSFER && e.amount > 0
37
37
  ).sort((e, s) => s.amount - e.amount), a = n.reduce(
38
38
  (e, s) => e + s.amount,
39
39
  0
40
- ), t = n.length > D ? D : n.length, r = n.slice(0, t), m = r.map((e) => ({
40
+ ), t = n.length > D ? D : n.length, r = n.slice(0, t), c = r.map((e) => ({
41
41
  id: e.guid,
42
42
  color: _(e.guid, g),
43
43
  label: e.name,
@@ -54,7 +54,7 @@ const D = 5, B = (i, l, g, c) => c.reduce((o, n) => {
54
54
  name: l.saving_goal_other,
55
55
  categoryTotals: e,
56
56
  amount: s
57
- }), m.push({
57
+ }), c.push({
58
58
  id: "other",
59
59
  color: g.palette.categories.others || "",
60
60
  label: l.saving_goal_other,
@@ -63,15 +63,15 @@ const D = 5, B = (i, l, g, c) => c.reduce((o, n) => {
63
63
  }
64
64
  return {
65
65
  categoryData: r,
66
- donutData: m,
66
+ donutData: c,
67
67
  totalAmount: a
68
68
  };
69
69
  }, et = (i, l, g) => {
70
- const c = i.filter(
70
+ const m = i.filter(
71
71
  (t) => t.guid === p.INCOME || t.parent_guid === p.INCOME
72
- ), o = l.filter((t) => c.some((r) => r.guid === t.category_guid)).sort((t, r) => t.total - r.total).map((t, r) => ({
72
+ ), o = l.filter((t) => m.some((r) => r.guid === t.category_guid)).sort((t, r) => t.total - r.total).map((t, r) => ({
73
73
  guid: t.category_guid,
74
- name: i.find((m) => m.guid === t.category_guid)?.name,
74
+ name: i.find((c) => c.guid === t.category_guid)?.name,
75
75
  color: g[r],
76
76
  categoryTotals: [],
77
77
  amount: Math.abs(t.total)
@@ -93,13 +93,13 @@ const D = 5, B = (i, l, g, c) => c.reduce((o, n) => {
93
93
  data: i,
94
94
  isIncome: l = !1,
95
95
  onSelected: g,
96
- onViewTransactions: c,
96
+ onViewTransactions: m,
97
97
  selectedId: o,
98
98
  size: n = 150,
99
99
  totalLabel: a,
100
100
  variant: t = "mini"
101
101
  }) => {
102
- const { spending: r } = v(), m = A(), { isTablet: e } = V(), { announce: s, ariaLive: C } = R(), u = T.useMemo(
102
+ const { spending: r } = v(), c = A(), { isTablet: e } = V(), { announce: s, ariaLive: C } = R(), u = T.useMemo(
103
103
  () => o ? i.categoryData.find((x) => x.guid === o) : void 0,
104
104
  [o]
105
105
  );
@@ -109,8 +109,8 @@ const D = 5, B = (i, l, g, c) => c.reduce((o, n) => {
109
109
  s(`${u.name}: ${x}`);
110
110
  }
111
111
  }, [u, s, t]);
112
- const E = i.donutData.length > 0 ? i.donutData : [{ id: "0", color: m.palette.divider, value: 100 }], I = () => {
113
- c?.(o);
112
+ const E = i.donutData.length > 0 ? i.donutData : [{ id: "0", color: c.palette.divider, value: 100 }], I = () => {
113
+ m?.(o);
114
114
  }, w = e ? 32 : 48;
115
115
  return /* @__PURE__ */ f(N, { children: [
116
116
  C,
@@ -161,7 +161,7 @@ const D = 5, B = (i, l, g, c) => c.reduce((o, n) => {
161
161
  ] }) }) })
162
162
  ] });
163
163
  }, rt = k(P), at = ({ data: i, onSelected: l, selectedId: g }) => {
164
- const c = (o, n) => {
164
+ const m = (o, n) => {
165
165
  (o.key === "Enter" || o.key === " ") && (o.preventDefault(), l(n));
166
166
  };
167
167
  return /* @__PURE__ */ d(h, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: i.categoryData.map((o) => /* @__PURE__ */ f(
@@ -173,7 +173,7 @@ const D = 5, B = (i, l, g, c) => c.reduce((o, n) => {
173
173
  direction: "row",
174
174
  gap: 8,
175
175
  onClick: () => l(o.guid),
176
- onKeyDown: (n) => c(n, o.guid),
176
+ onKeyDown: (n) => m(n, o.guid),
177
177
  role: "button",
178
178
  sx: { cursor: "pointer" },
179
179
  tabIndex: 0,
@@ -51,7 +51,7 @@ import { ChartsXAxis as Zn } from "@mui/x-charts/ChartsXAxis";
51
51
  import { ChartsYAxis as Jn } from "@mui/x-charts/ChartsYAxis";
52
52
  import { startOfMonth as Dt } from "date-fns/startOfMonth";
53
53
  import { endOfMonth as It } from "date-fns/endOfMonth";
54
- import { g as eo, S as to, b as no } from "../SpendingLegend-BgjazduU.mjs";
54
+ import { g as eo, S as to, b as no } from "../SpendingLegend-BCnXkPCD.mjs";
55
55
  import { formatISO as oo } from "date-fns/formatISO";
56
56
  import { fromUnixTime as ro } from "date-fns/fromUnixTime";
57
57
  import { startOfToday as st } from "date-fns/startOfToday";
@@ -8,7 +8,7 @@ import C from "@mui/material/Stack";
8
8
  import N from "@mui/material/Tab";
9
9
  import it from "@mui/material/Tabs";
10
10
  import _t from "@mui/material/styles/useTheme";
11
- import { g as rt, a as st, S as $, b as Y } from "../SpendingLegend-BgjazduU.mjs";
11
+ import { g as rt, a as st, S as $, b as Y } from "../SpendingLegend-BCnXkPCD.mjs";
12
12
  import { Text as T, Icon as bt } from "@mxenabled/mxui";
13
13
  import { f as R } from "../NumberFormatting-QCaNwbjv.mjs";
14
14
  import { u as I, l as A, d as lt, b as V, a as F, h as ct, g as yt } from "../hooks-BxkfR-Ff.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "8.0.0-alpha.v1",
3
+ "version": "8.0.0",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -33,6 +33,10 @@
33
33
  "import": "./dist/common/index.es.js",
34
34
  "types": "./dist/common/index.d.ts"
35
35
  },
36
+ "./core": {
37
+ "import": "./dist/core/index.es.js",
38
+ "types": "./dist/core/index.d.ts"
39
+ },
36
40
  "./dashboard": {
37
41
  "import": "./dist/dashboard/index.es.js",
38
42
  "types": "./dist/dashboard/index.d.ts"
@@ -118,6 +122,9 @@
118
122
  "common": [
119
123
  "./dist/common/index.d.ts"
120
124
  ],
125
+ "core": [
126
+ "./dist/core/index.d.ts"
127
+ ],
121
128
  "dashboard": [
122
129
  "./dist/dashboard/index.d.ts"
123
130
  ],