@hybridcore/ui 1.6.2 → 1.6.4
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/LinearGradient-DiRq5YcI.js +93 -0
- package/dist/components/charts/chart-wrapper/index.js +41 -40
- package/dist/components/charts/chart-wrapper/logic.js +14 -12
- package/dist/components/charts/heatmap/logic.js +155 -242
- package/dist/components/metric-card/MetricChart.js +65 -50
- package/dist/components/metric-card/helpers.js +18 -0
- package/dist/components/metric-card/index.js +83 -73
- package/dist/components/metric-card/logic.js +64 -76
- package/dist/components/metric-card/styled.js +125 -137
- package/dist/components/sortable-list/index.js +1992 -346
- package/dist/main.d.ts +53 -21
- package/dist/main.js +97 -95
- package/package.json +5 -2
|
@@ -1,160 +1,118 @@
|
|
|
1
|
-
import { styled as
|
|
2
|
-
|
|
1
|
+
import { styled as i, alpha as p, Stack as C, Typography as d } from "@mui/material";
|
|
2
|
+
import { Widget as g } from "../widget/styled.js";
|
|
3
|
+
import { variantColor as s, trendColor as f } from "./helpers.js";
|
|
4
|
+
const e = {
|
|
5
|
+
shouldForwardProp: (o) => o !== "ownerState"
|
|
6
|
+
}, x = i(g.Root, {
|
|
3
7
|
name: "HCMetricCard",
|
|
4
|
-
slot: "Root"
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
slot: "Root",
|
|
9
|
+
...e
|
|
10
|
+
})(({ theme: o, ownerState: t }) => {
|
|
11
|
+
const n = s(o, t.variant), a = t.layout === "panel";
|
|
12
|
+
let r;
|
|
13
|
+
return n ? r = p(n, 0.05) : a && (r = o.palette.background.default), {
|
|
7
14
|
position: "relative",
|
|
8
15
|
overflow: "hidden",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
border: `1px solid ${a.palette.divider}`,
|
|
14
|
-
backgroundColor: a.palette.background.paper,
|
|
15
|
-
display: "flex",
|
|
16
|
-
flexDirection: "column",
|
|
17
|
-
minHeight: 120,
|
|
18
|
-
[a.breakpoints.down("md")]: {
|
|
19
|
-
padding: a.spacing(1.5, 1.5)
|
|
20
|
-
},
|
|
21
|
-
[a.breakpoints.up("md")]: {
|
|
22
|
-
padding: a.spacing(1.5, 2)
|
|
16
|
+
padding: o.spacing(1.5, 2),
|
|
17
|
+
...r && { backgroundColor: r },
|
|
18
|
+
[o.breakpoints.down("md")]: {
|
|
19
|
+
padding: o.spacing(1.5)
|
|
23
20
|
}
|
|
24
21
|
};
|
|
25
|
-
|
|
26
|
-
switch (i.variant) {
|
|
27
|
-
case "primary":
|
|
28
|
-
n = {
|
|
29
|
-
backgroundColor: t(a.palette.primary.main, 0.05),
|
|
30
|
-
borderColor: t(a.palette.primary.main, 0.2)
|
|
31
|
-
};
|
|
32
|
-
break;
|
|
33
|
-
case "success":
|
|
34
|
-
n = {
|
|
35
|
-
backgroundColor: t(a.palette.success.main, 0.05),
|
|
36
|
-
borderColor: t(a.palette.success.main, 0.2)
|
|
37
|
-
};
|
|
38
|
-
break;
|
|
39
|
-
case "warning":
|
|
40
|
-
n = {
|
|
41
|
-
backgroundColor: t(a.palette.warning.main, 0.05),
|
|
42
|
-
borderColor: t(a.palette.warning.main, 0.2)
|
|
43
|
-
};
|
|
44
|
-
break;
|
|
45
|
-
case "danger":
|
|
46
|
-
n = {
|
|
47
|
-
backgroundColor: t(a.palette.error.main, 0.05),
|
|
48
|
-
borderColor: t(a.palette.error.main, 0.2)
|
|
49
|
-
};
|
|
50
|
-
break;
|
|
51
|
-
default:
|
|
52
|
-
n = {
|
|
53
|
-
backgroundColor: a.palette.background.paper,
|
|
54
|
-
borderColor: a.palette.divider
|
|
55
|
-
};
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
...r,
|
|
60
|
-
...n
|
|
61
|
-
};
|
|
62
|
-
}), d = o(e, {
|
|
22
|
+
}), m = i(C, {
|
|
63
23
|
name: "HCMetricCard",
|
|
64
24
|
slot: "Content"
|
|
65
|
-
})((
|
|
25
|
+
})(() => ({
|
|
66
26
|
flex: 1,
|
|
67
27
|
width: "100%",
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})),
|
|
28
|
+
minWidth: 0,
|
|
29
|
+
zIndex: 1
|
|
30
|
+
})), v = i(d, {
|
|
71
31
|
name: "HCMetricCard",
|
|
72
32
|
slot: "Label"
|
|
73
|
-
})(({ theme:
|
|
74
|
-
color:
|
|
75
|
-
marginBottom:
|
|
33
|
+
})(({ theme: o }) => ({
|
|
34
|
+
color: o.palette.text.secondary,
|
|
35
|
+
marginBottom: o.spacing(0.5),
|
|
76
36
|
fontWeight: 500
|
|
77
|
-
})),
|
|
37
|
+
})), y = i(d, {
|
|
78
38
|
name: "HCMetricCard",
|
|
79
|
-
slot: "Value"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
color: r,
|
|
90
|
-
fontWeight: 500,
|
|
91
|
-
marginBottom: a.spacing(0.5)
|
|
92
|
-
};
|
|
93
|
-
}), C = o("div", {
|
|
39
|
+
slot: "Value",
|
|
40
|
+
...e
|
|
41
|
+
})(({ theme: o, ownerState: t }) => ({
|
|
42
|
+
color: s(o, t.variant) ?? o.palette.text.primary,
|
|
43
|
+
fontWeight: 500,
|
|
44
|
+
marginBottom: o.spacing(0.5),
|
|
45
|
+
whiteSpace: "nowrap",
|
|
46
|
+
[o.breakpoints.down("md")]: { fontSize: "1.35rem" },
|
|
47
|
+
[o.breakpoints.up("md")]: { fontSize: "2rem" }
|
|
48
|
+
})), I = i("div", {
|
|
94
49
|
name: "HCMetricCard",
|
|
95
|
-
slot: "TrendContainer"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
fontSize: "0.7rem",
|
|
101
|
-
".MuiSvgIcon-root": {
|
|
102
|
-
display: "none"
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
[a.breakpoints.up("md")]: {
|
|
106
|
-
fontSize: "0.875rem"
|
|
107
|
-
},
|
|
50
|
+
slot: "TrendContainer",
|
|
51
|
+
...e
|
|
52
|
+
})(({ theme: o, ownerState: t }) => {
|
|
53
|
+
const n = f(o, t.calculatedTrend), a = t.layout === "panel";
|
|
54
|
+
return {
|
|
108
55
|
display: "inline-flex",
|
|
109
56
|
alignItems: "center",
|
|
110
|
-
gap:
|
|
57
|
+
gap: o.spacing(0.5),
|
|
111
58
|
fontWeight: 500,
|
|
112
|
-
color:
|
|
59
|
+
color: n,
|
|
60
|
+
...a ? {
|
|
61
|
+
backgroundColor: p(n, 0.14),
|
|
62
|
+
borderRadius: 999,
|
|
63
|
+
padding: o.spacing(0.25, 1),
|
|
64
|
+
fontSize: "0.8125rem",
|
|
65
|
+
whiteSpace: "nowrap"
|
|
66
|
+
} : {
|
|
67
|
+
fontSize: "0.875rem",
|
|
68
|
+
[o.breakpoints.down("md")]: {
|
|
69
|
+
fontSize: "0.7rem",
|
|
70
|
+
".MuiSvgIcon-root": { display: "none" }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
113
73
|
};
|
|
114
|
-
}),
|
|
74
|
+
}), k = i(d, {
|
|
115
75
|
name: "HCMetricCard",
|
|
116
76
|
slot: "Description"
|
|
117
|
-
})(({ theme:
|
|
118
|
-
color:
|
|
77
|
+
})(({ theme: o }) => ({
|
|
78
|
+
color: o.palette.text.secondary,
|
|
119
79
|
display: "block",
|
|
120
80
|
position: "relative",
|
|
121
81
|
zIndex: 1
|
|
122
|
-
})),
|
|
82
|
+
})), w = i("div", {
|
|
123
83
|
name: "HCMetricCard",
|
|
124
|
-
slot: "Icon"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
};
|
|
141
|
-
}), u = o("div", {
|
|
84
|
+
slot: "Icon",
|
|
85
|
+
...e
|
|
86
|
+
})(({ theme: o, ownerState: t }) => ({
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
justifyContent: "center",
|
|
90
|
+
color: s(o, t.variant) ?? o.palette.text.secondary,
|
|
91
|
+
marginRight: t.iconPosition === "left" ? o.spacing(2) : 0,
|
|
92
|
+
marginLeft: t.iconPosition === "right" ? o.spacing(2) : 0,
|
|
93
|
+
[o.breakpoints.down("sm")]: {
|
|
94
|
+
position: "absolute",
|
|
95
|
+
top: o.spacing(2),
|
|
96
|
+
left: o.spacing(2),
|
|
97
|
+
margin: 0
|
|
98
|
+
}
|
|
99
|
+
})), H = i("div", {
|
|
142
100
|
name: "HCMetricCard",
|
|
143
|
-
slot: "CornerIcon"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const n = {};
|
|
148
|
-
return
|
|
101
|
+
slot: "CornerIcon",
|
|
102
|
+
...e
|
|
103
|
+
})(({ theme: o, ownerState: t }) => {
|
|
104
|
+
var c, l;
|
|
105
|
+
const n = {}, a = (c = t.iconPosition) != null && c.startsWith("top") ? "top" : "bottom", r = (l = t.iconPosition) != null && l.endsWith("left") ? "left" : "right";
|
|
106
|
+
return n[a] = o.spacing(2), n[r] = o.spacing(2), {
|
|
149
107
|
position: "absolute",
|
|
150
108
|
...n,
|
|
151
|
-
color:
|
|
109
|
+
color: s(o, t.variant) ?? o.palette.text.secondary,
|
|
152
110
|
zIndex: 2
|
|
153
111
|
};
|
|
154
|
-
}),
|
|
112
|
+
}), P = i("div", {
|
|
155
113
|
name: "HCMetricCard",
|
|
156
|
-
slot: "
|
|
157
|
-
})(({ theme:
|
|
114
|
+
slot: "Chart"
|
|
115
|
+
})(({ theme: o }) => ({
|
|
158
116
|
position: "absolute",
|
|
159
117
|
right: 0,
|
|
160
118
|
bottom: 0,
|
|
@@ -163,16 +121,46 @@ const c = o("div", {
|
|
|
163
121
|
display: "flex",
|
|
164
122
|
alignItems: "flex-end",
|
|
165
123
|
overflow: "hidden",
|
|
166
|
-
borderRadius:
|
|
124
|
+
borderRadius: o.shape.borderRadius
|
|
125
|
+
})), S = i("div", {
|
|
126
|
+
name: "HCMetricCard",
|
|
127
|
+
slot: "Panel"
|
|
128
|
+
})(({ theme: o }) => ({
|
|
129
|
+
display: "flex",
|
|
130
|
+
flexDirection: "row",
|
|
131
|
+
alignItems: "stretch",
|
|
132
|
+
gap: o.spacing(2),
|
|
133
|
+
flex: 1,
|
|
134
|
+
minHeight: 0,
|
|
135
|
+
marginTop: o.spacing(1),
|
|
136
|
+
padding: o.spacing(2),
|
|
137
|
+
borderRadius: o.shape.borderRadius * 2,
|
|
138
|
+
border: `1px solid ${o.palette.divider}`,
|
|
139
|
+
backgroundColor: o.palette.background.paper,
|
|
140
|
+
boxShadow: o.shadows[1],
|
|
141
|
+
overflow: "hidden"
|
|
142
|
+
})), z = i("div", {
|
|
143
|
+
name: "HCMetricCard",
|
|
144
|
+
slot: "SideChart"
|
|
145
|
+
})(() => ({
|
|
146
|
+
// Take only the space the value/trend column leaves: grow into the gap, shrink to 0
|
|
147
|
+
// when the left content is wide (basis 0 + minWidth 0), so the value/pill never wrap.
|
|
148
|
+
flex: "1 1 0",
|
|
149
|
+
minWidth: 0,
|
|
150
|
+
alignSelf: "stretch",
|
|
151
|
+
display: "flex",
|
|
152
|
+
alignItems: "flex-end"
|
|
167
153
|
}));
|
|
168
154
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
155
|
+
P as MetricCardChartContainer,
|
|
156
|
+
m as MetricCardContent,
|
|
157
|
+
H as MetricCardCornerIconContainer,
|
|
158
|
+
k as MetricCardDescription,
|
|
159
|
+
w as MetricCardIconContainer,
|
|
160
|
+
v as MetricCardLabel,
|
|
161
|
+
S as MetricCardPanel,
|
|
162
|
+
x as MetricCardRoot,
|
|
163
|
+
z as MetricCardSideChart,
|
|
164
|
+
I as MetricCardTrendContainer,
|
|
165
|
+
y as MetricCardValue
|
|
178
166
|
};
|