@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 q } from "@mui/material";
2
- import { formatValue as V, resolveConditionalStyle as z } from "../charts/_common/format.js";
3
- import { c as N } from "../../createReactComponent-C7L-DMHj.js";
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 E = [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M13 18l6 -6", key: "svg-1" }], ["path", { d: "M13 6l6 6", key: "svg-2" }]], G = N("outline", "arrow-right", "ArrowRight", E);
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 K = [["path", { d: "M3 7l6 6l4 -4l8 8", key: "svg-0" }], ["path", { d: "M21 10l0 7l-7 0", key: "svg-1" }]], Q = N("outline", "trending-down", "TrendingDown", K);
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 W = [["path", { d: "M3 17l6 -6l4 4l8 -8", key: "svg-0" }], ["path", { d: "M14 7l7 0l0 7", key: "svg-1" }]], X = N("outline", "trending-up", "TrendingUp", W), ne = (_) => {
25
- const i = q({ props: _, name: "HCMetricCard" }), {
26
- value: l = [],
27
- secondValue: y = [],
28
- secondValueFormat: R,
29
- variant: $ = "default",
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: D,
32
- valueSuffix: P,
31
+ valuePrefix: A,
32
+ valueSuffix: O,
33
33
  format: e,
34
- showChange: B = !1,
35
- changeType: c = "percentage",
36
- showTrend: F = !1,
37
- showIcon: C = !1,
38
- icon: r,
39
- iconPosition: d = "right"
40
- } = i, A = l.length > 0, u = l[l.length - 1], b = l[l.length - 2], o = u ? Number(u.v) : NaN, n = b ? Number(b.v) : NaN, k = !isNaN(o) && !isNaN(n), g = {
41
- prefix: (e == null ? void 0 : e.prefix) ?? D,
42
- suffix: (e == null ? void 0 : e.suffix) ?? P,
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 a = "—", m = "", M, I;
48
+ let i = "—", S = "", M, V;
49
49
  if (!isNaN(o)) {
50
- a = V(o, g), m = u.t;
51
- const f = z(o, g);
52
- M = f.color, I = f.backgroundColor;
50
+ i = $(o, p), S = g.t;
51
+ const l = B(o, p);
52
+ M = l.color, V = l.backgroundColor;
53
53
  }
54
- let p;
55
- const T = y[y.length - 1], x = T ? Number(T.v) : NaN;
56
- isNaN(x) || (p = V(x, R ?? g));
57
- let s;
58
- if (B)
59
- if (k && !(n === 0 && c === "percentage")) {
60
- const v = c === "absolute" ? o - n : (o - n) / n * 100, J = v > 0 ? "+" : v < 0 ? "−" : "", L = c === "percentage" ? 1 : 2, j = c === "percentage" ? "%" : "";
61
- s = `${J}${Math.abs(v).toFixed(L)}${j}`;
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
- s = "—";
64
- let t;
65
- F && k && (o > n ? t = "up" : o < n ? t = "down" : t = "neutral");
66
- let h = G;
67
- t === "up" ? h = X : t === "down" && (h = Q);
68
- const S = [
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(d), O = C && !!r && S, U = C && !!r && !S, Z = JSON.stringify({
74
- metric: i.label,
75
- value: a,
76
- change: s,
77
- asOf: m
78
- }), H = {
79
- ...i,
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: c,
83
- iconPosition: d,
84
- calculatedValue: a,
85
- calculatedSecondValue: p,
86
- calculatedChange: s,
87
- calculatedTrend: t,
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: I,
90
- hasData: A
96
+ calculatedValueBg: V,
97
+ hasData: H
91
98
  };
92
99
  return {
93
100
  refs: {},
94
101
  state: {
95
- ownerState: H,
102
+ ownerState: q,
96
103
  layout: w,
97
- calculatedValue: a,
98
- calculatedSecondValue: p,
99
- calculatedChange: s,
100
- TrendIcon: h,
101
- Icon: r,
102
- showCornerIcon: O,
103
- showSideIcon: U,
104
- iconPosition: d,
105
- snapshotPayload: Z
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
- ne as useMetricCardLogic
118
+ ce as useMetricCardLogic
112
119
  };
@@ -1,25 +1,25 @@
1
- import { styled as i, alpha as C, Stack as g, Typography as d } from "@mui/material";
2
- import { Widget as f } from "../widget/styled.js";
3
- import { variantColor as s, resolvePaletteColor as p, trendColor as u } from "./helpers.js";
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(f.Root, {
6
+ }, v = i(u.Root, {
7
7
  name: "HCMetricCard",
8
8
  slot: "Root",
9
9
  ...e
10
10
  })(({ theme: o, ownerState: n }) => {
11
- const t = s(o, n.variant), a = n.layout === "panel";
12
- let r;
13
- return t ? r = C(t, 0.05) : a && (r = o.palette.background.default), {
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
- ...r && { backgroundColor: r },
17
+ ...t && { backgroundColor: t },
18
18
  [o.breakpoints.down("md")]: {
19
19
  padding: o.spacing(1.5)
20
20
  }
21
21
  };
22
- }), y = i(g, {
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
- })), m = i(d, {
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
- })), k = i(d, {
37
+ })), m = i(c, {
38
38
  name: "HCMetricCard",
39
39
  slot: "Value",
40
40
  ...e
41
41
  })(({ theme: o, ownerState: n }) => {
42
- const t = p(o, n.calculatedValueColor), a = p(o, n.calculatedValueBg);
42
+ const a = d(o, n.calculatedValueColor), r = d(o, n.calculatedValueBg);
43
43
  return {
44
- color: t ?? s(o, n.variant) ?? o.palette.text.primary,
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
- ...a && {
49
- backgroundColor: a,
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
- }), w = i(d, {
56
+ }), S = i(c, {
57
57
  name: "HCMetricCard",
58
- slot: "SecondValue"
59
- })(({ theme: o }) => ({
60
- color: o.palette.text.secondary,
61
- fontWeight: 400,
62
- whiteSpace: "nowrap",
63
- [o.breakpoints.down("md")]: { fontSize: "0.95rem" },
64
- [o.breakpoints.up("md")]: { fontSize: "1.25rem" }
65
- })), H = i("div", {
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 t = u(o, n.calculatedTrend), a = n.layout === "panel";
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: t,
77
- ...a ? {
78
- backgroundColor: C(t, 0.14),
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(d, {
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
- })), S = i("div", {
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: s(o, n.variant) ?? o.palette.text.secondary,
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
- })), z = i("div", {
125
+ })), w = i("div", {
117
126
  name: "HCMetricCard",
118
127
  slot: "CornerIcon",
119
128
  ...e
120
129
  })(({ theme: o, ownerState: n }) => {
121
- var c, l;
122
- const t = {}, a = (c = n.iconPosition) != null && c.startsWith("top") ? "top" : "bottom", r = (l = n.iconPosition) != null && l.endsWith("left") ? "left" : "right";
123
- return t[a] = o.spacing(2), t[r] = o.spacing(2), {
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
- ...t,
126
- color: s(o, n.variant) ?? o.palette.text.secondary,
134
+ ...a,
135
+ color: l(o, n.variant) ?? o.palette.text.secondary,
127
136
  zIndex: 2
128
137
  };
129
- }), P = i("div", {
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
- })), R = i("div", {
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
- P as MetricCardChartContainer,
181
+ z as MetricCardChartContainer,
173
182
  y as MetricCardContent,
174
- z as MetricCardCornerIconContainer,
183
+ w as MetricCardCornerIconContainer,
175
184
  I as MetricCardDescription,
176
- S as MetricCardIconContainer,
177
- m as MetricCardLabel,
178
- R as MetricCardPanel,
185
+ R as MetricCardIconContainer,
186
+ k as MetricCardLabel,
187
+ P as MetricCardPanel,
179
188
  v as MetricCardRoot,
180
- w as MetricCardSecondValue,
189
+ S as MetricCardSecondValue,
181
190
  W as MetricCardSideChart,
182
191
  H as MetricCardTrendContainer,
183
- k as MetricCardValue
192
+ m as MetricCardValue
184
193
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.6.7",
4
+ "version": "1.6.8",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",