@mx-cartographer/experiences 9.7.25 → 9.7.27
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 +8 -0
- package/dist/common/components/MiniWidgetContainer.es.js +35 -45
- package/dist/common/components/MiniWidgetContainer.es.js.map +1 -1
- package/dist/common/components/charts/LineChart.es.js +86 -85
- package/dist/common/components/charts/LineChart.es.js.map +1 -1
- package/dist/common/constants/Styles.d.ts +2 -0
- package/dist/common/constants/Styles.es.js +17 -0
- package/dist/common/constants/Styles.es.js.map +1 -0
- package/dist/common/constants/index.d.ts +1 -0
- package/dist/common/hooks/useAriaLive.es.js +12 -22
- package/dist/common/hooks/useAriaLive.es.js.map +1 -1
- package/dist/common/index.es.js +111 -109
- package/dist/core/stores/TrendsStore.d.ts +5 -0
- package/dist/core/types/Insights.d.ts +3 -0
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +2 -0
- package/dist/core/utils/DateUtil.d.ts +2 -0
- package/dist/core/utils/DateUtil.es.js +37 -35
- package/dist/core/utils/DateUtil.es.js.map +1 -1
- package/dist/core/utils/NumberFormatting.d.ts +1 -0
- package/dist/core/utils/NumberFormatting.es.js +14 -13
- package/dist/core/utils/NumberFormatting.es.js.map +1 -1
- package/dist/core/utils/TrendsUtil.d.ts +5 -0
- package/dist/core/utils/TrendsUtil.es.js +67 -59
- package/dist/core/utils/TrendsUtil.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.d.ts +3 -0
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js +101 -0
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendDaysBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendGraphic.d.ts +5 -0
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendGraphic.es.js +108 -0
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/NoSpendGraphic.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/NoSpendDaysBlock/index.d.ts +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
- package/dist/insights-v2/index.es.js +87 -85
- package/dist/insights-v2/mappings/blocks.es.js +44 -42
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionList.d.ts +4 -0
- package/dist/transactions/components/shared/TransactionList.es.js +138 -84
- package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
- package/dist/trends/components/CategoryDetailChart.d.ts +2 -1
- package/dist/trends/components/CategoryDetailChart.es.js +55 -35
- package/dist/trends/components/CategoryDetailChart.es.js.map +1 -1
- package/dist/trends/components/CategoryDetails.es.js +68 -71
- package/dist/trends/components/CategoryDetails.es.js.map +1 -1
- package/dist/trends/utils/TrendsTable.es.js +25 -25
- package/dist/trends/utils/TrendsTable.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [9.7.27] - 10-21-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - `no_spend_days_block` for Weekly No Spend Days
|
|
4
|
+
|
|
5
|
+
## [9.7.26] - 10-21-2026
|
|
6
|
+
|
|
7
|
+
- **FIXED** - a11y issues in line charts and transaction lists (MEW-4023)
|
|
8
|
+
|
|
1
9
|
## [9.7.25] - 10-21-2026
|
|
2
10
|
|
|
3
11
|
- **CHANGED** - The card's action label (shown when there is no primary CTA button: the mini card's `primary_cta` / `in_description_cta`, e.g. Unified Deposit Payroll Advance's "View Details", and a full card's block-less `in_description_cta`) is a blue text `Button` instead of plain text, so it is visibly clickable and focusable. It has no handler of its own and does not stop the click, so the tap still reaches the host's card handler (Pulse posts `carousel/cta`) and never opens the action drawer (WEC-1929)
|
|
@@ -1,47 +1,37 @@
|
|
|
1
1
|
import { WidgetContainerProvider as j } from "../context/WidgetContainerProvider.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { VISUALLY_HIDDEN_SX as z } from "../constants/Styles.es.js";
|
|
3
|
+
import { useDimensions as y } from "../hooks/useDimensions.es.js";
|
|
4
|
+
import c from "react";
|
|
5
|
+
import { H3 as D, P as R, Text as S } from "@mxenabled/mxui";
|
|
5
6
|
import W from "@mui/material/Button";
|
|
6
|
-
import { ChevronRight as
|
|
7
|
-
import { Fragment as
|
|
7
|
+
import { ChevronRight as w, Icon as F } from "@mxenabled/mx-icons";
|
|
8
|
+
import { Fragment as L, jsx as i, jsxs as r } from "react/jsx-runtime";
|
|
8
9
|
import s from "@mui/material/Box";
|
|
9
10
|
import T from "@mui/material/IconButton";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
var
|
|
14
|
-
const [
|
|
15
|
-
return /* @__PURE__ */ r(
|
|
16
|
-
"aria-label":
|
|
17
|
-
"aria-labelledby":
|
|
11
|
+
import V from "@mui/material/Card";
|
|
12
|
+
import _ from "@mui/material/CardContent";
|
|
13
|
+
import $ from "@mui/material/CardHeader";
|
|
14
|
+
var Q = ({ children: p, className: h = "mx-cmn-mini-widget", closeLabel: f, contentStyles: x, onClose: n, onPrimaryCtaClick: t, primaryCtaLabel: b = "", primaryCtaLabelAria: g = "", subTitle: a = "", sx: I = {}, title: e = "", titleAria: u, summaryAria: o }) => {
|
|
15
|
+
const [v, { height: B, width: C }] = y(), l = c.useId(), d = c.useId(), m = !!e, H = m ? [l, o && d].filter(Boolean).join(" ") : void 0;
|
|
16
|
+
return /* @__PURE__ */ r(V, {
|
|
17
|
+
"aria-label": m ? void 0 : [u, o].filter(Boolean).join(", ") || void 0,
|
|
18
|
+
"aria-labelledby": H,
|
|
18
19
|
className: h,
|
|
19
20
|
component: "section",
|
|
20
21
|
sx: {
|
|
21
22
|
touchAction: "manipulation",
|
|
22
|
-
...
|
|
23
|
+
...I
|
|
23
24
|
},
|
|
24
25
|
children: [
|
|
25
|
-
|
|
26
|
+
o && /* @__PURE__ */ i(s, {
|
|
26
27
|
"aria-hidden": "true",
|
|
27
28
|
id: d,
|
|
28
|
-
sx:
|
|
29
|
-
|
|
30
|
-
width: "1px",
|
|
31
|
-
height: "1px",
|
|
32
|
-
padding: 0,
|
|
33
|
-
margin: "-1px",
|
|
34
|
-
overflow: "hidden",
|
|
35
|
-
clip: "rect(0 0 0 0)",
|
|
36
|
-
clipPath: "inset(50%)",
|
|
37
|
-
whiteSpace: "nowrap",
|
|
38
|
-
border: 0
|
|
39
|
-
},
|
|
40
|
-
children: e
|
|
29
|
+
sx: z,
|
|
30
|
+
children: o
|
|
41
31
|
}),
|
|
42
|
-
/* @__PURE__ */ i(
|
|
32
|
+
/* @__PURE__ */ i($, {
|
|
43
33
|
sx: { pb: 8 },
|
|
44
|
-
title: /* @__PURE__ */ r(
|
|
34
|
+
title: /* @__PURE__ */ r(L, { children: [/* @__PURE__ */ r(s, {
|
|
45
35
|
sx: {
|
|
46
36
|
alignItems: "center",
|
|
47
37
|
display: "grid",
|
|
@@ -49,29 +39,29 @@ var X = ({ children: p, className: h = "mx-cmn-mini-widget", closeLabel: f, cont
|
|
|
49
39
|
gridTemplateColumns: "1fr auto",
|
|
50
40
|
pb: 4
|
|
51
41
|
},
|
|
52
|
-
children: [
|
|
42
|
+
children: [e && /* @__PURE__ */ i(D, {
|
|
53
43
|
id: l,
|
|
54
|
-
children:
|
|
55
|
-
}),
|
|
44
|
+
children: e
|
|
45
|
+
}), n ? /* @__PURE__ */ i(T, {
|
|
56
46
|
"aria-label": f,
|
|
57
|
-
onClick:
|
|
47
|
+
onClick: n,
|
|
58
48
|
size: "small",
|
|
59
|
-
children: /* @__PURE__ */ i(
|
|
49
|
+
children: /* @__PURE__ */ i(F, {
|
|
60
50
|
name: "close",
|
|
61
51
|
size: 24
|
|
62
52
|
})
|
|
63
|
-
}) :
|
|
64
|
-
"aria-label":
|
|
65
|
-
endIcon: /* @__PURE__ */ i(
|
|
66
|
-
onClick:
|
|
53
|
+
}) : t && /* @__PURE__ */ i(W, {
|
|
54
|
+
"aria-label": g,
|
|
55
|
+
endIcon: /* @__PURE__ */ i(w, {}),
|
|
56
|
+
onClick: t,
|
|
67
57
|
size: "small",
|
|
68
|
-
children: /* @__PURE__ */ i(
|
|
58
|
+
children: /* @__PURE__ */ i(S, {
|
|
69
59
|
bold: !0,
|
|
70
60
|
variant: "body2",
|
|
71
|
-
children:
|
|
61
|
+
children: b
|
|
72
62
|
})
|
|
73
63
|
})]
|
|
74
|
-
}), a && /* @__PURE__ */ i(
|
|
64
|
+
}), a && /* @__PURE__ */ i(R, {
|
|
75
65
|
color: "text.secondary",
|
|
76
66
|
sx: {
|
|
77
67
|
fontSize: 15,
|
|
@@ -81,8 +71,8 @@ var X = ({ children: p, className: h = "mx-cmn-mini-widget", closeLabel: f, cont
|
|
|
81
71
|
children: a
|
|
82
72
|
})] })
|
|
83
73
|
}),
|
|
84
|
-
/* @__PURE__ */ i(
|
|
85
|
-
ref:
|
|
74
|
+
/* @__PURE__ */ i(_, {
|
|
75
|
+
ref: v,
|
|
86
76
|
sx: {
|
|
87
77
|
p: 0,
|
|
88
78
|
...x
|
|
@@ -97,7 +87,7 @@ var X = ({ children: p, className: h = "mx-cmn-mini-widget", closeLabel: f, cont
|
|
|
97
87
|
});
|
|
98
88
|
};
|
|
99
89
|
export {
|
|
100
|
-
|
|
90
|
+
Q as default
|
|
101
91
|
};
|
|
102
92
|
|
|
103
93
|
//# sourceMappingURL=MiniWidgetContainer.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiniWidgetContainer.es.js","names":[],"sources":["../../../src/common/components/MiniWidgetContainer.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport CardHeader from '@mui/material/CardHeader'\nimport CardContent from '@mui/material/CardContent'\nimport IconButton from '@mui/material/IconButton'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { H3, P, Text } from '@mxenabled/mxui'\n\nimport { WidgetContainerProvider } from '../context'\nimport { useDimensions } from '../hooks/useDimensions'\n\ninterface CardContainerProps {\n className?: string\n closeLabel?: string\n contentStyles?: SxProps\n onClose?: () => void\n onPrimaryCtaClick?: () => void\n primaryCtaLabel?: string\n primaryCtaLabelAria?: string\n subTitle?: string\n sx?: SxProps\n title?: string\n /**\n * Accessible name for the widget region when no visible `title` is rendered.\n * When `title` is present, the region is labelled by the title text instead.\n */\n titleAria?: string\n /**\n * Extra summary read after the title when the screen-reader cursor lands on\n * the region (e.g. \"$240 left in budgets\"). Appended to the region's\n * accessible name via a visually-hidden node so it is announced but not shown.\n */\n summaryAria?: string\n}\n\nconst MiniWidgetContainer: React.FC<React.PropsWithChildren<CardContainerProps>> = ({\n children,\n className = 'mx-cmn-mini-widget',\n closeLabel,\n contentStyles,\n onClose,\n onPrimaryCtaClick,\n primaryCtaLabel = '',\n primaryCtaLabelAria = '',\n subTitle = '',\n sx = {},\n title = '',\n titleAria,\n summaryAria,\n}) => {\n const [containerRef, { height, width }] = useDimensions()\n const titleId = React.useId()\n const summaryId = React.useId()\n const hasVisibleTitle = Boolean(title)\n\n // aria-labelledby wins when a title is visible (name = title [+ summary]);\n // otherwise fall back to a plain aria-label.\n const labelledBy = hasVisibleTitle\n ? [titleId, summaryAria && summaryId].filter(Boolean).join(' ')\n : undefined\n\n return (\n <Card\n aria-label={\n hasVisibleTitle\n ? undefined\n : [titleAria, summaryAria].filter(Boolean).join(', ') || undefined\n }\n aria-labelledby={labelledBy}\n className={className}\n component=\"section\"\n sx={{ touchAction: 'manipulation', ...sx }}\n >\n {summaryAria && (\n // aria-hidden keeps this out of the browse cursor as a standalone stop;\n // aria-labelledby still pulls the text into the region's accessible name.\n <Box
|
|
1
|
+
{"version":3,"file":"MiniWidgetContainer.es.js","names":[],"sources":["../../../src/common/components/MiniWidgetContainer.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport CardHeader from '@mui/material/CardHeader'\nimport CardContent from '@mui/material/CardContent'\nimport IconButton from '@mui/material/IconButton'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { H3, P, Text } from '@mxenabled/mxui'\n\nimport { WidgetContainerProvider } from '../context'\nimport { useDimensions } from '../hooks/useDimensions'\nimport { VISUALLY_HIDDEN_SX } from '../constants/Styles'\n\ninterface CardContainerProps {\n className?: string\n closeLabel?: string\n contentStyles?: SxProps\n onClose?: () => void\n onPrimaryCtaClick?: () => void\n primaryCtaLabel?: string\n primaryCtaLabelAria?: string\n subTitle?: string\n sx?: SxProps\n title?: string\n /**\n * Accessible name for the widget region when no visible `title` is rendered.\n * When `title` is present, the region is labelled by the title text instead.\n */\n titleAria?: string\n /**\n * Extra summary read after the title when the screen-reader cursor lands on\n * the region (e.g. \"$240 left in budgets\"). Appended to the region's\n * accessible name via a visually-hidden node so it is announced but not shown.\n */\n summaryAria?: string\n}\n\nconst MiniWidgetContainer: React.FC<React.PropsWithChildren<CardContainerProps>> = ({\n children,\n className = 'mx-cmn-mini-widget',\n closeLabel,\n contentStyles,\n onClose,\n onPrimaryCtaClick,\n primaryCtaLabel = '',\n primaryCtaLabelAria = '',\n subTitle = '',\n sx = {},\n title = '',\n titleAria,\n summaryAria,\n}) => {\n const [containerRef, { height, width }] = useDimensions()\n const titleId = React.useId()\n const summaryId = React.useId()\n const hasVisibleTitle = Boolean(title)\n\n // aria-labelledby wins when a title is visible (name = title [+ summary]);\n // otherwise fall back to a plain aria-label.\n const labelledBy = hasVisibleTitle\n ? [titleId, summaryAria && summaryId].filter(Boolean).join(' ')\n : undefined\n\n return (\n <Card\n aria-label={\n hasVisibleTitle\n ? undefined\n : [titleAria, summaryAria].filter(Boolean).join(', ') || undefined\n }\n aria-labelledby={labelledBy}\n className={className}\n component=\"section\"\n sx={{ touchAction: 'manipulation', ...sx }}\n >\n {summaryAria && (\n // aria-hidden keeps this out of the browse cursor as a standalone stop;\n // aria-labelledby still pulls the text into the region's accessible name.\n <Box aria-hidden=\"true\" id={summaryId} sx={VISUALLY_HIDDEN_SX}>\n {summaryAria}\n </Box>\n )}\n <CardHeader\n sx={{ pb: 8 }}\n title={\n <>\n <Box\n sx={{\n alignItems: 'center',\n display: 'grid',\n gap: 2,\n gridTemplateColumns: '1fr auto',\n pb: 4,\n }}\n >\n {title && <H3 id={titleId}>{title}</H3>}\n\n {onClose ? (\n <IconButton aria-label={closeLabel} onClick={onClose} size=\"small\">\n <Icon name=\"close\" size={24} />\n </IconButton>\n ) : (\n onPrimaryCtaClick && (\n <Button\n aria-label={primaryCtaLabelAria}\n endIcon={<ChevronRight />}\n onClick={onPrimaryCtaClick}\n size=\"small\"\n >\n <Text bold={true} variant=\"body2\">\n {primaryCtaLabel}\n </Text>\n </Button>\n )\n )}\n </Box>\n\n {subTitle && (\n <P color=\"text.secondary\" sx={{ fontSize: 15, lineHeight: '20px' }} variant=\"body2\">\n {subTitle}\n </P>\n )}\n </>\n }\n />\n\n <CardContent ref={containerRef} sx={{ p: 0, ...contentStyles }}>\n <WidgetContainerProvider availableHeight={height} availableWidth={width}>\n {children}\n </WidgetContainerProvider>\n </CardContent>\n </Card>\n )\n}\n\nexport default MiniWidgetContainer\n"],"mappings":";;;;;;;;;;;;;AA2CA,IAAM,IAAA,CAA8E,EAClF,UAAA,GACA,WAAA,IAAY,sBACZ,YAAA,GACA,eAAA,GACA,SAAA,GACA,mBAAA,GACA,iBAAA,IAAkB,IAClB,qBAAA,IAAsB,IACtB,UAAA,IAAW,IACX,IAAA,IAAK,CAAC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A,EAAC,GAAD;AAAA,YACE,cAAY;AAAA,YACZ,SAAS,gBAAA,EAAC,GAAD,CAAe,CAAA;AAAA,YACxB,SAAS;AAAA,YACT,MAAK;AAAA,YAEL,UAAA,gBAAA,EAAC,GAAD;AAAA,cAAM,MAAM;AAAA,cAAM,SAAQ;AAAA,cACvB,UAAA;AAAA,YACG,CAAA;AAAA,UACA,CAAA,CAGT;AAAA,QAEJ,CAAA,GAAA,KACC,gBAAA,EAAC,GAAD;AAAA,UAAG,OAAM;AAAA,UAAiB,IAAI;AAAA,YAAE,UAAU;AAAA,YAAI,YAAY;AAAA,UAAO;AAAA,UAAG,SAAQ;AAAA,UACzE,UAAA;AAAA,QACA,CAAA,CAEL,EAAA,CAAA;AAAA,MAEL,CAAA;AAAA,MAED,gBAAA,EAAC,GAAD;AAAA,QAAa,KAAK;AAAA,QAAc,IAAI;AAAA,UAAE,GAAG;AAAA,UAAG,GAAG;AAAA,QAAc;AAAA,QAC3D,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAyB,iBAAiB;AAAA,UAAQ,gBAAgB;AAAA,UAC/D,UAAA;AAAA,QACsB,CAAA;AAAA,MACd,CAAA;AAAA,IACT;AAAA;AAEV"}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { formatCurrency as
|
|
2
|
-
import { stripChartSlotProps as
|
|
3
|
-
import { getMarkerShape as
|
|
4
|
-
import
|
|
5
|
-
import { CustomLine as
|
|
1
|
+
import { formatCurrency as P, generateEqualIntervals as R, roundedAverage as ft } from "../../../core/utils/NumberFormatting.es.js";
|
|
2
|
+
import { stripChartSlotProps as ct } from "./chartSlotProps.es.js";
|
|
3
|
+
import { getMarkerShape as ht } from "./linechart/utils/markerShapes.es.js";
|
|
4
|
+
import yt from "./linechart/CustomLegend.es.js";
|
|
5
|
+
import { CustomLine as dt } from "./linechart/CustomLine.es.js";
|
|
6
6
|
import { CustomMark as ut } from "./linechart/CustomMark.es.js";
|
|
7
|
-
import { CustomTooltip as
|
|
7
|
+
import { CustomTooltip as xt } from "./linechart/CustomTooltip.es.js";
|
|
8
8
|
import "react";
|
|
9
|
-
import { jsx as e, jsxs as
|
|
10
|
-
import { useTheme as
|
|
11
|
-
import
|
|
9
|
+
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
10
|
+
import { useTheme as gt } from "@mui/material/styles";
|
|
11
|
+
import bt from "@mui/material/Box";
|
|
12
12
|
import { BarPlot as kt } from "@mui/x-charts/BarChart";
|
|
13
|
-
import { ChartContainer as
|
|
14
|
-
import { ChartsAxisHighlight as
|
|
15
|
-
import { ChartsText as
|
|
16
|
-
import { ChartsReferenceLine as
|
|
13
|
+
import { ChartContainer as Lt } from "@mui/x-charts/ChartContainer";
|
|
14
|
+
import { ChartsAxisHighlight as Mt } from "@mui/x-charts/ChartsAxisHighlight";
|
|
15
|
+
import { ChartsText as I } from "@mui/x-charts/ChartsText";
|
|
16
|
+
import { ChartsReferenceLine as vt } from "@mui/x-charts/ChartsReferenceLine";
|
|
17
17
|
import { ChartsTooltipContainer as Tt } from "@mui/x-charts/ChartsTooltip";
|
|
18
|
-
import { ChartsXAxis as
|
|
19
|
-
import { ChartsYAxis as
|
|
20
|
-
import { AreaPlot as
|
|
21
|
-
var
|
|
22
|
-
const a = typeof r.text == "string" ? r.text : "",
|
|
23
|
-
return
|
|
18
|
+
import { ChartsXAxis as At } from "@mui/x-charts/ChartsXAxis";
|
|
19
|
+
import { ChartsYAxis as Ct } from "@mui/x-charts/ChartsYAxis";
|
|
20
|
+
import { AreaPlot as Pt, LinePlot as Rt, MarkPlot as It } from "@mui/x-charts/LineChart";
|
|
21
|
+
var St = (r) => {
|
|
22
|
+
const a = typeof r.text == "string" ? r.text : "", f = Array.from(a.trim())[0] ?? "";
|
|
23
|
+
return f ? /* @__PURE__ */ e(I, {
|
|
24
24
|
...r,
|
|
25
25
|
"aria-label": a,
|
|
26
26
|
role: "img",
|
|
27
|
-
text:
|
|
28
|
-
}) : /* @__PURE__ */ e(
|
|
29
|
-
},
|
|
30
|
-
const i =
|
|
31
|
-
type:
|
|
32
|
-
curve:
|
|
33
|
-
color:
|
|
34
|
-
data: t.map((
|
|
35
|
-
area:
|
|
36
|
-
baseline:
|
|
27
|
+
text: f
|
|
28
|
+
}) : /* @__PURE__ */ e(I, { ...r });
|
|
29
|
+
}, wt = { axisTickLabel: St }, Ft = ({ areaColor: r, axisColor: a, baseline: f = "max", chartFor: x, chartXaxisSx: S, chartYaxisSx: w, colors: k, curveType: O = "linear", customLegendVariant: _, customLegendSx: D, customLegendBoxSx: G, customTooltipLabels: N, datasets: c, height: W, isCurrency: X, isGraphClippingXAxis: $ = !1, labels: L, labelBackgroundColor: M, labelFontColor: j, labelFontSize: E, margin: q, markHandlers: z, markStyles: H, minRange: Y, maxRange: B, narrowXAxisLabels: v = !1, showAllXAxisLabels: J = !1, onItemClick: g, peerAverage: K, showArea: T = !1, showAverage: A = !1, showAxisHighlight: Q = !1, showBars: b = !1, showLegend: U = !1, showMark: V = !0, showMarkLabel: Z = !1, showTooltip: F = !1, showXAxis: tt = !1, showXAxisTicks: et = !1, showYAxis: rt = !1, showYAxisTicks: at = !1, title: it, useCustomMark: ot = !1, valueFormatterString: n, width: nt, xAxisScaleType: st }) => {
|
|
30
|
+
const i = gt(), lt = c.flat().map((t) => t.x), s = c.flat().map((t) => t.y), C = K || ft(s), l = s.length ? Math.floor(Math.min(...s) / 100) * 100 : 0, m = s.length ? Math.ceil(Math.max(...s) / 100) * 100 : 0, h = c.map((t, d) => ({
|
|
31
|
+
type: b ? "bar" : "line",
|
|
32
|
+
curve: O,
|
|
33
|
+
color: b ? i.palette.chart?.chart6 : k[d] ?? i.palette.primary.main,
|
|
34
|
+
data: t.map((o) => o.y),
|
|
35
|
+
area: T,
|
|
36
|
+
baseline: f,
|
|
37
37
|
showMark: !0,
|
|
38
|
-
shape:
|
|
39
|
-
valueFormatter: (
|
|
38
|
+
shape: ht(d),
|
|
39
|
+
valueFormatter: (o) => n ? P(o || 0, n) : String(o)
|
|
40
40
|
})), mt = {
|
|
41
41
|
top: 60,
|
|
42
42
|
right: 35,
|
|
43
43
|
bottom: 25,
|
|
44
44
|
left: -10,
|
|
45
|
-
...
|
|
45
|
+
...q
|
|
46
46
|
};
|
|
47
|
-
let p =
|
|
47
|
+
let p = Y ?? l, y = B ?? m;
|
|
48
48
|
if (x === "networthChart") {
|
|
49
|
-
const t =
|
|
50
|
-
p =
|
|
49
|
+
const t = m - l, d = t < m * 0.05 ? 0.25 : 0.2, o = Math.max(t * d, m * 0.015);
|
|
50
|
+
p = l - o < 0 ? l : l - o, y = m + o;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
if (x === "creditOverTime") return
|
|
54
|
-
if (x === "networthChart") return
|
|
52
|
+
const pt = () => {
|
|
53
|
+
if (x === "creditOverTime") return R(p, 850, 5);
|
|
54
|
+
if (x === "networthChart") return R(p, y, 5);
|
|
55
55
|
};
|
|
56
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ u(bt, {
|
|
57
57
|
sx: {
|
|
58
58
|
position: "relative",
|
|
59
59
|
touchAction: "pan-y",
|
|
@@ -63,10 +63,11 @@ var It = (r) => {
|
|
|
63
63
|
},
|
|
64
64
|
"& .recharts-wrapper": { touchAction: "pan-y" }
|
|
65
65
|
},
|
|
66
|
-
children: [/* @__PURE__ */
|
|
67
|
-
height:
|
|
66
|
+
children: [/* @__PURE__ */ u(Lt, {
|
|
67
|
+
height: W,
|
|
68
|
+
tabIndex: -1,
|
|
68
69
|
margin: mt,
|
|
69
|
-
series:
|
|
70
|
+
series: h,
|
|
70
71
|
sx: {
|
|
71
72
|
"& .MuiBarLabel-root": {
|
|
72
73
|
fontSize: 10,
|
|
@@ -79,34 +80,34 @@ var It = (r) => {
|
|
|
79
80
|
width: nt,
|
|
80
81
|
xAxis: [{
|
|
81
82
|
data: lt,
|
|
82
|
-
scaleType: st || (
|
|
83
|
-
...(
|
|
83
|
+
scaleType: st || (b ? "band" : "point"),
|
|
84
|
+
...(J || v) && { tickLabelInterval: () => !0 }
|
|
84
85
|
}],
|
|
85
86
|
yAxis: [{
|
|
86
|
-
tickInterval:
|
|
87
|
-
min:
|
|
88
|
-
max:
|
|
89
|
-
colorMap:
|
|
87
|
+
tickInterval: pt(),
|
|
88
|
+
min: $ ? -22 : p,
|
|
89
|
+
max: y || 100,
|
|
90
|
+
colorMap: T && h.length < 2 ? {
|
|
90
91
|
type: "continuous",
|
|
91
92
|
min: p,
|
|
92
|
-
max:
|
|
93
|
-
color: [i.palette.background.paper,
|
|
93
|
+
max: y,
|
|
94
|
+
color: [i.palette.background.paper, k[0] ?? i.palette.primary.main]
|
|
94
95
|
} : void 0,
|
|
95
|
-
valueFormatter: (t) =>
|
|
96
|
+
valueFormatter: (t) => n ? P(t, n) : String(t),
|
|
96
97
|
width: 62
|
|
97
98
|
}],
|
|
98
99
|
children: [
|
|
99
|
-
A && /* @__PURE__ */ e(
|
|
100
|
+
A && /* @__PURE__ */ e(vt, {
|
|
100
101
|
lineStyle: {
|
|
101
102
|
stroke: M ? i.palette.neutral.main : i.palette.neutral.dark,
|
|
102
103
|
strokeDasharray: "10, 8",
|
|
103
104
|
strokeWidth: 2
|
|
104
105
|
},
|
|
105
|
-
y:
|
|
106
|
+
y: C
|
|
106
107
|
}),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
108
|
+
/* @__PURE__ */ e(Pt, {
|
|
108
109
|
onItemClick: g,
|
|
109
|
-
...r && { slots: { area: (t) => /* @__PURE__ */
|
|
110
|
+
...r && { slots: { area: (t) => /* @__PURE__ */ u("g", { children: [/* @__PURE__ */ e("defs", { children: /* @__PURE__ */ u("linearGradient", {
|
|
110
111
|
id: "customGradient",
|
|
111
112
|
x1: "0",
|
|
112
113
|
x2: "0",
|
|
@@ -121,29 +122,29 @@ var It = (r) => {
|
|
|
121
122
|
stopOpacity: 0.02
|
|
122
123
|
})]
|
|
123
124
|
}) }), /* @__PURE__ */ e("path", {
|
|
124
|
-
...
|
|
125
|
+
...ct(t),
|
|
125
126
|
fill: "url(#customGradient)"
|
|
126
127
|
})] }) } }
|
|
127
128
|
}),
|
|
128
|
-
/* @__PURE__ */ e(
|
|
129
|
+
/* @__PURE__ */ e(Rt, {
|
|
129
130
|
onItemClick: g,
|
|
130
|
-
slots: { line: (t) => /* @__PURE__ */ e(
|
|
131
|
+
slots: { line: (t) => /* @__PURE__ */ e(dt, {
|
|
131
132
|
...t,
|
|
132
133
|
lineColor: r ?? t.ownerState.color ?? i.palette.primary.main
|
|
133
134
|
}) }
|
|
134
135
|
}),
|
|
135
|
-
/* @__PURE__ */ e(
|
|
136
|
+
/* @__PURE__ */ e(It, {
|
|
136
137
|
onItemClick: g,
|
|
137
138
|
slots: ot ? { mark: (t) => /* @__PURE__ */ e(ut, {
|
|
138
|
-
handlers:
|
|
139
|
+
handlers: z,
|
|
139
140
|
labelBackgroundColor: M,
|
|
140
|
-
labelFontColor:
|
|
141
|
-
labelFontSize:
|
|
141
|
+
labelFontColor: j,
|
|
142
|
+
labelFontSize: E,
|
|
142
143
|
showLabel: Z,
|
|
143
|
-
showMark: V || t.dataIndex ===
|
|
144
|
-
style:
|
|
145
|
-
valueFormatterString:
|
|
146
|
-
yData:
|
|
144
|
+
showMark: V || t.dataIndex === c[0].length - 1,
|
|
145
|
+
style: H?.(t.dataIndex) ?? {},
|
|
146
|
+
valueFormatterString: n,
|
|
147
|
+
yData: s,
|
|
147
148
|
...t
|
|
148
149
|
}) } : void 0
|
|
149
150
|
}),
|
|
@@ -151,56 +152,56 @@ var It = (r) => {
|
|
|
151
152
|
barLabel: (t) => Number(t.value) > 0 ? `$${t.value}` : null,
|
|
152
153
|
borderRadius: 10
|
|
153
154
|
}),
|
|
154
|
-
/* @__PURE__ */ e(
|
|
155
|
+
/* @__PURE__ */ e(At, {
|
|
155
156
|
disableLine: !tt,
|
|
156
157
|
disableTicks: !et,
|
|
157
|
-
slots:
|
|
158
|
+
slots: v ? wt : void 0,
|
|
158
159
|
slotProps: a ? {
|
|
159
160
|
axisLine: { style: { stroke: a } },
|
|
160
161
|
axisTick: { style: { stroke: a } }
|
|
161
162
|
} : {},
|
|
162
|
-
sx: { ...
|
|
163
|
+
sx: { ...S }
|
|
163
164
|
}),
|
|
164
|
-
/* @__PURE__ */ e(
|
|
165
|
+
/* @__PURE__ */ e(Ct, {
|
|
165
166
|
disableLine: !rt,
|
|
166
167
|
disableTicks: !at,
|
|
167
168
|
slotProps: a ? {
|
|
168
169
|
axisLine: { style: { stroke: a } },
|
|
169
170
|
axisTick: { style: { stroke: a } }
|
|
170
171
|
} : {},
|
|
171
|
-
sx: { ...
|
|
172
|
+
sx: { ...w }
|
|
172
173
|
}),
|
|
173
|
-
Q && /* @__PURE__ */ e(
|
|
174
|
+
Q && /* @__PURE__ */ e(Mt, { x: "line" }),
|
|
174
175
|
F && /* @__PURE__ */ e(Tt, {
|
|
175
176
|
trigger: "axis",
|
|
176
|
-
children: /* @__PURE__ */ e(
|
|
177
|
-
customLabels:
|
|
178
|
-
isCurrency:
|
|
177
|
+
children: /* @__PURE__ */ e(xt, {
|
|
178
|
+
customLabels: N,
|
|
179
|
+
isCurrency: X,
|
|
179
180
|
labels: L,
|
|
180
|
-
series:
|
|
181
|
-
valueFormatterString:
|
|
181
|
+
series: h,
|
|
182
|
+
valueFormatterString: n
|
|
182
183
|
})
|
|
183
184
|
})
|
|
184
185
|
]
|
|
185
|
-
}), U && /* @__PURE__ */ e(
|
|
186
|
-
average: A ?
|
|
187
|
-
customLegendBoxSx:
|
|
188
|
-
customLegendVariant:
|
|
186
|
+
}), U && /* @__PURE__ */ e(yt, {
|
|
187
|
+
average: A ? C : void 0,
|
|
188
|
+
customLegendBoxSx: G,
|
|
189
|
+
customLegendVariant: _,
|
|
189
190
|
labels: L,
|
|
190
|
-
series:
|
|
191
|
+
series: h,
|
|
191
192
|
style: {
|
|
192
193
|
position: "absolute",
|
|
193
194
|
top: 16,
|
|
194
195
|
left: 16,
|
|
195
|
-
...
|
|
196
|
+
...D
|
|
196
197
|
},
|
|
197
198
|
title: it,
|
|
198
|
-
valueFormatterString:
|
|
199
|
+
valueFormatterString: n
|
|
199
200
|
})]
|
|
200
201
|
});
|
|
201
202
|
};
|
|
202
203
|
export {
|
|
203
|
-
|
|
204
|
+
Ft as LineChart
|
|
204
205
|
};
|
|
205
206
|
|
|
206
207
|
//# sourceMappingURL=LineChart.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.es.js","names":[],"sources":["../../../../src/common/components/charts/LineChart.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport type { SxProps } from '@mui/material/styles'\nimport { useTheme } from '@mui/material/styles'\n\nimport type { AllSeriesType } from '@mui/x-charts'\nimport { BarPlot } from '@mui/x-charts/BarChart'\nimport { ChartContainer as ResponsiveChartContainer } from '@mui/x-charts/ChartContainer'\nimport { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight'\nimport { ChartsText, type ChartsTextProps } from '@mui/x-charts/ChartsText'\nimport { ChartsReferenceLine } from '@mui/x-charts/ChartsReferenceLine'\nimport { ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip'\nimport { ChartsXAxis } from '@mui/x-charts/ChartsXAxis'\nimport { ChartsYAxis } from '@mui/x-charts/ChartsYAxis'\nimport { AreaPlot, LinePlot, MarkPlot } from '@mui/x-charts/LineChart'\n\nimport { stripChartSlotProps } from './chartSlotProps'\nimport CustomLegend from './linechart/CustomLegend'\nimport { getMarkerShape } from './linechart/utils/markerShapes'\nimport { CustomLine } from './linechart/CustomLine'\nimport { CustomMark, MarkHandlers } from './linechart/CustomMark'\nimport { CustomTooltip } from './linechart/CustomTooltip'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { generateEqualIntervals } from '../../../core/utils/NumberFormatting'\n\nexport type LineChartDataset = { x: string; y: number }[]\nexport type LineChartLabel = string | { label: string; amount: number }\nexport type TooltipLabel = LineChartLabel & { header?: string }\n\n// X-axis tick that shows only the first letter of the label (e.g. \"J\" for\n// \"Jan\") so all labels fit in small/narrow views. role=\"img\" + aria-label give\n// the tick a reliable accessible name (aria-label alone on a bare SVG <text> is\n// inconsistently announced), so screen readers still get the full label.\nconst NarrowXAxisTickLabel = (props: ChartsTextProps) => {\n const fullLabel = typeof props.text === 'string' ? props.text : ''\n // Array.from keeps surrogate pairs / combining marks intact (non-Latin locales).\n const singleLetter = Array.from(fullLabel.trim())[0] ?? ''\n if (!singleLetter) return <ChartsText {...props} />\n return <ChartsText {...props} aria-label={fullLabel} role=\"img\" text={singleLetter} />\n}\n\nconst NARROW_X_AXIS_SLOTS = { axisTickLabel: NarrowXAxisTickLabel }\n\ntype LineChartCurve =\n | 'catmullRom'\n | 'linear'\n | 'monotoneX'\n | 'monotoneY'\n | 'natural'\n | 'step'\n | 'stepBefore'\n | 'stepAfter'\n | 'bump'\n | 'bumpX'\n | 'bumpY'\n\ninterface LineChartProps {\n areaColor?: string\n axisColor?: string\n baseline?: string\n chartFor?: string\n chartXaxisSx?: SxProps\n chartYaxisSx?: SxProps\n // Because theme chart colors are typed string|undefined\n colors: (string | undefined)[]\n curveType?: LineChartCurve\n customLegendVariant?: string\n customLegendSx?: SxProps\n customLegendBoxSx?: SxProps\n customTooltipLabels?: TooltipLabel[][]\n datasets: LineChartDataset[]\n height?: number\n isCurrency?: boolean\n isGraphClippingXAxis?: boolean\n labels: LineChartLabel[]\n labelBackgroundColor?: string\n labelFontColor?: string\n labelFontSize?: number\n margin?: { top?: number; right?: number; bottom?: number; left?: number }\n markHandlers?: MarkHandlers\n markStyles?: (markIndex: number) => React.CSSProperties & {\n markLabelStyles?: React.CSSProperties\n }\n minRange?: number\n maxRange?: number\n // When true, x-axis labels render as a single letter (with the full label kept\n // as the accessible name), so months don't overlap and get dropped in\n // small/narrow views. Implies showAllXAxisLabels.\n narrowXAxisLabels?: boolean\n onItemClick?: () => void\n // When true, every x-axis tick label is shown instead of letting x-charts drop\n // overlapping ones. Opt-in so it doesn't affect other charts that rely on the\n // default thinning.\n showAllXAxisLabels?: boolean\n peerAverage?: number\n showArea?: boolean\n showAverage?: boolean\n showAxisHighlight?: boolean\n showBars?: boolean\n showLegend?: boolean\n showMark?: boolean\n showMarkLabel?: boolean\n showTooltip?: boolean\n showXAxis?: boolean\n showXAxisTicks?: boolean\n showYAxis?: boolean\n showYAxisTicks?: boolean\n tickIntervals?: any[] | 'auto' | ((value: any, index: number) => boolean) | undefined\n title?: string\n useCustomMark?: boolean\n valueFormatterString?: string\n width?: number\n xAxisScaleType?: 'band' | 'point'\n}\n\n// TODO: Remove negative values and use a proper layout to support X-Charts v8\n\nexport const LineChart: React.FC<LineChartProps> = ({\n areaColor,\n axisColor,\n baseline = 'max',\n chartFor,\n chartXaxisSx,\n chartYaxisSx,\n colors,\n curveType = 'linear',\n customLegendVariant,\n customLegendSx,\n customLegendBoxSx,\n customTooltipLabels,\n datasets,\n height,\n isCurrency,\n isGraphClippingXAxis = false,\n labels,\n labelBackgroundColor,\n labelFontColor,\n labelFontSize,\n margin,\n markHandlers,\n markStyles,\n minRange,\n maxRange,\n narrowXAxisLabels = false,\n showAllXAxisLabels = false,\n onItemClick,\n peerAverage,\n showArea = false,\n showAverage = false,\n showAxisHighlight = false,\n showBars = false,\n showLegend = false,\n showMark = true,\n showMarkLabel = false,\n showTooltip = false,\n showXAxis = false,\n showXAxisTicks = false,\n showYAxis = false,\n showYAxisTicks = false,\n title,\n useCustomMark = false,\n valueFormatterString,\n width,\n xAxisScaleType,\n}) => {\n const theme = useTheme()\n\n // Data for the X axis\n const xData = datasets.flat().map((item) => item.x)\n const yData = datasets.flat().map((item) => item.y)\n\n // Guard the empty-data case: with no points, reduce()/Math.min()/Math.max()\n // produce NaN/±Infinity which flow into the y-axis and make x-charts warn\n // \"the value NaN does not exist in the data of y axis\". Default to 0 so an\n // empty/loading chart renders a valid (flat) axis instead.\n const average = peerAverage\n ? peerAverage\n : yData.length\n ? Math.round(yData.reduce((value, total) => total + value, 0) / yData.length)\n : 0\n\n // Used for the min and max Y axis values\n const yMin = yData.length ? Math.floor(Math.min(...yData) / 100) * 100 : 0\n const yMax = yData.length ? Math.ceil(Math.max(...yData) / 100) * 100 : 0\n\n const series = datasets.map((data, index) => {\n return {\n type: showBars ? 'bar' : 'line',\n curve: curveType,\n color: showBars ? theme.palette.chart?.chart6 : (colors[index] ?? theme.palette.primary.main),\n data: data.map((item) => item.y),\n area: showArea,\n baseline: baseline,\n showMark: true,\n shape: getMarkerShape(index),\n valueFormatter: (value: number) =>\n valueFormatterString ? formatCurrency(value || 0, valueFormatterString) : String(value),\n }\n })\n\n const defaultMargin = {\n top: 60,\n right: 35,\n bottom: 25,\n left: -10,\n }\n\n // Merge default margin with any provided custom margin\n const chartMargin = {\n ...defaultMargin,\n ...margin,\n }\n\n let rangeMin = minRange ?? yMin\n let rangeMax = maxRange ?? yMax\n if (chartFor === 'networthChart') {\n const valueRange = yMax - yMin\n\n const paddingRatio = valueRange < yMax * 0.05 ? 0.25 : 0.2\n const padding = Math.max(valueRange * paddingRatio, yMax * 0.015)\n rangeMin = yMin - padding < 0 ? yMin : yMin - padding\n rangeMax = yMax + padding\n }\n\n const getTickInterval = () => {\n if (chartFor === 'creditOverTime') {\n return generateEqualIntervals(rangeMin, 850, 5)\n } else if (chartFor === 'networthChart') {\n return generateEqualIntervals(rangeMin, rangeMax, 5)\n }\n return undefined\n }\n return (\n <Box\n sx={{\n position: 'relative',\n touchAction: 'pan-y', // Allow vertical scrolling\n '& svg': {\n touchAction: 'pan-y', // Allow vertical scrolling on SVG\n userSelect: 'none', // Prevent text selection\n },\n '& .recharts-wrapper': {\n touchAction: 'pan-y', // For Recharts library specifically\n },\n }}\n >\n <ResponsiveChartContainer\n height={height}\n margin={chartMargin}\n series={series as AllSeriesType[]}\n sx={{\n '& .MuiBarLabel-root': {\n fontSize: 10,\n fontWeight: 600,\n },\n '& .MuiAreaElement-root': {\n opacity: 0.15,\n },\n '& .MuiChartsAxis-tickLabel > tspan': {\n fontFamily: theme.typography.body2.fontFamily,\n },\n '& .MuiLineChart-markLabel': {\n fontFamily: theme.typography.body2.fontFamily,\n },\n }}\n width={width}\n xAxis={[\n {\n data: xData,\n scaleType: xAxisScaleType || (showBars ? 'band' : 'point'),\n // Show every tick instead of letting x-charts drop overlapping ones.\n ...((showAllXAxisLabels || narrowXAxisLabels) && { tickLabelInterval: () => true }),\n },\n ]}\n yAxis={[\n {\n tickInterval: getTickInterval(),\n min: isGraphClippingXAxis ? -22 : rangeMin,\n max: rangeMax || 100,\n colorMap:\n showArea && series.length < 2\n ? {\n type: 'continuous',\n min: rangeMin,\n max: rangeMax,\n color: [\n theme.palette.background.paper,\n colors[0] ?? theme.palette.primary.main,\n ],\n }\n : undefined,\n valueFormatter: (value: number) =>\n valueFormatterString ? formatCurrency(value, valueFormatterString) : String(value),\n width: 62,\n },\n ]}\n >\n {/** Provides the average line - positioned first to be behind other elements **/}\n {showAverage && (\n <ChartsReferenceLine\n lineStyle={{\n stroke: labelBackgroundColor\n ? theme.palette.neutral.main\n : theme.palette.neutral.dark,\n strokeDasharray: '10, 8',\n strokeWidth: 2,\n }}\n y={average}\n />\n )}\n\n {/** Area plot provides gradiant below the line **/}\n {/* Note: Must be above the LinePlot for some style rules to work */}\n <AreaPlot\n onItemClick={onItemClick}\n {...(areaColor && {\n slots: {\n area: (props) => {\n return (\n <g>\n <defs>\n <linearGradient id=\"customGradient\" x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={areaColor} />\n <stop offset=\"100%\" stopColor={areaColor} stopOpacity={0.02} />\n </linearGradient>\n </defs>\n <path {...stripChartSlotProps(props)} fill={`url(#customGradient)`} />\n </g>\n )\n },\n },\n })}\n />\n\n {/** Line plot provides the data line **/}\n <LinePlot\n onItemClick={onItemClick}\n slots={{\n line: (props) => (\n <CustomLine\n {...props}\n lineColor={areaColor ?? props.ownerState.color ?? theme.palette.primary.main}\n />\n ),\n }}\n />\n\n {/** Mark plot provides the circles **/}\n <MarkPlot\n onItemClick={onItemClick}\n slots={\n useCustomMark\n ? {\n mark: (props) => {\n return (\n <CustomMark\n handlers={markHandlers}\n labelBackgroundColor={labelBackgroundColor}\n labelFontColor={labelFontColor}\n labelFontSize={labelFontSize}\n showLabel={showMarkLabel}\n showMark={showMark || props.dataIndex === datasets[0].length - 1}\n style={markStyles?.(props.dataIndex) ?? {}}\n valueFormatterString={valueFormatterString}\n yData={yData}\n {...props}\n />\n )\n },\n }\n : undefined\n }\n />\n\n <BarPlot\n barLabel={(item) => (Number(item.value) > 0 ? `$${item.value}` : null)}\n borderRadius={10}\n />\n\n {/** Provides the X axis line and values **/}\n <ChartsXAxis\n disableLine={!showXAxis}\n disableTicks={!showXAxisTicks}\n slots={narrowXAxisLabels ? NARROW_X_AXIS_SLOTS : undefined}\n slotProps={\n axisColor\n ? {\n axisLine: {\n style: {\n stroke: axisColor,\n },\n },\n axisTick: {\n style: {\n stroke: axisColor,\n },\n },\n }\n : {}\n }\n sx={{ ...chartXaxisSx }}\n />\n\n {/** Provides the Y axis values **/}\n <ChartsYAxis\n disableLine={!showYAxis}\n disableTicks={!showYAxisTicks}\n slotProps={\n axisColor\n ? {\n axisLine: {\n style: {\n stroke: axisColor,\n },\n },\n axisTick: {\n style: {\n stroke: axisColor,\n },\n },\n }\n : {}\n }\n sx={{ ...chartYaxisSx }}\n />\n\n {/* Add vertical crosshair on hover */}\n {showAxisHighlight && <ChartsAxisHighlight x=\"line\" />}\n\n {showTooltip && (\n <ChartsTooltipContainer trigger=\"axis\">\n <CustomTooltip\n customLabels={customTooltipLabels}\n isCurrency={isCurrency}\n labels={labels}\n series={series}\n valueFormatterString={valueFormatterString}\n />\n </ChartsTooltipContainer>\n )}\n </ResponsiveChartContainer>\n\n {showLegend && (\n <CustomLegend\n average={showAverage ? average : undefined}\n customLegendBoxSx={customLegendBoxSx}\n customLegendVariant={customLegendVariant}\n labels={labels}\n series={series}\n style={{\n position: 'absolute',\n top: 16,\n left: 16,\n ...customLegendSx,\n }}\n title={title}\n valueFormatterString={valueFormatterString}\n />\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,IAAM,KAAA,CAAwB,MAA2B;AACvD,QAAM,IAAY,OAAO,EAAM,QAAS,WAAW,EAAM,OAAO,IAE1D,IAAe,MAAM,KAAK,EAAU,KAAK,CAAC,EAAE,CAAA,KAAM;AACxD,SAAK,IACE,gBAAA,EAAC,GAAD;AAAA,IAAY,GAAI;AAAA,IAAO,cAAY;AAAA,IAAW,MAAK;AAAA,IAAM,MAAM;AAAA,EAAe,CAAA,IAD3D,gBAAA,EAAC,GAAD,EAAY,GAAI,EAAQ,CAAA;AAEpD,GAEM,KAAsB,EAAE,eAAe,GAAqB,GA4ErD,KAAA,CAAuC,EAClD,WAAA,GACA,WAAA,GACA,UAAA,IAAW,OACX,UAAA,GACA,cAAA,GACA,cAAA,GACA,QAAA,GACA,WAAA,IAAY,UACZ,qBAAA,GACA,gBAAA,GACA,mBAAA,GACA,qBAAA,GACA,UAAA,GACA,QAAA,GACA,YAAA,GACA,sBAAA,IAAuB,IACvB,QAAA,GACA,sBAAA,GACA,gBAAA,GACA,eAAA,GACA,QAAA,GACA,cAAA,GACA,YAAA,GACA,UAAA,GACA,UAAA,GACA,mBAAA,IAAoB,IACpB,oBAAA,IAAqB,IACrB,aAAA,GACA,aAAA,GACA,UAAA,IAAW,IACX,aAAA,IAAc,IACd,mBAAA,IAAoB,IACpB,UAAA,IAAW,IACX,YAAA,IAAa,IACb,UAAA,IAAW,IACX,eAAA,IAAgB,IAChB,aAAA,IAAc,IACd,WAAA,KAAY,IACZ,gBAAA,KAAiB,IACjB,WAAA,KAAY,IACZ,gBAAA,KAAiB,IACjB,OAAA,IACA,eAAA,KAAgB,IAChB,sBAAA,GACA,OAAA,IACA,gBAAA,GAAA,MACI;AACJ,QAAM,IAAQ,GAAS,GAGjB,KAAQ,EAAS,KAAK,EAAE,IAAA,CAAK,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;AAAA,MAEF;AAAA,IAEzB,CAAA,GAAA,KACC,gBAAA,EAAC,IAAD;AAAA,MACE,SAAS,IAAc,IAAU;AAAA,MACd,mBAAA;AAAA,MACE,qBAAA;AAAA,MACb,QAAA;AAAA,MACA,QAAA;AAAA,MACR,OAAO;AAAA,QACL,UAAU;AAAA,QACV,KAAK;AAAA,QACL,MAAM;AAAA,QACN,GAAG;AAAA,MACL;AAAA,MACO,OAAA;AAAA,MACe,sBAAA;AAAA,IACvB,CAAA,CAEA;AAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"LineChart.es.js","names":[],"sources":["../../../../src/common/components/charts/LineChart.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport type { SxProps } from '@mui/material/styles'\nimport { useTheme } from '@mui/material/styles'\n\nimport type { AllSeriesType } from '@mui/x-charts'\nimport { BarPlot } from '@mui/x-charts/BarChart'\nimport { ChartContainer as ResponsiveChartContainer } from '@mui/x-charts/ChartContainer'\nimport { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight'\nimport { ChartsText, type ChartsTextProps } from '@mui/x-charts/ChartsText'\nimport { ChartsReferenceLine } from '@mui/x-charts/ChartsReferenceLine'\nimport { ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip'\nimport { ChartsXAxis } from '@mui/x-charts/ChartsXAxis'\nimport { ChartsYAxis } from '@mui/x-charts/ChartsYAxis'\nimport { AreaPlot, LinePlot, MarkPlot } from '@mui/x-charts/LineChart'\n\nimport { stripChartSlotProps } from './chartSlotProps'\nimport CustomLegend from './linechart/CustomLegend'\nimport { getMarkerShape } from './linechart/utils/markerShapes'\nimport { CustomLine } from './linechart/CustomLine'\nimport { CustomMark, MarkHandlers } from './linechart/CustomMark'\nimport { CustomTooltip } from './linechart/CustomTooltip'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { generateEqualIntervals, roundedAverage } from '../../../core/utils/NumberFormatting'\n\nexport type LineChartDataset = { x: string; y: number }[]\nexport type LineChartLabel = string | { label: string; amount: number }\nexport type TooltipLabel = LineChartLabel & { header?: string }\n\n// X-axis tick that shows only the first letter of the label (e.g. \"J\" for\n// \"Jan\") so all labels fit in small/narrow views. role=\"img\" + aria-label give\n// the tick a reliable accessible name (aria-label alone on a bare SVG <text> is\n// inconsistently announced), so screen readers still get the full label.\nconst NarrowXAxisTickLabel = (props: ChartsTextProps) => {\n const fullLabel = typeof props.text === 'string' ? props.text : ''\n // Array.from keeps surrogate pairs / combining marks intact (non-Latin locales).\n const singleLetter = Array.from(fullLabel.trim())[0] ?? ''\n if (!singleLetter) return <ChartsText {...props} />\n return <ChartsText {...props} aria-label={fullLabel} role=\"img\" text={singleLetter} />\n}\n\nconst NARROW_X_AXIS_SLOTS = { axisTickLabel: NarrowXAxisTickLabel }\n\ntype LineChartCurve =\n | 'catmullRom'\n | 'linear'\n | 'monotoneX'\n | 'monotoneY'\n | 'natural'\n | 'step'\n | 'stepBefore'\n | 'stepAfter'\n | 'bump'\n | 'bumpX'\n | 'bumpY'\n\ninterface LineChartProps {\n areaColor?: string\n axisColor?: string\n baseline?: string\n chartFor?: string\n chartXaxisSx?: SxProps\n chartYaxisSx?: SxProps\n // Because theme chart colors are typed string|undefined\n colors: (string | undefined)[]\n curveType?: LineChartCurve\n customLegendVariant?: string\n customLegendSx?: SxProps\n customLegendBoxSx?: SxProps\n customTooltipLabels?: TooltipLabel[][]\n datasets: LineChartDataset[]\n height?: number\n isCurrency?: boolean\n isGraphClippingXAxis?: boolean\n labels: LineChartLabel[]\n labelBackgroundColor?: string\n labelFontColor?: string\n labelFontSize?: number\n margin?: { top?: number; right?: number; bottom?: number; left?: number }\n markHandlers?: MarkHandlers\n markStyles?: (markIndex: number) => React.CSSProperties & {\n markLabelStyles?: React.CSSProperties\n }\n minRange?: number\n maxRange?: number\n // When true, x-axis labels render as a single letter (with the full label kept\n // as the accessible name), so months don't overlap and get dropped in\n // small/narrow views. Implies showAllXAxisLabels.\n narrowXAxisLabels?: boolean\n onItemClick?: () => void\n // When true, every x-axis tick label is shown instead of letting x-charts drop\n // overlapping ones. Opt-in so it doesn't affect other charts that rely on the\n // default thinning.\n showAllXAxisLabels?: boolean\n peerAverage?: number\n showArea?: boolean\n showAverage?: boolean\n showAxisHighlight?: boolean\n showBars?: boolean\n showLegend?: boolean\n showMark?: boolean\n showMarkLabel?: boolean\n showTooltip?: boolean\n showXAxis?: boolean\n showXAxisTicks?: boolean\n showYAxis?: boolean\n showYAxisTicks?: boolean\n tickIntervals?: any[] | 'auto' | ((value: any, index: number) => boolean) | undefined\n title?: string\n useCustomMark?: boolean\n valueFormatterString?: string\n width?: number\n xAxisScaleType?: 'band' | 'point'\n}\n\n// TODO: Remove negative values and use a proper layout to support X-Charts v8\n\nexport const LineChart: React.FC<LineChartProps> = ({\n areaColor,\n axisColor,\n baseline = 'max',\n chartFor,\n chartXaxisSx,\n chartYaxisSx,\n colors,\n curveType = 'linear',\n customLegendVariant,\n customLegendSx,\n customLegendBoxSx,\n customTooltipLabels,\n datasets,\n height,\n isCurrency,\n isGraphClippingXAxis = false,\n labels,\n labelBackgroundColor,\n labelFontColor,\n labelFontSize,\n margin,\n markHandlers,\n markStyles,\n minRange,\n maxRange,\n narrowXAxisLabels = false,\n showAllXAxisLabels = false,\n onItemClick,\n peerAverage,\n showArea = false,\n showAverage = false,\n showAxisHighlight = false,\n showBars = false,\n showLegend = false,\n showMark = true,\n showMarkLabel = false,\n showTooltip = false,\n showXAxis = false,\n showXAxisTicks = false,\n showYAxis = false,\n showYAxisTicks = false,\n title,\n useCustomMark = false,\n valueFormatterString,\n width,\n xAxisScaleType,\n}) => {\n const theme = useTheme()\n\n // Data for the X axis\n const xData = datasets.flat().map((item) => item.x)\n const yData = datasets.flat().map((item) => item.y)\n\n // Guard the empty-data case: with no points, reduce()/Math.min()/Math.max()\n // produce NaN/±Infinity which flow into the y-axis and make x-charts warn\n // \"the value NaN does not exist in the data of y axis\". Default to 0 so an\n // empty/loading chart renders a valid (flat) axis instead.\n const average = peerAverage || roundedAverage(yData)\n\n // Used for the min and max Y axis values\n const yMin = yData.length ? Math.floor(Math.min(...yData) / 100) * 100 : 0\n const yMax = yData.length ? Math.ceil(Math.max(...yData) / 100) * 100 : 0\n\n const series = datasets.map((data, index) => {\n return {\n type: showBars ? 'bar' : 'line',\n curve: curveType,\n color: showBars ? theme.palette.chart?.chart6 : (colors[index] ?? theme.palette.primary.main),\n data: data.map((item) => item.y),\n area: showArea,\n baseline: baseline,\n showMark: true,\n shape: getMarkerShape(index),\n valueFormatter: (value: number) =>\n valueFormatterString ? formatCurrency(value || 0, valueFormatterString) : String(value),\n }\n })\n\n const defaultMargin = {\n top: 60,\n right: 35,\n bottom: 25,\n left: -10,\n }\n\n // Merge default margin with any provided custom margin\n const chartMargin = {\n ...defaultMargin,\n ...margin,\n }\n\n let rangeMin = minRange ?? yMin\n let rangeMax = maxRange ?? yMax\n if (chartFor === 'networthChart') {\n const valueRange = yMax - yMin\n\n const paddingRatio = valueRange < yMax * 0.05 ? 0.25 : 0.2\n const padding = Math.max(valueRange * paddingRatio, yMax * 0.015)\n rangeMin = yMin - padding < 0 ? yMin : yMin - padding\n rangeMax = yMax + padding\n }\n\n const getTickInterval = () => {\n if (chartFor === 'creditOverTime') {\n return generateEqualIntervals(rangeMin, 850, 5)\n } else if (chartFor === 'networthChart') {\n return generateEqualIntervals(rangeMin, rangeMax, 5)\n }\n return undefined\n }\n return (\n <Box\n sx={{\n position: 'relative',\n touchAction: 'pan-y', // Allow vertical scrolling\n '& svg': {\n touchAction: 'pan-y', // Allow vertical scrolling on SVG\n userSelect: 'none', // Prevent text selection\n },\n '& .recharts-wrapper': {\n touchAction: 'pan-y', // For Recharts library specifically\n },\n }}\n >\n <ResponsiveChartContainer\n height={height}\n // Without this, Chrome adds the chart to the Tab order (MUI X Charts puts focus\n // listeners on the SVG), but the chart has no keyboard actions.\n tabIndex={-1}\n margin={chartMargin}\n series={series as AllSeriesType[]}\n sx={{\n '& .MuiBarLabel-root': {\n fontSize: 10,\n fontWeight: 600,\n },\n '& .MuiAreaElement-root': {\n opacity: 0.15,\n },\n '& .MuiChartsAxis-tickLabel > tspan': {\n fontFamily: theme.typography.body2.fontFamily,\n },\n '& .MuiLineChart-markLabel': {\n fontFamily: theme.typography.body2.fontFamily,\n },\n }}\n width={width}\n xAxis={[\n {\n data: xData,\n scaleType: xAxisScaleType || (showBars ? 'band' : 'point'),\n // Show every tick instead of letting x-charts drop overlapping ones.\n ...((showAllXAxisLabels || narrowXAxisLabels) && { tickLabelInterval: () => true }),\n },\n ]}\n yAxis={[\n {\n tickInterval: getTickInterval(),\n min: isGraphClippingXAxis ? -22 : rangeMin,\n max: rangeMax || 100,\n colorMap:\n showArea && series.length < 2\n ? {\n type: 'continuous',\n min: rangeMin,\n max: rangeMax,\n color: [\n theme.palette.background.paper,\n colors[0] ?? theme.palette.primary.main,\n ],\n }\n : undefined,\n valueFormatter: (value: number) =>\n valueFormatterString ? formatCurrency(value, valueFormatterString) : String(value),\n width: 62,\n },\n ]}\n >\n {/** Provides the average line - positioned first to be behind other elements **/}\n {showAverage && (\n <ChartsReferenceLine\n lineStyle={{\n stroke: labelBackgroundColor\n ? theme.palette.neutral.main\n : theme.palette.neutral.dark,\n strokeDasharray: '10, 8',\n strokeWidth: 2,\n }}\n y={average}\n />\n )}\n\n {/** Area plot provides gradiant below the line **/}\n {/* Note: Must be above the LinePlot for some style rules to work */}\n <AreaPlot\n onItemClick={onItemClick}\n {...(areaColor && {\n slots: {\n area: (props) => {\n return (\n <g>\n <defs>\n <linearGradient id=\"customGradient\" x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor={areaColor} />\n <stop offset=\"100%\" stopColor={areaColor} stopOpacity={0.02} />\n </linearGradient>\n </defs>\n <path {...stripChartSlotProps(props)} fill={`url(#customGradient)`} />\n </g>\n )\n },\n },\n })}\n />\n\n {/** Line plot provides the data line **/}\n <LinePlot\n onItemClick={onItemClick}\n slots={{\n line: (props) => (\n <CustomLine\n {...props}\n lineColor={areaColor ?? props.ownerState.color ?? theme.palette.primary.main}\n />\n ),\n }}\n />\n\n {/** Mark plot provides the circles **/}\n <MarkPlot\n onItemClick={onItemClick}\n slots={\n useCustomMark\n ? {\n mark: (props) => {\n return (\n <CustomMark\n handlers={markHandlers}\n labelBackgroundColor={labelBackgroundColor}\n labelFontColor={labelFontColor}\n labelFontSize={labelFontSize}\n showLabel={showMarkLabel}\n showMark={showMark || props.dataIndex === datasets[0].length - 1}\n style={markStyles?.(props.dataIndex) ?? {}}\n valueFormatterString={valueFormatterString}\n yData={yData}\n {...props}\n />\n )\n },\n }\n : undefined\n }\n />\n\n <BarPlot\n barLabel={(item) => (Number(item.value) > 0 ? `$${item.value}` : null)}\n borderRadius={10}\n />\n\n {/** Provides the X axis line and values **/}\n <ChartsXAxis\n disableLine={!showXAxis}\n disableTicks={!showXAxisTicks}\n slots={narrowXAxisLabels ? NARROW_X_AXIS_SLOTS : undefined}\n slotProps={\n axisColor\n ? {\n axisLine: {\n style: {\n stroke: axisColor,\n },\n },\n axisTick: {\n style: {\n stroke: axisColor,\n },\n },\n }\n : {}\n }\n sx={{ ...chartXaxisSx }}\n />\n\n {/** Provides the Y axis values **/}\n <ChartsYAxis\n disableLine={!showYAxis}\n disableTicks={!showYAxisTicks}\n slotProps={\n axisColor\n ? {\n axisLine: {\n style: {\n stroke: axisColor,\n },\n },\n axisTick: {\n style: {\n stroke: axisColor,\n },\n },\n }\n : {}\n }\n sx={{ ...chartYaxisSx }}\n />\n\n {/* Add vertical crosshair on hover */}\n {showAxisHighlight && <ChartsAxisHighlight x=\"line\" />}\n\n {showTooltip && (\n <ChartsTooltipContainer trigger=\"axis\">\n <CustomTooltip\n customLabels={customTooltipLabels}\n isCurrency={isCurrency}\n labels={labels}\n series={series}\n valueFormatterString={valueFormatterString}\n />\n </ChartsTooltipContainer>\n )}\n </ResponsiveChartContainer>\n\n {showLegend && (\n <CustomLegend\n average={showAverage ? average : undefined}\n customLegendBoxSx={customLegendBoxSx}\n customLegendVariant={customLegendVariant}\n labels={labels}\n series={series}\n style={{\n position: 'absolute',\n top: 16,\n left: 16,\n ...customLegendSx,\n }}\n title={title}\n valueFormatterString={valueFormatterString}\n />\n )}\n </Box>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,IAAM,KAAA,CAAwB,MAA2B;AACvD,QAAM,IAAY,OAAO,EAAM,QAAS,WAAW,EAAM,OAAO,IAE1D,IAAe,MAAM,KAAK,EAAU,KAAK,CAAC,EAAE,CAAA,KAAM;AACxD,SAAK,IACE,gBAAA,EAAC,GAAD;AAAA,IAAY,GAAI;AAAA,IAAO,cAAY;AAAA,IAAW,MAAK;AAAA,IAAM,MAAM;AAAA,EAAe,CAAA,IAD3D,gBAAA,EAAC,GAAD,EAAY,GAAI,EAAQ,CAAA;AAEpD,GAEM,KAAsB,EAAE,eAAe,GAAqB,GA4ErD,KAAA,CAAuC,EAClD,WAAA,GACA,WAAA,GACA,UAAA,IAAW,OACX,UAAA,GACA,cAAA,GACA,cAAA,GACA,QAAA,GACA,WAAA,IAAY,UACZ,qBAAA,GACA,gBAAA,GACA,mBAAA,GACA,qBAAA,GACA,UAAA,GACA,QAAA,GACA,YAAA,GACA,sBAAA,IAAuB,IACvB,QAAA,GACA,sBAAA,GACA,gBAAA,GACA,eAAA,GACA,QAAA,GACA,cAAA,GACA,YAAA,GACA,UAAA,GACA,UAAA,GACA,mBAAA,IAAoB,IACpB,oBAAA,IAAqB,IACrB,aAAA,GACA,aAAA,GACA,UAAA,IAAW,IACX,aAAA,IAAc,IACd,mBAAA,IAAoB,IACpB,UAAA,IAAW,IACX,YAAA,IAAa,IACb,UAAA,IAAW,IACX,eAAA,IAAgB,IAChB,aAAA,IAAc,IACd,WAAA,KAAY,IACZ,gBAAA,KAAiB,IACjB,WAAA,KAAY,IACZ,gBAAA,KAAiB,IACjB,OAAA,IACA,eAAA,KAAgB,IAChB,sBAAA,GACA,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ACvB,CAAA;AAAA,QACqB,CAAA;AAAA,MAEF;AAAA,IAEzB,CAAA,GAAA,KACC,gBAAA,EAAC,IAAD;AAAA,MACE,SAAS,IAAc,IAAU;AAAA,MACd,mBAAA;AAAA,MACE,qBAAA;AAAA,MACb,QAAA;AAAA,MACA,QAAA;AAAA,MACR,OAAO;AAAA,QACL,UAAU;AAAA,QACV,KAAK;AAAA,QACL,MAAM;AAAA,QACN,GAAG;AAAA,MACL;AAAA,MACO,OAAA;AAAA,MACe,sBAAA;AAAA,IACvB,CAAA,CAEA;AAAA;AAET"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var i = {
|
|
2
|
+
position: "absolute",
|
|
3
|
+
width: "1px",
|
|
4
|
+
height: "1px",
|
|
5
|
+
padding: 0,
|
|
6
|
+
margin: "-1px",
|
|
7
|
+
overflow: "hidden",
|
|
8
|
+
clip: "rect(0 0 0 0)",
|
|
9
|
+
clipPath: "inset(50%)",
|
|
10
|
+
whiteSpace: "nowrap",
|
|
11
|
+
border: 0
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
i as VISUALLY_HIDDEN_SX
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=Styles.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Styles.es.js","names":[],"sources":["../../../src/common/constants/Styles.ts"],"sourcesContent":["import type { SxProps } from '@mui/material/styles'\n\nexport const VISUALLY_HIDDEN_SX: SxProps = {\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n border: 0,\n}\n"],"mappings":"AAEA,IAAa,IAA8B;AAAA,EACzC,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AACV"}
|