@mx-cartographer/experiences 7.2.12-alpha.san1 → 7.2.13-alpha-ram1-finstrongtesting-wec-947
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/Donut-oaQFlbit.mjs +86 -0
- package/dist/SpendingLegend-CW8mIzqd.mjs +196 -0
- package/dist/budgets/index.es.js +454 -429
- package/dist/common/index.es.js +1 -1
- package/dist/finstrong/index.es.js +1 -1
- package/dist/investments/index.es.js +1 -1
- package/dist/spending/index.es.js +151 -125
- package/dist/transactions/index.es.js +165 -192
- package/dist/useAriaLive-B3_pRUio.mjs +35 -0
- package/package.json +1 -1
- package/dist/Donut-1UMNcG67.mjs +0 -57
- package/dist/SpendingLegend-squvjEhu.mjs +0 -170
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import b from "react";
|
|
3
|
+
import { selectAll as m, interpolateString as x, arc as I } from "d3";
|
|
4
|
+
import d from "@mui/material/Box";
|
|
5
|
+
import { useTheme as S } from "@mui/material/styles";
|
|
6
|
+
const k = 100, E = 140, v = 10, B = ({
|
|
7
|
+
data: u,
|
|
8
|
+
hoveredId: h,
|
|
9
|
+
onClick: s,
|
|
10
|
+
onMouseEnter: a,
|
|
11
|
+
onMouseLeave: l,
|
|
12
|
+
selectedId: i,
|
|
13
|
+
size: t = 300,
|
|
14
|
+
children: p
|
|
15
|
+
}) => {
|
|
16
|
+
const f = S();
|
|
17
|
+
let r = 0;
|
|
18
|
+
const g = (o, n) => {
|
|
19
|
+
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), s?.(n));
|
|
20
|
+
}, y = (o) => {
|
|
21
|
+
a?.(o);
|
|
22
|
+
}, D = (o) => {
|
|
23
|
+
l?.(o);
|
|
24
|
+
};
|
|
25
|
+
return b.useEffect(() => {
|
|
26
|
+
m(".arc-outer").transition("roll").duration(500).attrTween("transform", () => x("rotate(0)", "rotate(360)"));
|
|
27
|
+
}, []), /* @__PURE__ */ c(d, { height: t, position: "relative", width: t, children: [
|
|
28
|
+
/* @__PURE__ */ e(d, { height: "100%", width: "100%", children: p }),
|
|
29
|
+
/* @__PURE__ */ c(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
height: t,
|
|
33
|
+
style: { position: "absolute", top: 0, left: 0 },
|
|
34
|
+
viewBox: "-150 -150 300 300",
|
|
35
|
+
width: t,
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ e("style", { children: `
|
|
38
|
+
.arc-outer:focus,
|
|
39
|
+
.arc-outer:focus-visible {
|
|
40
|
+
stroke: ${f.palette.primary.main};
|
|
41
|
+
stroke-width: 3;
|
|
42
|
+
stroke-opacity: 0.8;
|
|
43
|
+
}
|
|
44
|
+
` }),
|
|
45
|
+
/* @__PURE__ */ e("g", { children: u.map((o) => {
|
|
46
|
+
const n = r;
|
|
47
|
+
r = r + 2 * Math.PI * (o.value / 100);
|
|
48
|
+
const w = r, R = I().cornerRadius(4)({
|
|
49
|
+
innerRadius: k,
|
|
50
|
+
outerRadius: E + (o.id === i || o.id === h ? v : 0),
|
|
51
|
+
startAngle: n,
|
|
52
|
+
endAngle: w,
|
|
53
|
+
padAngle: 0.025
|
|
54
|
+
});
|
|
55
|
+
return /* @__PURE__ */ e(
|
|
56
|
+
"path",
|
|
57
|
+
{
|
|
58
|
+
"aria-label": o.label || `Segment ${o.id}`,
|
|
59
|
+
"aria-pressed": o.id === i,
|
|
60
|
+
className: "arc-outer",
|
|
61
|
+
d: R,
|
|
62
|
+
fill: o.color,
|
|
63
|
+
onBlur: () => D(o.id),
|
|
64
|
+
onClick: () => s?.(o.id),
|
|
65
|
+
onFocus: () => y(o.id),
|
|
66
|
+
onKeyDown: (A) => g(A, o.id),
|
|
67
|
+
onMouseEnter: () => a?.(o.id),
|
|
68
|
+
onMouseLeave: () => l?.(o.id),
|
|
69
|
+
role: "button",
|
|
70
|
+
style: {
|
|
71
|
+
cursor: "pointer",
|
|
72
|
+
outline: "none"
|
|
73
|
+
},
|
|
74
|
+
tabIndex: 0
|
|
75
|
+
},
|
|
76
|
+
o.id
|
|
77
|
+
);
|
|
78
|
+
}) })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] });
|
|
83
|
+
}, j = B;
|
|
84
|
+
export {
|
|
85
|
+
j as D
|
|
86
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { b as S } from "./CategoryUtil-DUM8NuGO.mjs";
|
|
2
|
+
import { b as p } from "./Category-CevNQ03n.mjs";
|
|
3
|
+
import { jsxs as y, Fragment as v, jsx as m } from "react/jsx-runtime";
|
|
4
|
+
import x from "react";
|
|
5
|
+
import { observer as w } from "mobx-react-lite";
|
|
6
|
+
import f from "@mui/material/Stack";
|
|
7
|
+
import { CategoryIcon as M, CategoryIconVariants as N, Text as h } from "@mxenabled/mxui";
|
|
8
|
+
import { u as k } from "./useAriaLive-B3_pRUio.mjs";
|
|
9
|
+
import G from "@mui/material/Button";
|
|
10
|
+
import { useTheme as A } from "@mui/material";
|
|
11
|
+
import { D as O } from "./Donut-oaQFlbit.mjs";
|
|
12
|
+
import { u as j } from "./hooks-C41HAxM5.mjs";
|
|
13
|
+
import { u as R } from "./useScreenSize-B6JyS_Lj.mjs";
|
|
14
|
+
import { f as D } from "./NumberFormatting-Buh7u8Oi.mjs";
|
|
15
|
+
import $ from "@mui/material/Box";
|
|
16
|
+
const T = 5, B = (r, l, u) => u.reduce((g, t) => {
|
|
17
|
+
if (t.total > 0) {
|
|
18
|
+
const n = r.find((e) => e.guid === t.category_guid);
|
|
19
|
+
if (!n) return g;
|
|
20
|
+
const s = n.parent_guid ?? n.guid, o = r.find((e) => e.guid === s);
|
|
21
|
+
if (!o) return g;
|
|
22
|
+
const a = {
|
|
23
|
+
guid: n.guid,
|
|
24
|
+
name: n.guid === s ? `General ${n.name}` : n.name,
|
|
25
|
+
color: S(o.guid, l),
|
|
26
|
+
amount: t.total
|
|
27
|
+
}, c = g.find((e) => e.guid === s);
|
|
28
|
+
c ? (c.amount += t.total, c.categoryTotals?.push(a)) : g.push({
|
|
29
|
+
guid: s,
|
|
30
|
+
name: o.name,
|
|
31
|
+
color: S(o.guid, l),
|
|
32
|
+
categoryTotals: [a],
|
|
33
|
+
amount: t.total
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return g;
|
|
37
|
+
}, []), to = (r, l, u, g) => {
|
|
38
|
+
const t = B(r, u, g), n = t.filter(
|
|
39
|
+
(e) => e.guid !== p.INCOME && e.guid !== p.INVESTMENTS && e.guid !== p.TRANSFER
|
|
40
|
+
).sort((e, d) => d.amount - e.amount), s = n.reduce(
|
|
41
|
+
(e, d) => e + d.amount,
|
|
42
|
+
0
|
|
43
|
+
), o = n.length > T ? T : n.length, a = n.slice(0, o), c = a.map((e) => ({
|
|
44
|
+
id: e.guid,
|
|
45
|
+
color: S(e.guid, u),
|
|
46
|
+
label: e.name,
|
|
47
|
+
value: e.amount / s * 100
|
|
48
|
+
}));
|
|
49
|
+
if (n.length > 5) {
|
|
50
|
+
const e = n.slice(T, t.length), d = e.reduce(
|
|
51
|
+
(C, i) => C + i.amount,
|
|
52
|
+
0
|
|
53
|
+
);
|
|
54
|
+
a.push({
|
|
55
|
+
guid: "other",
|
|
56
|
+
color: u.palette.categories.others || "",
|
|
57
|
+
name: l.saving_goal_other,
|
|
58
|
+
categoryTotals: e,
|
|
59
|
+
amount: d
|
|
60
|
+
}), c.push({
|
|
61
|
+
id: "other",
|
|
62
|
+
color: u.palette.categories.others || "",
|
|
63
|
+
label: l.saving_goal_other,
|
|
64
|
+
value: d / s * 100
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
categoryData: a,
|
|
69
|
+
donutData: c,
|
|
70
|
+
totalAmount: s
|
|
71
|
+
};
|
|
72
|
+
}, no = (r, l, u) => {
|
|
73
|
+
const g = r.filter(
|
|
74
|
+
(o) => o.guid === p.INCOME || o.parent_guid === p.INCOME
|
|
75
|
+
), t = l.filter((o) => g.some((a) => a.guid === o.category_guid)).sort((o, a) => o.total - a.total).map((o, a) => ({
|
|
76
|
+
guid: o.category_guid,
|
|
77
|
+
name: r.find((c) => c.guid === o.category_guid)?.name,
|
|
78
|
+
color: u[a],
|
|
79
|
+
categoryTotals: [],
|
|
80
|
+
amount: Math.abs(o.total)
|
|
81
|
+
})), n = t.reduce(
|
|
82
|
+
(o, a) => o + a.amount,
|
|
83
|
+
0
|
|
84
|
+
), s = t.map((o) => ({
|
|
85
|
+
id: o.guid,
|
|
86
|
+
color: o.color,
|
|
87
|
+
label: o.name,
|
|
88
|
+
value: o.amount / n * 100
|
|
89
|
+
}));
|
|
90
|
+
return {
|
|
91
|
+
categoryData: t,
|
|
92
|
+
donutData: s,
|
|
93
|
+
totalAmount: n
|
|
94
|
+
};
|
|
95
|
+
}, H = ({
|
|
96
|
+
data: r,
|
|
97
|
+
isIncome: l = !1,
|
|
98
|
+
onSelected: u,
|
|
99
|
+
onViewTransactions: g,
|
|
100
|
+
selectedId: t,
|
|
101
|
+
size: n = 150,
|
|
102
|
+
totalLabel: s,
|
|
103
|
+
variant: o = "mini"
|
|
104
|
+
}) => {
|
|
105
|
+
const { spending: a } = j(), c = A(), { isTablet: e } = R(), { announce: d, ariaLive: C } = k(), i = x.useMemo(
|
|
106
|
+
() => t ? r.categoryData.find((b) => b.guid === t) : void 0,
|
|
107
|
+
[t]
|
|
108
|
+
);
|
|
109
|
+
x.useEffect(() => {
|
|
110
|
+
if (i) {
|
|
111
|
+
const b = D(i.amount, "0,0");
|
|
112
|
+
d(`${i.name}: ${b}`);
|
|
113
|
+
}
|
|
114
|
+
}, [i, d]);
|
|
115
|
+
const _ = x.useMemo(() => r.donutData.length > 0 ? r.donutData : [{ id: "0", color: c.palette.divider, value: 100 }], [r, c]), E = () => {
|
|
116
|
+
g?.(t);
|
|
117
|
+
}, I = e ? 32 : 48;
|
|
118
|
+
return /* @__PURE__ */ y(v, { children: [
|
|
119
|
+
C,
|
|
120
|
+
/* @__PURE__ */ m(O, { data: _, onClick: u, selectedId: t, size: n, children: /* @__PURE__ */ m(f, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ y(f, { alignItems: "center", justifyContent: "center", minHeight: n, minWidth: n, children: [
|
|
121
|
+
i && /* @__PURE__ */ y(
|
|
122
|
+
f,
|
|
123
|
+
{
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
gap: o === "mini" ? 0 : 8,
|
|
126
|
+
mb: o === "mini" ? 0 : 8,
|
|
127
|
+
mt: o === "mini" ? 0 : -16,
|
|
128
|
+
sx: o === "mini" ? { gap: 0, mb: 0 } : { gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } },
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ m(
|
|
131
|
+
M,
|
|
132
|
+
{
|
|
133
|
+
categoryGuid: l ? p.INCOME : i.guid,
|
|
134
|
+
size: o === "mini" ? 24 : I,
|
|
135
|
+
variant: N.Transparent
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ m(
|
|
139
|
+
h,
|
|
140
|
+
{
|
|
141
|
+
color: "secondary",
|
|
142
|
+
noWrap: !0,
|
|
143
|
+
variant: o === "mini" ? "Tiny" : "Body",
|
|
144
|
+
children: i ? i.name : s
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
!i && o === "full" && /* @__PURE__ */ m(h, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: s }),
|
|
151
|
+
/* @__PURE__ */ m(h, { variant: o === "mini" ? "H2" : "H1", children: i ? D(i.amount, "0,0") : D(r.totalAmount, "0,0") }),
|
|
152
|
+
!i && o === "mini" && /* @__PURE__ */ m(h, { color: "secondary", noWrap: !0, variant: "Tiny", children: s }),
|
|
153
|
+
o === "full" && /* @__PURE__ */ m(
|
|
154
|
+
G,
|
|
155
|
+
{
|
|
156
|
+
"aria-label": `View ${i?.name || ""} Transactions`,
|
|
157
|
+
disabled: r.categoryData.length === 0,
|
|
158
|
+
onClick: E,
|
|
159
|
+
sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
|
|
160
|
+
variant: "text",
|
|
161
|
+
children: a.view_transactions
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] }) }) })
|
|
165
|
+
] });
|
|
166
|
+
}, eo = w(H), ro = ({ data: r, onSelected: l, selectedId: u }) => {
|
|
167
|
+
const g = (t, n) => {
|
|
168
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), l(n));
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ m(f, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: r.categoryData.map((t) => /* @__PURE__ */ y(
|
|
171
|
+
f,
|
|
172
|
+
{
|
|
173
|
+
alignItems: "center",
|
|
174
|
+
"aria-label": t.name,
|
|
175
|
+
"aria-pressed": t.guid === u,
|
|
176
|
+
direction: "row",
|
|
177
|
+
gap: 8,
|
|
178
|
+
onClick: () => l(t.guid),
|
|
179
|
+
onKeyDown: (n) => g(n, t.guid),
|
|
180
|
+
role: "button",
|
|
181
|
+
sx: { cursor: "pointer" },
|
|
182
|
+
tabIndex: 0,
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ m($, { borderRadius: 4, height: 8, sx: { backgroundColor: t.color }, width: 8 }),
|
|
185
|
+
/* @__PURE__ */ m(h, { bold: t.guid === u, variant: "XSmall", children: t.name })
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
t.guid
|
|
189
|
+
)) });
|
|
190
|
+
};
|
|
191
|
+
export {
|
|
192
|
+
eo as S,
|
|
193
|
+
no as a,
|
|
194
|
+
ro as b,
|
|
195
|
+
to as g
|
|
196
|
+
};
|