@hybridcore/ui 1.5.80 → 1.5.82
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/dist/{AxisRendererY-CFo972D5.js → AxisRendererY-kADUad00.js} +2464 -3363
- package/dist/ColumnSeries-BTcqshjB.js +399 -0
- package/dist/DateAxis-CMum47iz.js +924 -0
- package/dist/LineSeries-CfcpoYla.js +549 -0
- package/dist/components/charts/candlestick/logic.js +133 -526
- package/dist/components/charts/highlighting-line-data/logic.js +152 -695
- package/dist/components/metric-card/MetricChart.js +525 -0
- package/dist/components/metric-card/index.js +88 -45
- package/dist/components/metric-card/logic.js +82 -37
- package/dist/components/metric-card/styled.js +109 -90
- package/dist/components/paginated-list/styled.js +3 -3
- package/dist/main.d.ts +33 -14
- package/package.json +1 -1
|
@@ -1,46 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useThemeProps as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
label:
|
|
6
|
-
value:
|
|
7
|
-
|
|
1
|
+
import { ArrowForward as S, TrendingUp as $, TrendingDown as y } from "@mui/icons-material";
|
|
2
|
+
import { useThemeProps as P } from "@mui/material";
|
|
3
|
+
const L = (N) => {
|
|
4
|
+
const u = P({ props: N, name: "MuiMetricCard" }), {
|
|
5
|
+
label: w,
|
|
6
|
+
value: e = [],
|
|
7
|
+
description: b,
|
|
8
|
+
variant: f = "default",
|
|
9
|
+
loading: v = !1,
|
|
10
|
+
showChange: p = !1,
|
|
8
11
|
changeType: r = "percentage",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
showTrend: d = !1,
|
|
13
|
+
showIcon: l = !1,
|
|
14
|
+
icon: c,
|
|
15
|
+
iconPosition: i = "right",
|
|
16
|
+
showChart: T = !1,
|
|
17
|
+
chartType: C,
|
|
18
|
+
sx: I,
|
|
19
|
+
...x
|
|
20
|
+
} = u, m = e.length > 0;
|
|
21
|
+
let h = "—";
|
|
22
|
+
if (m) {
|
|
23
|
+
const t = Number(e[e.length - 1].v);
|
|
24
|
+
isNaN(t) || (h = new Intl.NumberFormat("en-US", {
|
|
25
|
+
maximumFractionDigits: 2
|
|
26
|
+
}).format(t));
|
|
27
|
+
}
|
|
28
|
+
let s;
|
|
29
|
+
if (p)
|
|
30
|
+
if (e.length >= 2) {
|
|
31
|
+
const t = Number(e[e.length - 1].v), n = Number(e[e.length - 2].v);
|
|
32
|
+
if (isNaN(t) || isNaN(n))
|
|
33
|
+
s = "—";
|
|
34
|
+
else if (n === 0 && r === "percentage")
|
|
35
|
+
s = "—";
|
|
36
|
+
else {
|
|
37
|
+
let a = 0;
|
|
38
|
+
r === "absolute" ? a = t - n : a = (t - n) / n * 100, s = `${a > 0 ? "+" : a < 0 ? "−" : ""}${Math.abs(a).toFixed(
|
|
39
|
+
r === "percentage" ? 1 : 2
|
|
40
|
+
)}${r === "percentage" ? "%" : ""}`;
|
|
41
|
+
}
|
|
42
|
+
} else
|
|
43
|
+
s = "—";
|
|
44
|
+
let o;
|
|
45
|
+
if (d && e.length >= 2) {
|
|
46
|
+
const t = Number(e[e.length - 1].v), n = Number(e[e.length - 2].v);
|
|
47
|
+
!isNaN(t) && !isNaN(n) && (t > n ? o = "up" : t < n ? o = "down" : o = "neutral");
|
|
48
|
+
}
|
|
49
|
+
const F = {
|
|
50
|
+
...u,
|
|
51
|
+
calculatedValue: h,
|
|
52
|
+
calculatedChange: s,
|
|
53
|
+
calculatedTrend: o,
|
|
54
|
+
hasData: m,
|
|
18
55
|
changeType: r,
|
|
19
|
-
iconPosition:
|
|
20
|
-
variant:
|
|
56
|
+
iconPosition: i,
|
|
57
|
+
variant: f
|
|
21
58
|
};
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
);
|
|
59
|
+
let g = S;
|
|
60
|
+
o === "up" ? g = $ : o === "down" && (g = y);
|
|
61
|
+
const M = l && !!c && ["top-left", "top-right", "bottom-left", "bottom-right"].includes(
|
|
62
|
+
i || ""
|
|
63
|
+
), D = l && !!c && ["left", "right"].includes(i || "");
|
|
27
64
|
return {
|
|
28
|
-
label:
|
|
29
|
-
value:
|
|
30
|
-
|
|
65
|
+
label: w,
|
|
66
|
+
value: e,
|
|
67
|
+
calculatedValue: h,
|
|
68
|
+
calculatedChange: s,
|
|
69
|
+
calculatedTrend: o,
|
|
70
|
+
description: b,
|
|
71
|
+
variant: f,
|
|
72
|
+
loading: v,
|
|
73
|
+
showChange: p,
|
|
31
74
|
changeType: r,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
75
|
+
showTrend: d,
|
|
76
|
+
showIcon: l,
|
|
77
|
+
Icon: c,
|
|
78
|
+
iconPosition: i,
|
|
79
|
+
showChart: T,
|
|
80
|
+
chartType: C,
|
|
81
|
+
sx: I,
|
|
82
|
+
other: x,
|
|
83
|
+
ownerState: F,
|
|
84
|
+
TrendIcon: g,
|
|
85
|
+
showCornerIcon: M,
|
|
86
|
+
showSideIcon: D
|
|
42
87
|
};
|
|
43
88
|
};
|
|
44
89
|
export {
|
|
45
|
-
|
|
90
|
+
L as useMetricCardLogic
|
|
46
91
|
};
|
|
@@ -1,136 +1,155 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
const
|
|
1
|
+
import { styled as t, alpha as o, Stack as s, Typography as e } from "@mui/material";
|
|
2
|
+
const c = t("div", {
|
|
3
3
|
name: "MuiMetricCard",
|
|
4
4
|
slot: "Root"
|
|
5
|
-
})(({ theme:
|
|
6
|
-
const
|
|
5
|
+
})(({ theme: a, ownerState: i }) => {
|
|
6
|
+
const r = {
|
|
7
7
|
position: "relative",
|
|
8
8
|
overflow: "hidden",
|
|
9
|
-
padding:
|
|
10
|
-
borderRadius:
|
|
11
|
-
boxShadow:
|
|
9
|
+
padding: a.spacing(2, 3),
|
|
10
|
+
borderRadius: a.shape.borderRadius * 2,
|
|
11
|
+
boxShadow: a.shadows[1],
|
|
12
12
|
transition: "all 0.3s",
|
|
13
|
-
"&:hover": { boxShadow:
|
|
14
|
-
border: `1px solid ${
|
|
15
|
-
backgroundColor:
|
|
13
|
+
"&:hover": { boxShadow: a.shadows[3] },
|
|
14
|
+
border: `1px solid ${a.palette.divider}`,
|
|
15
|
+
backgroundColor: a.palette.background.paper,
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexDirection: "column",
|
|
18
|
+
minHeight: 120
|
|
16
19
|
};
|
|
17
|
-
let
|
|
18
|
-
switch (
|
|
20
|
+
let n = {};
|
|
21
|
+
switch (i.variant) {
|
|
19
22
|
case "primary":
|
|
20
|
-
|
|
21
|
-
backgroundColor:
|
|
22
|
-
borderColor:
|
|
23
|
+
n = {
|
|
24
|
+
backgroundColor: o(a.palette.primary.main, 0.05),
|
|
25
|
+
borderColor: o(a.palette.primary.main, 0.2)
|
|
23
26
|
};
|
|
24
27
|
break;
|
|
25
28
|
case "success":
|
|
26
|
-
|
|
27
|
-
backgroundColor:
|
|
28
|
-
borderColor:
|
|
29
|
+
n = {
|
|
30
|
+
backgroundColor: o(a.palette.success.main, 0.05),
|
|
31
|
+
borderColor: o(a.palette.success.main, 0.2)
|
|
29
32
|
};
|
|
30
33
|
break;
|
|
31
34
|
case "warning":
|
|
32
|
-
|
|
33
|
-
backgroundColor:
|
|
34
|
-
borderColor:
|
|
35
|
+
n = {
|
|
36
|
+
backgroundColor: o(a.palette.warning.main, 0.05),
|
|
37
|
+
borderColor: o(a.palette.warning.main, 0.2)
|
|
35
38
|
};
|
|
36
39
|
break;
|
|
37
40
|
case "danger":
|
|
38
|
-
|
|
39
|
-
backgroundColor:
|
|
40
|
-
borderColor:
|
|
41
|
+
n = {
|
|
42
|
+
backgroundColor: o(a.palette.error.main, 0.05),
|
|
43
|
+
borderColor: o(a.palette.error.main, 0.2)
|
|
41
44
|
};
|
|
42
45
|
break;
|
|
43
46
|
default:
|
|
44
|
-
|
|
45
|
-
backgroundColor:
|
|
46
|
-
borderColor:
|
|
47
|
+
n = {
|
|
48
|
+
backgroundColor: a.palette.background.paper,
|
|
49
|
+
borderColor: a.palette.divider
|
|
47
50
|
};
|
|
48
51
|
break;
|
|
49
52
|
}
|
|
50
53
|
return {
|
|
51
|
-
...
|
|
52
|
-
...
|
|
54
|
+
...r,
|
|
55
|
+
...n
|
|
53
56
|
};
|
|
54
|
-
}),
|
|
57
|
+
}), p = t(s, {
|
|
55
58
|
name: "MuiMetricCard",
|
|
56
59
|
slot: "Content"
|
|
57
|
-
})(() => ({
|
|
58
|
-
flex: 1
|
|
59
|
-
|
|
60
|
+
})(({ theme: a }) => ({
|
|
61
|
+
flex: 1,
|
|
62
|
+
width: "100%",
|
|
63
|
+
zIndex: 1,
|
|
64
|
+
[a.breakpoints.down("sm")]: {
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
textAlign: "center"
|
|
67
|
+
}
|
|
68
|
+
})), d = t(e, {
|
|
60
69
|
name: "MuiMetricCard",
|
|
61
70
|
slot: "Label"
|
|
62
|
-
})(({ theme:
|
|
63
|
-
color:
|
|
64
|
-
marginBottom:
|
|
65
|
-
|
|
71
|
+
})(({ theme: a }) => ({
|
|
72
|
+
color: a.palette.text.secondary,
|
|
73
|
+
marginBottom: a.spacing(0.5),
|
|
74
|
+
fontWeight: 500
|
|
75
|
+
})), g = t(e, {
|
|
66
76
|
name: "MuiMetricCard",
|
|
67
77
|
slot: "Value"
|
|
68
|
-
})(({ theme:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
})(({ theme: a, ownerState: i }) => {
|
|
79
|
+
let r = a.palette.text.primary;
|
|
80
|
+
return i.variant === "primary" && (r = a.palette.primary.main), i.variant === "success" && (r = a.palette.success.main), i.variant === "warning" && (r = a.palette.warning.main), i.variant === "danger" && (r = a.palette.error.main), {
|
|
81
|
+
color: r,
|
|
82
|
+
fontWeight: "bold",
|
|
83
|
+
marginBottom: a.spacing(0.5)
|
|
84
|
+
};
|
|
85
|
+
}), u = t("div", {
|
|
73
86
|
name: "MuiMetricCard",
|
|
74
87
|
slot: "TrendContainer"
|
|
75
|
-
})(({ theme:
|
|
76
|
-
let
|
|
77
|
-
return
|
|
88
|
+
})(({ theme: a, ownerState: i }) => {
|
|
89
|
+
let r = a.palette.text.secondary;
|
|
90
|
+
return i.calculatedTrend === "up" ? r = a.palette.success.main : i.calculatedTrend === "down" ? r = a.palette.error.main : i.calculatedTrend === "neutral" && (r = a.palette.text.secondary), {
|
|
78
91
|
display: "inline-flex",
|
|
79
92
|
alignItems: "center",
|
|
80
|
-
gap:
|
|
81
|
-
|
|
82
|
-
borderRadius: 10,
|
|
83
|
-
...o.typography.caption,
|
|
93
|
+
gap: a.spacing(0.5),
|
|
94
|
+
fontSize: "0.875rem",
|
|
84
95
|
fontWeight: 500,
|
|
85
|
-
color:
|
|
86
|
-
backgroundColor: r
|
|
96
|
+
color: r
|
|
87
97
|
};
|
|
88
|
-
}),
|
|
98
|
+
}), C = t(e, {
|
|
89
99
|
name: "MuiMetricCard",
|
|
90
100
|
slot: "Description"
|
|
91
|
-
})(({ theme:
|
|
92
|
-
color:
|
|
93
|
-
|
|
101
|
+
})(({ theme: a }) => ({
|
|
102
|
+
color: a.palette.text.secondary,
|
|
103
|
+
display: "block"
|
|
104
|
+
})), f = t("div", {
|
|
94
105
|
name: "MuiMetricCard",
|
|
95
106
|
slot: "Icon"
|
|
96
|
-
})(({ theme:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
})(({ theme: a, ownerState: i }) => {
|
|
108
|
+
let r = a.palette.text.secondary;
|
|
109
|
+
return i.variant === "primary" && (r = a.palette.primary.main), i.variant === "success" && (r = a.palette.success.main), i.variant === "warning" && (r = a.palette.warning.main), i.variant === "danger" && (r = a.palette.error.main), {
|
|
110
|
+
display: "flex",
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
justifyContent: "center",
|
|
113
|
+
color: r,
|
|
114
|
+
marginRight: i.iconPosition === "left" ? a.spacing(2) : 0,
|
|
115
|
+
marginLeft: i.iconPosition === "right" ? a.spacing(2) : 0,
|
|
116
|
+
[a.breakpoints.down("sm")]: {
|
|
117
|
+
position: "absolute",
|
|
118
|
+
top: a.spacing(2),
|
|
119
|
+
left: a.spacing(2),
|
|
120
|
+
margin: 0
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}), b = t("div", {
|
|
107
124
|
name: "MuiMetricCard",
|
|
108
125
|
slot: "CornerIcon"
|
|
109
|
-
})(({ theme:
|
|
110
|
-
|
|
111
|
-
|
|
126
|
+
})(({ theme: a, ownerState: i }) => {
|
|
127
|
+
let r = a.palette.text.secondary;
|
|
128
|
+
i.variant === "primary" && (r = a.palette.primary.main), i.variant === "success" && (r = a.palette.success.main), i.variant === "warning" && (r = a.palette.warning.main), i.variant === "danger" && (r = a.palette.error.main);
|
|
129
|
+
const n = {};
|
|
130
|
+
return i.iconPosition === "top-left" ? (n.top = a.spacing(2), n.left = a.spacing(2)) : i.iconPosition === "top-right" ? (n.top = a.spacing(2), n.right = a.spacing(2)) : i.iconPosition === "bottom-left" ? (n.bottom = a.spacing(2), n.left = a.spacing(2)) : i.iconPosition === "bottom-right" && (n.bottom = a.spacing(2), n.right = a.spacing(2)), {
|
|
112
131
|
position: "absolute",
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
right: (d = a.iconPosition) != null && d.includes("right") ? 24 : void 0,
|
|
117
|
-
zIndex: 1,
|
|
118
|
-
width: 48,
|
|
119
|
-
height: 48,
|
|
120
|
-
borderRadius: "50%",
|
|
121
|
-
backgroundColor: o.palette.action.hover,
|
|
122
|
-
display: "flex",
|
|
123
|
-
alignItems: "center",
|
|
124
|
-
justifyContent: "center"
|
|
132
|
+
...n,
|
|
133
|
+
color: r,
|
|
134
|
+
zIndex: 2
|
|
125
135
|
};
|
|
126
|
-
})
|
|
136
|
+
}), y = t("div", {
|
|
137
|
+
name: "MuiMetricCard",
|
|
138
|
+
slot: "ChartContainer"
|
|
139
|
+
})(() => ({
|
|
140
|
+
height: 40,
|
|
141
|
+
width: "100%",
|
|
142
|
+
display: "flex",
|
|
143
|
+
alignItems: "flex-end"
|
|
144
|
+
}));
|
|
127
145
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
146
|
+
y as MetricCardChartContainer,
|
|
147
|
+
p as MetricCardContent,
|
|
148
|
+
b as MetricCardCornerIconContainer,
|
|
149
|
+
C as MetricCardDescription,
|
|
150
|
+
f as MetricCardIconContainer,
|
|
151
|
+
d as MetricCardLabel,
|
|
152
|
+
c as MetricCardRoot,
|
|
153
|
+
u as MetricCardTrendContainer,
|
|
154
|
+
g as MetricCardValue
|
|
136
155
|
};
|
|
@@ -11,7 +11,7 @@ const s = t(e, {
|
|
|
11
11
|
slot: "Header"
|
|
12
12
|
})(({ theme: i }) => ({
|
|
13
13
|
padding: i.spacing(3),
|
|
14
|
-
paddingBottom:
|
|
14
|
+
paddingBottom: i.spacing(2),
|
|
15
15
|
"& .MuiCardHeader-title": {
|
|
16
16
|
fontSize: "1rem",
|
|
17
17
|
fontWeight: 500
|
|
@@ -34,7 +34,7 @@ const s = t(e, {
|
|
|
34
34
|
})(() => ({
|
|
35
35
|
flex: 1,
|
|
36
36
|
overflowY: "auto"
|
|
37
|
-
})),
|
|
37
|
+
})), p = t("div", {
|
|
38
38
|
name: "MuiPaginatedList",
|
|
39
39
|
slot: "Pagination"
|
|
40
40
|
})(({ theme: i }) => ({
|
|
@@ -44,6 +44,6 @@ export {
|
|
|
44
44
|
l as PaginatedListContent,
|
|
45
45
|
r as PaginatedListHeader,
|
|
46
46
|
g as PaginatedListList,
|
|
47
|
-
|
|
47
|
+
p as PaginatedListPagination,
|
|
48
48
|
s as PaginatedListRoot
|
|
49
49
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -195,6 +195,11 @@ export declare const ContextMenu: React.FC<Props_3>;
|
|
|
195
195
|
|
|
196
196
|
export { createTheme }
|
|
197
197
|
|
|
198
|
+
declare interface DataPointType {
|
|
199
|
+
t: string; // ISO date
|
|
200
|
+
v: number;
|
|
201
|
+
}
|
|
202
|
+
|
|
198
203
|
declare interface DataType extends ItemProps {
|
|
199
204
|
idKey?: string;
|
|
200
205
|
children?: DataType[];
|
|
@@ -676,26 +681,39 @@ export declare namespace Map_2 {
|
|
|
676
681
|
export declare const MetricCard: (props: MetricCardProps & React_2.RefAttributes<HTMLDivElement>) => React_2.ReactNode | null;
|
|
677
682
|
|
|
678
683
|
export declare interface MetricCardProps {
|
|
679
|
-
label
|
|
680
|
-
value
|
|
681
|
-
change?: number;
|
|
682
|
-
changeType?: MetricChangeType;
|
|
683
|
-
trend?: MetricTrend;
|
|
684
|
-
icon?: React.ElementType;
|
|
685
|
-
iconPosition?:
|
|
686
|
-
| "left"
|
|
687
|
-
| "right"
|
|
688
|
-
| "top-left"
|
|
689
|
-
| "top-right"
|
|
690
|
-
| "bottom-left"
|
|
691
|
-
| "bottom-right";
|
|
684
|
+
label: string;
|
|
685
|
+
value: DataPointType[];
|
|
692
686
|
description?: string;
|
|
693
687
|
variant?: MetricVariant;
|
|
688
|
+
loading?: boolean;
|
|
689
|
+
|
|
690
|
+
showChange?: boolean;
|
|
691
|
+
changeType?: MetricChangeType;
|
|
692
|
+
|
|
693
|
+
showTrend?: boolean;
|
|
694
|
+
|
|
695
|
+
showIcon?: boolean;
|
|
696
|
+
icon?: React.ElementType;
|
|
697
|
+
iconPosition?: MetricIconPosition;
|
|
698
|
+
|
|
699
|
+
showChart?: boolean;
|
|
700
|
+
chartType?: MetricChartType;
|
|
701
|
+
|
|
694
702
|
sx?: SxProps<Theme>;
|
|
695
703
|
}
|
|
696
704
|
|
|
697
705
|
export declare type MetricChangeType = "percentage" | "absolute";
|
|
698
706
|
|
|
707
|
+
declare type MetricChartType = "column" | "line";
|
|
708
|
+
|
|
709
|
+
declare type MetricIconPosition =
|
|
710
|
+
| "left"
|
|
711
|
+
| "right"
|
|
712
|
+
| "top-left"
|
|
713
|
+
| "top-right"
|
|
714
|
+
| "bottom-left"
|
|
715
|
+
| "bottom-right";
|
|
716
|
+
|
|
699
717
|
export declare type MetricTrend = "up" | "down" | "neutral";
|
|
700
718
|
|
|
701
719
|
export declare type MetricVariant =
|
|
@@ -1306,7 +1324,8 @@ declare module "@mui/material/styles" {
|
|
|
1306
1324
|
| "trendValue"
|
|
1307
1325
|
| "description"
|
|
1308
1326
|
| "icon"
|
|
1309
|
-
| "cornerIcon"
|
|
1327
|
+
| "cornerIcon"
|
|
1328
|
+
| "chart";
|
|
1310
1329
|
}
|
|
1311
1330
|
|
|
1312
1331
|
interface ComponentsPropsList {
|