@hybridcore/ui 1.6.7 → 1.6.8
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.
|
@@ -42,7 +42,7 @@ const G = (t) => {
|
|
|
42
42
|
children: [
|
|
43
43
|
/* @__PURE__ */ n(r, { direction: "row", alignItems: "baseline", spacing: 0.5, children: [
|
|
44
44
|
/* @__PURE__ */ e(z, { variant: "h4", ownerState: i, children: y }),
|
|
45
|
-
l && /* @__PURE__ */ e(V, { variant: "h5", children: l })
|
|
45
|
+
l && /* @__PURE__ */ e(V, { variant: "h5", ownerState: i, children: l })
|
|
46
46
|
] }),
|
|
47
47
|
T && /* @__PURE__ */ n(k, { ownerState: i, children: [
|
|
48
48
|
d === "overlay" && t.showTrend && /* @__PURE__ */ e(S, { size: 16 }),
|
|
@@ -1,112 +1,119 @@
|
|
|
1
|
-
import { useThemeProps as
|
|
2
|
-
import { formatValue as
|
|
3
|
-
import { c as
|
|
1
|
+
import { useThemeProps as K } from "@mui/material";
|
|
2
|
+
import { formatValue as $, resolveConditionalStyle as B } from "../charts/_common/format.js";
|
|
3
|
+
import { c as y } from "../../createReactComponent-C7L-DMHj.js";
|
|
4
4
|
/**
|
|
5
5
|
* @license @tabler/icons-react v3.44.0 - MIT
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license.
|
|
8
8
|
* See the LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const Q = [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M13 18l6 -6", key: "svg-1" }], ["path", { d: "M13 6l6 6", key: "svg-2" }]], W = y("outline", "arrow-right", "ArrowRight", Q);
|
|
11
11
|
/**
|
|
12
12
|
* @license @tabler/icons-react v3.44.0 - MIT
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the MIT license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
17
|
+
const X = [["path", { d: "M3 7l6 6l4 -4l8 8", key: "svg-0" }], ["path", { d: "M21 10l0 7l-7 0", key: "svg-1" }]], Y = y("outline", "trending-down", "TrendingDown", X);
|
|
18
18
|
/**
|
|
19
19
|
* @license @tabler/icons-react v3.44.0 - MIT
|
|
20
20
|
*
|
|
21
21
|
* This source code is licensed under the MIT license.
|
|
22
22
|
* See the LICENSE file in the root directory of this source tree.
|
|
23
23
|
*/
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
value:
|
|
27
|
-
secondValue:
|
|
28
|
-
secondValueFormat:
|
|
29
|
-
variant:
|
|
24
|
+
const ee = [["path", { d: "M3 17l6 -6l4 4l8 -8", key: "svg-0" }], ["path", { d: "M14 7l7 0l0 7", key: "svg-1" }]], oe = y("outline", "trending-up", "TrendingUp", ee), ce = (D) => {
|
|
25
|
+
const r = K({ props: D, name: "HCMetricCard" }), {
|
|
26
|
+
value: c = [],
|
|
27
|
+
secondValue: C = [],
|
|
28
|
+
secondValueFormat: F,
|
|
29
|
+
variant: P = "default",
|
|
30
30
|
layout: w = "overlay",
|
|
31
|
-
valuePrefix:
|
|
32
|
-
valueSuffix:
|
|
31
|
+
valuePrefix: A,
|
|
32
|
+
valueSuffix: O,
|
|
33
33
|
format: e,
|
|
34
|
-
showChange:
|
|
35
|
-
changeType:
|
|
36
|
-
showTrend:
|
|
37
|
-
showIcon:
|
|
38
|
-
icon:
|
|
39
|
-
iconPosition:
|
|
40
|
-
} =
|
|
41
|
-
prefix: (e == null ? void 0 : e.prefix) ??
|
|
42
|
-
suffix: (e == null ? void 0 : e.suffix) ??
|
|
34
|
+
showChange: U = !1,
|
|
35
|
+
changeType: s = "percentage",
|
|
36
|
+
showTrend: Z = !1,
|
|
37
|
+
showIcon: b = !1,
|
|
38
|
+
icon: d,
|
|
39
|
+
iconPosition: u = "right"
|
|
40
|
+
} = r, H = c.length > 0, g = c[c.length - 1], k = c[c.length - 2], o = g ? Number(g.v) : NaN, t = k ? Number(k.v) : NaN, m = !isNaN(o) && !isNaN(t), p = {
|
|
41
|
+
prefix: (e == null ? void 0 : e.prefix) ?? A,
|
|
42
|
+
suffix: (e == null ? void 0 : e.suffix) ?? O,
|
|
43
43
|
decimals: e == null ? void 0 : e.decimals,
|
|
44
44
|
color: e == null ? void 0 : e.color,
|
|
45
45
|
backgroundColor: e == null ? void 0 : e.backgroundColor,
|
|
46
46
|
conditionalRules: e == null ? void 0 : e.conditionalRules
|
|
47
47
|
};
|
|
48
|
-
let
|
|
48
|
+
let i = "—", S = "", M, V;
|
|
49
49
|
if (!isNaN(o)) {
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
M =
|
|
50
|
+
i = $(o, p), S = g.t;
|
|
51
|
+
const l = B(o, p);
|
|
52
|
+
M = l.color, V = l.backgroundColor;
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
const I = F ?? p;
|
|
55
|
+
let h, T, x;
|
|
56
|
+
const _ = C[C.length - 1], f = _ ? Number(_.v) : NaN;
|
|
57
|
+
if (!isNaN(f)) {
|
|
58
|
+
h = $(f, I);
|
|
59
|
+
const l = B(f, I);
|
|
60
|
+
T = l.color, x = l.backgroundColor;
|
|
61
|
+
}
|
|
62
|
+
let a;
|
|
63
|
+
if (U)
|
|
64
|
+
if (m && !(t === 0 && s === "percentage")) {
|
|
65
|
+
const N = s === "absolute" ? o - t : (o - t) / t * 100, z = N > 0 ? "+" : N < 0 ? "−" : "", E = s === "percentage" ? 1 : 2, G = s === "percentage" ? "%" : "";
|
|
66
|
+
a = `${z}${Math.abs(N).toFixed(E)}${G}`;
|
|
62
67
|
} else
|
|
63
|
-
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
const
|
|
68
|
+
a = "—";
|
|
69
|
+
let n;
|
|
70
|
+
Z && m && (o > t ? n = "up" : o < t ? n = "down" : n = "neutral");
|
|
71
|
+
let v = W;
|
|
72
|
+
n === "up" ? v = oe : n === "down" && (v = Y);
|
|
73
|
+
const R = [
|
|
69
74
|
"top-left",
|
|
70
75
|
"top-right",
|
|
71
76
|
"bottom-left",
|
|
72
77
|
"bottom-right"
|
|
73
|
-
].includes(
|
|
74
|
-
metric:
|
|
75
|
-
value:
|
|
76
|
-
change:
|
|
77
|
-
asOf:
|
|
78
|
-
}),
|
|
79
|
-
...
|
|
80
|
-
variant:
|
|
78
|
+
].includes(u), J = b && !!d && R, L = b && !!d && !R, j = JSON.stringify({
|
|
79
|
+
metric: r.label,
|
|
80
|
+
value: i,
|
|
81
|
+
change: a,
|
|
82
|
+
asOf: S
|
|
83
|
+
}), q = {
|
|
84
|
+
...r,
|
|
85
|
+
variant: P,
|
|
81
86
|
layout: w,
|
|
82
|
-
changeType:
|
|
83
|
-
iconPosition:
|
|
84
|
-
calculatedValue:
|
|
85
|
-
calculatedSecondValue:
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
changeType: s,
|
|
88
|
+
iconPosition: u,
|
|
89
|
+
calculatedValue: i,
|
|
90
|
+
calculatedSecondValue: h,
|
|
91
|
+
calculatedSecondValueColor: T,
|
|
92
|
+
calculatedSecondValueBg: x,
|
|
93
|
+
calculatedChange: a,
|
|
94
|
+
calculatedTrend: n,
|
|
88
95
|
calculatedValueColor: M,
|
|
89
|
-
calculatedValueBg:
|
|
90
|
-
hasData:
|
|
96
|
+
calculatedValueBg: V,
|
|
97
|
+
hasData: H
|
|
91
98
|
};
|
|
92
99
|
return {
|
|
93
100
|
refs: {},
|
|
94
101
|
state: {
|
|
95
|
-
ownerState:
|
|
102
|
+
ownerState: q,
|
|
96
103
|
layout: w,
|
|
97
|
-
calculatedValue:
|
|
98
|
-
calculatedSecondValue:
|
|
99
|
-
calculatedChange:
|
|
100
|
-
TrendIcon:
|
|
101
|
-
Icon:
|
|
102
|
-
showCornerIcon:
|
|
103
|
-
showSideIcon:
|
|
104
|
-
iconPosition:
|
|
105
|
-
snapshotPayload:
|
|
104
|
+
calculatedValue: i,
|
|
105
|
+
calculatedSecondValue: h,
|
|
106
|
+
calculatedChange: a,
|
|
107
|
+
TrendIcon: v,
|
|
108
|
+
Icon: d,
|
|
109
|
+
showCornerIcon: J,
|
|
110
|
+
showSideIcon: L,
|
|
111
|
+
iconPosition: u,
|
|
112
|
+
snapshotPayload: j
|
|
106
113
|
},
|
|
107
114
|
actions: {}
|
|
108
115
|
};
|
|
109
116
|
};
|
|
110
117
|
export {
|
|
111
|
-
|
|
118
|
+
ce as useMetricCardLogic
|
|
112
119
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { styled as i, alpha as
|
|
2
|
-
import { Widget as
|
|
3
|
-
import { variantColor as
|
|
1
|
+
import { styled as i, alpha as g, Stack as C, Typography as c } from "@mui/material";
|
|
2
|
+
import { Widget as u } from "../widget/styled.js";
|
|
3
|
+
import { variantColor as l, resolvePaletteColor as d, trendColor as f } from "./helpers.js";
|
|
4
4
|
const e = {
|
|
5
5
|
shouldForwardProp: (o) => o !== "ownerState"
|
|
6
|
-
}, v = i(
|
|
6
|
+
}, v = i(u.Root, {
|
|
7
7
|
name: "HCMetricCard",
|
|
8
8
|
slot: "Root",
|
|
9
9
|
...e
|
|
10
10
|
})(({ theme: o, ownerState: n }) => {
|
|
11
|
-
const
|
|
12
|
-
let
|
|
13
|
-
return
|
|
11
|
+
const a = l(o, n.variant), r = n.layout === "panel";
|
|
12
|
+
let t;
|
|
13
|
+
return a ? t = g(a, 0.05) : r && (t = o.palette.background.default), {
|
|
14
14
|
position: "relative",
|
|
15
15
|
overflow: "hidden",
|
|
16
16
|
padding: o.spacing(1.5, 2),
|
|
17
|
-
...
|
|
17
|
+
...t && { backgroundColor: t },
|
|
18
18
|
[o.breakpoints.down("md")]: {
|
|
19
19
|
padding: o.spacing(1.5)
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
}), y = i(
|
|
22
|
+
}), y = i(C, {
|
|
23
23
|
name: "HCMetricCard",
|
|
24
24
|
slot: "Content"
|
|
25
25
|
})(() => ({
|
|
@@ -27,55 +27,64 @@ const e = {
|
|
|
27
27
|
width: "100%",
|
|
28
28
|
minWidth: 0,
|
|
29
29
|
zIndex: 1
|
|
30
|
-
})),
|
|
30
|
+
})), k = i(c, {
|
|
31
31
|
name: "HCMetricCard",
|
|
32
32
|
slot: "Label"
|
|
33
33
|
})(({ theme: o }) => ({
|
|
34
34
|
color: o.palette.text.secondary,
|
|
35
35
|
marginBottom: o.spacing(0.5),
|
|
36
36
|
fontWeight: 500
|
|
37
|
-
})),
|
|
37
|
+
})), m = i(c, {
|
|
38
38
|
name: "HCMetricCard",
|
|
39
39
|
slot: "Value",
|
|
40
40
|
...e
|
|
41
41
|
})(({ theme: o, ownerState: n }) => {
|
|
42
|
-
const
|
|
42
|
+
const a = d(o, n.calculatedValueColor), r = d(o, n.calculatedValueBg);
|
|
43
43
|
return {
|
|
44
|
-
color:
|
|
44
|
+
color: a ?? l(o, n.variant) ?? o.palette.text.primary,
|
|
45
45
|
fontWeight: 500,
|
|
46
46
|
marginBottom: o.spacing(0.5),
|
|
47
47
|
whiteSpace: "nowrap",
|
|
48
|
-
...
|
|
49
|
-
backgroundColor:
|
|
48
|
+
...r && {
|
|
49
|
+
backgroundColor: r,
|
|
50
50
|
borderRadius: o.shape.borderRadius,
|
|
51
51
|
padding: o.spacing(0, 0.75)
|
|
52
52
|
},
|
|
53
53
|
[o.breakpoints.down("md")]: { fontSize: "1.35rem" },
|
|
54
54
|
[o.breakpoints.up("md")]: { fontSize: "2rem" }
|
|
55
55
|
};
|
|
56
|
-
}),
|
|
56
|
+
}), S = i(c, {
|
|
57
57
|
name: "HCMetricCard",
|
|
58
|
-
slot: "SecondValue"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
slot: "SecondValue",
|
|
59
|
+
...e
|
|
60
|
+
})(({ theme: o, ownerState: n }) => {
|
|
61
|
+
const a = d(o, n.calculatedSecondValueColor), r = d(o, n.calculatedSecondValueBg);
|
|
62
|
+
return {
|
|
63
|
+
color: a ?? o.palette.text.secondary,
|
|
64
|
+
fontWeight: 400,
|
|
65
|
+
whiteSpace: "nowrap",
|
|
66
|
+
...r && {
|
|
67
|
+
backgroundColor: r,
|
|
68
|
+
borderRadius: o.shape.borderRadius,
|
|
69
|
+
padding: o.spacing(0, 0.75)
|
|
70
|
+
},
|
|
71
|
+
[o.breakpoints.down("md")]: { fontSize: "0.95rem" },
|
|
72
|
+
[o.breakpoints.up("md")]: { fontSize: "1.25rem" }
|
|
73
|
+
};
|
|
74
|
+
}), H = i("div", {
|
|
66
75
|
name: "HCMetricCard",
|
|
67
76
|
slot: "TrendContainer",
|
|
68
77
|
...e
|
|
69
78
|
})(({ theme: o, ownerState: n }) => {
|
|
70
|
-
const
|
|
79
|
+
const a = f(o, n.calculatedTrend), r = n.layout === "panel";
|
|
71
80
|
return {
|
|
72
81
|
display: "inline-flex",
|
|
73
82
|
alignItems: "center",
|
|
74
83
|
gap: o.spacing(0.5),
|
|
75
84
|
fontWeight: 500,
|
|
76
|
-
color:
|
|
77
|
-
...
|
|
78
|
-
backgroundColor:
|
|
85
|
+
color: a,
|
|
86
|
+
...r ? {
|
|
87
|
+
backgroundColor: g(a, 0.14),
|
|
79
88
|
borderRadius: 999,
|
|
80
89
|
padding: o.spacing(0.25, 1),
|
|
81
90
|
fontSize: "0.8125rem",
|
|
@@ -88,7 +97,7 @@ const e = {
|
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
};
|
|
91
|
-
}), I = i(
|
|
100
|
+
}), I = i(c, {
|
|
92
101
|
name: "HCMetricCard",
|
|
93
102
|
slot: "Description"
|
|
94
103
|
})(({ theme: o }) => ({
|
|
@@ -96,7 +105,7 @@ const e = {
|
|
|
96
105
|
display: "block",
|
|
97
106
|
position: "relative",
|
|
98
107
|
zIndex: 1
|
|
99
|
-
})),
|
|
108
|
+
})), R = i("div", {
|
|
100
109
|
name: "HCMetricCard",
|
|
101
110
|
slot: "Icon",
|
|
102
111
|
...e
|
|
@@ -104,7 +113,7 @@ const e = {
|
|
|
104
113
|
display: "flex",
|
|
105
114
|
alignItems: "center",
|
|
106
115
|
justifyContent: "center",
|
|
107
|
-
color:
|
|
116
|
+
color: l(o, n.variant) ?? o.palette.text.secondary,
|
|
108
117
|
marginRight: n.iconPosition === "left" ? o.spacing(2) : 0,
|
|
109
118
|
marginLeft: n.iconPosition === "right" ? o.spacing(2) : 0,
|
|
110
119
|
[o.breakpoints.down("sm")]: {
|
|
@@ -113,20 +122,20 @@ const e = {
|
|
|
113
122
|
left: o.spacing(2),
|
|
114
123
|
margin: 0
|
|
115
124
|
}
|
|
116
|
-
})),
|
|
125
|
+
})), w = i("div", {
|
|
117
126
|
name: "HCMetricCard",
|
|
118
127
|
slot: "CornerIcon",
|
|
119
128
|
...e
|
|
120
129
|
})(({ theme: o, ownerState: n }) => {
|
|
121
|
-
var
|
|
122
|
-
const
|
|
123
|
-
return
|
|
130
|
+
var s, p;
|
|
131
|
+
const a = {}, r = (s = n.iconPosition) != null && s.startsWith("top") ? "top" : "bottom", t = (p = n.iconPosition) != null && p.endsWith("left") ? "left" : "right";
|
|
132
|
+
return a[r] = o.spacing(2), a[t] = o.spacing(2), {
|
|
124
133
|
position: "absolute",
|
|
125
|
-
...
|
|
126
|
-
color:
|
|
134
|
+
...a,
|
|
135
|
+
color: l(o, n.variant) ?? o.palette.text.secondary,
|
|
127
136
|
zIndex: 2
|
|
128
137
|
};
|
|
129
|
-
}),
|
|
138
|
+
}), z = i("div", {
|
|
130
139
|
name: "HCMetricCard",
|
|
131
140
|
slot: "Chart"
|
|
132
141
|
})(({ theme: o }) => ({
|
|
@@ -139,7 +148,7 @@ const e = {
|
|
|
139
148
|
alignItems: "flex-end",
|
|
140
149
|
overflow: "hidden",
|
|
141
150
|
borderRadius: o.shape.borderRadius
|
|
142
|
-
})),
|
|
151
|
+
})), P = i("div", {
|
|
143
152
|
name: "HCMetricCard",
|
|
144
153
|
slot: "Panel"
|
|
145
154
|
})(({ theme: o }) => ({
|
|
@@ -169,16 +178,16 @@ const e = {
|
|
|
169
178
|
alignItems: "flex-end"
|
|
170
179
|
}));
|
|
171
180
|
export {
|
|
172
|
-
|
|
181
|
+
z as MetricCardChartContainer,
|
|
173
182
|
y as MetricCardContent,
|
|
174
|
-
|
|
183
|
+
w as MetricCardCornerIconContainer,
|
|
175
184
|
I as MetricCardDescription,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
R as MetricCardIconContainer,
|
|
186
|
+
k as MetricCardLabel,
|
|
187
|
+
P as MetricCardPanel,
|
|
179
188
|
v as MetricCardRoot,
|
|
180
|
-
|
|
189
|
+
S as MetricCardSecondValue,
|
|
181
190
|
W as MetricCardSideChart,
|
|
182
191
|
H as MetricCardTrendContainer,
|
|
183
|
-
|
|
192
|
+
m as MetricCardValue
|
|
184
193
|
};
|