@hybridcore/ui 1.6.6 → 1.6.7

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.
@@ -1,41 +1,42 @@
1
- import { R as P, A as V, T as x, b as W, L as G } from "../../../AnimatedTheme-jnasw6rT.js";
1
+ import { R as V, A as W, T as x, b as z, L as G } from "../../../AnimatedTheme-jnasw6rT.js";
2
2
  import { useThemeProps as N, useTheme as j } from "@mui/material";
3
- import g from "lodash";
4
- import { useId as z, useRef as H, useEffect as M } from "react";
5
- import { colorSetFromPalette as U, applyValueFormat as _ } from "../_common/utils.js";
6
- import { c, a as y, p as $ } from "../../../ColorSet-C7vpNXhM.js";
7
- import { X as q, V as J } from "../../../AxisRenderer-DTyLLA6c.js";
8
- import { L as K } from "../../../Legend-Dp_MKfS4.js";
9
- import { D as Q } from "../../../DateAxis-YX3QNIB-.js";
10
- import { A as k, a as Z } from "../../../AxisRendererY-C_ItLPNV.js";
11
- import { C as ee } from "../../../CategoryAxis-CwnfaGc8.js";
12
- import { C as te } from "../../../ColumnSeries-CjgdJ2QL.js";
13
- import { D as re } from "../../../DataProcessor-CHDO51q4.js";
14
- import { B as oe } from "../../../Bullet-DVczI2TD.js";
15
- const we = (F) => {
16
- const w = N({ props: F, name: "HCXYChart" }), {
17
- dimensions: p,
3
+ import X from "lodash";
4
+ import { useId as H, useRef as M, useEffect as U } from "react";
5
+ import { humanizeLabel as k } from "../_common/format.js";
6
+ import { colorSetFromPalette as _, applyValueFormat as $ } from "../_common/utils.js";
7
+ import { c as p, a as g, p as q } from "../../../ColorSet-C7vpNXhM.js";
8
+ import { X as J, V as K } from "../../../AxisRenderer-DTyLLA6c.js";
9
+ import { L as Q } from "../../../Legend-Dp_MKfS4.js";
10
+ import { D as Z } from "../../../DateAxis-YX3QNIB-.js";
11
+ import { A as F, a as ee } from "../../../AxisRendererY-C_ItLPNV.js";
12
+ import { C as te } from "../../../CategoryAxis-CwnfaGc8.js";
13
+ import { C as re } from "../../../ColumnSeries-CjgdJ2QL.js";
14
+ import { D as oe } from "../../../DataProcessor-CHDO51q4.js";
15
+ import { B as ae } from "../../../Bullet-DVczI2TD.js";
16
+ const be = (L) => {
17
+ const y = N({ props: L, name: "HCXYChart" }), {
18
+ dimensions: c,
18
19
  values: n,
19
20
  data: d,
20
- initDelay: L = 0,
21
- baseInterval: R,
22
- colors: A,
23
- sx: O,
24
- ...B
25
- } = w, i = j(), v = `hc-xy-chart-${z().replace(/:/g, "")}`, u = H(null), b = p.length < 1 ? "Missing dimensions config!" : null;
26
- M(() => {
21
+ initDelay: R = 0,
22
+ baseInterval: O,
23
+ colors: w,
24
+ sx: B,
25
+ ...S
26
+ } = y, i = j(), A = `hc-xy-chart-${H().replace(/:/g, "")}`, u = M(null), b = c.length < 1 ? "Missing dimensions config!" : null;
27
+ U(() => {
27
28
  if (b) return;
28
29
  let f;
29
30
  return f = setTimeout(() => {
30
- var Y, D, X;
31
- const e = P.new(v);
32
- u.current = e, e.setThemes([V.new(e)]), e.interfaceColors.setAll({
33
- text: c(i.palette.text.primary),
34
- grid: c(i.palette.divider),
35
- stroke: c(i.palette.divider)
31
+ var C, Y, D;
32
+ const e = V.new(A);
33
+ u.current = e, e.setThemes([W.new(e)]), e.interfaceColors.setAll({
34
+ text: p(i.palette.text.primary),
35
+ grid: p(i.palette.divider),
36
+ stroke: p(i.palette.divider)
36
37
  });
37
38
  const o = e.container.children.push(
38
- q.new(e, {
39
+ J.new(e, {
39
40
  panX: !1,
40
41
  panY: !1,
41
42
  wheelX: "none",
@@ -43,31 +44,31 @@ const we = (F) => {
43
44
  layout: e.verticalLayout
44
45
  })
45
46
  );
46
- o.set("colors", U(e, A));
47
- const E = o.children.push(
48
- K.new(e, {
49
- centerX: y,
50
- x: y
47
+ o.set("colors", _(e, w));
48
+ const I = o.children.push(
49
+ Q.new(e, {
50
+ centerX: g,
51
+ x: g
51
52
  })
52
- ), a = p[0];
53
+ ), a = c[0];
53
54
  let s, m = d;
54
55
  if (a.type === "date")
55
56
  s = o.xAxes.push(
56
- Q.new(e, {
57
+ Z.new(e, {
57
58
  maxDeviation: 0,
58
- baseInterval: R || { timeUnit: "day", count: 1 },
59
- renderer: k.new(e, { minGridDistance: 60 }),
59
+ baseInterval: O || { timeUnit: "day", count: 1 },
60
+ renderer: F.new(e, { minGridDistance: 60 }),
60
61
  tooltip: x.new(e, {})
61
62
  })
62
- ), m = g.orderBy(d, [a.value]);
63
+ ), m = X.orderBy(d, [a.value]);
63
64
  else {
64
- const t = k.new(e, {
65
+ const t = F.new(e, {
65
66
  cellStartLocation: 0.1,
66
67
  cellEndLocation: 0.9,
67
68
  minGridDistance: 30
68
69
  });
69
70
  s = o.xAxes.push(
70
- ee.new(e, {
71
+ te.new(e, {
71
72
  categoryField: a.value,
72
73
  renderer: t,
73
74
  tooltip: x.new(e, {})
@@ -82,8 +83,8 @@ const we = (F) => {
82
83
  }), t.labels.template.setup = function(r) {
83
84
  r.set(
84
85
  "background",
85
- W.new(e, {
86
- fill: c(0),
86
+ z.new(e, {
87
+ fill: p(0),
87
88
  fillOpacity: 0
88
89
  })
89
90
  );
@@ -94,73 +95,78 @@ const we = (F) => {
94
95
  numericFields: ["valueX"]
95
96
  }), s.data.setAll(m);
96
97
  }
97
- const C = o.yAxes.push(
98
- J.new(e, {
99
- renderer: Z.new(e, { strokeOpacity: 0.1 })
98
+ const v = o.yAxes.push(
99
+ K.new(e, {
100
+ renderer: ee.new(e, { strokeOpacity: 0.1 })
100
101
  })
101
102
  );
102
- (Y = s.get("renderer")) == null || Y.grid.template.setAll({
103
- stroke: c(i.palette.divider),
103
+ (C = s.get("renderer")) == null || C.grid.template.setAll({
104
+ stroke: p(i.palette.divider),
104
105
  strokeOpacity: 1
105
- }), (D = C.get("renderer")) == null || D.grid.template.setAll({
106
- stroke: c(i.palette.divider),
106
+ }), (Y = v.get("renderer")) == null || Y.grid.template.setAll({
107
+ stroke: p(i.palette.divider),
107
108
  strokeOpacity: 1
108
109
  });
109
- function T(t, r, h, I) {
110
+ function T(t, r, h, P) {
110
111
  const l = o.series.push(
111
- te.new(e, {
112
+ re.new(e, {
112
113
  name: t,
113
114
  xAxis: s,
114
- yAxis: C,
115
- valueYField: I,
115
+ yAxis: v,
116
+ valueYField: P,
116
117
  ...a.type === "date" ? { valueXField: h } : { categoryXField: h }
117
118
  })
118
119
  );
119
120
  l.columns.template.setAll({
120
121
  tooltipText: "{name}, {categoryX}:{valueY}",
121
- width: $(90),
122
+ width: q(90),
122
123
  tooltipY: 0,
123
124
  strokeOpacity: 0
124
- }), a.type === "date" && (l.data.processor = re.new(e, {
125
+ }), a.type === "date" && (l.data.processor = oe.new(e, {
125
126
  dateFormat: "i",
126
127
  dateFields: [h]
127
128
  })), l.data.setAll(r), l.appear(), l.bullets.push(function() {
128
- return oe.new(e, {
129
+ return ae.new(e, {
129
130
  locationY: 0,
130
131
  sprite: G.new(e, {
131
132
  text: "{valueY}",
132
133
  fill: e.interfaceColors.get("alternativeText"),
133
134
  centerY: 0,
134
- centerX: y,
135
+ centerX: g,
135
136
  populateText: !0
136
137
  })
137
138
  });
138
- }), E.data.push(l);
139
+ }), I.data.push(l);
139
140
  }
140
- if (p.length === 1)
141
+ if (c.length === 1)
141
142
  n.forEach((t) => {
142
- T(t.name, m, a.value, t.dataFieldName);
143
+ T(
144
+ t.label ?? k(t.name),
145
+ m,
146
+ a.value,
147
+ t.dataFieldName
148
+ );
143
149
  });
144
150
  else {
145
- const t = g.groupBy(m, p[1].value);
151
+ const t = X.groupBy(m, c[1].value);
146
152
  Object.keys(t).forEach((r) => {
147
153
  T(
148
- g.startCase(r),
154
+ k(r),
149
155
  t[r],
150
156
  a.value,
151
157
  n[0].dataFieldName
152
158
  );
153
159
  });
154
160
  }
155
- _(e, (X = n == null ? void 0 : n[0]) == null ? void 0 : X.format), o.appear(1e3, 100);
156
- }, L), () => {
161
+ $(e, (D = n == null ? void 0 : n[0]) == null ? void 0 : D.format), o.appear(1e3, 100);
162
+ }, R), () => {
157
163
  var e;
158
164
  f && clearTimeout(f), (e = u.current) == null || e.dispose(), u.current = null;
159
165
  };
160
- }, [d, p, n, i.palette.mode, A]);
161
- const S = { ...w };
162
- return { chartId: v, ownerState: S, sx: O, error: b, other: B };
166
+ }, [d, c, n, i.palette.mode, w]);
167
+ const E = { ...y };
168
+ return { chartId: A, ownerState: E, sx: B, error: b, other: S };
163
169
  };
164
170
  export {
165
- we as useXYChartLogic
171
+ be as useXYChartLogic
166
172
  };
@@ -1,27 +1,28 @@
1
- import { jsx as t, jsxs as n, Fragment as x } from "react/jsx-runtime";
2
- import { Stack as a, Skeleton as c } from "@mui/material";
3
- import { MetricChart as g } from "./MetricChart.js";
4
- import { useMetricCardLogic as b } from "./logic.js";
5
- import { MetricCardRoot as u, MetricCardValue as j, MetricCardTrendContainer as z, MetricCardLabel as m, MetricCardPanel as k, MetricCardDescription as w, MetricCardSideChart as P, MetricCardCornerIconContainer as L, MetricCardIconContainer as f, MetricCardContent as V, MetricCardChartContainer as A } from "./styled.js";
6
- const B = (e) => {
7
- const { state: v } = b(e), {
1
+ import { jsx as e, jsxs as n, Fragment as u } from "react/jsx-runtime";
2
+ import { Stack as r, Skeleton as c } from "@mui/material";
3
+ import { MetricChart as x } from "./MetricChart.js";
4
+ import { useMetricCardLogic as j } from "./logic.js";
5
+ import { MetricCardRoot as m, MetricCardValue as z, MetricCardSecondValue as V, MetricCardTrendContainer as k, MetricCardLabel as w, MetricCardPanel as P, MetricCardDescription as f, MetricCardSideChart as L, MetricCardCornerIconContainer as A, MetricCardIconContainer as v, MetricCardContent as D, MetricCardChartContainer as F } from "./styled.js";
6
+ const G = (t) => {
7
+ const { state: M } = j(t), {
8
8
  ownerState: i,
9
9
  layout: d,
10
- calculatedValue: M,
10
+ calculatedValue: y,
11
+ calculatedSecondValue: l,
11
12
  calculatedChange: h,
12
- TrendIcon: y,
13
- Icon: r,
13
+ TrendIcon: S,
14
+ Icon: a,
14
15
  showCornerIcon: I,
15
- showSideIcon: l,
16
- iconPosition: o,
17
- snapshotPayload: S
18
- } = v, s = !!e.showChart && !!e.chartType && (e.value ?? []).length >= 2, T = (e.showChange || e.showTrend) && h !== "—";
19
- if (e.loading)
20
- return /* @__PURE__ */ t(u, { ownerState: i, sx: e.sx, children: /* @__PURE__ */ n(a, { spacing: 1, children: [
21
- /* @__PURE__ */ t(c, { variant: "text", width: "60%" }),
22
- /* @__PURE__ */ t(c, { variant: "rectangular", height: 40, width: "40%" }),
23
- /* @__PURE__ */ t(c, { variant: "text", width: "80%" }),
24
- e.showChart && /* @__PURE__ */ t(
16
+ showSideIcon: o,
17
+ iconPosition: s,
18
+ snapshotPayload: b
19
+ } = M, C = !!t.showChart && !!t.chartType && (t.value ?? []).length >= 2, T = (t.showChange || t.showTrend) && h !== "—";
20
+ if (t.loading)
21
+ return /* @__PURE__ */ e(m, { ownerState: i, sx: t.sx, children: /* @__PURE__ */ n(r, { spacing: 1, children: [
22
+ /* @__PURE__ */ e(c, { variant: "text", width: "60%" }),
23
+ /* @__PURE__ */ e(c, { variant: "rectangular", height: 40, width: "40%" }),
24
+ /* @__PURE__ */ e(c, { variant: "text", width: "80%" }),
25
+ t.showChart && /* @__PURE__ */ e(
25
26
  c,
26
27
  {
27
28
  variant: "rectangular",
@@ -31,80 +32,83 @@ const B = (e) => {
31
32
  }
32
33
  )
33
34
  ] }) });
34
- const C = /* @__PURE__ */ n(
35
- a,
35
+ const g = /* @__PURE__ */ n(
36
+ r,
36
37
  {
37
38
  direction: "row",
38
39
  alignItems: "center",
39
40
  spacing: 1,
40
41
  flexWrap: d === "panel" ? "nowrap" : "wrap",
41
42
  children: [
42
- /* @__PURE__ */ t(j, { variant: "h4", ownerState: i, children: M }),
43
- T && /* @__PURE__ */ n(z, { ownerState: i, children: [
44
- d === "overlay" && e.showTrend && /* @__PURE__ */ t(y, { size: 16 }),
45
- e.showChange && h
43
+ /* @__PURE__ */ n(r, { direction: "row", alignItems: "baseline", spacing: 0.5, children: [
44
+ /* @__PURE__ */ e(z, { variant: "h4", ownerState: i, children: y }),
45
+ l && /* @__PURE__ */ e(V, { variant: "h5", children: l })
46
+ ] }),
47
+ T && /* @__PURE__ */ n(k, { ownerState: i, children: [
48
+ d === "overlay" && t.showTrend && /* @__PURE__ */ e(S, { size: 16 }),
49
+ t.showChange && h
46
50
  ] })
47
51
  ]
48
52
  }
49
53
  );
50
- return /* @__PURE__ */ t(
51
- u,
54
+ return /* @__PURE__ */ e(
55
+ m,
52
56
  {
53
57
  ownerState: i,
54
- sx: e.sx,
55
- "data-snapshot": S,
56
- children: d === "panel" ? /* @__PURE__ */ n(x, { children: [
57
- /* @__PURE__ */ t(m, { variant: "body2", children: e.label }),
58
- /* @__PURE__ */ n(k, { children: [
59
- /* @__PURE__ */ n(a, { justifyContent: "center", spacing: 0.5, sx: { flexShrink: 0 }, children: [
60
- C,
61
- e.description && /* @__PURE__ */ t(w, { variant: "caption", children: e.description })
62
- ] }),
63
- s && /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(
58
+ sx: t.sx,
59
+ "data-snapshot": b,
60
+ children: d === "panel" ? /* @__PURE__ */ n(u, { children: [
61
+ /* @__PURE__ */ e(w, { variant: "body2", children: t.label }),
62
+ /* @__PURE__ */ n(P, { children: [
63
+ /* @__PURE__ */ n(r, { justifyContent: "center", spacing: 0.5, sx: { flexShrink: 0 }, children: [
64
64
  g,
65
+ t.description && /* @__PURE__ */ e(f, { variant: "caption", children: t.description })
66
+ ] }),
67
+ C && /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
68
+ x,
65
69
  {
66
- type: e.chartType,
67
- data: e.value,
70
+ type: t.chartType,
71
+ data: t.value,
68
72
  inset: !0,
69
73
  gradient: !0
70
74
  }
71
75
  ) })
72
76
  ] })
73
- ] }) : /* @__PURE__ */ n(x, { children: [
74
- I && r && /* @__PURE__ */ t(L, { ownerState: i, children: /* @__PURE__ */ t(r, { size: 24 }) }),
77
+ ] }) : /* @__PURE__ */ n(u, { children: [
78
+ I && a && /* @__PURE__ */ e(A, { ownerState: i, children: /* @__PURE__ */ e(a, { size: 24 }) }),
75
79
  /* @__PURE__ */ n(
76
- a,
80
+ r,
77
81
  {
78
82
  direction: "row",
79
83
  justifyContent: "space-between",
80
84
  alignItems: "flex-start",
81
85
  sx: { flex: 1 },
82
86
  children: [
83
- l && r && o === "left" && /* @__PURE__ */ t(f, { ownerState: i, children: /* @__PURE__ */ t(r, { sx: { fontSize: 24 } }) }),
84
- /* @__PURE__ */ n(V, { children: [
85
- /* @__PURE__ */ t(m, { variant: "body2", children: e.label }),
86
- C
87
+ o && a && s === "left" && /* @__PURE__ */ e(v, { ownerState: i, children: /* @__PURE__ */ e(a, { sx: { fontSize: 24 } }) }),
88
+ /* @__PURE__ */ n(D, { children: [
89
+ /* @__PURE__ */ e(w, { variant: "body2", children: t.label }),
90
+ g
87
91
  ] }),
88
- l && r && o === "right" && /* @__PURE__ */ t(f, { ownerState: i, children: /* @__PURE__ */ t(r, { sx: { fontSize: 24 } }) })
92
+ o && a && s === "right" && /* @__PURE__ */ e(v, { ownerState: i, children: /* @__PURE__ */ e(a, { sx: { fontSize: 24 } }) })
89
93
  ]
90
94
  }
91
95
  ),
92
96
  /* @__PURE__ */ n(
93
- a,
97
+ r,
94
98
  {
95
99
  direction: { xs: "column-reverse", sm: "column" },
96
100
  spacing: 1,
97
101
  sx: { width: "100%", mt: 2 },
98
102
  children: [
99
- e.description && /* @__PURE__ */ t(
100
- w,
103
+ t.description && /* @__PURE__ */ e(
104
+ f,
101
105
  {
102
106
  variant: "caption",
103
107
  sx: { textAlign: { xs: "center", sm: "left" } },
104
- children: e.description
108
+ children: t.description
105
109
  }
106
110
  ),
107
- s && /* @__PURE__ */ t(A, { children: /* @__PURE__ */ t(g, { type: e.chartType, data: e.value }) })
111
+ C && /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(x, { type: t.chartType, data: t.value }) })
108
112
  ]
109
113
  }
110
114
  )
@@ -113,5 +117,5 @@ const B = (e) => {
113
117
  );
114
118
  };
115
119
  export {
116
- B as MetricCard
120
+ G as MetricCard
117
121
  };
@@ -1,103 +1,112 @@
1
- import { useThemeProps as U } from "@mui/material";
2
- import { formatValue as Z, resolveConditionalStyle as H } from "../charts/_common/format.js";
3
- import { c as f } from "../../createReactComponent-C7L-DMHj.js";
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";
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 J = [["path", { d: "M5 12l14 0", key: "svg-0" }], ["path", { d: "M13 18l6 -6", key: "svg-1" }], ["path", { d: "M13 6l6 6", key: "svg-2" }]], L = f("outline", "arrow-right", "ArrowRight", J);
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);
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 j = [["path", { d: "M3 7l6 6l4 -4l8 8", key: "svg-0" }], ["path", { d: "M21 10l0 7l-7 0", key: "svg-1" }]], q = f("outline", "trending-down", "TrendingDown", j);
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);
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 z = [["path", { d: "M3 17l6 -6l4 4l8 -8", key: "svg-0" }], ["path", { d: "M14 7l7 0l0 7", key: "svg-1" }]], E = f("outline", "trending-up", "TrendingUp", z), W = (b) => {
25
- const i = U({ props: b, name: "HCMetricCard" }), {
26
- value: s = [],
27
- variant: k = "default",
28
- layout: v = "overlay",
29
- valuePrefix: x,
30
- valueSuffix: S,
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",
30
+ layout: w = "overlay",
31
+ valuePrefix: D,
32
+ valueSuffix: P,
31
33
  format: e,
32
- showChange: _ = !1,
33
- changeType: l = "percentage",
34
- showTrend: R = !1,
35
- showIcon: y = !1,
34
+ showChange: B = !1,
35
+ changeType: c = "percentage",
36
+ showTrend: F = !1,
37
+ showIcon: C = !1,
36
38
  icon: r,
37
39
  iconPosition: d = "right"
38
- } = i, V = s.length > 0, u = s[s.length - 1], N = s[s.length - 2], t = u ? Number(u.v) : NaN, o = N ? Number(N.v) : NaN, w = !isNaN(t) && !isNaN(o), m = {
39
- prefix: (e == null ? void 0 : e.prefix) ?? x,
40
- suffix: (e == null ? void 0 : e.suffix) ?? S,
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,
41
43
  decimals: e == null ? void 0 : e.decimals,
44
+ color: e == null ? void 0 : e.color,
45
+ backgroundColor: e == null ? void 0 : e.backgroundColor,
42
46
  conditionalRules: e == null ? void 0 : e.conditionalRules
43
47
  };
44
- let a = "—", C = "", M, I;
45
- if (!isNaN(t)) {
46
- a = Z(t, m), C = u.t;
47
- const p = H(t, m);
48
- M = p.color, I = p.backgroundColor;
48
+ let a = "—", m = "", M, I;
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;
49
53
  }
50
- let c;
51
- if (_)
52
- if (w && !(o === 0 && l === "percentage")) {
53
- const h = l === "absolute" ? t - o : (t - o) / o * 100, A = h > 0 ? "+" : h < 0 ? "−" : "", F = l === "percentage" ? 1 : 2, O = l === "percentage" ? "%" : "";
54
- c = `${A}${Math.abs(h).toFixed(F)}${O}`;
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}`;
55
62
  } else
56
- c = "—";
57
- let n;
58
- R && w && (t > o ? n = "up" : t < o ? n = "down" : n = "neutral");
59
- let g = L;
60
- n === "up" ? g = E : n === "down" && (g = q);
61
- const T = [
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 = [
62
69
  "top-left",
63
70
  "top-right",
64
71
  "bottom-left",
65
72
  "bottom-right"
66
- ].includes(d), $ = y && !!r && T, D = y && !!r && !T, P = JSON.stringify({
73
+ ].includes(d), O = C && !!r && S, U = C && !!r && !S, Z = JSON.stringify({
67
74
  metric: i.label,
68
75
  value: a,
69
- change: c,
70
- asOf: C
71
- }), B = {
76
+ change: s,
77
+ asOf: m
78
+ }), H = {
72
79
  ...i,
73
- variant: k,
74
- layout: v,
75
- changeType: l,
80
+ variant: $,
81
+ layout: w,
82
+ changeType: c,
76
83
  iconPosition: d,
77
84
  calculatedValue: a,
78
- calculatedChange: c,
79
- calculatedTrend: n,
85
+ calculatedSecondValue: p,
86
+ calculatedChange: s,
87
+ calculatedTrend: t,
80
88
  calculatedValueColor: M,
81
89
  calculatedValueBg: I,
82
- hasData: V
90
+ hasData: A
83
91
  };
84
92
  return {
85
93
  refs: {},
86
94
  state: {
87
- ownerState: B,
88
- layout: v,
95
+ ownerState: H,
96
+ layout: w,
89
97
  calculatedValue: a,
90
- calculatedChange: c,
91
- TrendIcon: g,
98
+ calculatedSecondValue: p,
99
+ calculatedChange: s,
100
+ TrendIcon: h,
92
101
  Icon: r,
93
- showCornerIcon: $,
94
- showSideIcon: D,
102
+ showCornerIcon: O,
103
+ showSideIcon: U,
95
104
  iconPosition: d,
96
- snapshotPayload: P
105
+ snapshotPayload: Z
97
106
  },
98
107
  actions: {}
99
108
  };
100
109
  };
101
110
  export {
102
- W as useMetricCardLogic
111
+ ne as useMetricCardLogic
103
112
  };