@mx-cartographer/experiences 7.4.17-alpha.mega1 → 7.4.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.4.17-alpha.mega1",
3
+ "version": "7.4.17",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -180,7 +180,7 @@
180
180
  "@mui/lab": "^5.0.0-alpha.177",
181
181
  "@mui/material": "^5.18.0",
182
182
  "@mui/system": "^5.18.0",
183
- "@mui/x-charts": "^8.23.0",
183
+ "@mui/x-charts": "^7.29.1",
184
184
  "@mui/x-data-grid-pro": "^7.29.8",
185
185
  "@mui/x-date-pickers": "^7.29.4",
186
186
  "@mui/x-date-pickers-pro": "^7.29.4",
@@ -1,580 +0,0 @@
1
- import { jsxs as a, jsx as e, Fragment as $ } from "react/jsx-runtime";
2
- import Y from "@mui/material/Box";
3
- import { useTheme as W } from "@mui/material/styles";
4
- import { BarPlot as ft } from "@mui/x-charts/BarChart";
5
- import { ChartContainer as xt } from "@mui/x-charts/ChartContainer";
6
- import { ChartsAxisHighlight as yt } from "@mui/x-charts/ChartsAxisHighlight";
7
- import { ChartsReferenceLine as gt } from "@mui/x-charts/ChartsReferenceLine";
8
- import { useAxesTooltip as pt, ChartsTooltipContainer as bt } from "@mui/x-charts/ChartsTooltip";
9
- import { ChartsXAxis as kt } from "@mui/x-charts/ChartsXAxis";
10
- import { ChartsYAxis as Mt } from "@mui/x-charts/ChartsYAxis";
11
- import { AreaPlot as Ct, LinePlot as wt, MarkPlot as Lt } from "@mui/x-charts/LineChart";
12
- import { f as p, c as X } from "./NumberFormatting-DjTD0t3W.mjs";
13
- import { observer as St } from "mobx-react-lite";
14
- import P from "@mui/material/Stack";
15
- import { Text as l } from "@mxenabled/mxui";
16
- import { u as vt } from "./hooks-ZMp65DFz.mjs";
17
- import Dt from "@mui/material/useMediaQuery";
18
- import { Stack as M, Box as F } from "@mui/material";
19
- const Tt = ({
20
- label: t,
21
- customLegendVariant: r
22
- }) => {
23
- const s = r || "Small";
24
- return typeof t == "string" ? /* @__PURE__ */ e(l, { variant: s, children: t }) : typeof t == "object" && t.amount !== void 0 && t.label ? /* @__PURE__ */ a($, { children: [
25
- /* @__PURE__ */ e(l, { variant: s, children: t.label }),
26
- /* @__PURE__ */ e(l, { bold: !0, sx: { marginLeft: 8 }, variant: s, children: p(t.amount, "0,0") })
27
- ] }) : null;
28
- }, At = ({
29
- average: t,
30
- customLegendVariant: r,
31
- customLegendBoxSx: s,
32
- labels: o = [],
33
- series: b,
34
- style: x,
35
- title: h,
36
- valueFormatterString: u
37
- }) => {
38
- const { common: m } = vt(), c = r || "Small";
39
- return /* @__PURE__ */ a(P, { style: { flexDirection: "row", gap: 24, ...x }, children: [
40
- b.map((i, f) => {
41
- const d = o[f];
42
- return d ? /* @__PURE__ */ a(
43
- P,
44
- {
45
- style: { alignItems: "center", flexDirection: "row", flexWrap: "wrap" },
46
- children: [
47
- /* @__PURE__ */ e(
48
- Y,
49
- {
50
- sx: {
51
- width: 10,
52
- height: 10,
53
- backgroundColor: i.color,
54
- marginRight: 8,
55
- ...s
56
- }
57
- }
58
- ),
59
- /* @__PURE__ */ e(Tt, { customLegendVariant: r, label: d })
60
- ]
61
- },
62
- f
63
- ) : null;
64
- }),
65
- t && /* @__PURE__ */ a(P, { sx: { alignItems: "center", flexDirection: "row" }, children: [
66
- /* @__PURE__ */ e(l, { bold: !0, sx: { marginRight: 8 }, variant: c, children: "– –" }),
67
- /* @__PURE__ */ a(l, { variant: c, children: [
68
- h || m.average,
69
- "  "
70
- ] }),
71
- /* @__PURE__ */ e(l, { bold: !0, variant: c, children: u ? p(t, u) : t })
72
- ] })
73
- ] });
74
- }, Bt = St(At), It = (t) => /* @__PURE__ */ a($, { children: [
75
- /* @__PURE__ */ e("clipPath", { id: t.id, children: /* @__PURE__ */ e("rect", { height: t.height, width: t.width, x: "0", y: "0" }) }),
76
- /* @__PURE__ */ e("g", { children: /* @__PURE__ */ e(
77
- "path",
78
- {
79
- cursor: "unset",
80
- d: t.d,
81
- style: {
82
- strokeWidth: 2,
83
- strokeLinejoin: "round",
84
- fill: "none",
85
- stroke: t.lineColor ? t.lineColor : t.stroke,
86
- transition: "opacity 0.2s ease-in, stroke 0.2s ease-in",
87
- opacity: 1
88
- }
89
- }
90
- ) })
91
- ] }), Rt = (t) => {
92
- const r = W(), s = t.showLabel, o = t.style, b = o?.markLabelStyles, x = Number(t.x), h = Number(t.y), u = t.handlers?.onMarkClick, m = t.handlers?.onMouseEnter, c = t.handlers?.onMouseLeave, i = Dt(r.breakpoints.up("sm")), f = t.valueFormatterString ? p(t.yData[t.dataIndex], t.valueFormatterString) : String(t.yData[t.dataIndex]), d = i ? r.typography.Small?.fontSize : r.typography.XSmall?.fontSize, D = 30, T = 24, A = x - D / 2, B = h - 30;
93
- return /* @__PURE__ */ a($, { children: [
94
- s && /* @__PURE__ */ a($, { children: [
95
- t.labelBackgroundColor && /* @__PURE__ */ e(
96
- "rect",
97
- {
98
- fill: t.labelBackgroundColor,
99
- height: T,
100
- rx: "3",
101
- width: D,
102
- x: A,
103
- y: B
104
- }
105
- ),
106
- /* @__PURE__ */ e(
107
- "text",
108
- {
109
- className: "MuiLineChart-markLabel",
110
- dominantBaseline: "middle",
111
- fill: t.labelFontColor ? t.labelFontColor : r.palette.text.primary,
112
- style: {
113
- fontSize: t.labelFontSize ? t.labelFontSize : d,
114
- ...b
115
- },
116
- textAnchor: "middle",
117
- x,
118
- y: h - 28 + T / 2,
119
- children: f
120
- }
121
- )
122
- ] }),
123
- t.showMark && /* @__PURE__ */ e(
124
- "path",
125
- {
126
- cursor: u ? "pointer" : "unset",
127
- d: "M4.514,0A4.514,4.514,0,1,1,-4.514,0A4.514,4.514,0,1,1,4.514,0",
128
- height: "20px",
129
- onClick: (j) => {
130
- u?.(j, t.dataIndex);
131
- },
132
- onMouseEnter: () => {
133
- m?.(t.dataIndex);
134
- },
135
- onMouseLeave: () => {
136
- c?.();
137
- },
138
- style: {
139
- fill: o?.fill ? o.fill : r.palette.background.paper,
140
- stroke: o?.stroke ? o.stroke : r.palette.primary.main,
141
- strokeWidth: 2,
142
- transform: `translate(${t.x}px, ${t.y}px)`,
143
- transformOrigin: `${t.x}px, ${t.y}px`,
144
- filter: o?.filter ? o.filter : "none"
145
- },
146
- width: "20px"
147
- }
148
- )
149
- ] });
150
- };
151
- function $t({
152
- customLabels: t,
153
- labels: r = [],
154
- series: s,
155
- valueFormatterString: o = "0,0"
156
- }) {
157
- const b = pt(), x = W(), h = b?.[0];
158
- if (!h) return null;
159
- const { axisValue: u, dataIndex: m = 0 } = h;
160
- if (t) {
161
- const c = t[m]?.[0]?.header || String(u);
162
- return /* @__PURE__ */ a(
163
- M,
164
- {
165
- sx: {
166
- backgroundColor: x.palette.background.paper,
167
- boxShadow: "0 2px 8px 0 rgba(0, 0, 0, 0.12)",
168
- flexDirection: "column",
169
- alignItems: "flex-start",
170
- borderRadius: "4px",
171
- width: 250,
172
- gap: 8,
173
- px: 16,
174
- py: 12
175
- },
176
- children: [
177
- /* @__PURE__ */ a(
178
- M,
179
- {
180
- sx: {
181
- flexDirection: "row",
182
- justifyContent: "space-between",
183
- alignItems: "center",
184
- alignSelf: "stretch",
185
- gap: 8,
186
- marginTop: 4
187
- },
188
- children: [
189
- /* @__PURE__ */ e(l, { variant: "H3", children: c }),
190
- /* @__PURE__ */ e(l, { bold: !0, variant: "H3", children: p(s[0]?.data[m], o) })
191
- ]
192
- }
193
- ),
194
- t[m]?.some((i) => (typeof i == "string" ? 0 : i.amount) !== 0) ? t[m]?.map((i) => {
195
- const f = typeof i == "string" ? i : i.label, d = typeof i == "string" ? 0 : i.amount;
196
- return d === 0 ? null : /* @__PURE__ */ a(
197
- M,
198
- {
199
- sx: {
200
- flexDirection: "row",
201
- justifyContent: "space-between",
202
- alignItems: "center",
203
- alignSelf: "stretch",
204
- gap: 8,
205
- marginTop: 4
206
- },
207
- children: [
208
- /* @__PURE__ */ a(
209
- M,
210
- {
211
- sx: {
212
- flexDirection: "row",
213
- alignItems: "center",
214
- gap: 8,
215
- flex: 1,
216
- minWidth: 0
217
- },
218
- children: [
219
- /* @__PURE__ */ e(
220
- F,
221
- {
222
- sx: {
223
- width: "12px",
224
- height: "12px",
225
- backgroundColor: s[0]?.color,
226
- borderRadius: "4px"
227
- }
228
- }
229
- ),
230
- /* @__PURE__ */ e(l, { variant: "Body", children: f })
231
- ]
232
- }
233
- ),
234
- /* @__PURE__ */ e(l, { bold: !0, variant: "Body", children: p(Math.abs(d), o) })
235
- ]
236
- },
237
- f
238
- );
239
- }) : /* @__PURE__ */ e(l, { variant: "Body", children: "No data" })
240
- ]
241
- }
242
- );
243
- }
244
- return /* @__PURE__ */ a(
245
- M,
246
- {
247
- sx: {
248
- backgroundColor: x.palette.background.paper,
249
- boxShadow: "0 2px 8px 0 rgba(0, 0, 0, 0.12)",
250
- flexDirection: "column",
251
- alignItems: "flex-start",
252
- borderRadius: "4px",
253
- width: 225,
254
- gap: 8,
255
- px: 16,
256
- py: 12
257
- },
258
- children: [
259
- /* @__PURE__ */ e(l, { variant: "H3", children: String(u) }),
260
- s.map((c, i) => /* @__PURE__ */ a(
261
- M,
262
- {
263
- sx: {
264
- flexDirection: "row",
265
- justifyContent: "space-between",
266
- alignItems: "center",
267
- alignSelf: "stretch",
268
- gap: 8,
269
- marginTop: 4
270
- },
271
- children: [
272
- /* @__PURE__ */ a(M, { sx: { flexDirection: "row", alignItems: "center", gap: 8 }, children: [
273
- /* @__PURE__ */ e(
274
- F,
275
- {
276
- sx: {
277
- width: "12px",
278
- height: "12px",
279
- backgroundColor: c.color,
280
- borderRadius: "4px"
281
- }
282
- }
283
- ),
284
- /* @__PURE__ */ e(l, { variant: "Body", children: typeof r[i] == "string" ? r[i] : r[i]?.label })
285
- ] }),
286
- /* @__PURE__ */ e(l, { bold: !0, variant: "Body", children: p(c.data[m], o) })
287
- ]
288
- },
289
- c.id
290
- ))
291
- ]
292
- }
293
- );
294
- }
295
- const _t = ({
296
- areaColor: t,
297
- axisColor: r,
298
- baseline: s = "max",
299
- chartFor: o,
300
- chartXaxisSx: b,
301
- chartYaxisSx: x,
302
- colors: h,
303
- curveType: u = "linear",
304
- customLegendVariant: m,
305
- customLegendSx: c,
306
- customLegendBoxSx: i,
307
- customTooltipLabels: f,
308
- datasets: d,
309
- height: D,
310
- isGraphClippingXAxis: T = !1,
311
- labels: A,
312
- labelBackgroundColor: B,
313
- labelFontColor: j,
314
- labelFontSize: q,
315
- margin: Q,
316
- markHandlers: U,
317
- markStyles: V,
318
- minRange: J,
319
- maxRange: K,
320
- onItemClick: z,
321
- peerAverage: E,
322
- showArea: H = !1,
323
- showAverage: G = !1,
324
- showAxisHighlight: Z = !1,
325
- showBars: N = !1,
326
- showLegend: _ = !1,
327
- showMark: tt = !0,
328
- showMarkLabel: et = !1,
329
- showTooltip: nt = !1,
330
- showXAxis: rt = !1,
331
- showXAxisTicks: at = !1,
332
- showYAxis: it = !1,
333
- showYAxisTicks: ot = !1,
334
- title: lt,
335
- useCustomMark: st = !1,
336
- valueFormatterString: k,
337
- width: ct,
338
- xAxisScaleType: dt
339
- }) => {
340
- const y = W(), ht = d.flat().map((n) => n.x), C = d.flat().map((n) => n.y), O = E || Math.round(C.reduce((n, v) => v + n, 0) / C.length), w = Math.floor(Math.min(...C) / 100) * 100, L = Math.ceil(Math.max(...C) / 100) * 100, I = d.map((n, v) => ({
341
- type: N ? "bar" : "line",
342
- curve: u,
343
- color: N ? y.palette.chart?.chart6 : h[v] ?? y.palette.primary.main,
344
- data: n.map((g) => g.y),
345
- area: H,
346
- baseline: s,
347
- showMark: !0,
348
- valueFormatter: (g) => k ? p(g || 0, k) : String(g)
349
- })), mt = {
350
- ...{
351
- top: 60,
352
- right: 35,
353
- bottom: 25,
354
- left: -8
355
- },
356
- ...Q
357
- };
358
- let S = J ?? w, R = K ?? L;
359
- if (o === "networthChart") {
360
- const n = L - w, v = n < L * 0.05 ? 0.25 : 0.2, g = Math.max(n * v, L * 0.015);
361
- S = w - g < 0 ? w : w - g, R = L + g;
362
- }
363
- const ut = () => {
364
- if (o === "creditOverTime")
365
- return X(S, 850, 5);
366
- if (o === "networthChart")
367
- return X(S, R, 5);
368
- };
369
- return /* @__PURE__ */ a(
370
- Y,
371
- {
372
- sx: {
373
- position: "relative",
374
- touchAction: "pan-y",
375
- // Allow vertical scrolling
376
- "& svg": {
377
- touchAction: "pan-y",
378
- // Allow vertical scrolling on SVG
379
- userSelect: "none"
380
- // Prevent text selection
381
- },
382
- "& .recharts-wrapper": {
383
- touchAction: "pan-y"
384
- // For Recharts library specifically
385
- }
386
- },
387
- children: [
388
- /* @__PURE__ */ a(
389
- xt,
390
- {
391
- height: D,
392
- margin: mt,
393
- series: I,
394
- sx: {
395
- "& .MuiBarLabel-root": {
396
- fontSize: 10,
397
- fontWeight: 600
398
- },
399
- "& .MuiAreaElement-root": {
400
- opacity: 0.15
401
- },
402
- "& .MuiChartsAxis-tickLabel > tspan": {
403
- fontFamily: y.typography.Small.fontFamily
404
- },
405
- "& .MuiLineChart-markLabel": {
406
- fontFamily: y.typography.Small.fontFamily
407
- }
408
- },
409
- width: ct,
410
- xAxis: [{ data: ht, scaleType: dt || (N ? "band" : "point") }],
411
- yAxis: [
412
- {
413
- tickInterval: ut(),
414
- min: T ? -22 : S,
415
- max: R || 100,
416
- colorMap: H && I.length < 2 ? {
417
- type: "continuous",
418
- min: S,
419
- max: R,
420
- color: [
421
- y.palette.background.paper,
422
- h[0] ?? y.palette.primary.main
423
- ]
424
- } : void 0,
425
- valueFormatter: (n) => k ? p(n, k) : String(n),
426
- width: 60
427
- }
428
- ],
429
- children: [
430
- G && /* @__PURE__ */ e(
431
- gt,
432
- {
433
- lineStyle: {
434
- stroke: B ? y.palette.neutral.main : y.palette.neutral.dark,
435
- strokeDasharray: "10, 8",
436
- strokeWidth: 2
437
- },
438
- y: O
439
- }
440
- ),
441
- /* @__PURE__ */ e(
442
- Ct,
443
- {
444
- onItemClick: z,
445
- ...t && {
446
- slots: {
447
- area: (n) => /* @__PURE__ */ a("g", { children: [
448
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ a("linearGradient", { id: "customGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
449
- /* @__PURE__ */ e("stop", { offset: "0%", stopColor: t }),
450
- /* @__PURE__ */ e("stop", { offset: "100%", stopColor: t, stopOpacity: 0.02 })
451
- ] }) }),
452
- /* @__PURE__ */ e("path", { ...n, fill: "url(#customGradient)" })
453
- ] })
454
- }
455
- }
456
- }
457
- ),
458
- /* @__PURE__ */ e(
459
- wt,
460
- {
461
- onItemClick: z,
462
- slots: {
463
- line: (n) => /* @__PURE__ */ e(
464
- It,
465
- {
466
- ...n,
467
- lineColor: t ?? n.ownerState.color ?? y.palette.primary.main
468
- }
469
- )
470
- }
471
- }
472
- ),
473
- /* @__PURE__ */ e(
474
- Lt,
475
- {
476
- onItemClick: z,
477
- slots: st ? {
478
- mark: (n) => /* @__PURE__ */ e(
479
- Rt,
480
- {
481
- handlers: U,
482
- labelBackgroundColor: B,
483
- labelFontColor: j,
484
- labelFontSize: q,
485
- showLabel: et,
486
- showMark: tt || n.dataIndex === d[0].length - 1,
487
- style: V?.(n.dataIndex) ?? {},
488
- valueFormatterString: k,
489
- yData: C,
490
- ...n
491
- }
492
- )
493
- } : void 0
494
- }
495
- ),
496
- /* @__PURE__ */ e(
497
- ft,
498
- {
499
- barLabel: (n) => Number(n.value) > 0 ? `$${n.value}` : null,
500
- borderRadius: 10
501
- }
502
- ),
503
- /* @__PURE__ */ e(
504
- kt,
505
- {
506
- disableLine: !rt,
507
- disableTicks: !at,
508
- slotProps: r ? {
509
- axisLine: {
510
- style: {
511
- stroke: r
512
- }
513
- },
514
- axisTick: {
515
- style: {
516
- stroke: r
517
- }
518
- }
519
- } : {},
520
- sx: { ...b }
521
- }
522
- ),
523
- /* @__PURE__ */ e(
524
- Mt,
525
- {
526
- disableLine: !it,
527
- disableTicks: !ot,
528
- slotProps: r ? {
529
- axisLine: {
530
- style: {
531
- stroke: r
532
- }
533
- },
534
- axisTick: {
535
- style: {
536
- stroke: r
537
- }
538
- }
539
- } : {},
540
- sx: { ...x }
541
- }
542
- ),
543
- Z && /* @__PURE__ */ e(yt, { x: "line" }),
544
- nt && /* @__PURE__ */ e(bt, { trigger: "axis", children: /* @__PURE__ */ e(
545
- $t,
546
- {
547
- customLabels: f,
548
- labels: A,
549
- series: I,
550
- valueFormatterString: k
551
- }
552
- ) })
553
- ]
554
- }
555
- ),
556
- _ && /* @__PURE__ */ e(
557
- Bt,
558
- {
559
- average: G ? O : void 0,
560
- customLegendBoxSx: i,
561
- customLegendVariant: m,
562
- labels: A,
563
- series: I,
564
- style: {
565
- position: "absolute",
566
- top: 16,
567
- left: 16,
568
- ...c
569
- },
570
- title: lt,
571
- valueFormatterString: k
572
- }
573
- )
574
- ]
575
- }
576
- );
577
- };
578
- export {
579
- _t as L
580
- };