@mt-gloss/ui 0.1.107 → 0.1.109
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/{BaseAsyncButton-Cq_l7clO.js → BaseAsyncButton-aDQ_TjJi.js} +30 -29
- package/BaseText-Dxbk1JJa.js +66 -0
- package/{Expandable-BcmIxWR8.js → Expandable-DFHxVkCF.js} +3493 -4181
- package/MetricCard-Cyoxhb_S.js +697 -0
- package/{UIContext-DP6JGCto.js → UIContext-Dm0GYHFT.js} +564 -626
- package/catalog.js +122 -120
- package/composites-panels.js +594 -416
- package/index.js +328 -326
- package/internals.js +81 -80
- package/package.json +1 -1
- package/ui.css +1 -1
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
import { jsxs as u, jsx as t, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import { useId as de, useMemo as N, useState as he, useRef as R, useCallback as A, useEffect as ue } from "react";
|
|
3
|
+
import { formatTrend as fe, isStatusModeEnabled as ge, pickMetricTier as me, getValueFontSize as F, formatValue as E } from "@mt-gloss/utils";
|
|
4
|
+
import { B as z, a as $, b as pe } from "./BaseText-Dxbk1JJa.js";
|
|
5
|
+
const V = {
|
|
6
|
+
up: { color: "#10b981", bg: "rgba(16,185,129,0.07)" },
|
|
7
|
+
down: { color: "#ef4444", bg: "rgba(239,68,68,0.07)" },
|
|
8
|
+
flat: { color: "#6b7280", bg: "rgba(107,114,128,0.07)" }
|
|
9
|
+
}, P = {
|
|
10
|
+
up: "▲",
|
|
11
|
+
down: "▼",
|
|
12
|
+
flat: "▶"
|
|
13
|
+
}, D = function({ value: o, direction: e }) {
|
|
14
|
+
if (o == null) return null;
|
|
15
|
+
const { text: c, direction: d } = fe(o), i = e || d, { color: r, bg: s } = V[i] || V.flat, l = P[i] || P.flat;
|
|
16
|
+
return /* @__PURE__ */ u(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
style: {
|
|
20
|
+
display: "inline-flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
gap: 2,
|
|
23
|
+
padding: "2px 6px",
|
|
24
|
+
borderRadius: 4,
|
|
25
|
+
fontSize: 11,
|
|
26
|
+
fontWeight: 600,
|
|
27
|
+
lineHeight: 1,
|
|
28
|
+
color: r,
|
|
29
|
+
backgroundColor: s,
|
|
30
|
+
whiteSpace: "nowrap"
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 8, lineHeight: 1 }, children: l }),
|
|
34
|
+
c
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
D.displayName = "TrendIndicator";
|
|
40
|
+
const L = ({ data: n, color: o, isStale: e }) => {
|
|
41
|
+
const d = "sparkbg-" + de().replace(/:/g, ""), i = o || "#4f46e5", r = N(() => {
|
|
42
|
+
if (!n || n.length < 2) return null;
|
|
43
|
+
const s = 300, l = 55, h = 2, a = Math.min(...n), g = Math.max(...n) - a || 1, x = n.map((p, k) => ({
|
|
44
|
+
x: k / (n.length - 1) * s,
|
|
45
|
+
y: h + (1 - (p - a) / g) * (l - h * 2)
|
|
46
|
+
})).map((p, k) => `${k === 0 ? "M" : "L"}${p.x},${p.y}`).join(" "), v = `${x} L${s},${l} L0,${l}Z`;
|
|
47
|
+
return { line: x, area: v, w: s, h: l };
|
|
48
|
+
}, [n]);
|
|
49
|
+
return r ? /* @__PURE__ */ u(
|
|
50
|
+
"svg",
|
|
51
|
+
{
|
|
52
|
+
height: 55,
|
|
53
|
+
viewBox: `0 0 ${r.w} ${r.h}`,
|
|
54
|
+
preserveAspectRatio: "none",
|
|
55
|
+
style: {
|
|
56
|
+
position: "absolute",
|
|
57
|
+
// quick-260418-k7k-fix-4: "bleed" means REACH the card edges — NOT
|
|
58
|
+
// extend past them. CardShell's FRONT BaseBox has `inset: 0` inside
|
|
59
|
+
// CardShell root, so its padding-box (= containing block for abs
|
|
60
|
+
// descendants) is the FULL card size. width:100% + left:0 + right:0
|
|
61
|
+
// + bottom:0 lands the SVG exactly inside the card border. Earlier
|
|
62
|
+
// fix-3 added `calc(100% + 24px)` to overshoot each side by 12px,
|
|
63
|
+
// which user rejected ("Why on earth would I want the sparklines
|
|
64
|
+
// to go beyond the edge of the cards?"). StackedGroupCard hoists
|
|
65
|
+
// SparklineBg to Fragment-root so its containing block matches the
|
|
66
|
+
// 1×1 MetricCard path (FRONT BaseBox padding-box = full card).
|
|
67
|
+
bottom: 0,
|
|
68
|
+
left: 0,
|
|
69
|
+
right: 0,
|
|
70
|
+
width: "100%",
|
|
71
|
+
zIndex: 1,
|
|
72
|
+
display: "block",
|
|
73
|
+
pointerEvents: "none",
|
|
74
|
+
transform: e ? "scaleY(0.05)" : "scaleY(1)",
|
|
75
|
+
transformOrigin: "bottom",
|
|
76
|
+
transition: e ? "transform 400ms ease-out" : "transform 500ms ease-in-out"
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ u("linearGradient", { id: d, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
80
|
+
/* @__PURE__ */ t("stop", { offset: "0%", stopColor: i, stopOpacity: "0.09" }),
|
|
81
|
+
/* @__PURE__ */ t("stop", { offset: "100%", stopColor: i, stopOpacity: "0.01" })
|
|
82
|
+
] }) }),
|
|
83
|
+
/* @__PURE__ */ t("path", { d: r.area, fill: `url(#${d})` }),
|
|
84
|
+
/* @__PURE__ */ t(
|
|
85
|
+
"path",
|
|
86
|
+
{
|
|
87
|
+
d: r.line,
|
|
88
|
+
fill: "none",
|
|
89
|
+
stroke: i,
|
|
90
|
+
strokeOpacity: "0.22",
|
|
91
|
+
strokeWidth: "1.5",
|
|
92
|
+
strokeLinecap: "round",
|
|
93
|
+
strokeLinejoin: "round"
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
) : null;
|
|
99
|
+
};
|
|
100
|
+
L.displayName = "SparklineBg";
|
|
101
|
+
const G = ({ data: n, color: o, isStale: e }) => {
|
|
102
|
+
const c = o || "#4f46e5", d = N(() => {
|
|
103
|
+
if (!n || n.length < 1) return null;
|
|
104
|
+
const i = 300, r = 50, s = r * 0.82, l = n.length, h = i / (l * 4), a = h * 3, g = Math.max(...n) || 1;
|
|
105
|
+
return n.map((b, x) => {
|
|
106
|
+
const v = b / g, p = Math.max(v * s, 2);
|
|
107
|
+
return {
|
|
108
|
+
x: x * (a + h),
|
|
109
|
+
y: r - p,
|
|
110
|
+
width: a,
|
|
111
|
+
height: p,
|
|
112
|
+
isLast: x === l - 1
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}, [n]);
|
|
116
|
+
return d ? /* @__PURE__ */ t(
|
|
117
|
+
"svg",
|
|
118
|
+
{
|
|
119
|
+
width: "100%",
|
|
120
|
+
height: 50,
|
|
121
|
+
viewBox: "0 0 300 50",
|
|
122
|
+
preserveAspectRatio: "none",
|
|
123
|
+
style: {
|
|
124
|
+
position: "absolute",
|
|
125
|
+
bottom: 0,
|
|
126
|
+
left: 0,
|
|
127
|
+
right: 0,
|
|
128
|
+
zIndex: 1,
|
|
129
|
+
display: "block",
|
|
130
|
+
pointerEvents: "none",
|
|
131
|
+
transform: e ? "scaleY(0.05)" : "scaleY(1)",
|
|
132
|
+
transformOrigin: "bottom",
|
|
133
|
+
transition: e ? "transform 400ms ease-out" : "transform 500ms ease-in-out"
|
|
134
|
+
},
|
|
135
|
+
children: d.map((i, r) => /* @__PURE__ */ t(
|
|
136
|
+
"rect",
|
|
137
|
+
{
|
|
138
|
+
x: i.x,
|
|
139
|
+
y: i.y,
|
|
140
|
+
width: i.width,
|
|
141
|
+
height: i.height,
|
|
142
|
+
fill: c,
|
|
143
|
+
fillOpacity: i.isLast ? 0.14 : 0.06,
|
|
144
|
+
rx: "2.5"
|
|
145
|
+
},
|
|
146
|
+
r
|
|
147
|
+
))
|
|
148
|
+
}
|
|
149
|
+
) : null;
|
|
150
|
+
};
|
|
151
|
+
G.displayName = "BarsBg";
|
|
152
|
+
const U = ({ value: n = 0, max: o = 100, color: e = "#4f46e5", colSpan: c = 1, isStale: d }) => {
|
|
153
|
+
const i = c >= 2 ? 40 : 34, r = 3.5, s = (i - r) / 2, l = 2 * Math.PI * s, h = d ? 0 : Math.min(Math.max(n / (o || 1), 0), 1), a = l * (1 - h);
|
|
154
|
+
return /* @__PURE__ */ u(
|
|
155
|
+
"svg",
|
|
156
|
+
{
|
|
157
|
+
width: i,
|
|
158
|
+
height: i,
|
|
159
|
+
viewBox: `0 0 ${i} ${i}`,
|
|
160
|
+
style: { flexShrink: 0, marginRight: 8, display: "block" },
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ t(
|
|
163
|
+
"circle",
|
|
164
|
+
{
|
|
165
|
+
cx: i / 2,
|
|
166
|
+
cy: i / 2,
|
|
167
|
+
r: s,
|
|
168
|
+
fill: "none",
|
|
169
|
+
stroke: e,
|
|
170
|
+
strokeOpacity: "0.06",
|
|
171
|
+
strokeWidth: r
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ t(
|
|
175
|
+
"circle",
|
|
176
|
+
{
|
|
177
|
+
cx: i / 2,
|
|
178
|
+
cy: i / 2,
|
|
179
|
+
r: s,
|
|
180
|
+
fill: "none",
|
|
181
|
+
stroke: e,
|
|
182
|
+
strokeWidth: r,
|
|
183
|
+
strokeDasharray: l,
|
|
184
|
+
strokeDashoffset: a,
|
|
185
|
+
strokeLinecap: "round",
|
|
186
|
+
transform: `rotate(-90 ${i / 2} ${i / 2})`,
|
|
187
|
+
style: { transition: "stroke-dashoffset 0.4s ease" }
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
U.displayName = "DonutChart";
|
|
195
|
+
const Z = ({ value: n = 0, max: o = 100, trendValue: e = 0, color: c = "#6b7280", colSpan: d = 1, isStale: i }) => {
|
|
196
|
+
const r = d >= 2 ? 44 : 36, s = 3.5, l = (r - s) / 2, h = 2 * Math.PI * l, a = i ? 0 : Math.min(Math.max(n / (o || 1), 0), 1), f = h * (1 - a), g = d >= 2 ? 11 : 9, b = `${Math.round(Math.abs(e))}%`;
|
|
197
|
+
return /* @__PURE__ */ u(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
style: {
|
|
201
|
+
position: "relative",
|
|
202
|
+
display: "inline-flex",
|
|
203
|
+
alignItems: "center",
|
|
204
|
+
justifyContent: "center",
|
|
205
|
+
width: r,
|
|
206
|
+
height: r,
|
|
207
|
+
flexShrink: 0,
|
|
208
|
+
marginRight: 8
|
|
209
|
+
},
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ u(
|
|
212
|
+
"svg",
|
|
213
|
+
{
|
|
214
|
+
width: r,
|
|
215
|
+
height: r,
|
|
216
|
+
viewBox: `0 0 ${r} ${r}`,
|
|
217
|
+
style: { display: "block" },
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ t(
|
|
220
|
+
"circle",
|
|
221
|
+
{
|
|
222
|
+
cx: r / 2,
|
|
223
|
+
cy: r / 2,
|
|
224
|
+
r: l,
|
|
225
|
+
fill: "none",
|
|
226
|
+
stroke: c,
|
|
227
|
+
strokeOpacity: "0.06",
|
|
228
|
+
strokeWidth: s
|
|
229
|
+
}
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ t(
|
|
232
|
+
"circle",
|
|
233
|
+
{
|
|
234
|
+
cx: r / 2,
|
|
235
|
+
cy: r / 2,
|
|
236
|
+
r: l,
|
|
237
|
+
fill: "none",
|
|
238
|
+
stroke: c,
|
|
239
|
+
strokeWidth: s,
|
|
240
|
+
strokeDasharray: h,
|
|
241
|
+
strokeDashoffset: f,
|
|
242
|
+
strokeLinecap: "round",
|
|
243
|
+
transform: `rotate(-90 ${r / 2} ${r / 2})`,
|
|
244
|
+
style: { transition: "stroke-dashoffset 0.4s ease" }
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
/* @__PURE__ */ t(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
style: {
|
|
254
|
+
position: "absolute",
|
|
255
|
+
inset: 0,
|
|
256
|
+
display: "flex",
|
|
257
|
+
alignItems: "center",
|
|
258
|
+
justifyContent: "center",
|
|
259
|
+
fontSize: g,
|
|
260
|
+
fontWeight: 700,
|
|
261
|
+
color: c,
|
|
262
|
+
lineHeight: 1,
|
|
263
|
+
pointerEvents: "none"
|
|
264
|
+
},
|
|
265
|
+
children: b
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
};
|
|
272
|
+
Z.displayName = "ObjectArrow";
|
|
273
|
+
const be = { slot3: 200, slot5: 380 };
|
|
274
|
+
function xe(n, o) {
|
|
275
|
+
const e = be, c = 150, [d, i] = he(1), r = R(null), s = R(null), l = A(() => {
|
|
276
|
+
const a = r.current;
|
|
277
|
+
if (a == null) return;
|
|
278
|
+
const f = a < e.slot3 ? 1 : a < e.slot5 ? 3 : 5;
|
|
279
|
+
i((g) => g === f ? g : f), r.current = null, s.current && (clearTimeout(s.current), s.current = null);
|
|
280
|
+
}, [e.slot3, e.slot5]);
|
|
281
|
+
ue(() => {
|
|
282
|
+
const a = n.current;
|
|
283
|
+
if (!a || typeof ResizeObserver > "u") return;
|
|
284
|
+
const f = new ResizeObserver((g) => {
|
|
285
|
+
const b = g[0]?.contentRect.width ?? 0;
|
|
286
|
+
r.current = b, s.current && clearTimeout(s.current), s.current = setTimeout(l, c);
|
|
287
|
+
});
|
|
288
|
+
return f.observe(a), () => {
|
|
289
|
+
f.disconnect(), s.current && clearTimeout(s.current);
|
|
290
|
+
};
|
|
291
|
+
}, [n, l, c]);
|
|
292
|
+
const h = A(() => {
|
|
293
|
+
l();
|
|
294
|
+
}, [l]);
|
|
295
|
+
return { capacity: d, onPointerUp: h };
|
|
296
|
+
}
|
|
297
|
+
function q(n) {
|
|
298
|
+
const { onStatusSlotClick: o } = n, e = R(null), c = ge(), { capacity: d, onPointerUp: i } = xe(e), r = n.maxSlots ?? d, s = n.statuses.slice(0, r);
|
|
299
|
+
if (!c) {
|
|
300
|
+
const l = n.statuses[0];
|
|
301
|
+
return /* @__PURE__ */ u(
|
|
302
|
+
z,
|
|
303
|
+
{
|
|
304
|
+
definition: { display: "flex", direction: "column" },
|
|
305
|
+
className: "gloss-status-card gloss-status-card--flag-off",
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ t($, { className: "gloss-metric-card__label", children: n.label }),
|
|
308
|
+
l != null ? /* @__PURE__ */ t($, { children: String(l.value) }) : null
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
return /* @__PURE__ */ u(
|
|
314
|
+
"div",
|
|
315
|
+
{
|
|
316
|
+
ref: e,
|
|
317
|
+
className: "gloss-status-card",
|
|
318
|
+
"data-status-mode": "on",
|
|
319
|
+
"data-status-capacity": r,
|
|
320
|
+
onPointerUp: i,
|
|
321
|
+
children: [
|
|
322
|
+
/* @__PURE__ */ t($, { className: "gloss-metric-card__label", children: n.label }),
|
|
323
|
+
/* @__PURE__ */ t("div", { className: "gloss-status-slots", "data-status-slot-count": s.length, children: s.map((l, h) => {
|
|
324
|
+
const a = n.sparklinePerStatus?.[l.id], f = l.id === n.activeStatusId;
|
|
325
|
+
return /* @__PURE__ */ u(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
className: `gloss-status-slots__slot${f ? " gloss-status-slots__slot--active" : ""}`,
|
|
329
|
+
"data-status-slot-id": l.id,
|
|
330
|
+
"data-status-slot-index": h,
|
|
331
|
+
onClick: o ? (g) => o(l.id, g.currentTarget) : void 0,
|
|
332
|
+
style: o ? { cursor: "pointer" } : void 0,
|
|
333
|
+
children: [
|
|
334
|
+
/* @__PURE__ */ t("span", { className: "gloss-metric-card__label", children: l.label }),
|
|
335
|
+
/* @__PURE__ */ t("span", { children: String(l.value) }),
|
|
336
|
+
a != null && a.length > 0 ? /* @__PURE__ */ t(L, { data: [...a], color: l.accentColor }) : null
|
|
337
|
+
]
|
|
338
|
+
},
|
|
339
|
+
l.id
|
|
340
|
+
);
|
|
341
|
+
}) })
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
q.displayName = "StatusModeCard";
|
|
347
|
+
function ye(n, o) {
|
|
348
|
+
if (!o) return;
|
|
349
|
+
if (n == null) return o.fallback;
|
|
350
|
+
const { operator: e, threshold: c, result: d, fallback: i } = o;
|
|
351
|
+
return (e === "lt" ? n < c : e === "gt" ? n > c : e === "eq" ? Math.abs(n - c) < 1e-9 : e === "gte" ? n >= c : e === "lte" ? n <= c : !1) ? d : i;
|
|
352
|
+
}
|
|
353
|
+
function Y(n, o) {
|
|
354
|
+
const e = n.replace("#", "");
|
|
355
|
+
if (!/^[0-9a-fA-F]{6}$/.test(e))
|
|
356
|
+
return `rgba(0,0,0,${o})`;
|
|
357
|
+
const c = parseInt(e.substring(0, 2), 16), d = parseInt(e.substring(2, 4), 16), i = parseInt(e.substring(4, 6), 16);
|
|
358
|
+
return `rgba(${c},${d},${i},${o})`;
|
|
359
|
+
}
|
|
360
|
+
const O = {
|
|
361
|
+
up: "var(--color-positive)",
|
|
362
|
+
down: "var(--color-negative)",
|
|
363
|
+
flat: "var(--color-text-secondary)"
|
|
364
|
+
}, ve = {
|
|
365
|
+
positive: "#10b981",
|
|
366
|
+
// Used with hexToRgba() for tinted overlays -- must stay hex
|
|
367
|
+
negative: "#ef4444",
|
|
368
|
+
// Used with hexToRgba() for tinted overlays -- must stay hex
|
|
369
|
+
warning: "#f59e0b",
|
|
370
|
+
// Used with hexToRgba() for tinted overlays -- must stay hex
|
|
371
|
+
neutral: "#6b7280"
|
|
372
|
+
// Used with hexToRgba() for tinted overlays -- must stay hex
|
|
373
|
+
}, ke = () => /* @__PURE__ */ u(
|
|
374
|
+
"svg",
|
|
375
|
+
{
|
|
376
|
+
"aria-label": "Warning threshold breached",
|
|
377
|
+
role: "img",
|
|
378
|
+
width: "14",
|
|
379
|
+
height: "14",
|
|
380
|
+
viewBox: "0 0 14 14",
|
|
381
|
+
fill: "none",
|
|
382
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
383
|
+
children: [
|
|
384
|
+
/* @__PURE__ */ t(
|
|
385
|
+
"path",
|
|
386
|
+
{
|
|
387
|
+
d: "M7 1.5L13 12.5H1L7 1.5Z",
|
|
388
|
+
fill: "currentColor",
|
|
389
|
+
fillOpacity: "0.15",
|
|
390
|
+
stroke: "currentColor",
|
|
391
|
+
strokeWidth: "1.2",
|
|
392
|
+
strokeLinejoin: "round"
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
/* @__PURE__ */ t("line", { x1: "7", y1: "5.5", x2: "7", y2: "8.5", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" }),
|
|
396
|
+
/* @__PURE__ */ t("circle", { cx: "7", cy: "10.5", r: "0.7", fill: "currentColor" })
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
), we = () => /* @__PURE__ */ u(
|
|
400
|
+
"svg",
|
|
401
|
+
{
|
|
402
|
+
"aria-label": "Critical threshold breached",
|
|
403
|
+
role: "img",
|
|
404
|
+
width: "14",
|
|
405
|
+
height: "14",
|
|
406
|
+
viewBox: "0 0 14 14",
|
|
407
|
+
fill: "none",
|
|
408
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ t("circle", { cx: "7", cy: "7", r: "6", fill: "currentColor", fillOpacity: "0.15", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
411
|
+
/* @__PURE__ */ t("line", { x1: "7", y1: "4", x2: "7", y2: "8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" }),
|
|
412
|
+
/* @__PURE__ */ t("circle", { cx: "7", cy: "10", r: "0.7", fill: "currentColor" })
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
), Se = function(o) {
|
|
416
|
+
if (o.variant === "status-mode")
|
|
417
|
+
return /* @__PURE__ */ t(q, { ...o });
|
|
418
|
+
const {
|
|
419
|
+
variant: e = "standard",
|
|
420
|
+
label: c,
|
|
421
|
+
labelAdornment: d,
|
|
422
|
+
value: i,
|
|
423
|
+
valueFormat: r,
|
|
424
|
+
trend: s,
|
|
425
|
+
subtitle: l,
|
|
426
|
+
colSpan: h = 1,
|
|
427
|
+
isStale: a,
|
|
428
|
+
thresholdBreach: f = "none"
|
|
429
|
+
} = o, g = e === "sparkline" || e === "bars" || e === "donut" ? o.accentColor ?? "#4f46e5" : "#4f46e5", b = e === "highlight" ? o.highlightColor : void 0, x = e === "sparkline" ? o.sparklineData : void 0, v = e === "bars" ? o.barData : void 0, p = e === "donut" ? o.donutValue : 0, k = e === "donut" ? o.donutMax ?? 100 : 100, J = e === "object-arrow" ? o.objectArrowValue : 0, K = e === "object-arrow" ? o.objectArrowMax : 100, Q = e === "arrow" ? o.arrowDirection : void 0, w = e === "versus" ? o.versusData : void 0, C = e === "segmented" ? o.segments : void 0, M = (e === "highlight" && o.tintCondition ? ye(
|
|
430
|
+
typeof o.value == "number" ? o.value : null,
|
|
431
|
+
o.tintCondition
|
|
432
|
+
) : void 0) ?? b, I = (M ? ve[M] : void 0) || M, { formatted: B, tier: X, length: ee } = N(
|
|
433
|
+
() => me(i, {
|
|
434
|
+
prefix: r?.prefix || "",
|
|
435
|
+
suffix: r?.suffix || "",
|
|
436
|
+
abbreviated: r?.abbreviated
|
|
437
|
+
}, h),
|
|
438
|
+
[i, r?.prefix, r?.suffix, r?.abbreviated, h]
|
|
439
|
+
), S = { display: B, full: B, length: ee }, te = F(S.length, h), re = s?.direction && O[s.direction] || O.flat, T = a ? "gloss-metric-data-stale" : "gloss-metric-data-fresh", W = {
|
|
440
|
+
fontWeight: 700,
|
|
441
|
+
letterSpacing: "-0.03em",
|
|
442
|
+
color: e === "highlight" ? I : "rgba(0,0,0,0.87)",
|
|
443
|
+
fontSize: te,
|
|
444
|
+
lineHeight: 1.1,
|
|
445
|
+
whiteSpace: "nowrap",
|
|
446
|
+
overflow: "hidden"
|
|
447
|
+
}, _ = {
|
|
448
|
+
fontSize: 10.5,
|
|
449
|
+
color: "rgba(0,0,0,0.35)",
|
|
450
|
+
overflow: "hidden",
|
|
451
|
+
textOverflow: "ellipsis",
|
|
452
|
+
whiteSpace: "nowrap",
|
|
453
|
+
flex: 1,
|
|
454
|
+
minWidth: 0
|
|
455
|
+
}, j = e === "sparkline" || e === "bars", ne = j && l ? {
|
|
456
|
+
..._,
|
|
457
|
+
backgroundColor: "rgba(255,255,255,0.78)",
|
|
458
|
+
backdropFilter: "blur(4px)",
|
|
459
|
+
WebkitBackdropFilter: "blur(4px)",
|
|
460
|
+
padding: "1px 6px",
|
|
461
|
+
borderRadius: 4,
|
|
462
|
+
color: "rgba(0,0,0,0.5)",
|
|
463
|
+
flex: "none",
|
|
464
|
+
minWidth: void 0
|
|
465
|
+
} : _, oe = () => {
|
|
466
|
+
const m = Q === "down" ? "▼" : "▲";
|
|
467
|
+
return /* @__PURE__ */ t(
|
|
468
|
+
"div",
|
|
469
|
+
{
|
|
470
|
+
style: {
|
|
471
|
+
width: 22,
|
|
472
|
+
height: 22,
|
|
473
|
+
borderRadius: 5,
|
|
474
|
+
backgroundColor: `${g}14`,
|
|
475
|
+
// ~8% opacity
|
|
476
|
+
display: "flex",
|
|
477
|
+
alignItems: "center",
|
|
478
|
+
justifyContent: "center",
|
|
479
|
+
flexShrink: 0,
|
|
480
|
+
marginRight: 6
|
|
481
|
+
},
|
|
482
|
+
children: /* @__PURE__ */ t("span", { style: { fontSize: 10, color: g, lineHeight: 1 }, children: m })
|
|
483
|
+
}
|
|
484
|
+
);
|
|
485
|
+
}, ie = () => {
|
|
486
|
+
if (!w) return null;
|
|
487
|
+
const m = E(w.current, {
|
|
488
|
+
prefix: r?.prefix || "",
|
|
489
|
+
suffix: r?.suffix || "",
|
|
490
|
+
abbreviated: r?.abbreviated
|
|
491
|
+
}), y = E(w.prior, {
|
|
492
|
+
prefix: r?.prefix || "",
|
|
493
|
+
suffix: r?.suffix || "",
|
|
494
|
+
abbreviated: r?.abbreviated
|
|
495
|
+
}), H = F(m.length, h), ae = Math.max(H - 4, 14);
|
|
496
|
+
return /* @__PURE__ */ u("div", { style: { display: "flex", alignItems: "center", gap: 12, flex: 1 }, children: [
|
|
497
|
+
/* @__PURE__ */ u("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
498
|
+
/* @__PURE__ */ t(
|
|
499
|
+
"span",
|
|
500
|
+
{
|
|
501
|
+
style: {
|
|
502
|
+
fontWeight: 700,
|
|
503
|
+
fontSize: H,
|
|
504
|
+
letterSpacing: "-0.03em",
|
|
505
|
+
color: "rgba(0,0,0,0.87)",
|
|
506
|
+
lineHeight: 1.1
|
|
507
|
+
},
|
|
508
|
+
title: m.full,
|
|
509
|
+
children: m.display
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 10, color: "rgba(0,0,0,0.35)", marginTop: 2 }, children: w.currentLabel })
|
|
513
|
+
] }),
|
|
514
|
+
/* @__PURE__ */ t(
|
|
515
|
+
pe,
|
|
516
|
+
{
|
|
517
|
+
definition: { orientation: "vertical", color: "rgba(0,0,0,0.08)" },
|
|
518
|
+
style: { flexShrink: 0 }
|
|
519
|
+
}
|
|
520
|
+
),
|
|
521
|
+
/* @__PURE__ */ u("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
522
|
+
/* @__PURE__ */ t(
|
|
523
|
+
"span",
|
|
524
|
+
{
|
|
525
|
+
style: {
|
|
526
|
+
fontWeight: 700,
|
|
527
|
+
fontSize: ae,
|
|
528
|
+
letterSpacing: "-0.03em",
|
|
529
|
+
color: "rgba(0,0,0,0.5)",
|
|
530
|
+
lineHeight: 1.1
|
|
531
|
+
},
|
|
532
|
+
title: y.full,
|
|
533
|
+
children: y.display
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 10, color: "rgba(0,0,0,0.35)", marginTop: 2 }, children: w.priorLabel })
|
|
537
|
+
] })
|
|
538
|
+
] });
|
|
539
|
+
}, se = () => !C || C.length === 0 ? null : /* @__PURE__ */ u("div", { style: { zIndex: 2, position: "relative" }, children: [
|
|
540
|
+
/* @__PURE__ */ t(
|
|
541
|
+
"div",
|
|
542
|
+
{
|
|
543
|
+
style: {
|
|
544
|
+
height: 5,
|
|
545
|
+
borderRadius: 3,
|
|
546
|
+
display: "flex",
|
|
547
|
+
gap: 1,
|
|
548
|
+
overflow: "hidden"
|
|
549
|
+
},
|
|
550
|
+
children: C.map((m, y) => /* @__PURE__ */ t(
|
|
551
|
+
"div",
|
|
552
|
+
{
|
|
553
|
+
style: {
|
|
554
|
+
flex: m.value,
|
|
555
|
+
backgroundColor: m.color,
|
|
556
|
+
minWidth: 2
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
y
|
|
560
|
+
))
|
|
561
|
+
}
|
|
562
|
+
),
|
|
563
|
+
/* @__PURE__ */ t(
|
|
564
|
+
"div",
|
|
565
|
+
{
|
|
566
|
+
style: {
|
|
567
|
+
display: "flex",
|
|
568
|
+
gap: 8,
|
|
569
|
+
flexWrap: "wrap",
|
|
570
|
+
marginTop: 4
|
|
571
|
+
},
|
|
572
|
+
children: C.map((m, y) => /* @__PURE__ */ u(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
style: {
|
|
576
|
+
display: "flex",
|
|
577
|
+
alignItems: "center",
|
|
578
|
+
gap: 3
|
|
579
|
+
},
|
|
580
|
+
children: [
|
|
581
|
+
/* @__PURE__ */ t(
|
|
582
|
+
"div",
|
|
583
|
+
{
|
|
584
|
+
style: {
|
|
585
|
+
width: 6,
|
|
586
|
+
height: 6,
|
|
587
|
+
borderRadius: "50%",
|
|
588
|
+
backgroundColor: m.color,
|
|
589
|
+
flexShrink: 0
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
),
|
|
593
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 10, color: "rgba(0,0,0,0.5)" }, children: m.label })
|
|
594
|
+
]
|
|
595
|
+
},
|
|
596
|
+
y
|
|
597
|
+
))
|
|
598
|
+
}
|
|
599
|
+
)
|
|
600
|
+
] }), le = [
|
|
601
|
+
"gloss-threshold-overlay",
|
|
602
|
+
f === "warn" ? "gloss-threshold-warn" : "",
|
|
603
|
+
f === "critical" ? "gloss-threshold-critical" : "",
|
|
604
|
+
f === "critical" ? "gloss-threshold-pulse" : ""
|
|
605
|
+
].filter(Boolean).join(" ");
|
|
606
|
+
return /* @__PURE__ */ u(ce, { children: [
|
|
607
|
+
f !== "none" && /* @__PURE__ */ t("div", { className: le }),
|
|
608
|
+
f === "warn" && /* @__PURE__ */ t("span", { className: "gloss-threshold-icon gloss-threshold-icon--warn", children: /* @__PURE__ */ t(ke, {}) }),
|
|
609
|
+
f === "critical" && /* @__PURE__ */ t("span", { className: "gloss-threshold-icon gloss-threshold-icon--critical", children: /* @__PURE__ */ t(we, {}) }),
|
|
610
|
+
e === "highlight" && I && /* @__PURE__ */ t(
|
|
611
|
+
"div",
|
|
612
|
+
{
|
|
613
|
+
style: {
|
|
614
|
+
position: "absolute",
|
|
615
|
+
inset: 0,
|
|
616
|
+
borderRadius: 10,
|
|
617
|
+
backgroundColor: Y(I, 0.06),
|
|
618
|
+
border: `1px solid ${Y(I, 0.15)}`,
|
|
619
|
+
zIndex: 0,
|
|
620
|
+
pointerEvents: "none"
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
e === "sparkline" && /* @__PURE__ */ t(L, { data: x, color: g, isStale: a }),
|
|
625
|
+
e === "bars" && /* @__PURE__ */ t(G, { data: v, color: g, isStale: a }),
|
|
626
|
+
/* @__PURE__ */ u(
|
|
627
|
+
z,
|
|
628
|
+
{
|
|
629
|
+
className: "gloss-metric-card__zone-a",
|
|
630
|
+
"data-tier": X,
|
|
631
|
+
style: { height: 28, flexShrink: 0, zIndex: 2, position: "relative", display: "flex", alignItems: "center" },
|
|
632
|
+
children: [
|
|
633
|
+
/* @__PURE__ */ t($, { className: "gloss-metric-card__label", children: c }),
|
|
634
|
+
d
|
|
635
|
+
]
|
|
636
|
+
}
|
|
637
|
+
),
|
|
638
|
+
/* @__PURE__ */ u(
|
|
639
|
+
z,
|
|
640
|
+
{
|
|
641
|
+
definition: { display: "flex", align: "center" },
|
|
642
|
+
className: `gloss-metric-card__zone-b ${T}`,
|
|
643
|
+
style: { flex: 1, zIndex: 2, position: "relative", minHeight: 0 },
|
|
644
|
+
children: [
|
|
645
|
+
e === "donut" && /* @__PURE__ */ t(U, { value: p, max: k, color: g, colSpan: h, isStale: a }),
|
|
646
|
+
e === "object-arrow" && /* @__PURE__ */ t(
|
|
647
|
+
Z,
|
|
648
|
+
{
|
|
649
|
+
value: J,
|
|
650
|
+
max: K,
|
|
651
|
+
trendValue: s?.value,
|
|
652
|
+
color: re,
|
|
653
|
+
colSpan: h,
|
|
654
|
+
isStale: a
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
e === "arrow" && oe(),
|
|
658
|
+
e !== "versus" && e !== "segmented" && /* @__PURE__ */ t("span", { style: W, title: S.full, children: S.display }),
|
|
659
|
+
e === "versus" && ie(),
|
|
660
|
+
e === "segmented" && /* @__PURE__ */ t("span", { style: W, title: S.full, children: S.display })
|
|
661
|
+
]
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
/* @__PURE__ */ u(
|
|
665
|
+
z,
|
|
666
|
+
{
|
|
667
|
+
definition: { display: "flex", justify: "between", align: "center" },
|
|
668
|
+
className: `gloss-metric-card__zone-c ${T}`,
|
|
669
|
+
style: { minHeight: 18, flexShrink: 0, zIndex: 2, position: "relative" },
|
|
670
|
+
children: [
|
|
671
|
+
/* @__PURE__ */ t("span", { style: ne, children: l }),
|
|
672
|
+
j && s?.value != null ? /* @__PURE__ */ t("span", { style: {
|
|
673
|
+
backgroundColor: "rgba(255,255,255,0.78)",
|
|
674
|
+
backdropFilter: "blur(4px)",
|
|
675
|
+
WebkitBackdropFilter: "blur(4px)",
|
|
676
|
+
borderRadius: 4,
|
|
677
|
+
display: "inline-flex",
|
|
678
|
+
flexShrink: 0
|
|
679
|
+
}, children: /* @__PURE__ */ t(D, { value: s?.value, direction: s?.direction }) }) : /* @__PURE__ */ t(D, { value: s?.value, direction: s?.direction })
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
),
|
|
683
|
+
e === "segmented" && se()
|
|
684
|
+
] });
|
|
685
|
+
};
|
|
686
|
+
Se.displayName = "MetricCard";
|
|
687
|
+
export {
|
|
688
|
+
G as B,
|
|
689
|
+
U as D,
|
|
690
|
+
Se as M,
|
|
691
|
+
Z as O,
|
|
692
|
+
q as S,
|
|
693
|
+
D as T,
|
|
694
|
+
L as a,
|
|
695
|
+
ye as e,
|
|
696
|
+
xe as u
|
|
697
|
+
};
|