@hybridcore/ui 1.5.78 → 1.5.79
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/components/metric-card/index.js +111 -95
- package/dist/main.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,101 +1,117 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { TrendingUp as
|
|
3
|
-
import { useTheme as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { TrendingUp as C, TrendingDown as S, Remove as z } from "@mui/icons-material";
|
|
3
|
+
import { useTheme as j, Card as R, Stack as h, Box as o, Typography as s, alpha as t } from "@mui/material";
|
|
4
|
+
const W = ({
|
|
5
5
|
label: g,
|
|
6
|
-
value:
|
|
6
|
+
value: u,
|
|
7
7
|
change: d,
|
|
8
|
-
changeType:
|
|
9
|
-
trend:
|
|
10
|
-
icon:
|
|
11
|
-
iconPosition:
|
|
8
|
+
changeType: m = "percentage",
|
|
9
|
+
trend: c,
|
|
10
|
+
icon: i,
|
|
11
|
+
iconPosition: n = "right",
|
|
12
12
|
description: p,
|
|
13
13
|
variant: b = "default",
|
|
14
|
-
sx:
|
|
14
|
+
sx: f
|
|
15
15
|
}) => {
|
|
16
|
-
const
|
|
17
|
-
color:
|
|
18
|
-
bgcolor: t(
|
|
19
|
-
} :
|
|
20
|
-
color:
|
|
21
|
-
bgcolor: t(
|
|
16
|
+
const r = j(), x = () => c === "up" ? /* @__PURE__ */ e(C, { sx: { fontSize: 16 } }) : c === "down" ? /* @__PURE__ */ e(S, { sx: { fontSize: 16 } }) : /* @__PURE__ */ e(z, { sx: { fontSize: 16 } }), y = () => c === "up" ? {
|
|
17
|
+
color: r.palette.success.main,
|
|
18
|
+
bgcolor: t(r.palette.success.main, 0.1)
|
|
19
|
+
} : c === "down" ? {
|
|
20
|
+
color: r.palette.error.main,
|
|
21
|
+
bgcolor: t(r.palette.error.main, 0.1)
|
|
22
22
|
} : {
|
|
23
|
-
color:
|
|
24
|
-
bgcolor:
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
color: r.palette.text.secondary,
|
|
24
|
+
bgcolor: r.palette.action.hover
|
|
25
|
+
}, v = () => {
|
|
26
|
+
const l = {
|
|
27
|
+
p: 3,
|
|
28
|
+
borderRadius: 2,
|
|
29
|
+
boxShadow: 1,
|
|
30
|
+
transition: "all 0.3s",
|
|
31
|
+
"&:hover": { boxShadow: 3 },
|
|
32
|
+
border: 1
|
|
33
|
+
};
|
|
34
|
+
switch (b) {
|
|
35
|
+
case "primary":
|
|
36
|
+
return {
|
|
37
|
+
...l,
|
|
38
|
+
bgcolor: t(r.palette.primary.main, 0.05),
|
|
39
|
+
borderColor: t(r.palette.primary.main, 0.2)
|
|
40
|
+
};
|
|
41
|
+
case "success":
|
|
42
|
+
return {
|
|
43
|
+
...l,
|
|
44
|
+
bgcolor: t(r.palette.success.main, 0.05),
|
|
45
|
+
borderColor: t(r.palette.success.main, 0.2)
|
|
46
|
+
};
|
|
47
|
+
case "warning":
|
|
48
|
+
return {
|
|
49
|
+
...l,
|
|
50
|
+
bgcolor: t(r.palette.warning.main, 0.05),
|
|
51
|
+
borderColor: t(r.palette.warning.main, 0.2)
|
|
52
|
+
};
|
|
53
|
+
case "danger":
|
|
54
|
+
return {
|
|
55
|
+
...l,
|
|
56
|
+
bgcolor: t(r.palette.error.main, 0.05),
|
|
57
|
+
borderColor: t(r.palette.error.main, 0.2)
|
|
58
|
+
};
|
|
59
|
+
default:
|
|
60
|
+
return {
|
|
61
|
+
...l,
|
|
62
|
+
bgcolor: "background.paper",
|
|
63
|
+
borderColor: "divider"
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}, w = () => !i || !["top-left", "top-right", "bottom-left", "bottom-right"].includes(
|
|
67
|
+
n
|
|
68
|
+
) ? null : /* @__PURE__ */ e(
|
|
69
|
+
o,
|
|
28
70
|
{
|
|
29
71
|
sx: {
|
|
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
|
-
|
|
59
|
-
return {
|
|
60
|
-
...a,
|
|
61
|
-
bgcolor: t(e.palette.error.main, 0.05),
|
|
62
|
-
borderColor: t(e.palette.error.main, 0.2)
|
|
63
|
-
};
|
|
64
|
-
default:
|
|
65
|
-
return {
|
|
66
|
-
...a,
|
|
67
|
-
bgcolor: "background.paper",
|
|
68
|
-
borderColor: "divider"
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
})(),
|
|
72
|
+
position: "absolute",
|
|
73
|
+
top: n.includes("top") ? 24 : void 0,
|
|
74
|
+
bottom: n.includes("bottom") ? 24 : void 0,
|
|
75
|
+
left: n.includes("left") ? 24 : void 0,
|
|
76
|
+
right: n.includes("right") ? 24 : void 0,
|
|
77
|
+
zIndex: 1
|
|
78
|
+
},
|
|
79
|
+
children: /* @__PURE__ */ e(
|
|
80
|
+
o,
|
|
81
|
+
{
|
|
82
|
+
sx: {
|
|
83
|
+
width: 48,
|
|
84
|
+
height: 48,
|
|
85
|
+
borderRadius: "50%",
|
|
86
|
+
bgcolor: "action.hover",
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
justifyContent: "center"
|
|
90
|
+
},
|
|
91
|
+
children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
return /* @__PURE__ */ a(
|
|
97
|
+
R,
|
|
98
|
+
{
|
|
99
|
+
sx: {
|
|
100
|
+
...v(),
|
|
72
101
|
position: "relative",
|
|
73
102
|
overflow: "hidden",
|
|
74
|
-
...
|
|
103
|
+
...f
|
|
75
104
|
},
|
|
76
105
|
children: [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
sx: {
|
|
81
|
-
position: "absolute",
|
|
82
|
-
right: -20,
|
|
83
|
-
bottom: -20,
|
|
84
|
-
opacity: 0.05,
|
|
85
|
-
transform: "rotate(-15deg)",
|
|
86
|
-
pointerEvents: "none"
|
|
87
|
-
},
|
|
88
|
-
children: /* @__PURE__ */ r(n, { sx: { fontSize: 120, color: "text.primary" } })
|
|
89
|
-
}
|
|
90
|
-
),
|
|
91
|
-
/* @__PURE__ */ i(
|
|
92
|
-
m,
|
|
106
|
+
w(),
|
|
107
|
+
/* @__PURE__ */ a(
|
|
108
|
+
h,
|
|
93
109
|
{
|
|
94
110
|
direction: "row",
|
|
95
111
|
justifyContent: "space-between",
|
|
96
112
|
alignItems: "flex-start",
|
|
97
113
|
children: [
|
|
98
|
-
|
|
114
|
+
i && n === "left" && /* @__PURE__ */ e(o, { mr: 2, children: /* @__PURE__ */ e(
|
|
99
115
|
o,
|
|
100
116
|
{
|
|
101
117
|
sx: {
|
|
@@ -107,23 +123,23 @@ const V = ({
|
|
|
107
123
|
alignItems: "center",
|
|
108
124
|
justifyContent: "center"
|
|
109
125
|
},
|
|
110
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
|
|
111
127
|
}
|
|
112
128
|
) }),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
129
|
+
/* @__PURE__ */ a(o, { flex: 1, children: [
|
|
130
|
+
/* @__PURE__ */ e(s, { variant: "subtitle2", color: "text.secondary", mb: 0.5, children: g }),
|
|
131
|
+
/* @__PURE__ */ e(
|
|
132
|
+
s,
|
|
117
133
|
{
|
|
118
134
|
variant: "h4",
|
|
119
135
|
fontWeight: "bold",
|
|
120
136
|
color: "text.primary",
|
|
121
137
|
mb: 1,
|
|
122
|
-
children:
|
|
138
|
+
children: u
|
|
123
139
|
}
|
|
124
140
|
),
|
|
125
|
-
d !== void 0 && /* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
141
|
+
d !== void 0 && /* @__PURE__ */ a(h, { direction: "row", alignItems: "center", spacing: 1, children: [
|
|
142
|
+
/* @__PURE__ */ a(
|
|
127
143
|
o,
|
|
128
144
|
{
|
|
129
145
|
sx: {
|
|
@@ -138,16 +154,16 @@ const V = ({
|
|
|
138
154
|
...y()
|
|
139
155
|
},
|
|
140
156
|
children: [
|
|
141
|
-
|
|
157
|
+
x(),
|
|
142
158
|
d,
|
|
143
|
-
|
|
159
|
+
m === "percentage" ? "%" : ""
|
|
144
160
|
]
|
|
145
161
|
}
|
|
146
162
|
),
|
|
147
|
-
p && /* @__PURE__ */
|
|
163
|
+
p && /* @__PURE__ */ e(s, { variant: "caption", color: "text.secondary", children: p })
|
|
148
164
|
] })
|
|
149
165
|
] }),
|
|
150
|
-
|
|
166
|
+
i && n === "right" && /* @__PURE__ */ e(o, { ml: 2, children: /* @__PURE__ */ e(
|
|
151
167
|
o,
|
|
152
168
|
{
|
|
153
169
|
sx: {
|
|
@@ -159,7 +175,7 @@ const V = ({
|
|
|
159
175
|
alignItems: "center",
|
|
160
176
|
justifyContent: "center"
|
|
161
177
|
},
|
|
162
|
-
children: /* @__PURE__ */
|
|
178
|
+
children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
|
|
163
179
|
}
|
|
164
180
|
) })
|
|
165
181
|
]
|
|
@@ -170,5 +186,5 @@ const V = ({
|
|
|
170
186
|
);
|
|
171
187
|
};
|
|
172
188
|
export {
|
|
173
|
-
|
|
189
|
+
W as MetricCard
|
|
174
190
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -672,7 +672,13 @@ export declare interface MetricCardProps {
|
|
|
672
672
|
changeType?: MetricChangeType;
|
|
673
673
|
trend?: MetricTrend;
|
|
674
674
|
icon?: React.ElementType;
|
|
675
|
-
iconPosition?:
|
|
675
|
+
iconPosition?:
|
|
676
|
+
| "left"
|
|
677
|
+
| "right"
|
|
678
|
+
| "top-left"
|
|
679
|
+
| "top-right"
|
|
680
|
+
| "bottom-left"
|
|
681
|
+
| "bottom-right";
|
|
676
682
|
description?: string;
|
|
677
683
|
variant?: MetricVariant;
|
|
678
684
|
sx?: SxProps<Theme_2>;
|