@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.
@@ -0,0 +1,35 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import e from "react";
3
+ import u from "@mui/material/Box";
4
+ const x = (a = "polite") => {
5
+ const [s, o] = e.useState(""), [t, r] = e.useState(a), n = e.useCallback((c, i) => {
6
+ i && r(i), o(c);
7
+ }, []), p = e.useMemo(
8
+ () => /* @__PURE__ */ l(
9
+ u,
10
+ {
11
+ "aria-atomic": "true",
12
+ "aria-live": t,
13
+ role: t === "assertive" ? "alert" : "status",
14
+ sx: {
15
+ position: "absolute",
16
+ width: "1px",
17
+ height: "1px",
18
+ padding: 0,
19
+ margin: "-1px",
20
+ overflow: "hidden",
21
+ clip: "rect(0 0 0 0)",
22
+ clipPath: "inset(50%)",
23
+ whiteSpace: "nowrap",
24
+ border: 0
25
+ },
26
+ children: s
27
+ }
28
+ ),
29
+ [s, t]
30
+ );
31
+ return { announce: n, ariaLive: p };
32
+ };
33
+ export {
34
+ x as u
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.2.12-alpha.san1",
3
+ "version": "7.2.13-alpha-ram1-finstrongtesting-wec-947",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -1,57 +0,0 @@
1
- import { jsxs as g, jsx as e } from "react/jsx-runtime";
2
- import R from "react";
3
- import { selectAll as A, interpolateString as D, arc as I } from "d3";
4
- import n from "@mui/material/Box";
5
- const m = 100, v = 140, w = 10, x = ({
6
- data: s,
7
- hoveredId: i,
8
- onClick: a,
9
- onMouseEnter: l,
10
- onMouseLeave: c,
11
- selectedId: d,
12
- size: o = 300,
13
- children: u
14
- }) => {
15
- let r = 0;
16
- return R.useEffect(() => {
17
- A(".arc-outer").transition("roll").duration(500).attrTween("transform", () => D("rotate(0)", "rotate(360)"));
18
- }, []), /* @__PURE__ */ g(n, { height: o, position: "relative", width: o, children: [
19
- /* @__PURE__ */ e(n, { height: "100%", width: "100%", children: u }),
20
- /* @__PURE__ */ e(
21
- "svg",
22
- {
23
- height: o,
24
- style: { position: "absolute", top: 0, left: 0 },
25
- viewBox: "-150 -150 300 300",
26
- width: o,
27
- children: /* @__PURE__ */ e("g", { children: s.map((t) => {
28
- const h = r;
29
- r = r + 2 * Math.PI * (t.value / 100);
30
- const p = r, f = I().cornerRadius(4)({
31
- innerRadius: m,
32
- outerRadius: v + (t.id === d || t.id === i ? w : 0),
33
- startAngle: h,
34
- endAngle: p,
35
- padAngle: 0.025
36
- });
37
- return /* @__PURE__ */ e(
38
- "path",
39
- {
40
- className: "arc-outer",
41
- d: f,
42
- fill: t.color,
43
- onClick: () => a?.(t.id),
44
- onMouseEnter: () => l?.(t.id),
45
- onMouseLeave: () => c?.(t.id),
46
- style: { cursor: "pointer" }
47
- },
48
- t.id
49
- );
50
- }) })
51
- }
52
- )
53
- ] });
54
- }, M = x;
55
- export {
56
- M as D
57
- };
@@ -1,170 +0,0 @@
1
- import { b } from "./CategoryUtil-DUM8NuGO.mjs";
2
- import { b as m } from "./Category-CevNQ03n.mjs";
3
- import { jsx as d, jsxs as x } from "react/jsx-runtime";
4
- import T from "react";
5
- import { observer as E } from "mobx-react-lite";
6
- import h from "@mui/material/Stack";
7
- import { CategoryIcon as I, CategoryIconVariants as M, Text as p } from "@mxenabled/mxui";
8
- import N from "@mui/material/Button";
9
- import { useTheme as v } from "@mui/material";
10
- import { D as G } from "./Donut-1UMNcG67.mjs";
11
- import { u as w } from "./hooks-C41HAxM5.mjs";
12
- import { u as O } from "./useScreenSize-B6JyS_Lj.mjs";
13
- import { f as D } from "./NumberFormatting-Buh7u8Oi.mjs";
14
- import j from "@mui/material/Box";
15
- const C = 5, k = (a, l, g) => g.reduce((e, r) => {
16
- if (r.total > 0) {
17
- const n = a.find((o) => o.guid === r.category_guid);
18
- if (!n) return e;
19
- const u = n.parent_guid ?? n.guid, t = a.find((o) => o.guid === u);
20
- if (!t) return e;
21
- const i = {
22
- guid: n.guid,
23
- name: n.guid === u ? `General ${n.name}` : n.name,
24
- color: b(t.guid, l),
25
- amount: r.total
26
- }, c = e.find((o) => o.guid === u);
27
- c ? (c.amount += r.total, c.categoryTotals?.push(i)) : e.push({
28
- guid: u,
29
- name: t.name,
30
- color: b(t.guid, l),
31
- categoryTotals: [i],
32
- amount: r.total
33
- });
34
- }
35
- return e;
36
- }, []), L = (a, l, g, e) => {
37
- const r = k(a, g, e), n = r.filter(
38
- (o) => o.guid !== m.INCOME && o.guid !== m.INVESTMENTS && o.guid !== m.TRANSFER
39
- ).sort((o, s) => s.amount - o.amount), u = n.reduce(
40
- (o, s) => o + s.amount,
41
- 0
42
- ), t = n.length > C ? C : n.length, i = n.slice(0, t), c = i.map((o) => ({
43
- id: o.guid,
44
- color: b(o.guid, g),
45
- label: o.name,
46
- value: o.amount / u * 100
47
- }));
48
- if (n.length > 5) {
49
- const o = n.slice(C, r.length), s = o.reduce(
50
- (f, y) => f + y.amount,
51
- 0
52
- );
53
- i.push({
54
- guid: "other",
55
- color: g.palette.categories.others || "",
56
- name: l.saving_goal_other,
57
- categoryTotals: o,
58
- amount: s
59
- }), c.push({
60
- id: "other",
61
- color: g.palette.categories.others || "",
62
- label: l.saving_goal_other,
63
- value: s / u * 100
64
- });
65
- }
66
- return {
67
- categoryData: i,
68
- donutData: c,
69
- totalAmount: u
70
- };
71
- }, Q = (a, l, g) => {
72
- const e = a.filter(
73
- (t) => t.guid === m.INCOME || t.parent_guid === m.INCOME
74
- ), r = l.filter((t) => e.some((i) => i.guid === t.category_guid)).sort((t, i) => t.total - i.total).map((t, i) => ({
75
- guid: t.category_guid,
76
- name: a.find((c) => c.guid === t.category_guid)?.name,
77
- color: g[i],
78
- categoryTotals: [],
79
- amount: Math.abs(t.total)
80
- })), n = r.reduce(
81
- (t, i) => t + i.amount,
82
- 0
83
- ), u = r.map((t) => ({
84
- id: t.guid,
85
- color: t.color,
86
- label: t.name,
87
- value: t.amount / n * 100
88
- }));
89
- return {
90
- categoryData: r,
91
- donutData: u,
92
- totalAmount: n
93
- };
94
- }, A = ({
95
- data: a,
96
- isIncome: l = !1,
97
- onSelected: g,
98
- onViewTransactions: e,
99
- selectedId: r,
100
- size: n = 150,
101
- totalLabel: u,
102
- variant: t = "mini"
103
- }) => {
104
- const { spending: i } = w(), c = v(), { isTablet: o } = O(), s = T.useMemo(
105
- () => r ? a.categoryData.find((_) => _.guid === r) : void 0,
106
- [r]
107
- ), f = T.useMemo(() => a.donutData.length > 0 ? a.donutData : [{ id: "0", color: c.palette.divider, value: 100 }], [a, c]), y = () => {
108
- e?.(r);
109
- }, S = o ? 32 : 48;
110
- return /* @__PURE__ */ d(G, { data: f, onClick: g, selectedId: r, size: n, children: /* @__PURE__ */ d(h, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ x(h, { alignItems: "center", justifyContent: "center", minHeight: n, minWidth: n, children: [
111
- s && /* @__PURE__ */ x(
112
- h,
113
- {
114
- alignItems: "center",
115
- gap: t === "mini" ? 0 : 8,
116
- mb: t === "mini" ? 0 : 8,
117
- mt: t === "mini" ? 0 : -16,
118
- sx: t === "mini" ? { gap: 0, mb: 0 } : { gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } },
119
- children: [
120
- /* @__PURE__ */ d(
121
- I,
122
- {
123
- categoryGuid: l ? m.INCOME : s.guid,
124
- size: t === "mini" ? 24 : S,
125
- variant: M.Transparent
126
- }
127
- ),
128
- /* @__PURE__ */ d(p, { color: "secondary", noWrap: !0, variant: t === "mini" ? "Tiny" : "Body", children: s ? s.name : u })
129
- ]
130
- }
131
- ),
132
- !s && t === "full" && /* @__PURE__ */ d(p, { bold: !0, color: "secondary", sx: { mb: { xs: 4, xl: 8 } }, children: u }),
133
- /* @__PURE__ */ d(p, { variant: t === "mini" ? "H2" : "H1", children: s ? D(s.amount, "0,0") : D(a.totalAmount, "0,0") }),
134
- !s && t === "mini" && /* @__PURE__ */ d(p, { color: "secondary", noWrap: !0, variant: "Tiny", children: u }),
135
- t === "full" && /* @__PURE__ */ d(
136
- N,
137
- {
138
- "aria-label": `View ${s?.name || ""} Transactions`,
139
- disabled: a.categoryData.length === 0,
140
- onClick: y,
141
- sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
142
- variant: "text",
143
- children: i.view_transactions
144
- }
145
- )
146
- ] }) }) });
147
- }, U = E(A), Z = ({ data: a, onSelected: l, selectedId: g }) => /* @__PURE__ */ d(h, { gap: 8, height: "100%", justifyContent: "center", my: "auto", children: a.categoryData.map((e) => /* @__PURE__ */ x(
148
- h,
149
- {
150
- alignItems: "center",
151
- "aria-label": e.name,
152
- "aria-selected": e.guid === g,
153
- direction: "row",
154
- gap: 8,
155
- onClick: () => l(e.guid),
156
- role: "button",
157
- sx: { cursor: "pointer" },
158
- children: [
159
- /* @__PURE__ */ d(j, { borderRadius: 4, height: 8, sx: { backgroundColor: e.color }, width: 8 }),
160
- /* @__PURE__ */ d(p, { bold: e.guid === g, variant: "XSmall", children: e.name })
161
- ]
162
- },
163
- e.guid
164
- )) });
165
- export {
166
- U as S,
167
- Q as a,
168
- Z as b,
169
- L as g
170
- };