@hybridcore/ui 1.5.77 → 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 +114 -94
- package/dist/main.d.ts +9 -3
- package/package.json +1 -1
|
@@ -1,97 +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
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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)
|
|
37
52
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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,
|
|
70
|
+
{
|
|
71
|
+
sx: {
|
|
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" } })
|
|
69
92
|
}
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
return /* @__PURE__ */ a(
|
|
97
|
+
R,
|
|
98
|
+
{
|
|
99
|
+
sx: {
|
|
100
|
+
...v(),
|
|
101
|
+
position: "relative",
|
|
102
|
+
overflow: "hidden",
|
|
103
|
+
...f
|
|
104
|
+
},
|
|
72
105
|
children: [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
sx: {
|
|
77
|
-
position: "absolute",
|
|
78
|
-
right: -20,
|
|
79
|
-
bottom: -20,
|
|
80
|
-
opacity: 0.05,
|
|
81
|
-
transform: "rotate(-15deg)",
|
|
82
|
-
pointerEvents: "none"
|
|
83
|
-
},
|
|
84
|
-
children: /* @__PURE__ */ r(n, { sx: { fontSize: 120, color: "text.primary" } })
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
/* @__PURE__ */ i(
|
|
88
|
-
m,
|
|
106
|
+
w(),
|
|
107
|
+
/* @__PURE__ */ a(
|
|
108
|
+
h,
|
|
89
109
|
{
|
|
90
110
|
direction: "row",
|
|
91
111
|
justifyContent: "space-between",
|
|
92
112
|
alignItems: "flex-start",
|
|
93
113
|
children: [
|
|
94
|
-
|
|
114
|
+
i && n === "left" && /* @__PURE__ */ e(o, { mr: 2, children: /* @__PURE__ */ e(
|
|
95
115
|
o,
|
|
96
116
|
{
|
|
97
117
|
sx: {
|
|
@@ -103,23 +123,23 @@ const V = ({
|
|
|
103
123
|
alignItems: "center",
|
|
104
124
|
justifyContent: "center"
|
|
105
125
|
},
|
|
106
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
|
|
107
127
|
}
|
|
108
128
|
) }),
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
|
|
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,
|
|
113
133
|
{
|
|
114
134
|
variant: "h4",
|
|
115
135
|
fontWeight: "bold",
|
|
116
136
|
color: "text.primary",
|
|
117
137
|
mb: 1,
|
|
118
|
-
children:
|
|
138
|
+
children: u
|
|
119
139
|
}
|
|
120
140
|
),
|
|
121
|
-
d !== void 0 && /* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
141
|
+
d !== void 0 && /* @__PURE__ */ a(h, { direction: "row", alignItems: "center", spacing: 1, children: [
|
|
142
|
+
/* @__PURE__ */ a(
|
|
123
143
|
o,
|
|
124
144
|
{
|
|
125
145
|
sx: {
|
|
@@ -134,16 +154,16 @@ const V = ({
|
|
|
134
154
|
...y()
|
|
135
155
|
},
|
|
136
156
|
children: [
|
|
137
|
-
|
|
157
|
+
x(),
|
|
138
158
|
d,
|
|
139
|
-
|
|
159
|
+
m === "percentage" ? "%" : ""
|
|
140
160
|
]
|
|
141
161
|
}
|
|
142
162
|
),
|
|
143
|
-
p && /* @__PURE__ */
|
|
163
|
+
p && /* @__PURE__ */ e(s, { variant: "caption", color: "text.secondary", children: p })
|
|
144
164
|
] })
|
|
145
165
|
] }),
|
|
146
|
-
|
|
166
|
+
i && n === "right" && /* @__PURE__ */ e(o, { ml: 2, children: /* @__PURE__ */ e(
|
|
147
167
|
o,
|
|
148
168
|
{
|
|
149
169
|
sx: {
|
|
@@ -155,7 +175,7 @@ const V = ({
|
|
|
155
175
|
alignItems: "center",
|
|
156
176
|
justifyContent: "center"
|
|
157
177
|
},
|
|
158
|
-
children: /* @__PURE__ */
|
|
178
|
+
children: /* @__PURE__ */ e(i, { sx: { fontSize: 24, color: "text.secondary" } })
|
|
159
179
|
}
|
|
160
180
|
) })
|
|
161
181
|
]
|
|
@@ -166,5 +186,5 @@ const V = ({
|
|
|
166
186
|
);
|
|
167
187
|
};
|
|
168
188
|
export {
|
|
169
|
-
|
|
189
|
+
W as MetricCard
|
|
170
190
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -663,7 +663,7 @@ export declare namespace Map_2 {
|
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
|
|
666
|
-
export declare const MetricCard: ({ label, value, change, changeType, trend, icon: Icon, iconPosition, description, variant,
|
|
666
|
+
export declare const MetricCard: ({ label, value, change, changeType, trend, icon: Icon, iconPosition, description, variant, sx, }: MetricCardProps) => JSX_2.Element;
|
|
667
667
|
|
|
668
668
|
export declare interface MetricCardProps {
|
|
669
669
|
label: string;
|
|
@@ -672,10 +672,16 @@ 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>;
|
|
679
685
|
}
|
|
680
686
|
|
|
681
687
|
export declare type MetricChangeType = "percentage" | "absolute";
|