@mx-cartographer/experiences 9.7.118 → 9.7.119
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/cashflow/CashflowMiniWidget.es.js +53 -19
- package/dist/cashflow/CashflowMiniWidget.es.js.map +1 -1
- package/dist/cashflow/components/CashflowWidgetContent.d.ts +1 -0
- package/dist/cashflow/components/CashflowWidgetContent.es.js +173 -137
- package/dist/cashflow/components/CashflowWidgetContent.es.js.map +1 -1
- package/dist/cashflow/components/RemainingCash.d.ts +1 -0
- package/dist/cashflow/components/RemainingCash.es.js +10 -9
- package/dist/cashflow/components/RemainingCash.es.js.map +1 -1
- package/dist/common/components/InformationTooltip.d.ts +1 -0
- package/dist/common/components/InformationTooltip.es.js +16 -16
- package/dist/common/components/InformationTooltip.es.js.map +1 -1
- package/dist/common/components/MiniWidgetContainer.d.ts +13 -0
- package/dist/common/components/MiniWidgetContainer.es.js +63 -55
- package/dist/common/components/MiniWidgetContainer.es.js.map +1 -1
- package/dist/common/components/charts/LineChart.d.ts +5 -1
- package/dist/common/components/charts/LineChart.es.js +124 -122
- package/dist/common/components/charts/LineChart.es.js.map +1 -1
- package/dist/common/components/charts/linechart/CustomLegend.es.js +53 -46
- package/dist/common/components/charts/linechart/CustomLegend.es.js.map +1 -1
- package/dist/common/components/charts/linechart/CustomMark.d.ts +2 -0
- package/dist/common/components/charts/linechart/CustomMark.es.js +72 -35
- package/dist/common/components/charts/linechart/CustomMark.es.js.map +1 -1
- package/dist/core/types/localization/CashflowCopy.d.ts +1 -0
- package/dist/core/types/localization/TrendsCopy.d.ts +1 -0
- package/dist/trends/TrendsMiniWidget.es.js +29 -22
- package/dist/trends/TrendsMiniWidget.es.js.map +1 -1
- package/dist/trends/components/SpendingChart.es.js +53 -17
- package/dist/trends/components/SpendingChart.es.js.map +1 -1
- package/dist/trends/utils/SpendingData.d.ts +2 -0
- package/dist/trends/utils/SpendingData.es.js +70 -43
- package/dist/trends/utils/SpendingData.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [9.7.119] - 11-06-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - mini widget header sizing, and Figma parity in the cash flow and trends mini widgets (WELL-49)
|
|
4
|
+
|
|
1
5
|
## [9.7.118] - 11-06-2026
|
|
2
6
|
|
|
3
7
|
- **FIXED** - Category Spending's mini card fits Figma: its 94px chart and 24px legend share the full chart's 122px, so the card's action is no longer cut off (`category_color` mini only) (WEC-2215)
|
|
@@ -1,45 +1,79 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { useWidgetLoadTimer as
|
|
3
|
-
import
|
|
1
|
+
import { useGlobalCopyStore as f, useGlobalUiStore as c, useRecurringTransactionsStore as p } from "../common/context/hooks.es.js";
|
|
2
|
+
import { useWidgetLoadTimer as h } from "../common/hooks/useWidgetLoadTimer.es.js";
|
|
3
|
+
import u from "../common/components/MiniWidgetContainer.es.js";
|
|
4
4
|
import a from "../common/components/Loader.es.js";
|
|
5
|
-
import { EmptyState as
|
|
5
|
+
import { EmptyState as x } from "../common/components/EmptyState.es.js";
|
|
6
6
|
import { useCashflowUiStore as y } from "./context/hooks.es.js";
|
|
7
|
-
import
|
|
7
|
+
import g from "./components/CashflowWidgetContent.es.js";
|
|
8
8
|
import w from "react";
|
|
9
|
-
import { observer as
|
|
10
|
-
import { jsx as e, jsxs as
|
|
11
|
-
var
|
|
12
|
-
const { cashflow: t } =
|
|
9
|
+
import { observer as b } from "mobx-react-lite";
|
|
10
|
+
import { jsx as e, jsxs as C } from "react/jsx-runtime";
|
|
11
|
+
var W = ({ onPrimaryCtaClick: r, onSecondaryCtaClick: m, sx: s = {} }) => {
|
|
12
|
+
const { cashflow: t } = f(), { isInitialized: n } = c(), { income: l } = y(), { loadRepeatingTransactionData: d, isDataLoaded: i } = p();
|
|
13
13
|
w.useEffect(() => {
|
|
14
14
|
i || d().finally();
|
|
15
|
-
}, []),
|
|
15
|
+
}, []), h({
|
|
16
16
|
widgetName: "CashflowMiniWidget",
|
|
17
17
|
isLoaded: i
|
|
18
18
|
});
|
|
19
19
|
const o = i && !l.length;
|
|
20
|
-
return n ? /* @__PURE__ */
|
|
20
|
+
return n ? /* @__PURE__ */ C(u, {
|
|
21
21
|
className: "mx-exp-cashflow-miniwidget",
|
|
22
22
|
onPrimaryCtaClick: r,
|
|
23
23
|
primaryCtaLabel: t.primary_cta,
|
|
24
24
|
primaryCtaLabelAria: t.primary_cta_aria,
|
|
25
25
|
subTitle: o || !i ? void 0 : t.sub_title,
|
|
26
|
+
contentStyles: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
flex: 1,
|
|
29
|
+
flexDirection: "column",
|
|
30
|
+
"&:last-child": { pb: 16 }
|
|
31
|
+
},
|
|
32
|
+
heightLimits: {
|
|
33
|
+
min: 264,
|
|
34
|
+
max: 324
|
|
35
|
+
},
|
|
26
36
|
sx: {
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
maxWidth: 900,
|
|
40
|
+
minWidth: 288,
|
|
41
|
+
...s
|
|
29
42
|
},
|
|
30
43
|
title: t.title,
|
|
31
|
-
|
|
44
|
+
wideHeightLimits: {
|
|
45
|
+
min: 160,
|
|
46
|
+
max: 200,
|
|
47
|
+
fromWidth: 633
|
|
48
|
+
},
|
|
49
|
+
children: [!i && /* @__PURE__ */ e(a, {}), i && (o ? /* @__PURE__ */ e(x, {
|
|
32
50
|
header: t.create,
|
|
33
51
|
icon: "local_atm",
|
|
34
|
-
onClick:
|
|
52
|
+
onClick: m,
|
|
35
53
|
primaryButton: t.add_income,
|
|
36
54
|
primaryButtonStartIcon: "add",
|
|
37
|
-
subText: t.create_description
|
|
38
|
-
|
|
55
|
+
subText: t.create_description,
|
|
56
|
+
sx: {
|
|
57
|
+
pt: 16,
|
|
58
|
+
pb: 8,
|
|
59
|
+
"& > svg:first-of-type": { my: 6 },
|
|
60
|
+
"& .empty-state-subtext": {
|
|
61
|
+
maxWidth: 288,
|
|
62
|
+
mt: 4,
|
|
63
|
+
width: "100%"
|
|
64
|
+
},
|
|
65
|
+
"& .buttons-footer": { mt: 24 },
|
|
66
|
+
"& .MuiButton-startIcon > svg": {
|
|
67
|
+
fontSize: 22,
|
|
68
|
+
height: 22,
|
|
69
|
+
width: 22
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}) : /* @__PURE__ */ e(g, {}))]
|
|
39
73
|
}) : /* @__PURE__ */ e(a, {});
|
|
40
|
-
},
|
|
74
|
+
}, R = b(W);
|
|
41
75
|
export {
|
|
42
|
-
|
|
76
|
+
R as default
|
|
43
77
|
};
|
|
44
78
|
|
|
45
79
|
//# sourceMappingURL=CashflowMiniWidget.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashflowMiniWidget.es.js","names":[],"sources":["../../src/cashflow/CashflowMiniWidget.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n EmptyState,\n Loader,\n MiniWidgetContainer,\n useGlobalCopyStore,\n useGlobalUiStore,\n useRecurringTransactionsStore,\n useWidgetLoadTimer,\n} from '../common'\nimport { MiniWidgetProps } from '../core'\n\nimport CashflowWidgetContent from './components/CashflowWidgetContent'\nimport { useCashflowUiStore } from './context/hooks'\n\nconst CashflowMiniWidget: React.FC<MiniWidgetProps> = ({\n onPrimaryCtaClick,\n onSecondaryCtaClick,\n sx = {},\n}) => {\n const { cashflow: copy } = useGlobalCopyStore()\n const { isInitialized } = useGlobalUiStore()\n const { income } = useCashflowUiStore()\n const { loadRepeatingTransactionData, isDataLoaded } = useRecurringTransactionsStore()\n\n React.useEffect(() => {\n if (!isDataLoaded) {\n loadRepeatingTransactionData().finally()\n }\n }, [])\n\n useWidgetLoadTimer({\n widgetName: 'CashflowMiniWidget',\n isLoaded: isDataLoaded,\n })\n\n const showEmptyState = isDataLoaded && !income.length\n\n if (!isInitialized) return <Loader />\n\n return (\n <MiniWidgetContainer\n className=\"mx-exp-cashflow-miniwidget\"\n onPrimaryCtaClick={onPrimaryCtaClick}\n primaryCtaLabel={copy.primary_cta}\n primaryCtaLabelAria={copy.primary_cta_aria}\n subTitle={showEmptyState || !isDataLoaded ? undefined : copy.sub_title}\n sx={{
|
|
1
|
+
{"version":3,"file":"CashflowMiniWidget.es.js","names":[],"sources":["../../src/cashflow/CashflowMiniWidget.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n EmptyState,\n Loader,\n MiniWidgetContainer,\n useGlobalCopyStore,\n useGlobalUiStore,\n useRecurringTransactionsStore,\n useWidgetLoadTimer,\n} from '../common'\nimport { MiniWidgetProps } from '../core'\n\nimport CashflowWidgetContent, { LARGE_LAYOUT_MIN_WIDTH } from './components/CashflowWidgetContent'\nimport { useCashflowUiStore } from './context/hooks'\n\nconst CashflowMiniWidget: React.FC<MiniWidgetProps> = ({\n onPrimaryCtaClick,\n onSecondaryCtaClick,\n sx = {},\n}) => {\n const { cashflow: copy } = useGlobalCopyStore()\n const { isInitialized } = useGlobalUiStore()\n const { income } = useCashflowUiStore()\n const { loadRepeatingTransactionData, isDataLoaded } = useRecurringTransactionsStore()\n\n React.useEffect(() => {\n if (!isDataLoaded) {\n loadRepeatingTransactionData().finally()\n }\n }, [])\n\n useWidgetLoadTimer({\n widgetName: 'CashflowMiniWidget',\n isLoaded: isDataLoaded,\n })\n\n const showEmptyState = isDataLoaded && !income.length\n\n if (!isInitialized) return <Loader />\n\n return (\n <MiniWidgetContainer\n className=\"mx-exp-cashflow-miniwidget\"\n onPrimaryCtaClick={onPrimaryCtaClick}\n primaryCtaLabel={copy.primary_cta}\n primaryCtaLabelAria={copy.primary_cta_aria}\n subTitle={showEmptyState || !isDataLoaded ? undefined : copy.sub_title}\n contentStyles={{\n display: 'flex',\n flex: 1,\n flexDirection: 'column',\n '&:last-child': { pb: 16 },\n }}\n heightLimits={{ min: 264, max: 324 }}\n sx={{ display: 'flex', flexDirection: 'column', maxWidth: 900, minWidth: 288, ...sx }}\n title={copy.title}\n wideHeightLimits={{ min: 160, max: 200, fromWidth: LARGE_LAYOUT_MIN_WIDTH }}\n >\n {!isDataLoaded && <Loader />}\n {isDataLoaded &&\n (showEmptyState ? (\n <EmptyState\n header={copy.create}\n icon=\"local_atm\"\n onClick={onSecondaryCtaClick}\n primaryButton={copy.add_income}\n primaryButtonStartIcon=\"add\"\n subText={copy.create_description}\n sx={{\n pt: 16,\n pb: 8,\n '& > svg:first-of-type': { my: 6 },\n '& .empty-state-subtext': { maxWidth: 288, mt: 4, width: '100%' },\n '& .buttons-footer': { mt: 24 },\n '& .MuiButton-startIcon > svg': { fontSize: 22, height: 22, width: 22 },\n }}\n />\n ) : (\n <CashflowWidgetContent />\n ))}\n </MiniWidgetContainer>\n )\n}\n\nexport default observer(CashflowMiniWidget)\n"],"mappings":";;;;;;;;;;AAiBA,IAAM,IAAA,CAAiD,EACrD,mBAAA,GACA,qBAAA,GACA,IAAA,IAAK,CAAC,EAAA,MACF;AACJ,QAAM,EAAE,UAAU,EAAA,IAAS,EAAmB,GACxC,EAAE,eAAA,EAAA,IAAkB,EAAiB,GACrC,EAAE,QAAA,EAAA,IAAW,EAAmB,GAChC,EAAE,8BAAA,GAA8B,cAAA,EAAA,IAAiB,EAA8B;AAErF,EAAA,EAAM,UAAA,MAAgB;AACpB,IAAK,KACH,EAA6B,EAAE,QAAQ;AAAA,EAE3C,GAAG,CAAC,CAAC,GAEL,EAAmB;AAAA,IACjB,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAC;AAED,QAAM,IAAiB,KAAgB,CAAC,EAAO;AAE/C,SAAK,IAGH,gBAAA,EAAC,GAAD;AAAA,IACE,WAAU;AAAA,IACS,mBAAA;AAAA,IACnB,iBAAiB,EAAK;AAAA,IACtB,qBAAqB,EAAK;AAAA,IAC1B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
3
|
-
import { useScreenSize as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { buildDynamicCopy as u } from "../../core/utils/Localization.es.js";
|
|
2
|
+
import { useGlobalCopyStore as W, useGlobalUiStore as j, useRecurringTransactionsStore as B, useWidgetContainerProvider as D } from "../../common/context/hooks.es.js";
|
|
3
|
+
import { useScreenSize as M } from "../../common/hooks/useScreenSize.es.js";
|
|
4
|
+
import { formatCurrency as R } from "../../core/utils/NumberFormatting.es.js";
|
|
5
|
+
import { VISUALLY_HIDDEN_SX as E } from "../../common/constants/Styles.es.js";
|
|
6
|
+
import G from "../../common/components/Loader.es.js";
|
|
7
|
+
import O from "../../common/components/InformationTooltip.es.js";
|
|
8
|
+
import { CurrencyText as l } from "../../common/components/CurrencyText.es.js";
|
|
9
|
+
import { useCashflowUiStore as k } from "../context/hooks.es.js";
|
|
10
|
+
import { getRemainingCashColor as H } from "./RemainingCash.es.js";
|
|
11
|
+
import "react";
|
|
12
|
+
import { observer as z } from "mobx-react-lite";
|
|
13
|
+
import o from "@mui/material/Stack";
|
|
14
|
+
import { Icon as S, P as c, Text as I } from "@mxenabled/mxui";
|
|
15
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
16
|
+
import { useTheme as P } from "@mui/material/styles";
|
|
17
|
+
import y from "@mui/material/Box";
|
|
18
|
+
var q = 1e4, b = ({ amount: t }) => {
|
|
19
|
+
if (Math.abs(t) < q) return /* @__PURE__ */ e(l, {
|
|
20
|
+
amount: t,
|
|
21
|
+
variant: "h2"
|
|
22
|
+
});
|
|
23
|
+
const i = R(Math.abs(t), "0.[0]a").toUpperCase(), d = R(t, "0,0.00");
|
|
24
|
+
return /* @__PURE__ */ r(c, {
|
|
25
|
+
variant: "h2",
|
|
26
|
+
children: [/* @__PURE__ */ r(y, {
|
|
27
|
+
"aria-hidden": !0,
|
|
28
|
+
component: "span",
|
|
29
|
+
children: [t < 0 ? "-" : "", i]
|
|
30
|
+
}), /* @__PURE__ */ e(y, {
|
|
31
|
+
component: "span",
|
|
32
|
+
sx: E,
|
|
33
|
+
children: d
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
}, f = ({ children: t, label: i }) => /* @__PURE__ */ r(o, {
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
direction: "row",
|
|
39
|
+
flex: 1,
|
|
40
|
+
justifyContent: "space-between",
|
|
41
|
+
px: 16,
|
|
42
|
+
children: [/* @__PURE__ */ e(c, {
|
|
43
|
+
variant: "caption",
|
|
44
|
+
children: i
|
|
45
|
+
}), t]
|
|
46
|
+
}), x = ({ children: t, label: i }) => /* @__PURE__ */ r(o, { children: [t, /* @__PURE__ */ e(c, {
|
|
47
|
+
color: "text.secondary",
|
|
48
|
+
variant: "caption",
|
|
49
|
+
whiteSpace: "nowrap",
|
|
50
|
+
children: i
|
|
51
|
+
})] }), V = () => {
|
|
52
|
+
const t = P(), { availableWidth: i } = D(), { isMobile: d } = M(), { selectedAccountGuids: L } = j(), { cashflow: n } = W(), { daysUntilNextIncome: g, expensesTilNextIncome: v, selectedCashAccounts: A, selectedCashBalance: s } = k(), { isDataLoaded: N } = B(), m = v.filter((p) => L.includes(p.accountGuid || "")).reduce((p, U) => p + U.amount, 0), h = s - m;
|
|
53
|
+
if (!N) return /* @__PURE__ */ e(G, { height: d ? 210 : 120 });
|
|
54
|
+
const a = `1px solid ${t.palette.divider}`, C = u(n.total_cash_accounts, A.length), w = u(n.expenses_due, v.length), _ = u(g === 1 ? n.day : n.days, g), T = /* @__PURE__ */ e(O, {
|
|
55
|
+
body: n.tooltip_body,
|
|
56
|
+
iconColor: "action.active",
|
|
57
|
+
title: n.tooltip_title
|
|
58
|
+
});
|
|
59
|
+
return /* @__PURE__ */ e(o, {
|
|
19
60
|
className: "mx-cashflow",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
children: w > 710 ? /* @__PURE__ */ r(t, {
|
|
24
|
-
border: `1px solid ${d.palette.divider}`,
|
|
25
|
-
borderRadius: 1,
|
|
61
|
+
flex: 1,
|
|
62
|
+
px: 16,
|
|
63
|
+
children: i >= 633 ? /* @__PURE__ */ r(o, {
|
|
26
64
|
direction: "row",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
/* @__PURE__ */ e(t, {
|
|
59
|
-
pt: 18,
|
|
60
|
-
children: /* @__PURE__ */ e(v, { name: "equal" })
|
|
61
|
-
}),
|
|
62
|
-
/* @__PURE__ */ r(t, {
|
|
63
|
-
pb: 14,
|
|
64
|
-
pr: 24,
|
|
65
|
-
pt: 12,
|
|
66
|
-
children: [/* @__PURE__ */ e(n, {
|
|
67
|
-
amount: f,
|
|
68
|
-
variant: "h2"
|
|
69
|
-
}), /* @__PURE__ */ r(t, {
|
|
65
|
+
children: [/* @__PURE__ */ r(o, {
|
|
66
|
+
alignItems: "center",
|
|
67
|
+
border: a,
|
|
68
|
+
direction: "row",
|
|
69
|
+
flex: 1,
|
|
70
|
+
justifyContent: "space-between",
|
|
71
|
+
minHeight: 72,
|
|
72
|
+
px: 20,
|
|
73
|
+
py: 11,
|
|
74
|
+
sx: {
|
|
75
|
+
borderBottomLeftRadius: 4,
|
|
76
|
+
borderTopLeftRadius: 4
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ e(x, {
|
|
80
|
+
label: C,
|
|
81
|
+
children: /* @__PURE__ */ e(b, { amount: s })
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ e(S, {
|
|
84
|
+
name: "remove",
|
|
85
|
+
size: 24
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ e(x, {
|
|
88
|
+
label: w,
|
|
89
|
+
children: /* @__PURE__ */ e(b, { amount: m })
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ e(S, {
|
|
92
|
+
name: "equal",
|
|
93
|
+
size: 24
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ r(o, { children: [/* @__PURE__ */ e(b, { amount: h }), /* @__PURE__ */ r(o, {
|
|
70
96
|
alignItems: "center",
|
|
71
97
|
direction: "row",
|
|
72
|
-
gap:
|
|
98
|
+
gap: 4,
|
|
73
99
|
children: [/* @__PURE__ */ e(c, {
|
|
100
|
+
color: "text.secondary",
|
|
74
101
|
variant: "caption",
|
|
75
102
|
whiteSpace: "nowrap",
|
|
76
|
-
children:
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
children: n.available_to_spend
|
|
104
|
+
}), T]
|
|
105
|
+
})] })
|
|
106
|
+
]
|
|
107
|
+
}), /* @__PURE__ */ e(o, {
|
|
108
|
+
borderBottom: a,
|
|
109
|
+
borderRight: a,
|
|
110
|
+
borderTop: a,
|
|
111
|
+
justifyContent: "center",
|
|
112
|
+
maxWidth: 190,
|
|
113
|
+
minWidth: 148,
|
|
114
|
+
px: 20,
|
|
115
|
+
py: 11,
|
|
116
|
+
sx: {
|
|
117
|
+
borderBottomRightRadius: 4,
|
|
118
|
+
borderTopRightRadius: 4
|
|
119
|
+
},
|
|
120
|
+
children: /* @__PURE__ */ e(x, {
|
|
121
|
+
label: n.next_paycheck,
|
|
122
|
+
children: /* @__PURE__ */ e(I, {
|
|
89
123
|
variant: "h2",
|
|
90
|
-
children: i(o.days, u)
|
|
91
|
-
}), /* @__PURE__ */ e(c, {
|
|
92
|
-
variant: "caption",
|
|
93
124
|
whiteSpace: "nowrap",
|
|
94
|
-
children:
|
|
95
|
-
})
|
|
125
|
+
children: _
|
|
126
|
+
})
|
|
96
127
|
})
|
|
97
|
-
]
|
|
98
|
-
}) : /* @__PURE__ */ r(
|
|
99
|
-
border:
|
|
128
|
+
})]
|
|
129
|
+
}) : /* @__PURE__ */ r(o, {
|
|
130
|
+
border: a,
|
|
100
131
|
borderRadius: 1,
|
|
132
|
+
flex: 1,
|
|
133
|
+
minHeight: 176,
|
|
134
|
+
overflow: "hidden",
|
|
135
|
+
sx: { "& > :not(:last-child)": { borderBottom: a } },
|
|
101
136
|
children: [
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
children: [/* @__PURE__ */ e(a, {
|
|
107
|
-
variant: "body2",
|
|
108
|
-
children: i(o.total_cash_accounts, b.length)
|
|
109
|
-
}), /* @__PURE__ */ e(n, {
|
|
110
|
-
amount: p,
|
|
137
|
+
/* @__PURE__ */ e(f, {
|
|
138
|
+
label: C,
|
|
139
|
+
children: /* @__PURE__ */ e(l, {
|
|
140
|
+
amount: s,
|
|
111
141
|
bold: !0,
|
|
112
|
-
variant: "
|
|
113
|
-
})
|
|
142
|
+
variant: "body2"
|
|
143
|
+
})
|
|
114
144
|
}),
|
|
115
|
-
/* @__PURE__ */ e(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
p: 16,
|
|
120
|
-
children: [/* @__PURE__ */ e(a, {
|
|
121
|
-
variant: "body2",
|
|
122
|
-
children: i(o.expenses_due, l.length)
|
|
123
|
-
}), /* @__PURE__ */ e(n, {
|
|
124
|
-
amount: s,
|
|
145
|
+
/* @__PURE__ */ e(f, {
|
|
146
|
+
label: w,
|
|
147
|
+
children: /* @__PURE__ */ e(l, {
|
|
148
|
+
amount: m,
|
|
125
149
|
bold: !0,
|
|
126
150
|
symbol: "-",
|
|
127
|
-
variant: "
|
|
128
|
-
})
|
|
151
|
+
variant: "body2"
|
|
152
|
+
})
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ e(f, {
|
|
155
|
+
label: n.next_paycheck,
|
|
156
|
+
children: /* @__PURE__ */ e(I, {
|
|
157
|
+
bold: !0,
|
|
158
|
+
variant: "body2",
|
|
159
|
+
children: _
|
|
160
|
+
})
|
|
129
161
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */ e(t, {
|
|
162
|
+
/* @__PURE__ */ r(o, {
|
|
132
163
|
alignItems: "center",
|
|
133
|
-
bgcolor: "
|
|
164
|
+
bgcolor: "neutral.lighter",
|
|
134
165
|
direction: "row",
|
|
135
|
-
|
|
136
|
-
height: 48,
|
|
166
|
+
flex: 1,
|
|
137
167
|
justifyContent: "space-between",
|
|
138
168
|
px: 16,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
169
|
+
children: [/* @__PURE__ */ r(o, {
|
|
170
|
+
alignItems: "center",
|
|
171
|
+
direction: "row",
|
|
172
|
+
gap: 8,
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ e(y, {
|
|
175
|
+
"aria-hidden": !0,
|
|
176
|
+
sx: {
|
|
177
|
+
backgroundColor: H(h),
|
|
178
|
+
borderRadius: "50%",
|
|
179
|
+
height: 8,
|
|
180
|
+
width: 8
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ e(c, {
|
|
184
|
+
variant: "caption",
|
|
185
|
+
children: n.remaining_cash
|
|
186
|
+
}),
|
|
187
|
+
T
|
|
188
|
+
]
|
|
189
|
+
}), /* @__PURE__ */ e(l, {
|
|
190
|
+
amount: h,
|
|
154
191
|
bold: !0,
|
|
155
|
-
variant: "
|
|
156
|
-
children: i(o.days, u)
|
|
192
|
+
variant: "body2"
|
|
157
193
|
})]
|
|
158
194
|
})
|
|
159
195
|
]
|
|
160
196
|
})
|
|
161
|
-
})
|
|
162
|
-
},
|
|
197
|
+
});
|
|
198
|
+
}, se = z(V);
|
|
163
199
|
export {
|
|
164
|
-
|
|
200
|
+
se as default
|
|
165
201
|
};
|
|
166
202
|
|
|
167
203
|
//# sourceMappingURL=CashflowWidgetContent.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CashflowWidgetContent.es.js","names":[],"sources":["../../../src/cashflow/components/CashflowWidgetContent.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, P, Text } from '@mxenabled/mxui'\n\nimport {\n InformationTooltip,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useRecurringTransactionsStore,\n useScreenSize,\n useWidgetContainerProvider,\n} from '../../common'\nimport { useCashflowUiStore } from '../context/hooks'\nimport { CurrencyText } from '../../common'\nimport RemainingCash from './RemainingCash'\nimport { buildDynamicCopy } from '../../core/utils/Localization'\n\nconst CashflowWidgetContent = () => {\n const theme = useTheme()\n const { availableWidth } = useWidgetContainerProvider()\n const { isMobile } = useScreenSize()\n\n const { selectedAccountGuids } = useGlobalUiStore()\n const { cashflow: customCopy } = useGlobalCopyStore()\n const { daysUntilNextIncome, expensesTilNextIncome, selectedCashAccounts, selectedCashBalance } =\n useCashflowUiStore()\n const { isDataLoaded } = useRecurringTransactionsStore()\n\n // Plain derivations: observer tracks the observable reads and re-renders\n // correctly even when arrays are mutated in place by MobX. The account-scoped\n // balance is a store computed (selectedCashBalance).\n const filteredExpenseTotal = expensesTilNextIncome\n .filter((expense) => selectedAccountGuids.includes(expense.accountGuid || ''))\n .reduce((acc, curr) => acc + curr.amount, 0)\n\n const availableToSpend = selectedCashBalance - filteredExpenseTotal\n\n if (!isDataLoaded) {\n return <Loader height={isMobile ? 210 : 120} />\n }\n\n return (\n <Box className=\"mx-cashflow\" pl={16} pr={16} pt={16}>\n {availableWidth > 710 ? (\n <Stack\n border={`1px solid ${theme.palette.divider}`}\n borderRadius={1}\n direction=\"row\"\n justifyContent=\"space-between\"\n px={24}\n >\n <Stack pb={14} pt={12}>\n <CurrencyText amount={selectedCashBalance} variant=\"h2\" />\n <P variant=\"caption\" whiteSpace=\"nowrap\">\n {\n buildDynamicCopy(\n customCopy.total_cash_accounts,\n selectedCashAccounts.length,\n ) as string\n }\n </P>\n </Stack>\n\n <Stack pt={18}>\n <Icon name=\"remove\" />\n </Stack>\n\n <Stack pb={14} pt={12}>\n <CurrencyText amount={filteredExpenseTotal} variant=\"h2\" />\n <P variant=\"caption\" whiteSpace=\"nowrap\">\n {buildDynamicCopy(customCopy.expenses_due, expensesTilNextIncome.length) as string}\n </P>\n </Stack>\n\n <Stack pt={18}>\n <Icon name=\"equal\" />\n </Stack>\n\n <Stack pb={14} pr={24} pt={12}>\n <CurrencyText amount={availableToSpend} variant=\"h2\" />\n <Stack alignItems=\"center\" direction=\"row\" gap={8}>\n <P variant=\"caption\" whiteSpace=\"nowrap\">\n {customCopy.available_to_spend}\n </P>\n <InformationTooltip body={customCopy.tooltip_body} title={customCopy.tooltip_title} />\n </Stack>\n </Stack>\n\n <Stack borderLeft={`1px solid ${theme.palette.divider}`} pb={12} pl={24} pt={12}>\n <>\n <Text variant=\"h2\">\n {buildDynamicCopy(customCopy.days, daysUntilNextIncome) as string}\n </Text>\n <P variant=\"caption\" whiteSpace=\"nowrap\">\n {customCopy.next_paycheck}\n </P>\n </>\n </Stack>\n </Stack>\n ) : (\n <Stack border={`1px solid ${theme.palette.divider}`} borderRadius={1}>\n <Stack direction=\"row\" justifyContent=\"space-between\" p={16}>\n <Text variant=\"body2\">\n {\n buildDynamicCopy(\n customCopy.total_cash_accounts,\n selectedCashAccounts.length,\n ) as string\n }\n </Text>\n <CurrencyText amount={selectedCashBalance} bold={true} variant=\"caption\" />\n </Stack>\n\n <Divider />\n\n <Stack direction=\"row\" justifyContent=\"space-between\" p={16}>\n <Text variant=\"body2\">\n {buildDynamicCopy(customCopy.expenses_due, expensesTilNextIncome.length) as string}\n </Text>\n <CurrencyText amount={filteredExpenseTotal} bold={true} symbol=\"-\" variant=\"caption\" />\n </Stack>\n\n <Divider />\n\n <Stack\n alignItems=\"center\"\n bgcolor=\"background.default\"\n direction=\"row\"\n gap={8}\n height={48}\n justifyContent=\"space-between\"\n px={16}\n sx={{ borderBottomLeftRadius: 4, borderBottomRightRadius: 4 }}\n >\n <RemainingCash remaining={availableToSpend} />\n </Stack>\n <Divider />\n <Stack direction=\"row\" justifyContent=\"space-between\" p={16}>\n <Text variant=\"body2\">{customCopy.next_paycheck}</Text>\n <Text bold={true} variant=\"caption\">\n {buildDynamicCopy(customCopy.days, daysUntilNextIncome) as string}\n </Text>\n </Stack>\n </Stack>\n )}\n </Box>\n )\n}\n\nexport default observer(CashflowWidgetContent)\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,IAAM,IAAA,MAA8B;AAClC,QAAM,IAAQ,EAAS,GACjB,EAAE,gBAAA,EAAA,IAAmB,EAA2B,GAChD,EAAE,UAAA,EAAA,IAAa,EAAc,GAE7B,EAAE,sBAAA,EAAA,IAAyB,EAAiB,GAC5C,EAAE,UAAU,EAAA,IAAe,EAAmB,GAC9C,EAAE,qBAAA,GAAqB,uBAAA,GAAuB,sBAAA,GAAsB,qBAAA,EAAA,IACxE,EAAmB,GACf,EAAE,cAAA,EAAA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AA,EAAC,GAAD;AAAA,YAAM,MAAM;AAAA,YAAM,SAAQ;AAAA,YACvB,UAAA,EAAiB,EAAW,MAAM,CAAmB;AAAA,UAClD,CAAA,CACD;AAAA;MACF;AAAA;EAEN,CAAA,IA3GE,gBAAA,EAAC,GAAD,EAAQ,QAAQ,IAAW,MAAM,IAAM,CAAA;AA6GlD,GAEA,IAAe,EAAS,CAAqB"}
|
|
1
|
+
{"version":3,"file":"CashflowWidgetContent.es.js","names":[],"sources":["../../../src/cashflow/components/CashflowWidgetContent.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, P, Text } from '@mxenabled/mxui'\n\nimport {\n InformationTooltip,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useRecurringTransactionsStore,\n useScreenSize,\n useWidgetContainerProvider,\n} from '../../common'\nimport { useCashflowUiStore } from '../context/hooks'\nimport { CurrencyText, VISUALLY_HIDDEN_SX } from '../../common'\nimport { getRemainingCashColor } from './RemainingCash'\nimport { buildDynamicCopy } from '../../core/utils/Localization'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\nexport const LARGE_LAYOUT_MIN_WIDTH = 633\nconst USE_COMPACT_NOTATION_FROM = 10000\n\nconst EquationAmount = ({ amount }: { amount: number }) => {\n if (Math.abs(amount) < USE_COMPACT_NOTATION_FROM)\n return <CurrencyText amount={amount} variant=\"h2\" />\n\n const compactAmount = formatCurrency(Math.abs(amount), '0.[0]a').toUpperCase()\n const standardAmount = formatCurrency(amount, '0,0.00')\n return (\n <P variant=\"h2\">\n <Box aria-hidden={true} component=\"span\">\n {amount < 0 ? '-' : ''}\n {compactAmount}\n </Box>\n <Box component=\"span\" sx={VISUALLY_HIDDEN_SX}>\n {standardAmount}\n </Box>\n </P>\n )\n}\n\nconst SummaryRow = ({ children, label }: React.PropsWithChildren<{ label: string }>) => (\n <Stack alignItems=\"center\" direction=\"row\" flex={1} justifyContent=\"space-between\" px={16}>\n <P variant=\"caption\">{label}</P>\n {children}\n </Stack>\n)\n\nconst LabeledValue = ({ children, label }: React.PropsWithChildren<{ label: string }>) => (\n <Stack>\n {children}\n <P color=\"text.secondary\" variant=\"caption\" whiteSpace=\"nowrap\">\n {label}\n </P>\n </Stack>\n)\n\nconst CashflowWidgetContent = () => {\n const theme = useTheme()\n const { availableWidth } = useWidgetContainerProvider()\n const { isMobile } = useScreenSize()\n\n const { selectedAccountGuids } = useGlobalUiStore()\n const { cashflow: customCopy } = useGlobalCopyStore()\n const { daysUntilNextIncome, expensesTilNextIncome, selectedCashAccounts, selectedCashBalance } =\n useCashflowUiStore()\n const { isDataLoaded } = useRecurringTransactionsStore()\n\n // Plain derivations: observer tracks the observable reads and re-renders\n // correctly even when arrays are mutated in place by MobX. The account-scoped\n // balance is a store computed (selectedCashBalance).\n const filteredExpenseTotal = expensesTilNextIncome\n .filter((expense) => selectedAccountGuids.includes(expense.accountGuid || ''))\n .reduce((acc, curr) => acc + curr.amount, 0)\n\n const availableToSpend = selectedCashBalance - filteredExpenseTotal\n\n if (!isDataLoaded) {\n return <Loader height={isMobile ? 210 : 120} />\n }\n\n const border = `1px solid ${theme.palette.divider}`\n const cashAccountsLabel = buildDynamicCopy(\n customCopy.total_cash_accounts,\n selectedCashAccounts.length,\n ) as string\n const expensesDueLabel = buildDynamicCopy(\n customCopy.expenses_due,\n expensesTilNextIncome.length,\n ) as string\n const daysLabel = buildDynamicCopy(\n daysUntilNextIncome === 1 ? customCopy.day : customCopy.days,\n daysUntilNextIncome,\n ) as string\n const remainingCashTooltip = (\n <InformationTooltip\n body={customCopy.tooltip_body}\n iconColor=\"action.active\"\n title={customCopy.tooltip_title}\n />\n )\n\n return (\n <Stack className=\"mx-cashflow\" flex={1} px={16}>\n {availableWidth >= LARGE_LAYOUT_MIN_WIDTH ? (\n <Stack direction=\"row\">\n <Stack\n alignItems=\"center\"\n border={border}\n direction=\"row\"\n flex={1}\n justifyContent=\"space-between\"\n minHeight={72}\n px={20}\n py={11}\n sx={{ borderBottomLeftRadius: 4, borderTopLeftRadius: 4 }}\n >\n <LabeledValue label={cashAccountsLabel}>\n <EquationAmount amount={selectedCashBalance} />\n </LabeledValue>\n <Icon name=\"remove\" size={24} />\n <LabeledValue label={expensesDueLabel}>\n <EquationAmount amount={filteredExpenseTotal} />\n </LabeledValue>\n <Icon name=\"equal\" size={24} />\n <Stack>\n <EquationAmount amount={availableToSpend} />\n <Stack alignItems=\"center\" direction=\"row\" gap={4}>\n <P color=\"text.secondary\" variant=\"caption\" whiteSpace=\"nowrap\">\n {customCopy.available_to_spend}\n </P>\n {remainingCashTooltip}\n </Stack>\n </Stack>\n </Stack>\n\n <Stack\n borderBottom={border}\n borderRight={border}\n borderTop={border}\n justifyContent=\"center\"\n maxWidth={190}\n minWidth={148}\n px={20}\n py={11}\n sx={{ borderBottomRightRadius: 4, borderTopRightRadius: 4 }}\n >\n <LabeledValue label={customCopy.next_paycheck}>\n <Text variant=\"h2\" whiteSpace=\"nowrap\">\n {daysLabel}\n </Text>\n </LabeledValue>\n </Stack>\n </Stack>\n ) : (\n <Stack\n border={border}\n borderRadius={1}\n flex={1}\n minHeight={176}\n overflow=\"hidden\"\n sx={{ '& > :not(:last-child)': { borderBottom: border } }}\n >\n <SummaryRow label={cashAccountsLabel}>\n <CurrencyText amount={selectedCashBalance} bold={true} variant=\"body2\" />\n </SummaryRow>\n <SummaryRow label={expensesDueLabel}>\n <CurrencyText amount={filteredExpenseTotal} bold={true} symbol=\"-\" variant=\"body2\" />\n </SummaryRow>\n <SummaryRow label={customCopy.next_paycheck}>\n <Text bold={true} variant=\"body2\">\n {daysLabel}\n </Text>\n </SummaryRow>\n <Stack\n alignItems=\"center\"\n bgcolor=\"neutral.lighter\"\n direction=\"row\"\n flex={1}\n justifyContent=\"space-between\"\n px={16}\n >\n <Stack alignItems=\"center\" direction=\"row\" gap={8}>\n <Box\n aria-hidden={true}\n sx={{\n backgroundColor: getRemainingCashColor(availableToSpend),\n borderRadius: '50%',\n height: 8,\n width: 8,\n }}\n />\n <P variant=\"caption\">{customCopy.remaining_cash}</P>\n {remainingCashTooltip}\n </Stack>\n <CurrencyText amount={availableToSpend} bold={true} variant=\"body2\" />\n </Stack>\n </Stack>\n )}\n </Stack>\n )\n}\n\nexport default observer(CashflowWidgetContent)\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,IAAM,IAA4B,KAE5B,IAAA,CAAkB,EAAE,QAAA,EAAA,MAAiC;AACzD,MAAI,KAAK,IAAI,CAAM,IAAI,EACrB,QAAO,gBAAA,EAAC,GAAD;AAAA,IAAsB,QAAA;AAAA,IAAQ,SAAQ;AAAA,EAAM,CAAA;AAErD,QAAM,IAAgB,EAAe,KAAK,IAAI,CAAM,GAAG,QAAQ,EAAE,YAAY,GACvE,IAAiB,EAAe,GAAQ,QAAQ;AACtD,SACE,gBAAA,EAAC,GAAD;AAAA,IAAG,SAAQ;AAAA,IAAX,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAK,eAAa;AAAA,MAAM,WAAU;AAAA,MAAlC,UAAA,CACG,IAAS,IAAI,MAAM,IACnB,CACE;AAAA,IACL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAAK,WAAU;AAAA,MAAO,IAAI;AAAA,MACvB,UAAA;AAAA,IACE,CAAA,CACJ;AAAA;AAEP,GAEM,IAAA,CAAc,EAAE,UAAA,GAAU,OAAA,EAAA,MAC9B,gBAAA,EAAC,GAAD;AAAA,EAAO,YAAW;AAAA,EAAS,WAAU;AAAA,EAAM,MAAM;AAAA,EAAG,gBAAe;AAAA,EAAgB,IAAI;AAAA,EAAvF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAG,SAAQ;AAAA,IAAW,UAAA;AAAA,EAAS,CAAA,GAC9B,CACI;IAGH,IAAA,CAAgB,EAAE,UAAA,GAAU,OAAA,EAAA,MAChC,gBAAA,EAA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AA,YAAM,KAAK;AAAA,YAAhD,UAAA;AAAA,cACE,gBAAA,EAAC,GAAD;AAAA,gBACE,eAAa;AAAA,gBACb,IAAI;AAAA,kBACF,iBAAiB,EAAsB,CAAgB;AAAA,kBACvD,cAAc;AAAA,kBACd,QAAQ;AAAA,kBACR,OAAO;AAAA,gBACT;AAAA,cACD,CAAA;AAAA,cACD,gBAAA,EAAC,GAAD;AAAA,gBAAG,SAAQ;AAAA,gBAAW,UAAA,EAAW;AAAA,cAAkB,CAAA;AAAA,cAClD;AAAA,YACI;AAAA,UACP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,YAAc,QAAQ;AAAA,YAAkB,MAAM;AAAA,YAAM,SAAQ;AAAA,UAAS,CAAA,CAChE;AAAA;MACF;AAAA;EAEJ,CAAA;AAEX,GAEA,KAAe,EAAS,CAAqB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface RemainingCashProps {
|
|
2
2
|
remaining: number;
|
|
3
3
|
}
|
|
4
|
+
export declare const getRemainingCashColor: (remaining: number) => "success.main" | "error.main" | "warning.main";
|
|
4
5
|
declare const _default: (({ remaining }: RemainingCashProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
5
6
|
displayName: string;
|
|
6
7
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { useGlobalCopyStore as t } from "../../common/context/hooks.es.js";
|
|
2
2
|
import { CurrencyText as i } from "../../common/components/CurrencyText.es.js";
|
|
3
|
-
import { observer as
|
|
4
|
-
import { Text as
|
|
5
|
-
import { Fragment as
|
|
3
|
+
import { observer as a } from "mobx-react-lite";
|
|
4
|
+
import { Text as n } from "@mxenabled/mxui";
|
|
5
|
+
import { Fragment as m, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
import u from "@mui/material/Box";
|
|
7
|
-
var f = ({ remaining: r }) => {
|
|
7
|
+
var f = (r) => r < 0 ? "error.main" : r > 0 ? "success.main" : "warning.main", l = ({ remaining: r }) => {
|
|
8
8
|
const { cashflow: e } = t();
|
|
9
|
-
return /* @__PURE__ */ m
|
|
9
|
+
return /* @__PURE__ */ s(m, { children: [
|
|
10
10
|
/* @__PURE__ */ o(u, { sx: {
|
|
11
11
|
borderRadius: "1px",
|
|
12
|
-
backgroundColor: r
|
|
12
|
+
backgroundColor: f(r),
|
|
13
13
|
height: 6,
|
|
14
14
|
width: 6
|
|
15
15
|
} }),
|
|
16
|
-
/* @__PURE__ */ o(
|
|
16
|
+
/* @__PURE__ */ o(n, {
|
|
17
17
|
bold: !0,
|
|
18
18
|
sx: {
|
|
19
19
|
flexGrow: 1,
|
|
@@ -27,9 +27,10 @@ var f = ({ remaining: r }) => {
|
|
|
27
27
|
sx: { fontSize: 12 }
|
|
28
28
|
})
|
|
29
29
|
] });
|
|
30
|
-
}, g =
|
|
30
|
+
}, g = a(l);
|
|
31
31
|
export {
|
|
32
|
-
g as default
|
|
32
|
+
g as default,
|
|
33
|
+
f as getRemainingCashColor
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
//# sourceMappingURL=RemainingCash.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemainingCash.es.js","names":[],"sources":["../../../src/cashflow/components/RemainingCash.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { useGlobalCopyStore } from '../../common'\nimport { CurrencyText } from '../../common'\n\ninterface RemainingCashProps {\n remaining: number\n}\n\
|
|
1
|
+
{"version":3,"file":"RemainingCash.es.js","names":[],"sources":["../../../src/cashflow/components/RemainingCash.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { useGlobalCopyStore } from '../../common'\nimport { CurrencyText } from '../../common'\n\ninterface RemainingCashProps {\n remaining: number\n}\n\nexport const getRemainingCashColor = (remaining: number) => {\n if (remaining < 0) {\n return 'error.main'\n }\n if (remaining > 0) {\n return 'success.main'\n }\n return 'warning.main'\n}\n\nconst RemainingCash = ({ remaining }: RemainingCashProps) => {\n const { cashflow: customCopy } = useGlobalCopyStore()\n\n return (\n <>\n <Box\n sx={{\n borderRadius: '1px',\n backgroundColor: getRemainingCashColor(remaining),\n height: 6,\n width: 6,\n }}\n />\n <Text bold={true} sx={{ flexGrow: 1, fontSize: 12 }}>\n {customCopy.remaining_cash}\n </Text>\n <CurrencyText amount={remaining} bold={true} sx={{ fontSize: 12 }} />\n </>\n )\n}\n\nexport default observer(RemainingCash)\n"],"mappings":";;;;;;AAaA,IAAa,IAAA,CAAyB,MAChC,IAAY,IACP,eAEL,IAAY,IACP,iBAEF,gBAGH,IAAA,CAAiB,EAAE,WAAA,EAAA,MAAoC;AAC3D,QAAM,EAAE,UAAU,EAAA,IAAe,EAAmB;AAEpD,SACE,gBAAA,EAAA,GAAA,EAAA,UAAA;AAAA,IACE,gBAAA,EAAC,GAAD,EACE,IAAI;AAAA,MACF,cAAc;AAAA,MACd,iBAAiB,EAAsB,CAAS;AAAA,MAChD,QAAQ;AAAA,MACR,OAAO;AAAA,IACT,EACD,CAAA;AAAA,IACD,gBAAA,EAAC,GAAD;AAAA,MAAM,MAAM;AAAA,MAAM,IAAI;AAAA,QAAE,UAAU;AAAA,QAAG,UAAU;AAAA,MAAG;AAAA,MAC/C,UAAA,EAAW;AAAA,IACR,CAAA;AAAA,IACN,gBAAA,EAAC,GAAD;AAAA,MAAc,QAAQ;AAAA,MAAW,MAAM;AAAA,MAAM,IAAI,EAAE,UAAU,GAAG;AAAA,IAAI,CAAA;AAAA,EACpE,EAAA,CAAA;AAEN,GAEA,IAAe,EAAS,CAAa"}
|