@divami-artefacts/ai-design-system 1.0.53 → 1.0.55
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/ai-design-system.css +1 -1
- package/dist/canvas/canvasUtils.d.ts +6 -3
- package/dist/canvas/useCanvasInteraction.d.ts +5 -2
- package/dist/canvas/useContainerWidth.d.ts +1 -0
- package/dist/components/areaLineChart/AreaLineChart.d.ts +1 -1
- package/dist/components/areaLineChart/types.d.ts +1 -1
- package/dist/components/balanceScaleChart/BalanceScaleChart.d.ts +1 -1
- package/dist/components/balanceScaleChart/types.d.ts +5 -2
- package/dist/components/common/ChartEmptyState.d.ts +2 -2
- package/dist/components/common/ToggleButton.d.ts +2 -2
- package/dist/components/dotMatrixChart/DotMatrixChart.d.ts +1 -1
- package/dist/components/dotMatrixChart/types.d.ts +1 -1
- package/dist/components/horizontalBarChart/HorizontalBarChart.d.ts +1 -1
- package/dist/components/horizontalBarChart/types.d.ts +4 -1
- package/dist/components/hubAndSpokeRadialChart/HubAndSpokeRadialChart.d.ts +1 -1
- package/dist/components/hubAndSpokeRadialChart/types.d.ts +1 -1
- package/dist/components/multiMetricConstellationChart/MultiMetricConstellationChart.d.ts +1 -1
- package/dist/components/multiMetricConstellationChart/types.d.ts +1 -1
- package/dist/components/multiSegmentHorizontalBarChart/MultiSegmentHorizontalBarChart.d.ts +1 -1
- package/dist/components/multiSegmentHorizontalBarChart/types.d.ts +1 -1
- package/dist/components/progressRaceChart/ProgressRaceChart.d.ts +1 -1
- package/dist/components/progressRaceChart/types.d.ts +5 -2
- package/dist/components/proportionalBandChart/ProportionalBandChart.d.ts +1 -1
- package/dist/components/proportionalBandChart/types.d.ts +3 -2
- package/dist/components/radialFanTreeChart/RadialFanTreeChart.d.ts +1 -1
- package/dist/components/radialFanTreeChart/types.d.ts +10 -2
- package/dist/components/rankedCardLeaderboard/RankedCardLeaderboard.d.ts +1 -1
- package/dist/components/rankedCardLeaderboard/types.d.ts +3 -2
- package/dist/components/segmentedSplitBarChart/SegmentedSplitBarChart.d.ts +1 -1
- package/dist/components/segmentedSplitBarChart/types.d.ts +5 -2
- package/dist/components/semiCircularGaugeChart/SemiCircularGaugeChart.d.ts +1 -1
- package/dist/components/semiCircularGaugeChart/types.d.ts +11 -1
- package/dist/components/stackedHorizontalBarChart/StackedHorizontalBarChart.d.ts +1 -1
- package/dist/components/stackedHorizontalBarChart/types.d.ts +5 -2
- package/dist/components/trend/Trend.d.ts +1 -1
- package/dist/components/trend/types.d.ts +3 -1
- package/dist/components/visualizationGroup/VisualizationGroup.d.ts +2 -0
- package/dist/components/visualizationRenderer/VisualizationRenderer.d.ts +1 -1
- package/dist/components/weeklyFlow/WeeklyFlow.d.ts +1 -1
- package/dist/components/weeklyFlow/types.d.ts +3 -2
- package/dist/constants.d.ts +37 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1457 -1018
- package/dist/pages/interactiveDemo/InteractiveDemoPage.d.ts +1 -0
- package/dist/pages/interactiveDemo/styles.d.ts +2 -0
- package/dist/types/index.d.ts +60 -20
- package/package.json +21 -21
- package/dist/components/constants.d.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ var u = {
|
|
|
24
24
|
amber: "#EEBF3B",
|
|
25
25
|
teal: "#69DFE9",
|
|
26
26
|
tealDark: "#00818F",
|
|
27
|
+
barBg: "#7DB9DF",
|
|
27
28
|
t1: "#F7F9FA",
|
|
28
29
|
t2: "#B3B5B6",
|
|
29
30
|
t3: "#94979C",
|
|
@@ -59,31 +60,43 @@ var u = {
|
|
|
59
60
|
u.green,
|
|
60
61
|
u.red
|
|
61
62
|
], m = [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
d.teal,
|
|
64
|
+
d.mint,
|
|
65
|
+
d.sky,
|
|
66
|
+
d.blue,
|
|
67
|
+
d.royal,
|
|
68
|
+
d.purple,
|
|
69
|
+
d.violet,
|
|
70
|
+
d.magenta
|
|
71
|
+
], h = [
|
|
72
|
+
f.teal,
|
|
73
|
+
f.mint,
|
|
74
|
+
f.sky,
|
|
75
|
+
f.blue,
|
|
76
|
+
f.royal,
|
|
77
|
+
f.purple,
|
|
78
|
+
f.violet,
|
|
79
|
+
f.magenta
|
|
80
|
+
], g = {
|
|
68
81
|
font: "400 16px 'Satoshi Variable', 'DM Sans', sans-serif",
|
|
69
82
|
color: "#F7F7F7",
|
|
70
83
|
letterSpacing: "0px"
|
|
71
|
-
},
|
|
84
|
+
}, _ = {
|
|
72
85
|
font: "500 16px 'Satoshi Variable', 'DM Sans', sans-serif",
|
|
73
86
|
color: "#F7F7F7"
|
|
74
|
-
},
|
|
87
|
+
}, v = {
|
|
75
88
|
font: "400 18px 'Satoshi Variable', 'DM Sans', sans-serif",
|
|
76
89
|
color: "#B3B5B6",
|
|
77
90
|
letterSpacing: "0px"
|
|
78
91
|
};
|
|
79
|
-
function
|
|
92
|
+
function y(e, t = 1) {
|
|
80
93
|
let n = e.replace("#", "");
|
|
81
94
|
return `rgba(${parseInt(n.substring(0, 2), 16)},${parseInt(n.substring(2, 4), 16)},${parseInt(n.substring(4, 6), 16)},${t})`;
|
|
82
95
|
}
|
|
83
|
-
function
|
|
96
|
+
function b(e, t, n) {
|
|
84
97
|
return e + (t - e) * n;
|
|
85
98
|
}
|
|
86
|
-
function
|
|
99
|
+
function x(e, t, n) {
|
|
87
100
|
let r = (e) => {
|
|
88
101
|
let t = e.replace("#", "");
|
|
89
102
|
return [
|
|
@@ -93,34 +106,34 @@ function b(e, t, n) {
|
|
|
93
106
|
];
|
|
94
107
|
}, [i, a, o] = r(e), [s, c, l] = r(t), u = (e) => Math.max(0, Math.min(255, Math.round(e)));
|
|
95
108
|
return [
|
|
96
|
-
u(
|
|
97
|
-
u(
|
|
98
|
-
u(
|
|
109
|
+
u(b(i, s, n)),
|
|
110
|
+
u(b(a, c, n)),
|
|
111
|
+
u(b(o, l, n))
|
|
99
112
|
].map((e) => e.toString(16).padStart(2, "0")).join("").replace(/^/, "#");
|
|
100
113
|
}
|
|
101
|
-
function
|
|
114
|
+
function S(e, t, n, r = 2) {
|
|
102
115
|
e.width = t * r, e.height = n * r;
|
|
103
116
|
let i = e.getContext("2d");
|
|
104
117
|
return i.scale(r, r), i;
|
|
105
118
|
}
|
|
106
|
-
function
|
|
119
|
+
function C(e, t, n, r, i, a = .3) {
|
|
107
120
|
let o = e.createRadialGradient(t, n, 0, t, n, r);
|
|
108
|
-
o.addColorStop(0,
|
|
121
|
+
o.addColorStop(0, y(i, a)), o.addColorStop(1, y(i, 0)), e.fillStyle = o, e.beginPath(), e.arc(t, n, r, 0, Math.PI * 2), e.fill();
|
|
109
122
|
}
|
|
110
|
-
function
|
|
123
|
+
function w(e, t, n, r, i = 50, a = y(u.blue, .05)) {
|
|
111
124
|
for (let o = 0; o < i; o++) e.beginPath(), e.arc((Math.sin(r * .001 + o * 23) * .5 + .5) * t, (Math.cos(r * 8e-4 + o * 37) * .5 + .5) * n, .6, 0, Math.PI * 2), e.fillStyle = a, e.fill();
|
|
112
125
|
}
|
|
113
|
-
function
|
|
126
|
+
function T(e, t, n, r, i = .015) {
|
|
114
127
|
e.fillStyle = `rgba(0,0,0,${i})`;
|
|
115
128
|
let a = r * .5 % 6;
|
|
116
129
|
for (let r = a; r < n; r += 3) e.fillRect(0, r, t, 1);
|
|
117
130
|
}
|
|
118
|
-
function
|
|
131
|
+
function E(e, t, n, r, i = y(u.t1, .08)) {
|
|
119
132
|
e.strokeStyle = i, e.lineWidth = 1, e.setLineDash([3, 3]), e.beginPath(), e.moveTo(t, n), e.lineTo(t, r), e.stroke(), e.setLineDash([]);
|
|
120
133
|
}
|
|
121
134
|
//#endregion
|
|
122
135
|
//#region src/canvas/CanvasTooltip.tsx
|
|
123
|
-
function
|
|
136
|
+
function D({ visible: e, x: t, y: n, content: i, parentW: o, parentH: l }) {
|
|
124
137
|
let d = a(null);
|
|
125
138
|
if (r(() => {
|
|
126
139
|
let r = d.current;
|
|
@@ -193,7 +206,7 @@ function E({ visible: e, x: t, y: n, content: i, parentW: o, parentH: l }) {
|
|
|
193
206
|
}
|
|
194
207
|
//#endregion
|
|
195
208
|
//#region src/canvas/useCanvasInteraction.ts
|
|
196
|
-
function
|
|
209
|
+
function O(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
|
|
197
210
|
let l = a({
|
|
198
211
|
x: -1,
|
|
199
212
|
y: -1,
|
|
@@ -240,7 +253,17 @@ function D(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
|
|
|
240
253
|
}, o = () => {
|
|
241
254
|
if (u.current && s) {
|
|
242
255
|
let e = d.current.find((e) => e.id === u.current);
|
|
243
|
-
|
|
256
|
+
if (e) {
|
|
257
|
+
let n = t.getBoundingClientRect(), a = n.top + e.centerY * (n.height / i), o = n.left + e.centerX * (n.width / r), c = e.sourceY == null ? void 0 : n.top + e.sourceY * (n.height / i);
|
|
258
|
+
t.dispatchEvent(new CustomEvent("viz-item-click", {
|
|
259
|
+
bubbles: !0,
|
|
260
|
+
detail: {
|
|
261
|
+
centerClientY: a,
|
|
262
|
+
centerClientX: o,
|
|
263
|
+
sourceClientY: c
|
|
264
|
+
}
|
|
265
|
+
})), s(e.id, e.data);
|
|
266
|
+
}
|
|
244
267
|
}
|
|
245
268
|
};
|
|
246
269
|
return t.addEventListener("mousemove", n), t.addEventListener("mouseleave", a), t.addEventListener("click", o), () => {
|
|
@@ -263,30 +286,35 @@ function D(e, { width: r, height: i, onClick: s, enabled: c = !0 }) {
|
|
|
263
286
|
hitZonesRef: d
|
|
264
287
|
};
|
|
265
288
|
}
|
|
266
|
-
function
|
|
289
|
+
function k(e, t, n, r, i, a, o) {
|
|
267
290
|
e.push({
|
|
268
291
|
id: t,
|
|
269
292
|
data: a,
|
|
293
|
+
centerY: r,
|
|
294
|
+
centerX: o ?? n,
|
|
270
295
|
test: (e, t) => (e - n) ** 2 + (t - r) ** 2 <= i * i
|
|
271
296
|
});
|
|
272
297
|
}
|
|
273
|
-
function
|
|
298
|
+
function A(e, t, n, r, i, a, o, s, c, l) {
|
|
274
299
|
e.push({
|
|
275
300
|
id: t,
|
|
276
301
|
data: o,
|
|
302
|
+
centerY: s ?? r + a / 2,
|
|
303
|
+
centerX: c ?? n + i / 2,
|
|
304
|
+
sourceY: l,
|
|
277
305
|
test: (e, t) => e >= n && e <= n + i && t >= r && t <= r + a
|
|
278
306
|
});
|
|
279
307
|
}
|
|
280
308
|
//#endregion
|
|
281
309
|
//#region src/canvas/easing.ts
|
|
282
|
-
var
|
|
310
|
+
var j = (e) => 1 - (1 - e) ** 3, M = (e) => 1 - (1 - e) ** 4, N = (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e), P = (e) => {
|
|
283
311
|
let t = 1.70158;
|
|
284
312
|
return 1 + (t + 1) * (e - 1) ** 3 + t * (e - 1) ** 2;
|
|
285
|
-
},
|
|
313
|
+
}, F = (e, t = .04, n = .001) => Math.sin(e * t) * Math.exp(-Math.min(e * n, 4)), I = (e, t, n, r = j) => {
|
|
286
314
|
let i = Math.min(.06, .5 / n), a = t * i, o = 1 - (n - 1) * i;
|
|
287
315
|
return r(Math.max(0, Math.min((e - a) / o, 1)));
|
|
288
316
|
};
|
|
289
|
-
function
|
|
317
|
+
function L(e, t, n = .12) {
|
|
290
318
|
e.forEach((r, i) => {
|
|
291
319
|
let a = i === t ? 1 : 0, o = r + (a - r) * n;
|
|
292
320
|
Math.abs(o - a) < .005 ? a === 0 ? e.delete(i) : e.set(i, 1) : e.set(i, o);
|
|
@@ -294,66 +322,66 @@ function I(e, t, n = .12) {
|
|
|
294
322
|
}
|
|
295
323
|
//#endregion
|
|
296
324
|
//#region src/components/common/SeriesChart.tsx
|
|
297
|
-
var
|
|
298
|
-
function
|
|
299
|
-
let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), { mouseRef: p, hoveredRef: m, tooltip: h, hitZonesRef: g } =
|
|
300
|
-
width:
|
|
301
|
-
height:
|
|
325
|
+
var R = 760, z = 250;
|
|
326
|
+
function B({ rows: e = [], variant: t, className: r, colors: i }) {
|
|
327
|
+
let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), { mouseRef: p, hoveredRef: m, tooltip: h, hitZonesRef: g } = O(o, {
|
|
328
|
+
width: R,
|
|
329
|
+
height: z
|
|
302
330
|
});
|
|
303
331
|
return n(() => {
|
|
304
332
|
let n = o.current;
|
|
305
333
|
if (!n) return;
|
|
306
|
-
let r =
|
|
334
|
+
let r = S(n, R, z);
|
|
307
335
|
f.current = 0;
|
|
308
336
|
let a = i?.line ?? u.blue, s = i?.point ?? u.blue, c = i?.axisLine ?? u.bd, l = i?.areaFill ?? u.blue, h = {
|
|
309
337
|
top: 24,
|
|
310
338
|
right: 24,
|
|
311
339
|
bottom: 44,
|
|
312
340
|
left: 24
|
|
313
|
-
}, _ =
|
|
341
|
+
}, _ = R - h.left - h.right, v = z - h.top - h.bottom, b, x = () => {
|
|
314
342
|
f.current++;
|
|
315
343
|
let n = f.current;
|
|
316
|
-
if (r.clearRect(0, 0,
|
|
317
|
-
b = requestAnimationFrame(
|
|
344
|
+
if (r.clearRect(0, 0, R, z), e.length < 2) {
|
|
345
|
+
b = requestAnimationFrame(x);
|
|
318
346
|
return;
|
|
319
347
|
}
|
|
320
|
-
let i = e.map((e) => e.pricing ?? 0), o = Math.max(100, ...i),
|
|
321
|
-
|
|
348
|
+
let i = e.map((e) => e.pricing ?? 0), o = Math.max(100, ...i), S = (t) => h.left + t / (e.length - 1) * _, w = (e) => h.top + (1 - e / o) * v, T = N(Math.min(n / 48, 1)), D = Math.max(2, Math.floor(T * e.length));
|
|
349
|
+
L(d.current, m.current), g.current = [], r.strokeStyle = y(u.bd, .2), r.lineWidth = .5;
|
|
322
350
|
for (let e = 0; e <= 4; e++) {
|
|
323
|
-
let t = h.top + e / 4 *
|
|
351
|
+
let t = h.top + e / 4 * v;
|
|
324
352
|
r.beginPath(), r.moveTo(h.left, t), r.lineTo(h.left + _, t), r.stroke();
|
|
325
353
|
}
|
|
326
|
-
if (r.strokeStyle =
|
|
354
|
+
if (r.strokeStyle = y(c, .4), r.lineWidth = 1, r.setLineDash([]), r.beginPath(), r.moveTo(h.left, w(0)), r.lineTo(h.left + _, w(0)), r.stroke(), p.current.over && m.current) {
|
|
327
355
|
let e = parseInt(m.current.split("-")[1]);
|
|
328
|
-
isNaN(e) ||
|
|
356
|
+
isNaN(e) || E(r, S(e), h.top, h.top + v);
|
|
329
357
|
}
|
|
330
358
|
if (t === "area" && D > 1) {
|
|
331
|
-
let t = r.createLinearGradient(0, h.top, 0, h.top +
|
|
332
|
-
t.addColorStop(0,
|
|
333
|
-
for (let t = 0; t < D; t++) r.lineTo(
|
|
334
|
-
r.lineTo(
|
|
359
|
+
let t = r.createLinearGradient(0, h.top, 0, h.top + v);
|
|
360
|
+
t.addColorStop(0, y(l, .12)), t.addColorStop(1, y(l, 0)), r.fillStyle = t, r.beginPath(), r.moveTo(S(0), h.top + v);
|
|
361
|
+
for (let t = 0; t < D; t++) r.lineTo(S(t), w(e[t].pricing ?? 0));
|
|
362
|
+
r.lineTo(S(D - 1), h.top + v), r.closePath(), r.fill();
|
|
335
363
|
}
|
|
336
364
|
if (D > 1) {
|
|
337
|
-
r.strokeStyle =
|
|
365
|
+
r.strokeStyle = y(a, .85), r.lineWidth = 2, r.setLineDash([]), r.beginPath();
|
|
338
366
|
for (let t = 0; t < D; t++) {
|
|
339
|
-
let n =
|
|
367
|
+
let n = S(t), i = w(e[t].pricing ?? 0);
|
|
340
368
|
t === 0 ? r.moveTo(n, i) : r.lineTo(n, i);
|
|
341
369
|
}
|
|
342
370
|
r.stroke();
|
|
343
371
|
}
|
|
344
372
|
for (let i = 0; i < D; i++) {
|
|
345
|
-
let a =
|
|
346
|
-
|
|
373
|
+
let a = S(i), o = w(e[i].pricing ?? 0), c = `sc-${i}`, l = d.current.get(c) ?? 0, f = i === e.length - 1;
|
|
374
|
+
k(g.current, c, a, o, 12, {
|
|
347
375
|
label: e[i].vendor,
|
|
348
376
|
value: String(e[i].pricing ?? 0),
|
|
349
377
|
color: f ? u.red : s
|
|
350
|
-
}), l > 0 &&
|
|
351
|
-
let p = f ?
|
|
352
|
-
f ? (r.shadowColor =
|
|
378
|
+
}), l > 0 && C(r, a, o, 16 * l, s, .2 * l);
|
|
379
|
+
let p = f ? F(n, .05, 5e-4) : 0, m = t === "area" ? 5 : 6;
|
|
380
|
+
f ? (r.shadowColor = y(u.red, .5), r.shadowBlur = (8 + p * 4) * (1 + l * .5), r.fillStyle = u.red, r.beginPath(), r.arc(a, o, (m + p * 1.5) * (1 + l * .3), 0, Math.PI * 2), r.fill(), r.shadowBlur = 0) : (r.fillStyle = y(s, .7 + l * .3), r.beginPath(), r.arc(a, o, m + l * 2, 0, Math.PI * 2), r.fill()), r.font = "10px 'JetBrains Mono', monospace", r.fillStyle = y(u.t3, .6 + l * .3), r.textAlign = "center", r.fillText(e[i].vendor, a, z - 14);
|
|
353
381
|
}
|
|
354
|
-
b = requestAnimationFrame(
|
|
382
|
+
b = requestAnimationFrame(x);
|
|
355
383
|
};
|
|
356
|
-
return
|
|
384
|
+
return x(), () => cancelAnimationFrame(b);
|
|
357
385
|
}, [
|
|
358
386
|
e,
|
|
359
387
|
t,
|
|
@@ -363,31 +391,31 @@ function te({ rows: e = [], variant: t, className: r, colors: i }) {
|
|
|
363
391
|
children: /* @__PURE__ */ c("div", {
|
|
364
392
|
style: {
|
|
365
393
|
position: "relative",
|
|
366
|
-
width:
|
|
367
|
-
height:
|
|
394
|
+
width: R,
|
|
395
|
+
height: z
|
|
368
396
|
},
|
|
369
397
|
children: [/* @__PURE__ */ s("canvas", {
|
|
370
398
|
ref: o,
|
|
371
399
|
role: "img",
|
|
372
400
|
"aria-label": `${t} chart`,
|
|
373
401
|
style: {
|
|
374
|
-
width:
|
|
375
|
-
height:
|
|
402
|
+
width: R,
|
|
403
|
+
height: z,
|
|
376
404
|
display: "block",
|
|
377
405
|
borderRadius: 8
|
|
378
406
|
}
|
|
379
|
-
}), /* @__PURE__ */ s(
|
|
407
|
+
}), /* @__PURE__ */ s(D, {
|
|
380
408
|
...h,
|
|
381
|
-
parentW:
|
|
382
|
-
parentH:
|
|
409
|
+
parentW: R,
|
|
410
|
+
parentH: z
|
|
383
411
|
})]
|
|
384
412
|
})
|
|
385
413
|
});
|
|
386
414
|
}
|
|
387
415
|
//#endregion
|
|
388
416
|
//#region src/components/areaChart/AreaChart.tsx
|
|
389
|
-
function
|
|
390
|
-
return /* @__PURE__ */ s(
|
|
417
|
+
function V({ rows: e = [], className: t, colors: n }) {
|
|
418
|
+
return /* @__PURE__ */ s(B, {
|
|
391
419
|
rows: e,
|
|
392
420
|
variant: "area",
|
|
393
421
|
className: t,
|
|
@@ -396,76 +424,90 @@ function ne({ rows: e = [], className: t, colors: n }) {
|
|
|
396
424
|
}
|
|
397
425
|
//#endregion
|
|
398
426
|
//#region src/components/barChart/BarChart.tsx
|
|
399
|
-
var
|
|
400
|
-
function
|
|
401
|
-
let i = a(null), o = a(/* @__PURE__ */ new Map()), d = a(0), { hoveredRef: f, tooltip: m, hitZonesRef: h } =
|
|
402
|
-
width:
|
|
403
|
-
height:
|
|
427
|
+
var H = 760, U = 280;
|
|
428
|
+
function W({ rows: e = [], className: t, colors: r }) {
|
|
429
|
+
let i = a(null), o = a(/* @__PURE__ */ new Map()), d = a(0), { hoveredRef: f, tooltip: m, hitZonesRef: h } = O(i, {
|
|
430
|
+
width: H,
|
|
431
|
+
height: U
|
|
404
432
|
});
|
|
405
433
|
return n(() => {
|
|
406
434
|
let t = i.current;
|
|
407
435
|
if (!t) return;
|
|
408
|
-
let n =
|
|
436
|
+
let n = S(t, H, U);
|
|
409
437
|
d.current = 0;
|
|
410
438
|
let a = r?.bars ?? p, s = r?.axisLine ?? u.bd, c = r?.valueLabel ?? u.t2, l = {
|
|
411
439
|
top: 24,
|
|
412
440
|
right: 24,
|
|
413
441
|
bottom: 56,
|
|
414
442
|
left: 24
|
|
415
|
-
}, m =
|
|
443
|
+
}, m = U - l.top - l.bottom, g = (H - l.left - l.right) / Math.max(e.length, 1), _ = Math.max(100, ...e.map((e) => e.pricing ?? 0)), v = l.top + m, b, x = () => {
|
|
416
444
|
d.current++;
|
|
417
445
|
let t = d.current;
|
|
418
|
-
n.clearRect(0, 0,
|
|
419
|
-
let r =
|
|
420
|
-
|
|
421
|
-
let s = l.left + i * g, d =
|
|
422
|
-
|
|
446
|
+
n.clearRect(0, 0, H, U);
|
|
447
|
+
let r = M(Math.min(t / 48, 1));
|
|
448
|
+
L(o.current, f.current), h.current = [], n.strokeStyle = y(s, .4), n.lineWidth = 1, n.setLineDash([]), n.beginPath(), n.moveTo(l.left, v), n.lineTo(H - l.right, v), n.stroke(), e.forEach((t, i) => {
|
|
449
|
+
let s = l.left + i * g, d = I(r, i, e.length, M), f = _ > 0 ? (t.pricing ?? 0) / _ * m : 0, p = Math.max(f > 0 ? 4 : 0, f * d), b = a[i % a.length], x = o.current.get(t.id ?? `bar-${i}`) ?? 0;
|
|
450
|
+
A(h.current, t.id ?? `bar-${i}`, s + 4, v - p, g - 8, p, {
|
|
423
451
|
label: t.vendor,
|
|
424
452
|
value: String(t.pricing ?? 0),
|
|
425
453
|
color: b
|
|
426
|
-
}), p > 0 && (x > 0 &&
|
|
454
|
+
}), p > 0 && (x > 0 && C(n, s + g / 2, v - p / 2, g * .8, b, .12 * x), n.shadowColor = y(b, .2 * (x > 0 ? x : 0)), n.shadowBlur = x > 0 ? 6 : 0, n.fillStyle = y(b, .5 + x * .25), n.beginPath(), n.roundRect(s + 4, v - p, g - 8, p, [
|
|
427
455
|
4,
|
|
428
456
|
4,
|
|
429
457
|
0,
|
|
430
458
|
0
|
|
431
|
-
]), n.fill(), n.shadowBlur = 0, x > 0 && (n.strokeStyle =
|
|
459
|
+
]), n.fill(), n.shadowBlur = 0, x > 0 && (n.strokeStyle = y(b, .4 * x), n.lineWidth = 1, n.beginPath(), n.roundRect(s + 4, v - p, g - 8, p, [
|
|
432
460
|
4,
|
|
433
461
|
4,
|
|
434
462
|
0,
|
|
435
463
|
0
|
|
436
|
-
]), n.stroke())), d > .5 && p > 0 && (n.globalAlpha = Math.min(1, (d - .5) * 2), n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = x > 0 ? b :
|
|
437
|
-
}), b = requestAnimationFrame(
|
|
464
|
+
]), n.stroke())), d > .5 && p > 0 && (n.globalAlpha = Math.min(1, (d - .5) * 2), n.font = "bold 10px 'JetBrains Mono', monospace", n.fillStyle = x > 0 ? b : y(c, .7), n.textAlign = "center", n.fillText(String(t.pricing ?? ""), s + g / 2, v - p - 6), n.globalAlpha = 1), n.font = `${x > 0 ? "bold " : ""}9px 'JetBrains Mono', monospace`, n.fillStyle = x > 0 ? b : y(u.t3, .6), n.textAlign = "center", n.fillText(t.vendor, s + g / 2, U - 14);
|
|
465
|
+
}), b = requestAnimationFrame(x);
|
|
438
466
|
};
|
|
439
|
-
return
|
|
467
|
+
return x(), () => cancelAnimationFrame(b);
|
|
440
468
|
}, [e, r]), /* @__PURE__ */ s(l, {
|
|
441
469
|
className: t,
|
|
442
470
|
children: /* @__PURE__ */ c("div", {
|
|
443
471
|
style: {
|
|
444
472
|
position: "relative",
|
|
445
|
-
width:
|
|
446
|
-
height:
|
|
473
|
+
width: H,
|
|
474
|
+
height: U
|
|
447
475
|
},
|
|
448
476
|
children: [/* @__PURE__ */ s("canvas", {
|
|
449
477
|
ref: i,
|
|
450
478
|
role: "img",
|
|
451
479
|
"aria-label": "bar chart",
|
|
452
480
|
style: {
|
|
453
|
-
width:
|
|
454
|
-
height:
|
|
481
|
+
width: H,
|
|
482
|
+
height: U,
|
|
455
483
|
display: "block",
|
|
456
484
|
borderRadius: 8
|
|
457
485
|
}
|
|
458
|
-
}), /* @__PURE__ */ s(
|
|
486
|
+
}), /* @__PURE__ */ s(D, {
|
|
459
487
|
...m,
|
|
460
|
-
parentW:
|
|
461
|
-
parentH:
|
|
488
|
+
parentW: H,
|
|
489
|
+
parentH: U
|
|
462
490
|
})]
|
|
463
491
|
})
|
|
464
492
|
});
|
|
465
493
|
}
|
|
466
494
|
//#endregion
|
|
495
|
+
//#region src/canvas/useContainerWidth.ts
|
|
496
|
+
function ee(e) {
|
|
497
|
+
let t = a(null), [r, i] = o(e);
|
|
498
|
+
return n(() => {
|
|
499
|
+
let e = t.current;
|
|
500
|
+
if (!e) return;
|
|
501
|
+
let n = new ResizeObserver((e) => {
|
|
502
|
+
let t = e[0]?.contentRect.width;
|
|
503
|
+
t && t > 0 && i(Math.floor(t));
|
|
504
|
+
});
|
|
505
|
+
return n.observe(e), () => n.disconnect();
|
|
506
|
+
}, []), [t, r];
|
|
507
|
+
}
|
|
508
|
+
//#endregion
|
|
467
509
|
//#region src/components/common/ChartEmptyState.tsx
|
|
468
|
-
function
|
|
510
|
+
function G({ width: e, height: t, message: n = "No data available", testID: r }) {
|
|
469
511
|
return /* @__PURE__ */ s("div", {
|
|
470
512
|
"data-testid": r,
|
|
471
513
|
style: {
|
|
@@ -485,7 +527,7 @@ function R({ width: e, height: t, message: n = "No data available", "data-testid
|
|
|
485
527
|
}
|
|
486
528
|
//#endregion
|
|
487
529
|
//#region src/components/common/ToggleButton.tsx
|
|
488
|
-
function
|
|
530
|
+
function te({ expanded: e, onToggle: t, labelExpanded: n = "View Less", labelCollapsed: r = "View More", testID: i }) {
|
|
489
531
|
return /* @__PURE__ */ c("button", {
|
|
490
532
|
type: "button",
|
|
491
533
|
"data-testid": i,
|
|
@@ -528,7 +570,7 @@ function oe({ expanded: e, onToggle: t, labelExpanded: n = "View Less", labelCol
|
|
|
528
570
|
}
|
|
529
571
|
//#endregion
|
|
530
572
|
//#region src/utils/numberFormat.ts
|
|
531
|
-
var
|
|
573
|
+
var ne = [
|
|
532
574
|
{
|
|
533
575
|
value: 0xe8d4a51000,
|
|
534
576
|
suffix: "T",
|
|
@@ -550,103 +592,113 @@ var se = [
|
|
|
550
592
|
divisor: 1e3
|
|
551
593
|
}
|
|
552
594
|
];
|
|
553
|
-
function
|
|
595
|
+
function K(e, t = 1) {
|
|
554
596
|
let n = Math.abs(e), r = e < 0 ? "-" : "";
|
|
555
|
-
for (let e of
|
|
597
|
+
for (let e of ne) if (n >= e.value) return `${r}${(n / e.divisor).toFixed(t)}${e.suffix}`;
|
|
556
598
|
return `${r}${n.toFixed(0)}`;
|
|
557
599
|
}
|
|
558
600
|
//#endregion
|
|
559
601
|
//#region src/components/progressRaceChart/ProgressRaceChart.tsx
|
|
560
|
-
var
|
|
561
|
-
function
|
|
602
|
+
var re = 660, ie = 4, ae = 30, oe = ae / 2, se = ae / 2, ce = 8;
|
|
603
|
+
function le(e, t, n) {
|
|
562
604
|
if (e.measureText(t).width <= n) return t;
|
|
563
605
|
let r = t;
|
|
564
606
|
for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
|
|
565
607
|
return r + "…";
|
|
566
608
|
}
|
|
567
|
-
function
|
|
568
|
-
let
|
|
569
|
-
|
|
570
|
-
|
|
609
|
+
function ue({ items: e = [], itemsByEntity: r, onItemClick: l, selectedId: d, colorOffset: f = 0, testID: p }) {
|
|
610
|
+
let [h, v] = ee(re), b = a(null), x = a(0), E = a(/* @__PURE__ */ new Map()), M = a(d);
|
|
611
|
+
M.current = d;
|
|
612
|
+
let N = a([]), P = t((e, t) => {
|
|
613
|
+
let n = typeof t == "object" ? t.label ?? e : e, r = N.current.find((t) => t.id === e);
|
|
614
|
+
l?.(e, n, r?.subentity);
|
|
615
|
+
}, [l]), [F, I] = o(!1), L = !!(d && r?.[d]), R = L ? r[d] : e, z = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), B = i(() => R.filter((e) => typeof e == "object" && !!e), [R]), V = i(() => [...B].sort((e, t) => (t.percentage ?? 0) - (e.percentage ?? 0)), [B]), H = i(() => F ? V : V.slice(0, ce), [V, F]);
|
|
616
|
+
N.current = H;
|
|
617
|
+
let U = H.length, W = oe + se + U * ie + Math.max(0, U - 1) * ae, { hoveredRef: ne, tooltip: ue, hitZonesRef: de } = O(b, {
|
|
618
|
+
width: v,
|
|
619
|
+
height: W,
|
|
620
|
+
onClick: l ? P : void 0
|
|
571
621
|
});
|
|
572
622
|
return n(() => {
|
|
573
|
-
let e =
|
|
623
|
+
let e = b.current;
|
|
574
624
|
if (!e) return;
|
|
575
|
-
let
|
|
576
|
-
|
|
577
|
-
let
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
let d = (a.
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
625
|
+
let t = S(e, v, W);
|
|
626
|
+
x.current = 0, t.font = g.font, t.letterSpacing = g.letterSpacing;
|
|
627
|
+
let n = H.reduce((e, n) => Math.max(e, t.measureText(n.name ?? n.abbreviation ?? "").width), 0);
|
|
628
|
+
t.font = _.font;
|
|
629
|
+
let r = H.reduce((e, n) => Math.max(e, t.measureText(K(n.total ?? 0)).width), 0), i = Math.max(Math.min(n + 20, v * .3), 40), a = Math.max(r + 20, 28), o = v - i - a, [s, c] = m[f % m.length], l, d = () => {
|
|
630
|
+
x.current++;
|
|
631
|
+
let e = x.current;
|
|
632
|
+
t.clearRect(0, 0, v, W), t.letterSpacing = g.letterSpacing, de.current = [], E.current.forEach((e, t) => {
|
|
633
|
+
let n = t === ne.current ? 1 : 0, r = e + (n - e) * .12;
|
|
634
|
+
Math.abs(r - n) < .005 ? n === 0 ? E.current.delete(t) : E.current.set(t, 1) : E.current.set(t, r);
|
|
635
|
+
}), ne.current && !E.current.has(ne.current) && E.current.set(ne.current, 0), w(t, v, W, e, 40, y(c, .04));
|
|
636
|
+
let n = Math.max(...H.map((e) => e.total ?? 0), 1);
|
|
637
|
+
H.forEach((a, l) => {
|
|
638
|
+
let d = E.current.get(a.id) ?? 0, f = !L && M.current && a.id !== M.current ? .6 : 1, p = oe + l * (ie + ae);
|
|
639
|
+
t.fillStyle = y(u.barBg, .2), t.beginPath(), t.rect(i, p, o, ie), t.fill();
|
|
640
|
+
let m = (a.total ?? 0) / n, h = i + o * Math.min(m, m * j(Math.min(1, e * .005)));
|
|
641
|
+
if (h > i + 2) {
|
|
642
|
+
let e = t.createLinearGradient(i, 0, h, 0);
|
|
643
|
+
e.addColorStop(0, y(s, .75 * f)), e.addColorStop(1, y(c, .95 * f)), t.fillStyle = e, t.beginPath(), t.rect(i, p, h - i, ie), t.fill();
|
|
592
644
|
}
|
|
593
|
-
|
|
594
|
-
let
|
|
645
|
+
d > 0 && C(t, h, p + ie / 2, 12 * d, c, .35 * d);
|
|
646
|
+
let v = {
|
|
595
647
|
label: a.name,
|
|
596
|
-
sublabel: a.totalLabel ?? (a.total == null ? void 0 :
|
|
597
|
-
color:
|
|
648
|
+
sublabel: a.totalLabel ?? (a.total == null ? void 0 : K(a.total)),
|
|
649
|
+
color: c
|
|
598
650
|
};
|
|
599
|
-
|
|
600
|
-
}),
|
|
651
|
+
A(de.current, a.id, 0, p - ae / 2, i + o, ie + ae, v, void 0, i + o + 12 + r + 14), k(de.current, a.id, h, p + ie / 2, 10, v), t.font = _.font, t.fillStyle = d > 0 ? y(c, 1 * f) : y(u.t1, .85 * f), t.textAlign = "left", t.textBaseline = "middle", t.fillText(K(a.total ?? 0), i + o + 12, p + ie / 2), t.font = g.font, t.fillStyle = d > 0 ? y(c, 1 * f) : y(u.t2, .85 * f), t.textAlign = "right", t.fillText(le(t, a.name ?? a.abbreviation ?? "", i - 16), i - 8, p + ie / 2);
|
|
652
|
+
}), T(t, v, W, e, .015), l = requestAnimationFrame(d);
|
|
601
653
|
};
|
|
602
|
-
return
|
|
654
|
+
return d(), () => cancelAnimationFrame(l);
|
|
603
655
|
}, [
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
"
|
|
656
|
+
H,
|
|
657
|
+
W,
|
|
658
|
+
f,
|
|
659
|
+
v
|
|
660
|
+
]), V.length === 0 ? /* @__PURE__ */ s("div", {
|
|
661
|
+
ref: h,
|
|
662
|
+
style: { width: "100%" },
|
|
663
|
+
children: /* @__PURE__ */ s(G, {
|
|
664
|
+
width: v,
|
|
665
|
+
height: 160,
|
|
666
|
+
testID: p
|
|
667
|
+
})
|
|
611
668
|
}) : /* @__PURE__ */ c("div", {
|
|
612
|
-
|
|
613
|
-
|
|
669
|
+
ref: h,
|
|
670
|
+
"data-testid": p,
|
|
671
|
+
style: { width: "100%" },
|
|
614
672
|
children: [/* @__PURE__ */ c("div", {
|
|
615
673
|
style: { position: "relative" },
|
|
616
674
|
children: [/* @__PURE__ */ s("canvas", {
|
|
617
|
-
ref:
|
|
675
|
+
ref: b,
|
|
618
676
|
role: "img",
|
|
619
677
|
"aria-label": "Commitment race — contractors ranked by commitment percentage",
|
|
620
678
|
style: {
|
|
621
|
-
width:
|
|
622
|
-
height:
|
|
679
|
+
width: "100%",
|
|
680
|
+
height: W,
|
|
623
681
|
display: "block",
|
|
624
682
|
borderRadius: 8
|
|
625
683
|
}
|
|
626
|
-
}), /* @__PURE__ */ s(
|
|
627
|
-
...
|
|
628
|
-
parentW:
|
|
629
|
-
parentH:
|
|
684
|
+
}), /* @__PURE__ */ s(D, {
|
|
685
|
+
...ue,
|
|
686
|
+
parentW: v,
|
|
687
|
+
parentH: W
|
|
630
688
|
})]
|
|
631
|
-
}),
|
|
689
|
+
}), z.length > ce && /* @__PURE__ */ s("div", {
|
|
632
690
|
style: { marginTop: 8 },
|
|
633
|
-
children: /* @__PURE__ */ s(
|
|
634
|
-
expanded:
|
|
635
|
-
onToggle: () =>
|
|
691
|
+
children: /* @__PURE__ */ s(te, {
|
|
692
|
+
expanded: F,
|
|
693
|
+
onToggle: () => I((e) => !e)
|
|
636
694
|
})
|
|
637
695
|
})]
|
|
638
696
|
});
|
|
639
697
|
}
|
|
640
698
|
//#endregion
|
|
641
699
|
//#region src/components/semiCircularGaugeChart/SemiCircularGaugeChart.tsx
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
"#5C42B8",
|
|
645
|
-
"#C87B0A",
|
|
646
|
-
"#2563EB",
|
|
647
|
-
"#166534"
|
|
648
|
-
];
|
|
649
|
-
function ye(e, t, n) {
|
|
700
|
+
var de = 480, fe = 310, pe = 18;
|
|
701
|
+
function me(e, t, n) {
|
|
650
702
|
let r = t.split(" "), i = [], a = "";
|
|
651
703
|
for (let t of r) {
|
|
652
704
|
let r = a ? `${a} ${t}` : t;
|
|
@@ -654,64 +706,89 @@ function ye(e, t, n) {
|
|
|
654
706
|
}
|
|
655
707
|
return a && i.push(a), i;
|
|
656
708
|
}
|
|
657
|
-
function
|
|
658
|
-
let
|
|
709
|
+
function he({ confirmed: e, total: r, label: i, colorOffset: o = 0, selectedId: l, selectedLabel: d, gaugeByEntity: f, onItemClick: p, subentity: h, testID: _ }) {
|
|
710
|
+
let b = a(null), x = a(0), w = l && f?.[l] ? f[l] : {
|
|
711
|
+
confirmed: e,
|
|
712
|
+
total: r
|
|
713
|
+
}, T = w.confirmed, E = w.total, k = t(() => {
|
|
714
|
+
p?.("confirmed", i ?? "confirmed", h);
|
|
715
|
+
}, [
|
|
716
|
+
p,
|
|
717
|
+
i,
|
|
718
|
+
h
|
|
719
|
+
]), { tooltip: M, hitZonesRef: N } = O(b, {
|
|
720
|
+
width: de,
|
|
721
|
+
height: fe,
|
|
722
|
+
onClick: p ? k : void 0
|
|
723
|
+
});
|
|
659
724
|
return n(() => {
|
|
660
|
-
let
|
|
661
|
-
if (!
|
|
662
|
-
let
|
|
663
|
-
|
|
664
|
-
let
|
|
665
|
-
|
|
666
|
-
let
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
725
|
+
let e = b.current;
|
|
726
|
+
if (!e) return;
|
|
727
|
+
let t = S(e, de, fe);
|
|
728
|
+
x.current = 0;
|
|
729
|
+
let [n, r] = m[o % m.length], a = de / 2, s = Math.PI, c = 2 * Math.PI, l = Math.PI, d, f = () => {
|
|
730
|
+
x.current++;
|
|
731
|
+
let e = x.current;
|
|
732
|
+
t.clearRect(0, 0, de, fe), t.letterSpacing = g.letterSpacing, N.current = [], A(N.current, "confirmed", a - 148, 27, 296, 148, {
|
|
733
|
+
label: i ?? "Confirmed",
|
|
734
|
+
value: `${K(T ?? 0)} / ${K(E ?? 0)}`,
|
|
735
|
+
sublabel: `${Math.round((T ?? 0) / (E || 1) * 100)}%`,
|
|
736
|
+
color: r
|
|
737
|
+
});
|
|
738
|
+
let o = j(Math.min(e / 80, 1)), p = P(Math.min(e / 72, 1)), m = Math.round((T ?? 0) / (E || 1) * 100), h = s + m / 100 * l * o;
|
|
739
|
+
t.beginPath(), t.arc(a, 175, 148, s, c), t.strokeStyle = y(r, .28), t.lineWidth = 4, t.lineCap = "round", t.stroke(), t.lineCap = "butt", t.beginPath(), t.moveTo(a, 175), t.arc(a, 175, 133, s, h), t.closePath(), t.fillStyle = y(n, .35 * o), t.fill();
|
|
740
|
+
let _ = a + Math.cos(h) * 148, b = 175 + Math.sin(h) * 148;
|
|
741
|
+
C(t, _, b, 10, r, .3 * o);
|
|
742
|
+
let S = t.createLinearGradient(a + Math.cos(s) * 148, 175 + Math.sin(s) * 148, _, b);
|
|
743
|
+
S.addColorStop(0, y(n, .9 * o)), S.addColorStop(1, y(r, 1 * o)), t.beginPath(), t.arc(a, 175, 148, s, h), t.strokeStyle = S, t.lineWidth = 4, t.lineCap = "round", t.stroke(), t.lineCap = "butt";
|
|
744
|
+
let w = s + m / 100 * l * p, D = a + Math.cos(w) * 133, O = 175 + Math.sin(w) * 133, k = a - Math.cos(w) * 24, M = 175 - Math.sin(w) * 24, F = -Math.sin(w), I = Math.cos(w), L = 2.5 * p;
|
|
745
|
+
t.beginPath(), t.moveTo(D, O), t.lineTo(a + F * L, 175 + I * L), t.lineTo(k + F * 1, M + I * 1), t.lineTo(k - F * 1, M - I * 1), t.lineTo(a - F * L, 175 - I * L), t.closePath(), t.fillStyle = y(u.t1, p), t.fill(), t.beginPath(), t.arc(a, 175, 11, 0, Math.PI * 2), t.strokeStyle = y(r, .85 * p), t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a, 175, 9, 0, Math.PI * 2), t.fillStyle = u.t1, t.fill(), [
|
|
676
746
|
[0, "0%"],
|
|
677
747
|
[.5, "50%"],
|
|
678
748
|
[1, "100%"]
|
|
679
|
-
].forEach(([e,
|
|
680
|
-
let
|
|
681
|
-
|
|
682
|
-
}),
|
|
683
|
-
|
|
684
|
-
}),
|
|
749
|
+
].forEach(([e, n]) => {
|
|
750
|
+
let r = s + e * l, i = e === 1 ? 184 : 168, o = a + Math.cos(r) * i, c = 175 + Math.sin(r) * i;
|
|
751
|
+
t.font = g.font, t.fillStyle = g.color, t.textAlign = "center", t.fillText(n, o, c + 4);
|
|
752
|
+
}), o > .4 && (t.globalAlpha = Math.min(1, (o - .4) / .4), t.font = "700 32px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = u.t1, t.textAlign = "center", t.fillText(`${Math.round(m * p)}%`, a, 247), t.globalAlpha = 1), o > .7 && i && (t.globalAlpha = Math.min(1, (o - .7) / .3), t.font = v.font, t.fillStyle = v.color, t.textAlign = "center", me(t, `${K(T ?? 0)} of ${K(E ?? 0)} ${i}`, de - 40).forEach((e, n) => {
|
|
753
|
+
t.fillText(e, a, 287 + n * pe);
|
|
754
|
+
}), t.globalAlpha = 1), d = requestAnimationFrame(f);
|
|
685
755
|
};
|
|
686
|
-
return
|
|
756
|
+
return f(), () => cancelAnimationFrame(d);
|
|
687
757
|
}, [
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
758
|
+
T,
|
|
759
|
+
E,
|
|
760
|
+
i,
|
|
761
|
+
o,
|
|
762
|
+
l,
|
|
763
|
+
d
|
|
764
|
+
]), /* @__PURE__ */ c("div", {
|
|
765
|
+
"data-testid": _,
|
|
694
766
|
style: {
|
|
695
767
|
position: "relative",
|
|
696
|
-
width:
|
|
697
|
-
|
|
768
|
+
width: "100%",
|
|
769
|
+
maxWidth: de,
|
|
770
|
+
margin: "0 auto"
|
|
698
771
|
},
|
|
699
|
-
children: /* @__PURE__ */ s("canvas", {
|
|
700
|
-
ref:
|
|
772
|
+
children: [/* @__PURE__ */ s("canvas", {
|
|
773
|
+
ref: b,
|
|
701
774
|
role: "img",
|
|
702
|
-
"aria-label": `Compensation event gauge — ${Math.round((
|
|
775
|
+
"aria-label": `Compensation event gauge — ${Math.round((T ?? 0) / (E || 1) * 100)}% of NCEs confirmed as compensation events`,
|
|
703
776
|
style: {
|
|
704
|
-
width:
|
|
705
|
-
|
|
777
|
+
width: "100%",
|
|
778
|
+
aspectRatio: `${de} / ${fe}`,
|
|
706
779
|
display: "block"
|
|
707
780
|
}
|
|
708
|
-
})
|
|
781
|
+
}), /* @__PURE__ */ s(D, {
|
|
782
|
+
...M,
|
|
783
|
+
parentW: de,
|
|
784
|
+
parentH: fe
|
|
785
|
+
})]
|
|
709
786
|
});
|
|
710
787
|
}
|
|
711
788
|
//#endregion
|
|
712
789
|
//#region src/canvas/useCanvasLoop.ts
|
|
713
|
-
function
|
|
714
|
-
let c = a(0), { easing: l =
|
|
790
|
+
function ge(e, t, r, i, o = !0, s = {}) {
|
|
791
|
+
let c = a(0), { easing: l = j, durationFrames: u = 48 } = s;
|
|
715
792
|
n(() => {
|
|
716
793
|
let n = e.current;
|
|
717
794
|
if (!n || !t || !r) return;
|
|
@@ -742,28 +819,28 @@ function xe(e, t, r, i, o = !0, s = {}) {
|
|
|
742
819
|
}
|
|
743
820
|
//#endregion
|
|
744
821
|
//#region src/components/multiMetricConstellationChart/MultiMetricConstellationChart.tsx
|
|
745
|
-
var
|
|
822
|
+
var q = 780, _e = 234, ve = 130, ye = 52, be = [
|
|
746
823
|
u.blue,
|
|
747
824
|
u.amber,
|
|
748
825
|
u.purple,
|
|
749
826
|
u.green
|
|
750
|
-
],
|
|
827
|
+
], xe = [
|
|
751
828
|
"Base Value",
|
|
752
829
|
"Variations",
|
|
753
830
|
"Commitment"
|
|
754
|
-
],
|
|
831
|
+
], Se = [
|
|
755
832
|
"Base",
|
|
756
833
|
"Var",
|
|
757
834
|
"Commit"
|
|
758
835
|
];
|
|
759
|
-
function
|
|
760
|
-
let n = a(null), r = a(/* @__PURE__ */ new Map()), { hoveredRef: o, tooltip: l, hitZonesRef: d } =
|
|
761
|
-
width:
|
|
762
|
-
height:
|
|
836
|
+
function Ce({ items: e = [], testID: t }) {
|
|
837
|
+
let n = a(null), r = a(/* @__PURE__ */ new Map()), { hoveredRef: o, tooltip: l, hitZonesRef: d } = O(n, {
|
|
838
|
+
width: q,
|
|
839
|
+
height: _e
|
|
763
840
|
}), f = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), p = i(() => {
|
|
764
841
|
let e = Math.max(...f.map((e) => e.base ?? 0)), t = Math.max(...f.map((e) => e.variation ?? 0));
|
|
765
842
|
return f.map((n, r) => {
|
|
766
|
-
let i =
|
|
843
|
+
let i = q * (.12 + r * .19), a = ve, o = Math.min(q * .075, ye), s = be[r % be.length], c = [
|
|
767
844
|
(n.base ?? 0) / (e || 1) * 100,
|
|
768
845
|
(n.variation ?? 0) / (t || 1) * 100,
|
|
769
846
|
n.percentage ?? 0
|
|
@@ -772,10 +849,10 @@ function Oe({ items: e = [], "data-testid": t }) {
|
|
|
772
849
|
n.variationLabel ?? String(n.variation ?? 0),
|
|
773
850
|
`${n.percentage ?? 0}%`
|
|
774
851
|
], u = c.map((e, t) => {
|
|
775
|
-
let n = -Math.PI / 2 + t /
|
|
852
|
+
let n = -Math.PI / 2 + t / xe.length * Math.PI * 2, r = e / 100, s = o * Math.max(.08, r);
|
|
776
853
|
return {
|
|
777
|
-
name:
|
|
778
|
-
short:
|
|
854
|
+
name: xe[t],
|
|
855
|
+
short: Se[t],
|
|
779
856
|
label: l[t],
|
|
780
857
|
val: Math.round(e),
|
|
781
858
|
x: i + Math.cos(n) * s,
|
|
@@ -795,307 +872,338 @@ function Oe({ items: e = [], "data-testid": t }) {
|
|
|
795
872
|
};
|
|
796
873
|
});
|
|
797
874
|
}, [f]);
|
|
798
|
-
return
|
|
799
|
-
|
|
875
|
+
return ge(n, q, _e, (e, t, n) => {
|
|
876
|
+
L(r.current, o.current), d.current = [], w(e, q, _e, n, 30), p.forEach((t, i) => {
|
|
800
877
|
let a = t.color, o = `constellation-${i}`, s = r.current.get(o) ?? 0;
|
|
801
|
-
e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 5, 0, Math.PI * 2), e.strokeStyle =
|
|
878
|
+
e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 5, 0, Math.PI * 2), e.strokeStyle = y(u.bd, .08 + .08 * s), e.lineWidth = .5, e.stroke(), e.beginPath(), t.stars.forEach((t, n) => {
|
|
802
879
|
n === 0 ? e.moveTo(t.x, t.y) : e.lineTo(t.x, t.y);
|
|
803
|
-
}), e.closePath(), e.fillStyle =
|
|
804
|
-
let c =
|
|
805
|
-
p.addColorStop(0,
|
|
880
|
+
}), e.closePath(), e.fillStyle = y(a, .04 + .03 * s), e.fill(), e.strokeStyle = y(a, .15 + .1 * s), e.lineWidth = .8, e.stroke(), t.stars.forEach((o, s) => {
|
|
881
|
+
let c = F(n, .05, 5e-4) * .3 + .7, l = 3.5 * c, u = `star-${i}-${s}`, f = r.current.get(u) ?? 0, p = e.createRadialGradient(o.x, o.y, 0, o.x, o.y, l * 4);
|
|
882
|
+
p.addColorStop(0, y(a, (.2 + .1 * f) * c)), p.addColorStop(1, y(a, 0)), e.fillStyle = p, e.beginPath(), e.arc(o.x, o.y, l * 4, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(o.x, o.y, l + f * 2, 0, Math.PI * 2), e.fillStyle = y(a, (.8 + .2 * f) * c), e.fill();
|
|
806
883
|
let m = Math.sin(o.angle) < -.3;
|
|
807
|
-
e.textAlign = "center", e.textBaseline = "middle", m ? (e.font =
|
|
884
|
+
e.textAlign = "center", e.textBaseline = "middle", m ? (e.font = g.font, e.fillStyle = y(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y - 24), e.font = g.font, e.fillStyle = y(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y - 11)) : (e.font = g.font, e.fillStyle = y(a, .5 + .15 * f), e.fillText(o.short, o.x, o.y + 11), e.font = g.font, e.fillStyle = y(a, .8 + .15 * f), e.fillText(o.label, o.x, o.y + 24)), k(d.current, u, o.x, o.y, l * 4 + 2, {
|
|
808
885
|
label: o.name,
|
|
809
886
|
value: o.label,
|
|
810
887
|
sublabel: t.abbreviation ?? t.name.slice(0, 6),
|
|
811
888
|
color: a
|
|
812
889
|
});
|
|
813
|
-
}), s > 0 &&
|
|
890
|
+
}), s > 0 && C(e, t.cx, t.cy, 16 * s, a, .15 * s), e.beginPath(), e.arc(t.cx, t.cy, t.baseR + 12, 0, Math.PI * 2), e.strokeStyle = y(a, .1 + F(n, .03, 5e-4) * .05), e.lineWidth = 1, e.stroke(), e.font = g.font, e.textAlign = "center", e.textBaseline = "alphabetic", e.fillStyle = s > 0 ? t.color : g.color, e.fillText(t.abbreviation ?? t.name.slice(0, 6), t.cx, t.cy + t.baseR + 26), k(d.current, o, t.cx, t.cy, t.baseR + 5, {
|
|
814
891
|
label: t.name,
|
|
815
892
|
value: `${t.totalLabel ?? String(t.total ?? 0)} total`,
|
|
816
893
|
sublabel: `${t.percentage ?? 0}% committed · scatter ${t.scatter.toFixed(1)}`,
|
|
817
894
|
color: a
|
|
818
895
|
});
|
|
819
|
-
}), e.font =
|
|
820
|
-
}, !0), p.length === 0 ? /* @__PURE__ */ s(
|
|
821
|
-
width:
|
|
822
|
-
height:
|
|
823
|
-
|
|
896
|
+
}), e.font = v.font, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = v.color, e.fillText("▲ top = Base value · ▼▸ lower-right = Variations · ◂▼ lower-left = Commitment % · hover stars for details", q / 2, _e - 14), T(e, q, _e, n, .012);
|
|
897
|
+
}, !0), p.length === 0 ? /* @__PURE__ */ s(G, {
|
|
898
|
+
width: q,
|
|
899
|
+
height: _e,
|
|
900
|
+
testID: t
|
|
824
901
|
}) : /* @__PURE__ */ c("div", {
|
|
825
902
|
"data-testid": t,
|
|
826
903
|
style: {
|
|
827
904
|
position: "relative",
|
|
828
|
-
width:
|
|
829
|
-
height:
|
|
905
|
+
width: q,
|
|
906
|
+
height: _e
|
|
830
907
|
},
|
|
831
908
|
children: [/* @__PURE__ */ s("canvas", {
|
|
832
909
|
ref: n,
|
|
833
910
|
role: "img",
|
|
834
911
|
"aria-label": "Contract value breakdown per contractor — multi-KPI constellation chart",
|
|
835
912
|
style: {
|
|
836
|
-
width:
|
|
837
|
-
height:
|
|
913
|
+
width: q,
|
|
914
|
+
height: _e,
|
|
838
915
|
display: "block"
|
|
839
916
|
}
|
|
840
|
-
}), /* @__PURE__ */ s(
|
|
917
|
+
}), /* @__PURE__ */ s(D, {
|
|
841
918
|
...l,
|
|
842
|
-
parentW:
|
|
843
|
-
parentH:
|
|
919
|
+
parentW: q,
|
|
920
|
+
parentH: _e
|
|
844
921
|
})]
|
|
845
922
|
});
|
|
846
923
|
}
|
|
847
924
|
//#endregion
|
|
848
925
|
//#region src/components/stackedHorizontalBarChart/StackedHorizontalBarChart.tsx
|
|
849
|
-
var
|
|
926
|
+
var we = 680, Te = 220, Ee = 8, De = [u.teal], J = {
|
|
850
927
|
left: 8,
|
|
851
928
|
right: 100,
|
|
852
929
|
top: 16,
|
|
853
930
|
bottom: 38
|
|
854
|
-
},
|
|
855
|
-
function
|
|
931
|
+
}, Oe = 150, ke = 6;
|
|
932
|
+
function Ae(e, t, n) {
|
|
856
933
|
if (e.measureText(t).width <= n) return t;
|
|
857
934
|
let r = t;
|
|
858
935
|
for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
|
|
859
936
|
return r + "…";
|
|
860
937
|
}
|
|
861
|
-
function
|
|
938
|
+
function je(e) {
|
|
862
939
|
let t = Math.abs(e), n = e < 0 ? "-" : "";
|
|
863
940
|
return t >= 1e6 ? `${n}£${(t / 1e6).toFixed(1)}M` : t >= 1e3 ? `${n}£${(t / 1e3).toFixed(1)}K` : `${n}£${t.toFixed(0)}`;
|
|
864
941
|
}
|
|
865
|
-
function
|
|
866
|
-
let
|
|
867
|
-
|
|
868
|
-
|
|
942
|
+
function Me({ data: e, dataByEntity: n, onItemClick: r, selectedId: i, testID: l }) {
|
|
943
|
+
let [d, f] = ee(we), p = a(null), m = a(/* @__PURE__ */ new Map()), h = a(i);
|
|
944
|
+
h.current = i;
|
|
945
|
+
let b = t((e, t) => {
|
|
946
|
+
let n = typeof t == "object" ? t.label ?? e : e, i = V.current.visibleItems.find((t) => t.id === e);
|
|
947
|
+
r?.(e, n, i?.subentity);
|
|
948
|
+
}, [r]), [x, S] = o(!1), w = !!(i && n?.[i]), { items: T = [], totals: E } = w ? n[i] : e, k = T.filter((e) => typeof e == "object" && !!e), j = [...k].sort((e, t) => (t.total ?? 0) - (e.total ?? 0)), N = x ? j : j.slice(0, Ee), P = N.length, F = Math.max(...j.map((e) => Math.abs(e.total ?? 0)), 1), R = P * ke + Math.max(0, P - 1) * 38, z = J.top + J.bottom + R, B = f - J.left - Oe - J.right, V = a({
|
|
949
|
+
visibleItems: N,
|
|
950
|
+
maxCommitment: F,
|
|
951
|
+
totals: E,
|
|
952
|
+
barArea: B,
|
|
953
|
+
BAR_GAP: 38,
|
|
954
|
+
n: P,
|
|
955
|
+
dynamicH: z,
|
|
956
|
+
isDrillMode: w
|
|
957
|
+
});
|
|
958
|
+
V.current = {
|
|
959
|
+
visibleItems: N,
|
|
960
|
+
maxCommitment: F,
|
|
961
|
+
totals: E,
|
|
962
|
+
barArea: B,
|
|
963
|
+
BAR_GAP: 38,
|
|
964
|
+
n: P,
|
|
965
|
+
dynamicH: z,
|
|
966
|
+
isDrillMode: w
|
|
967
|
+
};
|
|
968
|
+
let H = (e.items ?? []).filter((e) => typeof e == "object" && !!e).length === 0, { hoveredRef: U, tooltip: W, hitZonesRef: ne } = O(p, {
|
|
969
|
+
width: f,
|
|
970
|
+
height: z,
|
|
971
|
+
onClick: r ? b : void 0
|
|
869
972
|
});
|
|
870
|
-
return
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
973
|
+
return ge(p, f, z, (e, t) => {
|
|
974
|
+
let { visibleItems: n, maxCommitment: r, totals: i, barArea: a, BAR_GAP: o, n: s, dynamicH: c, isDrillMode: l } = V.current;
|
|
975
|
+
L(m.current, U.current), ne.current = [], n.forEach((n, i) => {
|
|
976
|
+
let c = De[i % De.length], d = I(t, i, s, M), f = J.top + i * (ke + o), p = J.left + Oe, v = m.current.get(n.id) ?? 0, b = !l && h.current && n.id !== h.current ? .2 : 1, x = Math.max(n.total ?? 0, 0) / r * a * d;
|
|
977
|
+
if (e.font = g.font, e.fillStyle = v > 0 ? c : g.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(Ae(e, n.name ?? "", Oe - 16), p - 8, f + ke / 2), A(ne.current, n.id, 0, f, p, ke, {
|
|
874
978
|
label: n.name,
|
|
875
|
-
value: `${n.totalLabel ??
|
|
876
|
-
sublabel: `Base ${n.baseLabel ??
|
|
877
|
-
color:
|
|
878
|
-
}),
|
|
879
|
-
|
|
880
|
-
let t = e.createLinearGradient(
|
|
881
|
-
t.addColorStop(0,
|
|
882
|
-
}
|
|
883
|
-
let f = T * o, p = c + d, m = f - d;
|
|
884
|
-
if (m > 2) {
|
|
885
|
-
let t = e.createLinearGradient(p, 0, c + f, 0);
|
|
886
|
-
t.addColorStop(0, v(u.tealDark, .55)), t.addColorStop(1, v(u.tealDark, .22)), e.fillStyle = t, e.beginPath(), e.rect(p, s, m, U), e.fill();
|
|
979
|
+
value: `${n.totalLabel ?? je(n.total ?? 0)} total`,
|
|
980
|
+
sublabel: `Base ${n.baseLabel ?? je(n.base ?? 0)} + Var ${n.variationLabel ?? je(n.variation ?? 0)}`,
|
|
981
|
+
color: c
|
|
982
|
+
}), x > 0) {
|
|
983
|
+
v > 0 && C(e, p + x / 2, f + ke / 2, x * .15, u.teal, .12 * v);
|
|
984
|
+
let t = e.createLinearGradient(p, 0, p + x, 0);
|
|
985
|
+
t.addColorStop(0, y(u.tealDark, .85 * b)), t.addColorStop(1, y(u.teal, 1 * b)), e.fillStyle = t, e.beginPath(), e.rect(p, f, x, ke), e.fill();
|
|
887
986
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
987
|
+
let S = B * d, w = p + x, T = S - x;
|
|
988
|
+
if (T > 2 && (e.fillStyle = y(u.barBg, .2), e.beginPath(), e.rect(w, f, T, ke), e.fill()), x > 4) {
|
|
989
|
+
let t = p + x, n = f + ke;
|
|
990
|
+
e.strokeStyle = y(u.t4, .9 * d), e.lineWidth = 4, e.beginPath(), e.moveTo(t, f), e.lineTo(t, n), e.stroke();
|
|
891
991
|
let r = n + 3, i = {
|
|
892
992
|
x: t,
|
|
893
993
|
y: r
|
|
894
994
|
}, a = {
|
|
895
995
|
x: t + 10,
|
|
896
996
|
y: r + 12
|
|
897
|
-
},
|
|
997
|
+
}, o = {
|
|
898
998
|
x: t - 10,
|
|
899
999
|
y: r + 12
|
|
900
1000
|
};
|
|
901
|
-
e.fillStyle =
|
|
1001
|
+
e.fillStyle = y(u.t1, d), e.beginPath(), e.moveTo((i.x + a.x) / 2, (i.y + a.y) / 2), e.arcTo(a.x, a.y, o.x, o.y, 1), e.arcTo(o.x, o.y, i.x, i.y, 1), e.arcTo(i.x, i.y, a.x, a.y, 1), e.closePath(), e.fill();
|
|
902
1002
|
}
|
|
903
|
-
|
|
1003
|
+
d > .35 && (e.globalAlpha = Math.min(1, (d - .35) / .4) * b, e.font = _.font, e.fillStyle = v > 0 ? c : _.color, e.textAlign = "left", e.textBaseline = "middle", e.fillText(n.totalLabel ?? je(n.total ?? 0), p + a + 28, f + ke / 2), e.globalAlpha = 1), A(ne.current, n.id, p, f, Math.max(x, 1), ke, {
|
|
904
1004
|
label: n.name,
|
|
905
|
-
value: n.totalLabel ??
|
|
906
|
-
sublabel: `${n.baseLabel ??
|
|
907
|
-
color:
|
|
1005
|
+
value: n.totalLabel ?? je(n.total ?? 0),
|
|
1006
|
+
sublabel: `${n.baseLabel ?? je(n.base ?? 0)} + ${n.variationLabel ?? je(n.variation ?? 0)}`,
|
|
1007
|
+
color: c
|
|
908
1008
|
});
|
|
909
1009
|
});
|
|
910
|
-
let
|
|
911
|
-
e.textBaseline = "middle", e.font =
|
|
912
|
-
let
|
|
913
|
-
|
|
914
|
-
}, !0, { easing:
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1010
|
+
let d = c - 14;
|
|
1011
|
+
e.textBaseline = "middle", e.font = v.font, e.textAlign = "left";
|
|
1012
|
+
let p = e.createLinearGradient(J.left + Oe, 0, J.left + Oe + 14, 0);
|
|
1013
|
+
p.addColorStop(0, y(u.tealDark, .85)), p.addColorStop(1, y(u.teal, 1)), e.fillStyle = p, e.beginPath(), e.rect(J.left + Oe, d - 6, 12, 12), e.fill(), e.fillStyle = v.color, e.fillText("base value", J.left + Oe + 16, d), e.fillStyle = y(u.teal, .35), e.beginPath(), e.rect(J.left + Oe + 160, d - 6, 12, 12), e.fill(), e.fillStyle = v.color, e.fillText("approved variations", J.left + Oe + 176, d), e.font = v.font, e.textAlign = "right", e.fillStyle = v.color, e.fillText(`Portfolio: ${je(i?.total ?? 0)}`, f - 8, d);
|
|
1014
|
+
}, !0, { easing: M }), H ? /* @__PURE__ */ s("div", {
|
|
1015
|
+
ref: d,
|
|
1016
|
+
style: { width: "100%" },
|
|
1017
|
+
children: /* @__PURE__ */ s(G, {
|
|
1018
|
+
width: f,
|
|
1019
|
+
height: Te,
|
|
1020
|
+
message: "No contract data available",
|
|
1021
|
+
testID: l
|
|
1022
|
+
})
|
|
919
1023
|
}) : /* @__PURE__ */ c("div", {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
transition: "all 0.25s ease"
|
|
924
|
-
},
|
|
1024
|
+
ref: d,
|
|
1025
|
+
"data-testid": l,
|
|
1026
|
+
style: { width: "100%" },
|
|
925
1027
|
children: [/* @__PURE__ */ c("div", {
|
|
926
1028
|
style: { position: "relative" },
|
|
927
1029
|
children: [/* @__PURE__ */ s("canvas", {
|
|
928
|
-
ref:
|
|
1030
|
+
ref: p,
|
|
929
1031
|
role: "img",
|
|
930
1032
|
"aria-label": "Total contract value per contractor — horizontal bar chart",
|
|
931
1033
|
style: {
|
|
932
|
-
width:
|
|
933
|
-
height:
|
|
1034
|
+
width: "100%",
|
|
1035
|
+
height: z,
|
|
934
1036
|
display: "block",
|
|
935
1037
|
borderRadius: 8
|
|
936
1038
|
}
|
|
937
|
-
}), /* @__PURE__ */ s(
|
|
938
|
-
...
|
|
939
|
-
parentW:
|
|
940
|
-
parentH:
|
|
1039
|
+
}), /* @__PURE__ */ s(D, {
|
|
1040
|
+
...W,
|
|
1041
|
+
parentW: f,
|
|
1042
|
+
parentH: z
|
|
941
1043
|
})]
|
|
942
|
-
}),
|
|
1044
|
+
}), k.length > Ee && /* @__PURE__ */ s("div", {
|
|
943
1045
|
style: { marginTop: 8 },
|
|
944
|
-
children: /* @__PURE__ */ s(
|
|
945
|
-
expanded:
|
|
946
|
-
onToggle: () =>
|
|
1046
|
+
children: /* @__PURE__ */ s(te, {
|
|
1047
|
+
expanded: x,
|
|
1048
|
+
onToggle: () => S((e) => !e)
|
|
947
1049
|
})
|
|
948
1050
|
})]
|
|
949
1051
|
});
|
|
950
1052
|
}
|
|
951
1053
|
//#endregion
|
|
952
1054
|
//#region src/components/rankedCardLeaderboard/RankedCardLeaderboard.tsx
|
|
953
|
-
var
|
|
954
|
-
function
|
|
955
|
-
let
|
|
956
|
-
|
|
957
|
-
|
|
1055
|
+
var Ne = 780, Pe = 240, Fe = 12, Ie = 10, Le = 5;
|
|
1056
|
+
function Re({ items: e = [], onItemClick: r, testID: o }) {
|
|
1057
|
+
let [l, d] = ee(Ne), f = a(null), m = a(0), h = a(/* @__PURE__ */ new Map()), v = [...i(() => e.filter((e) => typeof e == "object" && !!e), [e])].sort((e, t) => (t.count ?? 0) - (e.count ?? 0)).slice(0, 5), b = v.reduce((e, t) => e + (t.count ?? 0), 0), x = a(v);
|
|
1058
|
+
x.current = v;
|
|
1059
|
+
let w = t((e, t) => {
|
|
1060
|
+
let n = typeof t == "object" ? t.label ?? e : e, i = x.current.find((t) => t.id === e);
|
|
1061
|
+
r?.(e, n, i?.subentity);
|
|
1062
|
+
}, [r]), E = Math.min(Le, v.length), k = E > 0 ? (d - 2 * Fe - (E - 1) * Ie) / E : (d - 2 * Fe) / Le, { hoveredRef: j, tooltip: M, hitZonesRef: N } = O(f, {
|
|
1063
|
+
width: d,
|
|
1064
|
+
height: Pe,
|
|
1065
|
+
onClick: r ? w : void 0
|
|
958
1066
|
});
|
|
959
1067
|
return n(() => {
|
|
960
|
-
let e =
|
|
1068
|
+
let e = f.current;
|
|
961
1069
|
if (!e) return;
|
|
962
|
-
let t =
|
|
963
|
-
|
|
964
|
-
let n =
|
|
965
|
-
|
|
966
|
-
let e =
|
|
967
|
-
t.clearRect(0, 0,
|
|
968
|
-
let n = t ===
|
|
969
|
-
Math.abs(r - n) < .005 ? n === 0 ?
|
|
970
|
-
}),
|
|
971
|
-
let
|
|
972
|
-
t.fillStyle =
|
|
973
|
-
let
|
|
974
|
-
|
|
975
|
-
let
|
|
976
|
-
for (; t.measureText(
|
|
977
|
-
|
|
978
|
-
let
|
|
979
|
-
if (
|
|
980
|
-
t.font =
|
|
981
|
-
let e =
|
|
982
|
-
for (; t.measureText(
|
|
983
|
-
|
|
1070
|
+
let t = S(e, d, Pe);
|
|
1071
|
+
m.current = 0;
|
|
1072
|
+
let n = Pe * .84, r = Pe * .08, i = Fe, a, o = () => {
|
|
1073
|
+
m.current++;
|
|
1074
|
+
let e = m.current;
|
|
1075
|
+
t.clearRect(0, 0, d, Pe), t.letterSpacing = g.letterSpacing, N.current = [], h.current.forEach((e, t) => {
|
|
1076
|
+
let n = t === j.current ? 1 : 0, r = e + (n - e) * .12;
|
|
1077
|
+
Math.abs(r - n) < .005 ? n === 0 ? h.current.delete(t) : h.current.set(t, 1) : h.current.set(t, r);
|
|
1078
|
+
}), j.current && !h.current.has(j.current) && h.current.set(j.current, 0), v.forEach((a, o) => {
|
|
1079
|
+
let s = o === 0, c = o === 0 ? u.red : o === 1 ? u.amber : p[o % p.length], l = i + o * (k + Ie), d = h.current.get(a.id) ?? 0, f = d * 8, m = l - f / 2, g = k + f, v = s ? F(e, .04, 3e-4) * .06 + .06 : 0;
|
|
1080
|
+
t.fillStyle = y(c, .08 + d * .07), t.beginPath(), t.roundRect(m, r, g, n, 6), t.fill(), t.strokeStyle = y(c, .2 + d * .4 + v), t.lineWidth = s ? 1.5 : 1, t.stroke(), (d > .01 || s) && C(t, m + g / 2, r + n / 2, g * .55, c, v + d * .14), t.font = _.font, t.textAlign = "left", t.textBaseline = "top", t.fillStyle = y(c, .5 + d * .35), t.fillText(`#${o + 1}`, m + 7, r + 6);
|
|
1081
|
+
let x = Math.min(k * .28, n * .32, 72), S = m + g / 2, w = r + n * .38, T = t.createRadialGradient(S, w - x * .2, 0, S, w, x);
|
|
1082
|
+
T.addColorStop(0, y(c, .5 + d * .2)), T.addColorStop(1, y(c, .2 + d * .1)), t.beginPath(), t.arc(S, w, x, 0, Math.PI * 2), t.fillStyle = T, t.fill(), t.strokeStyle = y(c, .4 + d * .3), t.lineWidth = 1, t.stroke(), t.font = _.font, t.textAlign = "center", t.textBaseline = "middle", t.fillStyle = y(u.t1, .9);
|
|
1083
|
+
let E = a.abbreviation ?? a.name ?? "", D = x * 1.7, O = E;
|
|
1084
|
+
for (; t.measureText(O).width > D && O.length > 1;) O = O.slice(0, -1);
|
|
1085
|
+
O !== E && (O = O.slice(0, -1) + "…"), t.fillText(O, S, w);
|
|
1086
|
+
let j = a.count == null ? null : K(a.count), M = a.label ?? j;
|
|
1087
|
+
if (M) {
|
|
1088
|
+
t.font = _.font, t.textBaseline = "alphabetic", t.fillStyle = y(c, .9 + d * .1);
|
|
1089
|
+
let e = g - 16, i = M;
|
|
1090
|
+
for (; t.measureText(i).width > e && i.length > 1;) i = i.slice(0, -1);
|
|
1091
|
+
i !== M && (i = i.slice(0, -1) + "…"), t.fillText(i, S, r + n * .74);
|
|
984
1092
|
}
|
|
985
|
-
let
|
|
986
|
-
|
|
987
|
-
label:
|
|
988
|
-
value: `${
|
|
1093
|
+
let P = Math.round((a.count ?? 0) / (b || 1) * 100);
|
|
1094
|
+
A(N.current, a.id, l, r, k, n, {
|
|
1095
|
+
label: a.name,
|
|
1096
|
+
value: `${M} · ${P}% of total`,
|
|
989
1097
|
sublabel: `Rank #${o + 1}`,
|
|
990
|
-
color:
|
|
1098
|
+
color: c
|
|
991
1099
|
});
|
|
992
|
-
}),
|
|
1100
|
+
}), T(t, d, Pe, e, .015), a = requestAnimationFrame(o);
|
|
993
1101
|
};
|
|
994
|
-
return
|
|
1102
|
+
return o(), () => cancelAnimationFrame(a);
|
|
995
1103
|
}, [
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
]),
|
|
1000
|
-
width:
|
|
1001
|
-
height:
|
|
1002
|
-
|
|
1104
|
+
v,
|
|
1105
|
+
b,
|
|
1106
|
+
d
|
|
1107
|
+
]), v.length === 0 ? /* @__PURE__ */ s(G, {
|
|
1108
|
+
width: d,
|
|
1109
|
+
height: Pe,
|
|
1110
|
+
testID: o
|
|
1003
1111
|
}) : /* @__PURE__ */ c("div", {
|
|
1004
|
-
"data-testid":
|
|
1112
|
+
"data-testid": o,
|
|
1005
1113
|
style: {
|
|
1006
1114
|
position: "relative",
|
|
1007
|
-
width:
|
|
1008
|
-
height:
|
|
1115
|
+
width: d,
|
|
1116
|
+
height: Pe
|
|
1009
1117
|
},
|
|
1010
1118
|
children: [/* @__PURE__ */ s("canvas", {
|
|
1011
|
-
ref:
|
|
1119
|
+
ref: f,
|
|
1012
1120
|
role: "img",
|
|
1013
1121
|
"aria-label": "Contractor rank — open EW count per contractor",
|
|
1014
1122
|
style: {
|
|
1015
|
-
width:
|
|
1016
|
-
height:
|
|
1123
|
+
width: d,
|
|
1124
|
+
height: Pe,
|
|
1017
1125
|
display: "block",
|
|
1018
1126
|
borderRadius: 8
|
|
1019
1127
|
}
|
|
1020
|
-
}), /* @__PURE__ */ s(
|
|
1021
|
-
...
|
|
1022
|
-
parentW:
|
|
1023
|
-
parentH:
|
|
1128
|
+
}), /* @__PURE__ */ s(D, {
|
|
1129
|
+
...M,
|
|
1130
|
+
parentW: d,
|
|
1131
|
+
parentH: Pe
|
|
1024
1132
|
})]
|
|
1025
1133
|
});
|
|
1026
1134
|
}
|
|
1027
1135
|
//#endregion
|
|
1028
1136
|
//#region src/components/dotMatrixChart/DotMatrixChart.tsx
|
|
1029
|
-
var
|
|
1030
|
-
function
|
|
1031
|
-
let r = a(null), o = a(0), l = a(/* @__PURE__ */ new Map()), { hoveredRef: d, tooltip: f, hitZonesRef: p } =
|
|
1032
|
-
width:
|
|
1033
|
-
height:
|
|
1137
|
+
var ze = 680, Be = 260;
|
|
1138
|
+
function Ve({ items: e = [], testID: t }) {
|
|
1139
|
+
let r = a(null), o = a(0), l = a(/* @__PURE__ */ new Map()), { hoveredRef: d, tooltip: f, hitZonesRef: p } = O(r, {
|
|
1140
|
+
width: ze,
|
|
1141
|
+
height: Be
|
|
1034
1142
|
}), m = i(() => e.filter((e) => typeof e == "object" && !!e), [e]);
|
|
1035
1143
|
return n(() => {
|
|
1036
1144
|
let e = r.current;
|
|
1037
1145
|
if (!e) return;
|
|
1038
|
-
let t =
|
|
1146
|
+
let t = S(e, ze, Be);
|
|
1039
1147
|
o.current = 0;
|
|
1040
|
-
let n = m.length, i = Math.max(...m.map((e) => e.count), 1), a = i, s =
|
|
1148
|
+
let n = m.length, i = Math.max(...m.map((e) => e.count), 1), a = i, s = ze * .05, c = Be * .1, f = ze * .9 / n, h = Be * .7 / a, _ = m.reduce((e, t) => e + t.count, 0), v, b = () => {
|
|
1041
1149
|
o.current++;
|
|
1042
1150
|
let e = o.current;
|
|
1043
|
-
t.clearRect(0, 0,
|
|
1151
|
+
t.clearRect(0, 0, ze, Be), p.current = [], l.current.forEach((e, t) => {
|
|
1044
1152
|
let n = t === d.current ? 1 : 0, r = e + (n - e) * .12;
|
|
1045
1153
|
Math.abs(r - n) < .005 ? n === 0 ? l.current.delete(t) : l.current.set(t, 1) : l.current.set(t, r);
|
|
1046
|
-
}), d.current && !l.current.has(d.current) && l.current.set(d.current, 0),
|
|
1154
|
+
}), d.current && !l.current.has(d.current) && l.current.set(d.current, 0), w(t, ze, Be, e, 40, y(u.blue, .04)), m.forEach((n, r) => {
|
|
1047
1155
|
let o = n.count === i, d = u.blue, m = l.current.get(`${n.category}-col`) ?? 0;
|
|
1048
1156
|
for (let u = 0; u < a; u++) {
|
|
1049
|
-
let a = s + r * f + f / 2,
|
|
1157
|
+
let a = s + r * f + f / 2, g = c + u * h + h / 2, v = Math.min(f, h) * .38;
|
|
1050
1158
|
if (u >= i - n.count) {
|
|
1051
|
-
let i =
|
|
1052
|
-
(o || m > .01) &&
|
|
1159
|
+
let i = v * (1 + (F(e, .04, 5e-4) + Math.sin(r * .6 + u * 1.2) * .3) * .12);
|
|
1160
|
+
(o || m > .01) && C(t, a, g, i * 3, d, (o ? .2 : .1) + m * .1), t.beginPath(), t.arc(a, g, i, 0, Math.PI * 2), t.fillStyle = y(d, o ? .8 : .5 + m * .2), t.fill();
|
|
1053
1161
|
let s = `${n.category}-${u}`;
|
|
1054
|
-
|
|
1162
|
+
k(p.current, s, a, g, v + 4, {
|
|
1055
1163
|
label: n.fullName,
|
|
1056
1164
|
value: `${n.count} Early Warnings`,
|
|
1057
1165
|
sublabel: `${Math.round(n.count / _ * 100)}% of total`,
|
|
1058
1166
|
color: d
|
|
1059
1167
|
}), l.current.get(`${n.category}-col`);
|
|
1060
|
-
} else t.beginPath(), t.arc(a,
|
|
1168
|
+
} else t.beginPath(), t.arc(a, g, 1, 0, Math.PI * 2), t.fillStyle = y(d, .08), t.fill();
|
|
1061
1169
|
}
|
|
1062
|
-
let
|
|
1063
|
-
t.font =
|
|
1064
|
-
}),
|
|
1170
|
+
let v = c + a * h + 16;
|
|
1171
|
+
t.font = g.font, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = o ? u.blue : y(u.t2, .65), t.fillText(n.category, s + r * f + f / 2, v);
|
|
1172
|
+
}), T(t, ze, Be, e, .015), v = requestAnimationFrame(b);
|
|
1065
1173
|
};
|
|
1066
|
-
return b(), () => cancelAnimationFrame(
|
|
1067
|
-
}, [m]), m.length === 0 ? /* @__PURE__ */ s(
|
|
1068
|
-
width:
|
|
1069
|
-
height:
|
|
1070
|
-
|
|
1174
|
+
return b(), () => cancelAnimationFrame(v);
|
|
1175
|
+
}, [m]), m.length === 0 ? /* @__PURE__ */ s(G, {
|
|
1176
|
+
width: ze,
|
|
1177
|
+
height: Be,
|
|
1178
|
+
testID: t
|
|
1071
1179
|
}) : /* @__PURE__ */ c("div", {
|
|
1072
1180
|
"data-testid": t,
|
|
1073
1181
|
style: {
|
|
1074
1182
|
position: "relative",
|
|
1075
|
-
width:
|
|
1076
|
-
height:
|
|
1183
|
+
width: ze,
|
|
1184
|
+
height: Be
|
|
1077
1185
|
},
|
|
1078
1186
|
children: [/* @__PURE__ */ s("canvas", {
|
|
1079
1187
|
ref: r,
|
|
1080
1188
|
role: "img",
|
|
1081
1189
|
"aria-label": "Early Warning count by category — breathing dot grid",
|
|
1082
1190
|
style: {
|
|
1083
|
-
width:
|
|
1084
|
-
height:
|
|
1191
|
+
width: ze,
|
|
1192
|
+
height: Be,
|
|
1085
1193
|
display: "block",
|
|
1086
1194
|
borderRadius: 8
|
|
1087
1195
|
}
|
|
1088
|
-
}), /* @__PURE__ */ s(
|
|
1196
|
+
}), /* @__PURE__ */ s(D, {
|
|
1089
1197
|
...f,
|
|
1090
|
-
parentW:
|
|
1091
|
-
parentH:
|
|
1198
|
+
parentW: ze,
|
|
1199
|
+
parentH: Be
|
|
1092
1200
|
})]
|
|
1093
1201
|
});
|
|
1094
1202
|
}
|
|
1095
1203
|
//#endregion
|
|
1096
1204
|
//#region src/components/lineChart/LineChart.tsx
|
|
1097
|
-
function
|
|
1098
|
-
return /* @__PURE__ */ s(
|
|
1205
|
+
function He({ rows: e = [], className: t, colors: n }) {
|
|
1206
|
+
return /* @__PURE__ */ s(B, {
|
|
1099
1207
|
rows: e,
|
|
1100
1208
|
variant: "line",
|
|
1101
1209
|
className: t,
|
|
@@ -1103,8 +1211,33 @@ function We({ rows: e = [], className: t, colors: n }) {
|
|
|
1103
1211
|
});
|
|
1104
1212
|
}
|
|
1105
1213
|
//#endregion
|
|
1106
|
-
//#region src/
|
|
1107
|
-
var
|
|
1214
|
+
//#region src/constants.ts
|
|
1215
|
+
var Y = {
|
|
1216
|
+
LINE: "line",
|
|
1217
|
+
AREA: "area",
|
|
1218
|
+
BAR: "bar",
|
|
1219
|
+
PIE: "pie",
|
|
1220
|
+
DONUT: "donut",
|
|
1221
|
+
SANKEY: "sankey",
|
|
1222
|
+
FLOW: "flow",
|
|
1223
|
+
TREND: "trend",
|
|
1224
|
+
MINI_BARS: "mini-bars",
|
|
1225
|
+
STACKED_HORIZONTAL_BAR: "stacked-horizontal-bar-chart",
|
|
1226
|
+
MULTI_METRIC_CONSTELLATION: "multi-metric-constellation-chart",
|
|
1227
|
+
PROGRESS_RACE: "progress-race-chart",
|
|
1228
|
+
HUB_AND_SPOKE_RADIAL: "hub-and-spoke-radial-chart",
|
|
1229
|
+
DOT_MATRIX: "dot-matrix-chart",
|
|
1230
|
+
RANKED_CARD_LEADERBOARD: "ranked-card-leaderboard",
|
|
1231
|
+
PROPORTIONAL_BAND: "proportional-band-chart",
|
|
1232
|
+
RADIAL_FAN_TREE: "radial-fan-tree-chart",
|
|
1233
|
+
SEMI_CIRCULAR_GAUGE: "semi-circular-gauge-chart",
|
|
1234
|
+
SEGMENTED_SPLIT_BAR: "segmented-split-bar-chart",
|
|
1235
|
+
BALANCE_SCALE: "balance-scale-chart",
|
|
1236
|
+
AREA_LINE: "area-line-chart",
|
|
1237
|
+
TREND_VIEW: "trend-view",
|
|
1238
|
+
WEEKLY_FLOW: "weekly-flow",
|
|
1239
|
+
HORIZONTAL_BAR: "horizontal-bar-chart"
|
|
1240
|
+
}, Ue = [
|
|
1108
1241
|
"#4C93D9",
|
|
1109
1242
|
"#5DA537",
|
|
1110
1243
|
"#F3862C",
|
|
@@ -1112,7 +1245,7 @@ var Ge = [
|
|
|
1112
1245
|
"#A0B724",
|
|
1113
1246
|
"#EEBF3B",
|
|
1114
1247
|
"#3C45D1"
|
|
1115
|
-
],
|
|
1248
|
+
], We = {
|
|
1116
1249
|
nodes: [
|
|
1117
1250
|
{
|
|
1118
1251
|
id: "supplier-x",
|
|
@@ -1155,8 +1288,8 @@ var Ge = [
|
|
|
1155
1288
|
};
|
|
1156
1289
|
//#endregion
|
|
1157
1290
|
//#region src/components/miniBars/MiniBars.tsx
|
|
1158
|
-
function
|
|
1159
|
-
let r = n?.slices ??
|
|
1291
|
+
function Ge({ rows: e = [], className: t, colors: n }) {
|
|
1292
|
+
let r = n?.slices ?? Ue;
|
|
1160
1293
|
return /* @__PURE__ */ s("div", {
|
|
1161
1294
|
className: ["d3-mini-bars", t].filter(Boolean).join(" "),
|
|
1162
1295
|
children: e.map(([e, t, n], i) => /* @__PURE__ */ c("div", {
|
|
@@ -1182,7 +1315,7 @@ function qe({ rows: e = [], className: t, colors: n }) {
|
|
|
1182
1315
|
width: Math.max(0, Math.min(100, t)),
|
|
1183
1316
|
height: "12",
|
|
1184
1317
|
rx: "6",
|
|
1185
|
-
className: `d3-mini-fill tone-${i %
|
|
1318
|
+
className: `d3-mini-fill tone-${i % Ue.length}`,
|
|
1186
1319
|
fill: r[i % r.length]
|
|
1187
1320
|
})]
|
|
1188
1321
|
})
|
|
@@ -1194,137 +1327,152 @@ function qe({ rows: e = [], className: t, colors: n }) {
|
|
|
1194
1327
|
}
|
|
1195
1328
|
//#endregion
|
|
1196
1329
|
//#region src/components/radialFanTreeChart/RadialFanTreeChart.tsx
|
|
1197
|
-
var
|
|
1198
|
-
function
|
|
1199
|
-
let
|
|
1200
|
-
|
|
1201
|
-
|
|
1330
|
+
var Ke = 770, qe = 320, Je = 60, Ye = 28;
|
|
1331
|
+
function Xe({ total: e = 0, totalLabel: r, items: o = [], dataByEntity: l, onItemClick: d, selectedId: f, colorOffset: p = 0, testID: m }) {
|
|
1332
|
+
let [v, b] = ee(Ke), x = a(null), w = a(/* @__PURE__ */ new Map()), T = a(0), E = a(f);
|
|
1333
|
+
E.current = f;
|
|
1334
|
+
let A = a([]), M = t((e, t) => {
|
|
1335
|
+
if (e === "__root__") return;
|
|
1336
|
+
let n = typeof t == "object" ? t.label ?? e : e, r = A.current.find((t) => t.id === e);
|
|
1337
|
+
d?.(e, n, r?.subentity);
|
|
1338
|
+
}, [d]), N = !!(f && l?.[f]), P = N ? l[f] : null, F = P ? P.total : e, R = P ? P.totalLabel : r, z = P ? P.items : o, B = i(() => z.filter((e) => typeof e == "object" && !!e), [z]);
|
|
1339
|
+
A.current = B;
|
|
1340
|
+
let V = i(() => Math.max(qe, Je + Math.max(0, B.length - 1) * Ye), [B.length]), H = V, { hoveredRef: U, tooltip: W, hitZonesRef: te } = O(x, {
|
|
1341
|
+
width: b,
|
|
1342
|
+
height: V,
|
|
1343
|
+
onClick: d ? M : void 0
|
|
1202
1344
|
});
|
|
1203
1345
|
return n(() => {
|
|
1204
|
-
let
|
|
1205
|
-
if (!
|
|
1206
|
-
let
|
|
1207
|
-
|
|
1208
|
-
let
|
|
1209
|
-
x:
|
|
1210
|
-
y: 30 + t *
|
|
1211
|
-
})),
|
|
1212
|
-
|
|
1213
|
-
let
|
|
1214
|
-
|
|
1215
|
-
let
|
|
1216
|
-
|
|
1217
|
-
let
|
|
1218
|
-
x.addColorStop(0,
|
|
1219
|
-
let
|
|
1220
|
-
if (
|
|
1221
|
-
let
|
|
1222
|
-
|
|
1346
|
+
let e = x.current;
|
|
1347
|
+
if (!e) return;
|
|
1348
|
+
let t = S(e, b, H);
|
|
1349
|
+
T.current = 0;
|
|
1350
|
+
let n = V / 2, r = b - 140, i = Math.max(...B.map((e) => e.count ?? 0), 1), a = B.length > 1 ? (V - 60) / (B.length - 1) : 60, o = Math.min(22, a / 2 - 3), s = Math.min(8, Math.max(3, o - 6)), c = r + o + 10, l = B.map((e, t) => ({
|
|
1351
|
+
x: r,
|
|
1352
|
+
y: 30 + t * a
|
|
1353
|
+
})), d, f = () => {
|
|
1354
|
+
T.current++;
|
|
1355
|
+
let e = T.current;
|
|
1356
|
+
t.clearRect(0, 0, b, H), t.letterSpacing = g.letterSpacing;
|
|
1357
|
+
let a = j(Math.min(e / 72, 1));
|
|
1358
|
+
L(w.current, U.current), te.current = [];
|
|
1359
|
+
let m = h[p % h.length], v = 100 + 60 * Math.min(1, a * 2.5), x = t.createLinearGradient(100, 0, v, 0);
|
|
1360
|
+
x.addColorStop(0, y(m, .8)), x.addColorStop(1, y(m, .7)), t.beginPath(), t.moveTo(100, n), t.lineTo(v, n), t.strokeStyle = x, t.lineWidth = 1.33, t.stroke(), B.forEach((e, d) => {
|
|
1361
|
+
let f = I(a, d, B.length, j), p = l[d], h = w.current.get(e.id) ?? 0, v = !N && E.current && e.id !== E.current ? .6 : 1;
|
|
1362
|
+
if (f < .01) return;
|
|
1363
|
+
let x = 160 + (r - 160) * .35, S = n, T = 160 + (r - 160) * .65, D = p.y;
|
|
1364
|
+
t.beginPath();
|
|
1223
1365
|
for (let e = 0; e <= 40; e++) {
|
|
1224
|
-
let
|
|
1225
|
-
e === 0 ?
|
|
1366
|
+
let r = e / 40 * f, i = (1 - r) ** 3 * 160 + 3 * (1 - r) ** 2 * r * x + 3 * (1 - r) * r ** 2 * T + r ** 3 * p.x, a = (1 - r) ** 3 * n + 3 * (1 - r) ** 2 * r * S + 3 * (1 - r) * r ** 2 * D + r ** 3 * p.y;
|
|
1367
|
+
e === 0 ? t.moveTo(i, a) : t.lineTo(i, a);
|
|
1226
1368
|
}
|
|
1227
|
-
let
|
|
1228
|
-
if (
|
|
1229
|
-
let n = Math.min(1, (
|
|
1230
|
-
|
|
1231
|
-
let a =
|
|
1232
|
-
|
|
1233
|
-
label:
|
|
1369
|
+
let O = t.createLinearGradient(160, n, p.x, p.y);
|
|
1370
|
+
if (O.addColorStop(0, y(m, (h > 0 ? 1 : .8) * v)), O.addColorStop(1, y(m, (h > 0 ? 1 : .7) * v)), t.strokeStyle = O, t.lineWidth = h > 0 ? 2 : 1.33, t.stroke(), f > .85) {
|
|
1371
|
+
let n = Math.min(1, (f - .85) / .15), r = s + (e.count ?? 0) / i * (o - s);
|
|
1372
|
+
C(t, p.x, p.y, r * 2, m, (.2 + h * .2) * n * v), t.beginPath(), t.arc(p.x, p.y, r * n, 0, Math.PI * 2), t.fillStyle = y(m, n * v), t.fill();
|
|
1373
|
+
let a = K(e.count ?? 0);
|
|
1374
|
+
k(te.current, e.id, p.x, p.y, r + 8, {
|
|
1375
|
+
label: e.name,
|
|
1234
1376
|
value: a,
|
|
1235
|
-
sublabel: `${Math.round((
|
|
1236
|
-
color:
|
|
1237
|
-
}),
|
|
1238
|
-
let
|
|
1239
|
-
|
|
1240
|
-
let
|
|
1241
|
-
|
|
1377
|
+
sublabel: `${Math.round((e.count ?? 0) / (F || 1) * 100)}% of total`,
|
|
1378
|
+
color: m
|
|
1379
|
+
}, b), t.globalAlpha = n * v, t.font = g.font, t.textAlign = "left";
|
|
1380
|
+
let l = e.abbreviation ?? e.name?.slice(0, 6) ?? "", d = ` ${K(e.count ?? 0)}`, x = p.y + 4;
|
|
1381
|
+
t.fillStyle = h > 0 ? m : y(u.t2, .85), t.fillText(l, c, x);
|
|
1382
|
+
let S = t.measureText(l).width;
|
|
1383
|
+
t.font = _.font, t.fillStyle = h > 0 ? m : u.t1, t.fillText(d, c + S, x), t.globalAlpha = 1;
|
|
1242
1384
|
}
|
|
1243
1385
|
});
|
|
1244
|
-
let
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1247
|
-
let
|
|
1248
|
-
|
|
1249
|
-
let
|
|
1250
|
-
for (;
|
|
1251
|
-
|
|
1386
|
+
let S = 40 * a, D = t.createRadialGradient(60, n, 0, 60, n, S);
|
|
1387
|
+
if (D.addColorStop(0, y(m, .02 * a)), D.addColorStop(.55, y(m, .02 * a)), D.addColorStop(1, y(m, .15 * a)), t.beginPath(), t.arc(60, n, S, 0, Math.PI * 2), t.fillStyle = D, t.fill(), t.beginPath(), t.arc(60, n, S, 0, Math.PI * 2), t.strokeStyle = y(m, .8 * a), t.lineWidth = 1, t.stroke(), a > .4) {
|
|
1388
|
+
t.globalAlpha = Math.min(1, (a - .4) / .4);
|
|
1389
|
+
let e = R ?? K(F, 0);
|
|
1390
|
+
t.font = "500 16px 'Satoshi Variable', 'DM Sans', sans-serif";
|
|
1391
|
+
let r = e;
|
|
1392
|
+
for (; t.measureText(r).width > 68 && r.length > 1;) r = r.slice(0, -1);
|
|
1393
|
+
r !== e && (r = r.slice(0, -1) + "…"), t.fillStyle = u.t1, t.textAlign = "center", t.textBaseline = "middle", t.fillText(r, 60, n), t.textBaseline = "alphabetic", t.globalAlpha = 1;
|
|
1252
1394
|
}
|
|
1253
|
-
|
|
1254
|
-
label:
|
|
1255
|
-
value:
|
|
1256
|
-
sublabel: `${
|
|
1257
|
-
color:
|
|
1258
|
-
}),
|
|
1395
|
+
k(te.current, "__root__", 60, n, 40, {
|
|
1396
|
+
label: R ?? "Total",
|
|
1397
|
+
value: K(F, 0),
|
|
1398
|
+
sublabel: `${B.length} items`,
|
|
1399
|
+
color: m
|
|
1400
|
+
}), d = requestAnimationFrame(f);
|
|
1259
1401
|
};
|
|
1260
|
-
return
|
|
1402
|
+
return f(), () => cancelAnimationFrame(d);
|
|
1261
1403
|
}, [
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1404
|
+
F,
|
|
1405
|
+
R,
|
|
1406
|
+
B,
|
|
1407
|
+
V,
|
|
1265
1408
|
b,
|
|
1266
|
-
|
|
1267
|
-
]),
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1409
|
+
N
|
|
1410
|
+
]), B.length === 0 ? /* @__PURE__ */ s("div", {
|
|
1411
|
+
ref: v,
|
|
1412
|
+
style: { width: "100%" },
|
|
1413
|
+
children: /* @__PURE__ */ s(G, {
|
|
1414
|
+
width: b,
|
|
1415
|
+
height: qe,
|
|
1416
|
+
testID: m
|
|
1417
|
+
})
|
|
1271
1418
|
}) : /* @__PURE__ */ c("div", {
|
|
1272
|
-
|
|
1419
|
+
ref: v,
|
|
1420
|
+
"data-testid": m,
|
|
1273
1421
|
style: {
|
|
1274
1422
|
position: "relative",
|
|
1275
|
-
width:
|
|
1276
|
-
height:
|
|
1423
|
+
width: "100%",
|
|
1424
|
+
height: H
|
|
1277
1425
|
},
|
|
1278
1426
|
children: [/* @__PURE__ */ s("canvas", {
|
|
1279
|
-
ref:
|
|
1427
|
+
ref: x,
|
|
1280
1428
|
role: "img",
|
|
1281
1429
|
"aria-label": "NCE fault tree — NCEs per contractor as branching tree",
|
|
1282
1430
|
style: {
|
|
1283
|
-
width:
|
|
1284
|
-
height:
|
|
1431
|
+
width: "100%",
|
|
1432
|
+
height: H,
|
|
1285
1433
|
display: "block"
|
|
1286
1434
|
}
|
|
1287
|
-
}), /* @__PURE__ */ s(
|
|
1288
|
-
...
|
|
1289
|
-
parentW:
|
|
1290
|
-
parentH:
|
|
1435
|
+
}), /* @__PURE__ */ s(D, {
|
|
1436
|
+
...W,
|
|
1437
|
+
parentW: b,
|
|
1438
|
+
parentH: H
|
|
1291
1439
|
})]
|
|
1292
1440
|
});
|
|
1293
1441
|
}
|
|
1294
1442
|
//#endregion
|
|
1295
1443
|
//#region src/components/pieChart/PieChart.tsx
|
|
1296
|
-
var
|
|
1297
|
-
function
|
|
1298
|
-
let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), m = i?.slices ?? p, { hoveredRef: h, tooltip: g, hitZonesRef: _ } =
|
|
1299
|
-
width:
|
|
1300
|
-
height:
|
|
1444
|
+
var Ze = 192, Qe = Ze, $e = Ze + 80;
|
|
1445
|
+
function et({ rows: e = [], variant: t, className: r, colors: i }) {
|
|
1446
|
+
let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), m = i?.slices ?? p, { hoveredRef: h, tooltip: g, hitZonesRef: _ } = O(o, {
|
|
1447
|
+
width: Qe,
|
|
1448
|
+
height: $e
|
|
1301
1449
|
});
|
|
1302
1450
|
return n(() => {
|
|
1303
1451
|
let n = o.current;
|
|
1304
1452
|
if (!n) return;
|
|
1305
|
-
let r =
|
|
1453
|
+
let r = S(n, Qe, $e);
|
|
1306
1454
|
f.current = 0;
|
|
1307
|
-
let i =
|
|
1455
|
+
let i = Qe / 2, a = Ze / 2, s = Ze * .4, c = t === "donut" ? Ze * .21 : 0, l = e.reduce((e, t) => e + (t.pricing ?? 0), 0) || 1, p, g = () => {
|
|
1308
1456
|
f.current++;
|
|
1309
1457
|
let n = f.current;
|
|
1310
|
-
r.clearRect(0, 0,
|
|
1458
|
+
r.clearRect(0, 0, Qe, $e);
|
|
1311
1459
|
let o = 1 - (1 - Math.min(n / 48, 1)) ** 3;
|
|
1312
|
-
|
|
1313
|
-
let
|
|
1460
|
+
L(d.current, h.current), _.current = [];
|
|
1461
|
+
let v = -Math.PI / 2;
|
|
1314
1462
|
e.forEach((e, t) => {
|
|
1315
|
-
let f = (e.pricing ?? 0) / l, p = f * Math.PI * 2 * o, h =
|
|
1316
|
-
|
|
1463
|
+
let f = (e.pricing ?? 0) / l, p = f * Math.PI * 2 * o, h = v + p, g = m[t % m.length], b = d.current.get(e.id ?? `sl-${t}`) ?? 0, x = v + p / 2, S = (s + c) / 2, w = i + Math.cos(x) * S, T = a + Math.sin(x) * S, E = (s - c) / 2 + 8;
|
|
1464
|
+
k(_.current, e.id ?? `sl-${t}`, w, T, E, {
|
|
1317
1465
|
label: e.vendor,
|
|
1318
1466
|
value: `${e.pricing ?? 0} (${Math.round(f * 100)}%)`,
|
|
1319
1467
|
color: g
|
|
1320
|
-
}), b > 0 &&
|
|
1321
|
-
let D =
|
|
1322
|
-
r.beginPath(), r.moveTo(i + Math.cos(
|
|
1323
|
-
}), t === "donut" && e.length > 0 &&
|
|
1324
|
-
let
|
|
1468
|
+
}), b > 0 && C(r, w, T, E * 2 * b, g, .2 * b);
|
|
1469
|
+
let D = F(n, .03, 3e-4), O = s + b * 6 + (b > 0 ? D * 2 : 0);
|
|
1470
|
+
r.beginPath(), r.moveTo(i + Math.cos(v) * c, a + Math.sin(v) * c), r.arc(i, a, O, v, h), c > 0 ? r.arc(i, a, c, h, v, !0) : r.lineTo(i, a), r.closePath(), r.fillStyle = y(g, .7 + b * .2), r.fill(), r.strokeStyle = y(u.bg, .8), r.lineWidth = 1.5, r.stroke(), v = h;
|
|
1471
|
+
}), t === "donut" && e.length > 0 && C(r, i, a, c * .8, u.blue, .06);
|
|
1472
|
+
let b = Ze + 12;
|
|
1325
1473
|
e.forEach((e, t) => {
|
|
1326
|
-
let n = m[t % m.length], i = (e.pricing ?? 0) / l, a = d.current.get(e.id ?? `sl-${t}`) ?? 0, o =
|
|
1327
|
-
r.fillStyle =
|
|
1474
|
+
let n = m[t % m.length], i = (e.pricing ?? 0) / l, a = d.current.get(e.id ?? `sl-${t}`) ?? 0, o = b + t * 18;
|
|
1475
|
+
r.fillStyle = y(n, .8 + a * .2), r.fillRect(4, o - 6, 12, 12), r.font = "9px 'JetBrains Mono', monospace", r.fillStyle = y(u.t2, .7 + a * .2), r.textAlign = "left", r.fillText(e.vendor, 18, o + 3.5), r.font = "bold 9px 'JetBrains Mono', monospace", r.fillStyle = x(u.t3, n, a), r.textAlign = "right", r.fillText(`${e.pricing ?? 0} (${Math.round(i * 100)}%)`, Qe - 4, o + 3.5);
|
|
1328
1476
|
}), p = requestAnimationFrame(g);
|
|
1329
1477
|
};
|
|
1330
1478
|
return g(), () => cancelAnimationFrame(p);
|
|
@@ -1338,30 +1486,30 @@ function nt({ rows: e = [], variant: t, className: r, colors: i }) {
|
|
|
1338
1486
|
children: /* @__PURE__ */ c("div", {
|
|
1339
1487
|
style: {
|
|
1340
1488
|
position: "relative",
|
|
1341
|
-
width:
|
|
1342
|
-
height:
|
|
1489
|
+
width: Qe,
|
|
1490
|
+
height: $e
|
|
1343
1491
|
},
|
|
1344
1492
|
children: [/* @__PURE__ */ s("canvas", {
|
|
1345
1493
|
ref: o,
|
|
1346
1494
|
role: "img",
|
|
1347
1495
|
"aria-label": `${t} chart`,
|
|
1348
1496
|
style: {
|
|
1349
|
-
width:
|
|
1350
|
-
height:
|
|
1497
|
+
width: Qe,
|
|
1498
|
+
height: $e,
|
|
1351
1499
|
display: "block",
|
|
1352
1500
|
borderRadius: 8
|
|
1353
1501
|
}
|
|
1354
|
-
}), /* @__PURE__ */ s(
|
|
1502
|
+
}), /* @__PURE__ */ s(D, {
|
|
1355
1503
|
...g,
|
|
1356
|
-
parentW:
|
|
1357
|
-
parentH:
|
|
1504
|
+
parentW: Qe,
|
|
1505
|
+
parentH: $e
|
|
1358
1506
|
})]
|
|
1359
1507
|
})
|
|
1360
1508
|
});
|
|
1361
1509
|
}
|
|
1362
1510
|
//#endregion
|
|
1363
1511
|
//#region src/components/sankey/SankeySvg.tsx
|
|
1364
|
-
function
|
|
1512
|
+
function tt(e, t, n, r) {
|
|
1365
1513
|
let i = new Set(t.map((e) => e.source)), a = new Set(t.map((e) => e.target)), o = /* @__PURE__ */ new Map(), s = [];
|
|
1366
1514
|
for (e.forEach((e) => {
|
|
1367
1515
|
i.has(e.id) && !a.has(e.id) && s.push({
|
|
@@ -1406,38 +1554,38 @@ function rt(e, t, n, r) {
|
|
|
1406
1554
|
});
|
|
1407
1555
|
}), f;
|
|
1408
1556
|
}
|
|
1409
|
-
function
|
|
1410
|
-
let g = a(null), _ = a(/* @__PURE__ */ new Map()),
|
|
1557
|
+
function nt({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d, selectedEntity: f, className: m, colors: h }) {
|
|
1558
|
+
let g = a(null), _ = a(/* @__PURE__ */ new Map()), v = a(0), b = a([]), x = h?.nodes ?? p, w = h?.links ?? u.bd, E = h?.activeLinks ?? u.blue, j = h?.activeNodes ?? u.blue, M = i(() => tt(e, t, r, o), [
|
|
1411
1559
|
e,
|
|
1412
1560
|
t,
|
|
1413
1561
|
r,
|
|
1414
1562
|
o
|
|
1415
|
-
]), { hoveredRef: N, tooltip:
|
|
1563
|
+
]), { hoveredRef: N, tooltip: P, hitZonesRef: I } = O(g, {
|
|
1416
1564
|
width: r,
|
|
1417
1565
|
height: o
|
|
1418
1566
|
});
|
|
1419
1567
|
return n(() => {
|
|
1420
1568
|
let n = g.current;
|
|
1421
1569
|
if (!n) return;
|
|
1422
|
-
let i =
|
|
1423
|
-
|
|
1570
|
+
let i = S(n, r, o);
|
|
1571
|
+
v.current = 0, b.current = [];
|
|
1424
1572
|
let a = t.length > 0 ? Math.max(...t.map((e) => e.value)) : 1, s, c = () => {
|
|
1425
|
-
|
|
1426
|
-
let n =
|
|
1573
|
+
v.current++;
|
|
1574
|
+
let n = v.current;
|
|
1427
1575
|
i.clearRect(0, 0, r, o);
|
|
1428
1576
|
let l = 1 - (1 - Math.min(n / 56, 1)) ** 3;
|
|
1429
|
-
|
|
1577
|
+
L(_.current, N.current), I.current = [], t.forEach((e, t) => {
|
|
1430
1578
|
let r = M.get(e.source), o = M.get(e.target);
|
|
1431
1579
|
if (!r || !o) return;
|
|
1432
|
-
let s = !!f && (e.source === f || e.target === f), c = s ?
|
|
1580
|
+
let s = !!f && (e.source === f || e.target === f), c = s ? E : w, d = s ? .5 : .2, p = Math.max(3, e.value / a * 36 * l), m = p / 2, h = r.x + r.w, g = r.y + r.h / 2, _ = o.x, v = o.y + o.h / 2, x = (h + _) / 2;
|
|
1433
1581
|
for (let e = 0; e < 30; e++) {
|
|
1434
|
-
let r = e / 30, a = (e + 1) / 30, o = 1 - r, s = 1 - a, l = o * o * h + 2 * o * r * x + r * r * _, u = o * o * g + 2 * o * r * g + r * r *
|
|
1435
|
-
i.beginPath(), i.moveTo(l, u - m + b), i.lineTo(f, p - m + b), i.lineTo(f, p + m + b), i.lineTo(l, u + m + b), i.closePath(), i.fillStyle =
|
|
1582
|
+
let r = e / 30, a = (e + 1) / 30, o = 1 - r, s = 1 - a, l = o * o * h + 2 * o * r * x + r * r * _, u = o * o * g + 2 * o * r * g + r * r * v, f = s * s * h + 2 * s * a * x + a * a * _, p = s * s * g + 2 * s * a * g + a * a * v, b = F(n + r * 120 + t * 40, .025, 3e-4) * 1.2;
|
|
1583
|
+
i.beginPath(), i.moveTo(l, u - m + b), i.lineTo(f, p - m + b), i.lineTo(f, p + m + b), i.lineTo(l, u + m + b), i.closePath(), i.fillStyle = y(c, d * (.5 + r * .5)), i.fill();
|
|
1436
1584
|
}
|
|
1437
|
-
|
|
1585
|
+
k(I.current, `link-${t}`, x, (g + v) / 2, p + 6, {
|
|
1438
1586
|
label: `${e.source} → ${e.target}`,
|
|
1439
1587
|
value: String(e.value),
|
|
1440
|
-
color: s ?
|
|
1588
|
+
color: s ? E : u.blue
|
|
1441
1589
|
}), Math.random() < .08 && b.current.push({
|
|
1442
1590
|
linkIdx: t,
|
|
1443
1591
|
prog: 0,
|
|
@@ -1448,16 +1596,16 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
|
|
|
1448
1596
|
}), e.forEach((e, t) => {
|
|
1449
1597
|
let r = M.get(e.id);
|
|
1450
1598
|
if (!r) return;
|
|
1451
|
-
let a = f === e.id, o = N.current === `node-${t}`, s = _.current.get(`node-${t}`) ?? 0, c = a ? j :
|
|
1452
|
-
|
|
1599
|
+
let a = f === e.id, o = N.current === `node-${t}`, s = _.current.get(`node-${t}`) ?? 0, c = a ? j : x[t % x.length];
|
|
1600
|
+
A(I.current, `node-${t}`, r.x, r.y, r.w, r.h, {
|
|
1453
1601
|
label: e.name,
|
|
1454
1602
|
value: e.valueLabel ?? e.id,
|
|
1455
1603
|
color: c
|
|
1456
|
-
}), (s > 0 || a) &&
|
|
1457
|
-
let l = a ?
|
|
1458
|
-
i.fillStyle =
|
|
1604
|
+
}), (s > 0 || a) && C(i, r.x + r.w / 2, r.y + r.h / 2, r.w * 2, c, .2 * Math.max(s, a ? .6 : 0));
|
|
1605
|
+
let l = a ? F(n, .03, 3e-4) * .15 : 0;
|
|
1606
|
+
i.fillStyle = y(c, .6 + s * .25 + l), i.beginPath(), i.roundRect(r.x, r.y, r.w, r.h, 4), i.fill(), (a || s > 0) && (i.strokeStyle = y(c, .5 * Math.max(s, a ? 1 : 0)), i.lineWidth = 1, i.beginPath(), i.roundRect(r.x, r.y, r.w, r.h, 4), i.stroke());
|
|
1459
1607
|
let d = r.x + r.w + 8;
|
|
1460
|
-
i.font = `${a || o ? "bold " : ""}10px 'JetBrains Mono', monospace`, i.fillStyle =
|
|
1608
|
+
i.font = `${a || o ? "bold " : ""}10px 'JetBrains Mono', monospace`, i.fillStyle = y(a ? c : u.t2, .7 + s * .2), i.textAlign = "left", i.fillText(e.name, d, r.y + r.h / 2 + 4), e.valueLabel && (i.font = "9px 'JetBrains Mono', monospace", i.fillStyle = y(c, .5 + s * .2), i.fillText(e.valueLabel, d, r.y + r.h / 2 + 17));
|
|
1461
1609
|
}), b.current = b.current.filter((e) => {
|
|
1462
1610
|
if (e.prog += e.speed, e.prog > 1) return !1;
|
|
1463
1611
|
let n = t[e.linkIdx];
|
|
@@ -1465,8 +1613,8 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
|
|
|
1465
1613
|
let r = M.get(n.source), a = M.get(n.target);
|
|
1466
1614
|
if (!r || !a) return !1;
|
|
1467
1615
|
let o = r.x + r.w, s = r.y + r.h / 2, c = a.x, l = a.y + a.h / 2, d = (o + c) / 2, f = 1 - e.prog, p = f * f * o + 2 * f * e.prog * d + e.prog * e.prog * c, m = f * f * s + 2 * f * e.prog * s + e.prog * e.prog * l + e.off, g = Math.sin(e.prog * Math.PI) * .5, _ = h?.links ?? u.blue;
|
|
1468
|
-
return i.beginPath(), i.arc(p, m, e.sz, 0, Math.PI * 2), i.fillStyle =
|
|
1469
|
-
}), b.current.length > 150 && (b.current = b.current.slice(-150)),
|
|
1616
|
+
return i.beginPath(), i.arc(p, m, e.sz, 0, Math.PI * 2), i.fillStyle = y(_, g), i.fill(), !0;
|
|
1617
|
+
}), b.current.length > 150 && (b.current = b.current.slice(-150)), T(i, r, o, n, .01), s = requestAnimationFrame(c);
|
|
1470
1618
|
};
|
|
1471
1619
|
return c(), () => {
|
|
1472
1620
|
cancelAnimationFrame(s), b.current = [];
|
|
@@ -1497,8 +1645,8 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
|
|
|
1497
1645
|
display: "block",
|
|
1498
1646
|
borderRadius: 8
|
|
1499
1647
|
}
|
|
1500
|
-
}), /* @__PURE__ */ s(
|
|
1501
|
-
...
|
|
1648
|
+
}), /* @__PURE__ */ s(D, {
|
|
1649
|
+
...P,
|
|
1502
1650
|
parentW: r,
|
|
1503
1651
|
parentH: o
|
|
1504
1652
|
})]
|
|
@@ -1507,7 +1655,7 @@ function it({ nodes: e, links: t, width: r = 960, height: o = 280, ariaLabel: d,
|
|
|
1507
1655
|
}
|
|
1508
1656
|
//#endregion
|
|
1509
1657
|
//#region src/canvas/CausalFlowCanvas.tsx
|
|
1510
|
-
var
|
|
1658
|
+
var rt = [
|
|
1511
1659
|
{
|
|
1512
1660
|
x: .13,
|
|
1513
1661
|
y: .48
|
|
@@ -1540,7 +1688,7 @@ var at = [
|
|
|
1540
1688
|
x: .92,
|
|
1541
1689
|
y: .22
|
|
1542
1690
|
}
|
|
1543
|
-
],
|
|
1691
|
+
], it = [
|
|
1544
1692
|
u.blue,
|
|
1545
1693
|
u.orange,
|
|
1546
1694
|
u.red,
|
|
@@ -1548,7 +1696,7 @@ var at = [
|
|
|
1548
1696
|
u.green,
|
|
1549
1697
|
u.amber,
|
|
1550
1698
|
u.t2
|
|
1551
|
-
],
|
|
1699
|
+
], at = [
|
|
1552
1700
|
26,
|
|
1553
1701
|
24,
|
|
1554
1702
|
24,
|
|
@@ -1558,21 +1706,21 @@ var at = [
|
|
|
1558
1706
|
22,
|
|
1559
1707
|
22
|
|
1560
1708
|
];
|
|
1561
|
-
function
|
|
1709
|
+
function ot(e, t) {
|
|
1562
1710
|
let n = 1 - t;
|
|
1563
1711
|
return {
|
|
1564
1712
|
x: n * n * n * e.p0.x + 3 * n * n * t * e.p1.x + 3 * n * t * t * e.p2.x + t * t * t * e.p3.x,
|
|
1565
1713
|
y: n * n * n * e.p0.y + 3 * n * n * t * e.p1.y + 3 * n * t * t * e.p2.y + t * t * t * e.p3.y
|
|
1566
1714
|
};
|
|
1567
1715
|
}
|
|
1568
|
-
function
|
|
1716
|
+
function st(e, t) {
|
|
1569
1717
|
let n = 1 - t, r = 3 * n * n * (e.p1.x - e.p0.x) + 6 * n * t * (e.p2.x - e.p1.x) + 3 * t * t * (e.p3.x - e.p2.x), i = 3 * n * n * (e.p1.y - e.p0.y) + 6 * n * t * (e.p2.y - e.p1.y) + 3 * t * t * (e.p3.y - e.p2.y), a = Math.sqrt(r * r + i * i) || 1;
|
|
1570
1718
|
return {
|
|
1571
1719
|
x: -i / a,
|
|
1572
1720
|
y: r / a
|
|
1573
1721
|
};
|
|
1574
1722
|
}
|
|
1575
|
-
function
|
|
1723
|
+
function ct(e, t) {
|
|
1576
1724
|
let n = t.x - e.x, r = t.y - e.y;
|
|
1577
1725
|
return {
|
|
1578
1726
|
p0: {
|
|
@@ -1593,46 +1741,46 @@ function ut(e, t) {
|
|
|
1593
1741
|
}
|
|
1594
1742
|
};
|
|
1595
1743
|
}
|
|
1596
|
-
function
|
|
1597
|
-
let d = a(null), f = a(0), p = a([]), { hoveredRef: m, tooltip: h, hitZonesRef: g } =
|
|
1744
|
+
function lt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntity: l }) {
|
|
1745
|
+
let d = a(null), f = a(0), p = a([]), { hoveredRef: m, tooltip: h, hitZonesRef: g } = O(d, {
|
|
1598
1746
|
width: r,
|
|
1599
1747
|
height: o
|
|
1600
1748
|
}), _ = i(() => {
|
|
1601
1749
|
let t = /* @__PURE__ */ new Map();
|
|
1602
1750
|
return e.forEach((e, n) => t.set(e.id, n)), t;
|
|
1603
|
-
}, [e]),
|
|
1604
|
-
let n =
|
|
1751
|
+
}, [e]), v = i(() => t.length > 0 ? Math.max(...t.map((e) => e.value)) : 100, [t]), b = (e) => v > 1 ? e / 100 : e, E = i(() => e.map((e, t) => {
|
|
1752
|
+
let n = rt[t % rt.length];
|
|
1605
1753
|
return {
|
|
1606
1754
|
id: e.id,
|
|
1607
1755
|
label: e.name,
|
|
1608
1756
|
sub: e.valueLabel ?? "",
|
|
1609
1757
|
x: n.x * r,
|
|
1610
1758
|
y: n.y * o,
|
|
1611
|
-
r:
|
|
1612
|
-
color:
|
|
1759
|
+
r: at[t % at.length],
|
|
1760
|
+
color: it[t % it.length]
|
|
1613
1761
|
};
|
|
1614
1762
|
}), [
|
|
1615
1763
|
e,
|
|
1616
1764
|
r,
|
|
1617
1765
|
o
|
|
1618
|
-
]),
|
|
1766
|
+
]), A = i(() => t.map((e) => ({
|
|
1619
1767
|
fromIdx: _.get(e.source) ?? -1,
|
|
1620
1768
|
toIdx: _.get(e.target) ?? -1,
|
|
1621
|
-
conf:
|
|
1769
|
+
conf: b(e.value)
|
|
1622
1770
|
})).filter((e) => e.fromIdx >= 0 && e.toIdx >= 0), [t, _]);
|
|
1623
1771
|
return n(() => {
|
|
1624
1772
|
let e = d.current;
|
|
1625
1773
|
if (!e) return;
|
|
1626
|
-
let t =
|
|
1774
|
+
let t = S(e, r, o);
|
|
1627
1775
|
f.current = 0, p.current = [];
|
|
1628
1776
|
let n, i = () => {
|
|
1629
1777
|
f.current++;
|
|
1630
1778
|
let e = f.current;
|
|
1631
|
-
if (t.clearRect(0, 0, r, o), g.current = [],
|
|
1632
|
-
let r =
|
|
1779
|
+
if (t.clearRect(0, 0, r, o), g.current = [], w(t, r, o, e, 50, y(u.blue, .05)), A.forEach((e, n) => {
|
|
1780
|
+
let r = E[e.fromIdx], i = E[e.toIdx];
|
|
1633
1781
|
if (!r || !i) return;
|
|
1634
|
-
let a = !!l && (r.id === l || i.id === l), o =
|
|
1635
|
-
t.beginPath(), t.moveTo(d.p0.x, d.p0.y), t.bezierCurveTo(d.p1.x, d.p1.y, d.p2.x, d.p2.y, d.p3.x, d.p3.y), t.strokeStyle =
|
|
1782
|
+
let a = !!l && (r.id === l || i.id === l), o = x(r.color, i.color, .5), s = a ? .18 : .05, c = a ? .25 : .1, d = ct(r, i);
|
|
1783
|
+
t.beginPath(), t.moveTo(d.p0.x, d.p0.y), t.bezierCurveTo(d.p1.x, d.p1.y, d.p2.x, d.p2.y, d.p3.x, d.p3.y), t.strokeStyle = y(o, s), t.lineWidth = 16, t.lineCap = "round", t.stroke(), t.strokeStyle = y(o, c), t.lineWidth = 1.5, t.stroke();
|
|
1636
1784
|
for (let t = 0; t < e.conf * 2.5; t++) Math.random() < .45 && p.current.push({
|
|
1637
1785
|
edgeIdx: n,
|
|
1638
1786
|
t: 0,
|
|
@@ -1640,45 +1788,45 @@ function dt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntit
|
|
|
1640
1788
|
off: (Math.random() - .5) * 13,
|
|
1641
1789
|
sz: .7 + Math.random() * 2
|
|
1642
1790
|
});
|
|
1643
|
-
let f =
|
|
1791
|
+
let f = ot(d, .5), m = `${Math.round(e.conf * 100)}%`;
|
|
1644
1792
|
t.font = "bold 12px 'JetBrains Mono', monospace", t.textBaseline = "middle";
|
|
1645
1793
|
let h = t.measureText(m).width + 14;
|
|
1646
|
-
t.fillStyle = "rgba(10,16,24,0.88)", t.beginPath(), t.roundRect(f.x - h / 2, f.y - 11, h, 22, 6), t.fill(), t.strokeStyle =
|
|
1794
|
+
t.fillStyle = "rgba(10,16,24,0.88)", t.beginPath(), t.roundRect(f.x - h / 2, f.y - 11, h, 22, 6), t.fill(), t.strokeStyle = y(u.blue, .25), t.lineWidth = 1, t.stroke(), t.fillStyle = y(u.blue, .9), t.textAlign = "center", t.fillText(m, f.x, f.y);
|
|
1647
1795
|
}), p.current = p.current.filter((e) => {
|
|
1648
1796
|
if (e.t += e.speed, e.t > 1) return !1;
|
|
1649
|
-
let n =
|
|
1797
|
+
let n = A[e.edgeIdx];
|
|
1650
1798
|
if (!n) return !1;
|
|
1651
|
-
let r =
|
|
1799
|
+
let r = E[n.fromIdx], i = E[n.toIdx];
|
|
1652
1800
|
if (!r || !i) return !1;
|
|
1653
|
-
let a =
|
|
1654
|
-
return
|
|
1655
|
-
}), p.current.length > 350 && (p.current = p.current.slice(-350)),
|
|
1656
|
-
let i = l === n.id, a = m.current === `node-${r}`, o =
|
|
1657
|
-
t.beginPath(), t.arc(n.x, n.y, s + 6, 0, Math.PI * 2), t.strokeStyle =
|
|
1801
|
+
let a = ct(r, i), o = ot(a, e.t), s = st(a, e.t), c = o.x + s.x * e.off, l = o.y + s.y * e.off, u = Math.sin(e.t * Math.PI) * .7, d = x(r.color, i.color, e.t);
|
|
1802
|
+
return C(t, c, l, e.sz * 3, d, u * .1), t.beginPath(), t.arc(c, l, e.sz, 0, Math.PI * 2), t.fillStyle = y(d, u), t.fill(), !0;
|
|
1803
|
+
}), p.current.length > 350 && (p.current = p.current.slice(-350)), E.forEach((n, r) => {
|
|
1804
|
+
let i = l === n.id, a = m.current === `node-${r}`, o = F(e, .03, 3e-4) * .1 + 1, s = n.r * o * (i ? 1.15 : 1);
|
|
1805
|
+
t.beginPath(), t.arc(n.x, n.y, s + 6, 0, Math.PI * 2), t.strokeStyle = y(n.color, i ? .3 : .1), t.lineWidth = i ? 1.5 : .7, t.stroke(), C(t, n.x, n.y, s * 3, n.color, i ? .22 : .12);
|
|
1658
1806
|
let c = t.createRadialGradient(n.x, n.y - s * .2, 0, n.x, n.y, s);
|
|
1659
|
-
if (c.addColorStop(0,
|
|
1807
|
+
if (c.addColorStop(0, y(n.color, i ? 1 : .85)), c.addColorStop(1, y(n.color, i ? .65 : .45)), t.fillStyle = c, t.beginPath(), t.arc(n.x, n.y, s, 0, Math.PI * 2), t.fill(), i || r === E.length - 1) {
|
|
1660
1808
|
let r = s + 16, i = e * .04, a = n.x + Math.cos(i) * r, o = n.y + Math.sin(i) * r;
|
|
1661
|
-
|
|
1809
|
+
C(t, a, o, 6, n.color, .3), t.beginPath(), t.arc(a, o, 2, 0, Math.PI * 2), t.fillStyle = y(n.color, .75), t.fill();
|
|
1662
1810
|
}
|
|
1663
|
-
|
|
1811
|
+
k(g.current, `node-${r}`, n.x, n.y, s + 8, {
|
|
1664
1812
|
label: n.label,
|
|
1665
1813
|
value: n.sub || n.id,
|
|
1666
1814
|
color: n.color
|
|
1667
|
-
}), t.font = `${i || a ? "bold " : ""}12px 'DM Sans', sans-serif`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle =
|
|
1668
|
-
}),
|
|
1669
|
-
let n =
|
|
1670
|
-
t.fillStyle =
|
|
1671
|
-
let l =
|
|
1672
|
-
t.textAlign = "right", t.font = "9px 'JetBrains Mono', monospace", t.fillStyle =
|
|
1815
|
+
}), t.font = `${i || a ? "bold " : ""}12px 'DM Sans', sans-serif`, t.textAlign = "center", t.textBaseline = "alphabetic", t.fillStyle = y(n.color, i ? 1 : .9), t.fillText(n.label, n.x, n.y + s + 18), n.sub && (t.font = "10px 'JetBrains Mono', monospace", t.fillStyle = y(u.t3, .65), t.fillText(n.sub, n.x, n.y + s + 32));
|
|
1816
|
+
}), A.length >= 2) {
|
|
1817
|
+
let n = A.reduce((e, t) => e * t.conf, 1), i = o * .92, a = r * .12, s = r * .76, c = j(Math.min(e * .008, 1));
|
|
1818
|
+
t.fillStyle = y(u.bd, .35), t.beginPath(), t.roundRect(a, i, s, 5, 3), t.fill(), t.fillStyle = y(u.orange, .6), t.beginPath(), t.roundRect(a, i, s * n * c, 5, 3), t.fill(), t.font = "bold 12px 'JetBrains Mono', monospace", t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = y(u.orange, .85), t.fillText(`${Math.round(n * 100)}% compound confidence`, a + s * n * c + 10, i + 2);
|
|
1819
|
+
let l = A.map((e) => e.conf.toFixed(2)).join(" × ");
|
|
1820
|
+
t.textAlign = "right", t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = y(u.t4, .6), t.fillText(l, a - 6, i + 2);
|
|
1673
1821
|
}
|
|
1674
|
-
|
|
1822
|
+
T(t, r, o, e, .012), n = requestAnimationFrame(i);
|
|
1675
1823
|
};
|
|
1676
1824
|
return i(), () => {
|
|
1677
1825
|
cancelAnimationFrame(n), p.current = [];
|
|
1678
1826
|
};
|
|
1679
1827
|
}, [
|
|
1680
|
-
|
|
1681
|
-
|
|
1828
|
+
E,
|
|
1829
|
+
A,
|
|
1682
1830
|
r,
|
|
1683
1831
|
o,
|
|
1684
1832
|
l
|
|
@@ -1698,7 +1846,7 @@ function dt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntit
|
|
|
1698
1846
|
},
|
|
1699
1847
|
role: "img",
|
|
1700
1848
|
"aria-label": "causal flow diagram"
|
|
1701
|
-
}), /* @__PURE__ */ s(
|
|
1849
|
+
}), /* @__PURE__ */ s(D, {
|
|
1702
1850
|
...h,
|
|
1703
1851
|
parentW: r,
|
|
1704
1852
|
parentH: o
|
|
@@ -1707,10 +1855,10 @@ function dt({ nodes: e, links: t, width: r = 960, height: o = 280, selectedEntit
|
|
|
1707
1855
|
}
|
|
1708
1856
|
//#endregion
|
|
1709
1857
|
//#region src/components/sankey/ProcessSankey.tsx
|
|
1710
|
-
function
|
|
1711
|
-
return /* @__PURE__ */ s(
|
|
1712
|
-
nodes:
|
|
1713
|
-
links:
|
|
1858
|
+
function ut({ selectedEntity: e, colors: t }) {
|
|
1859
|
+
return /* @__PURE__ */ s(lt, {
|
|
1860
|
+
nodes: We.nodes,
|
|
1861
|
+
links: We.links,
|
|
1714
1862
|
width: 960,
|
|
1715
1863
|
height: 280,
|
|
1716
1864
|
selectedEntity: e
|
|
@@ -1718,7 +1866,7 @@ function ft({ selectedEntity: e, colors: t }) {
|
|
|
1718
1866
|
}
|
|
1719
1867
|
//#endregion
|
|
1720
1868
|
//#region src/components/sankey/RankingSankey.tsx
|
|
1721
|
-
function
|
|
1869
|
+
function dt({ rows: e = [], className: t, colors: n }) {
|
|
1722
1870
|
let { nodes: r, links: a } = i(() => {
|
|
1723
1871
|
let t = e.slice(0, 5);
|
|
1724
1872
|
return {
|
|
@@ -1736,7 +1884,7 @@ function pt({ rows: e = [], className: t, colors: n }) {
|
|
|
1736
1884
|
}))
|
|
1737
1885
|
};
|
|
1738
1886
|
}, [e]);
|
|
1739
|
-
return /* @__PURE__ */ s(
|
|
1887
|
+
return /* @__PURE__ */ s(nt, {
|
|
1740
1888
|
nodes: r,
|
|
1741
1889
|
links: a,
|
|
1742
1890
|
width: 760,
|
|
@@ -1748,96 +1896,137 @@ function pt({ rows: e = [], className: t, colors: n }) {
|
|
|
1748
1896
|
}
|
|
1749
1897
|
//#endregion
|
|
1750
1898
|
//#region src/components/balanceScaleChart/BalanceScaleChart.tsx
|
|
1751
|
-
var
|
|
1752
|
-
function
|
|
1753
|
-
let
|
|
1899
|
+
var ft = 780, pt = 420;
|
|
1900
|
+
function mt({ left: e, right: r, leftTitle: i = "Accepted", rightTitle: o = "Submitted", unit: l = "quotations", selectedId: d, dataByEntity: f, onItemClick: p, testID: m }) {
|
|
1901
|
+
let h = a(null), _ = a(0), v = d && f?.[d] ? f[d] : {
|
|
1902
|
+
left: e,
|
|
1903
|
+
right: r
|
|
1904
|
+
}, b = v.left, x = v.right, w = a({
|
|
1905
|
+
left: b,
|
|
1906
|
+
right: x,
|
|
1907
|
+
leftTitle: i,
|
|
1908
|
+
rightTitle: o
|
|
1909
|
+
});
|
|
1910
|
+
w.current = {
|
|
1911
|
+
left: b,
|
|
1912
|
+
right: x,
|
|
1913
|
+
leftTitle: i,
|
|
1914
|
+
rightTitle: o
|
|
1915
|
+
};
|
|
1916
|
+
let T = a(d);
|
|
1917
|
+
T.current = d;
|
|
1918
|
+
let E = t((e, t) => {
|
|
1919
|
+
let n = typeof t == "object" ? t.label ?? e : e, r = e === "left" ? w.current.left : w.current.right;
|
|
1920
|
+
p?.(e, n, r?.subentity);
|
|
1921
|
+
}, [p]), { hitZonesRef: k, tooltip: M, hoveredRef: N } = O(h, {
|
|
1922
|
+
width: ft,
|
|
1923
|
+
height: pt,
|
|
1924
|
+
onClick: p ? E : void 0
|
|
1925
|
+
});
|
|
1754
1926
|
return n(() => {
|
|
1755
|
-
let
|
|
1756
|
-
if (!
|
|
1757
|
-
let
|
|
1758
|
-
|
|
1759
|
-
let
|
|
1760
|
-
let o =
|
|
1927
|
+
let e = h.current;
|
|
1928
|
+
if (!e) return;
|
|
1929
|
+
let t = S(e, ft, pt);
|
|
1930
|
+
_.current = 0;
|
|
1931
|
+
let n = ft / 2, r = Math.abs(b.value ?? 0), a = Math.abs(x.value ?? 0), s = Math.max(r, a, 1), c = (b.value - x.value) / (2 * s) * 14, d = Math.max(-14, Math.min(14, c)), f = (e, n, r, i, a) => {
|
|
1932
|
+
let o = n - 99 / 2, s = r + 30, c = [
|
|
1761
1933
|
0,
|
|
1762
1934
|
0,
|
|
1763
1935
|
10,
|
|
1764
1936
|
10
|
|
1765
1937
|
];
|
|
1766
|
-
|
|
1767
|
-
let l =
|
|
1768
|
-
f.addColorStop(0, l), f.addColorStop(1, d),
|
|
1769
|
-
let p =
|
|
1770
|
-
p.addColorStop(0, l), p.addColorStop(1, d),
|
|
1771
|
-
let m =
|
|
1772
|
-
m.addColorStop(0, l), m.addColorStop(1, d),
|
|
1773
|
-
let h =
|
|
1774
|
-
h.addColorStop(0, l), h.addColorStop(1, d),
|
|
1938
|
+
t.save(), t.beginPath(), t.roundRect(o, s, 99, i, c), t.clip();
|
|
1939
|
+
let l = y(e, .27 * a), d = y(e, 0), f = t.createLinearGradient(o, 0, o + 25, 0);
|
|
1940
|
+
f.addColorStop(0, l), f.addColorStop(1, d), t.fillStyle = f, t.fillRect(o, s, 25, i);
|
|
1941
|
+
let p = t.createLinearGradient(o + 99, 0, o + 99 - 25, 0);
|
|
1942
|
+
p.addColorStop(0, l), p.addColorStop(1, d), t.fillStyle = p, t.fillRect(o + 99 - 25, s, 25, i);
|
|
1943
|
+
let m = t.createLinearGradient(0, s, 0, s + 25);
|
|
1944
|
+
m.addColorStop(0, l), m.addColorStop(1, d), t.fillStyle = m, t.fillRect(o, s, 99, 25);
|
|
1945
|
+
let h = t.createLinearGradient(0, s + i, 0, s + i - 25);
|
|
1946
|
+
h.addColorStop(0, l), h.addColorStop(1, d), t.fillStyle = h, t.fillRect(o, s + i - 25, 99, 25), t.restore(), t.beginPath(), t.roundRect(o, s, 99, i, c), t.strokeStyle = y(e, 1 * a), t.lineWidth = 1, t.stroke();
|
|
1775
1947
|
let g = o + 99 / 2, _ = s - 5;
|
|
1776
|
-
|
|
1777
|
-
},
|
|
1778
|
-
|
|
1779
|
-
let
|
|
1780
|
-
|
|
1781
|
-
let
|
|
1782
|
-
x:
|
|
1783
|
-
y: 100 + Math.sin(-
|
|
1784
|
-
},
|
|
1785
|
-
x:
|
|
1786
|
-
y: 100 + Math.sin(
|
|
1948
|
+
t.strokeStyle = y(u.t2, .5 * a), t.lineWidth = 1, t.beginPath(), t.moveTo(n, r + 4), t.lineTo(g, _), t.stroke(), t.beginPath(), t.moveTo(g, _), t.lineTo(g - 10, s), t.stroke(), t.beginPath(), t.moveTo(g, _), t.lineTo(g + 10, s), t.stroke(), t.beginPath(), t.arc(n, r, 3, 0, Math.PI * 2), t.fillStyle = y(u.t2, .7 * a), t.fill();
|
|
1949
|
+
}, p, m = () => {
|
|
1950
|
+
_.current++;
|
|
1951
|
+
let e = _.current;
|
|
1952
|
+
t.clearRect(0, 0, ft, pt), t.letterSpacing = g.letterSpacing, k.current = [];
|
|
1953
|
+
let c = j(Math.min(e / 80, 1)), h = d * P(Math.min(e / 80, 1)) * Math.PI / 180, v = {
|
|
1954
|
+
x: n - Math.cos(h) * 240,
|
|
1955
|
+
y: 100 + Math.sin(-h) * 240
|
|
1956
|
+
}, S = {
|
|
1957
|
+
x: n + Math.cos(h) * 240,
|
|
1958
|
+
y: 100 + Math.sin(h) * 240
|
|
1787
1959
|
};
|
|
1788
|
-
|
|
1789
|
-
let w = Math.max(20,
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1960
|
+
t.strokeStyle = y(u.t2, .55 * c), t.lineWidth = 1.5, t.beginPath(), t.moveTo(v.x, v.y), t.lineTo(S.x, S.y), t.stroke(), C(t, n, 100, 18, u.t2, .14 * c), t.beginPath(), t.arc(n, 100, 9 * c, 0, Math.PI * 2), t.fillStyle = y(u.t2, .85 * c), t.fill();
|
|
1961
|
+
let w = Math.max(20, r / s * 95 * c), E = Math.max(20, a / s * 95 * c), D = T.current === "right" ? .6 : 1, O = T.current === "left" ? .6 : 1;
|
|
1962
|
+
f(u.green, v.x, v.y, w, c * D), f(u.amber, S.x, S.y, E, c * O);
|
|
1963
|
+
let M = v.y + 30 + w, N = S.y + 30 + E;
|
|
1964
|
+
if (A(k.current, "left", v.x - 99 / 2, v.y + 30, 99, w + 90, {
|
|
1965
|
+
label: i,
|
|
1966
|
+
value: b.label,
|
|
1967
|
+
sublabel: `${b.count} ${l}`,
|
|
1968
|
+
color: u.green
|
|
1969
|
+
}, pt, v.x, M + 102), A(k.current, "right", S.x - 99 / 2, S.y + 30, 99, E + 90, {
|
|
1970
|
+
label: o,
|
|
1971
|
+
value: x.label,
|
|
1972
|
+
sublabel: `${x.count} ${l}`,
|
|
1973
|
+
color: u.amber
|
|
1974
|
+
}, pt, S.x, N + 102), c > .5) {
|
|
1975
|
+
let e = Math.min(1, (c - .5) / .5);
|
|
1976
|
+
t.textAlign = "center", t.textBaseline = "top";
|
|
1977
|
+
let n = v.y + 30 + w + 14, r = S.y + 30 + E + 14;
|
|
1978
|
+
t.globalAlpha = e * D, t.font = "700 34px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = u.t1, t.fillText(b.label, v.x, n), t.font = g.font, t.fillStyle = g.color, t.fillText(`${i} ${b.count} ${l}`, v.x, n + 42), t.globalAlpha = e * O, t.font = "700 34px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = u.t1, t.fillText(x.label, S.x, r), t.font = g.font, t.fillStyle = g.color, t.fillText(`${o} ${x.count} ${l}`, S.x, r + 42), t.globalAlpha = 1, t.textBaseline = "alphabetic";
|
|
1794
1979
|
}
|
|
1795
|
-
|
|
1980
|
+
p = requestAnimationFrame(m);
|
|
1796
1981
|
};
|
|
1797
|
-
return
|
|
1798
|
-
}, [
|
|
1799
|
-
"data-testid":
|
|
1982
|
+
return m(), () => cancelAnimationFrame(p);
|
|
1983
|
+
}, [b, x]), /* @__PURE__ */ c("div", {
|
|
1984
|
+
"data-testid": m,
|
|
1800
1985
|
style: {
|
|
1801
1986
|
position: "relative",
|
|
1802
|
-
width:
|
|
1803
|
-
|
|
1987
|
+
width: "100%",
|
|
1988
|
+
maxWidth: ft
|
|
1804
1989
|
},
|
|
1805
|
-
children: /* @__PURE__ */ s("canvas", {
|
|
1806
|
-
ref:
|
|
1990
|
+
children: [/* @__PURE__ */ s("canvas", {
|
|
1991
|
+
ref: h,
|
|
1807
1992
|
role: "img",
|
|
1808
1993
|
"aria-label": "Quotation balance — accepted vs submitted quotation value",
|
|
1809
1994
|
style: {
|
|
1810
|
-
width:
|
|
1811
|
-
|
|
1995
|
+
width: "100%",
|
|
1996
|
+
aspectRatio: `${ft} / ${pt}`,
|
|
1812
1997
|
display: "block",
|
|
1813
1998
|
borderRadius: 8
|
|
1814
1999
|
}
|
|
1815
|
-
})
|
|
2000
|
+
}), /* @__PURE__ */ s(D, {
|
|
2001
|
+
...M,
|
|
2002
|
+
parentW: ft,
|
|
2003
|
+
parentH: pt
|
|
2004
|
+
})]
|
|
1816
2005
|
});
|
|
1817
2006
|
}
|
|
1818
2007
|
//#endregion
|
|
1819
2008
|
//#region src/components/areaLineChart/AreaLineChart.tsx
|
|
1820
|
-
var
|
|
1821
|
-
function
|
|
1822
|
-
let r = a(null), o = a(/* @__PURE__ */ new Map()), l = a(0), { hoveredRef: d, tooltip: f, hitZonesRef: p } =
|
|
1823
|
-
width:
|
|
1824
|
-
height:
|
|
2009
|
+
var ht = 780, gt = 360;
|
|
2010
|
+
function _t({ points: e = [], testID: t }) {
|
|
2011
|
+
let r = a(null), o = a(/* @__PURE__ */ new Map()), l = a(0), { hoveredRef: d, tooltip: f, hitZonesRef: p } = O(r, {
|
|
2012
|
+
width: ht,
|
|
2013
|
+
height: gt
|
|
1825
2014
|
}), m = i(() => e.filter((e) => typeof e == "object" && !!e), [e]);
|
|
1826
2015
|
return n(() => {
|
|
1827
2016
|
let e = r.current;
|
|
1828
2017
|
if (!e) return;
|
|
1829
|
-
let t =
|
|
2018
|
+
let t = S(e, ht, gt);
|
|
1830
2019
|
l.current = 0;
|
|
1831
|
-
let n =
|
|
2020
|
+
let n = ht - 64 - 48, i = gt - 48 - 68, a = Math.max(...m.map((e) => e.count), 1), s = m.length, c = s > 1 ? n / (s - 1) : n, f = m.map((e, t) => ({
|
|
1832
2021
|
x: 64 + t * c,
|
|
1833
2022
|
y: 48 + i - e.count / a * i,
|
|
1834
2023
|
point: e
|
|
1835
|
-
})),
|
|
2024
|
+
})), h, _ = () => {
|
|
1836
2025
|
l.current++;
|
|
1837
2026
|
let e = l.current;
|
|
1838
|
-
t.clearRect(0, 0,
|
|
1839
|
-
let r =
|
|
1840
|
-
|
|
2027
|
+
t.clearRect(0, 0, ht, gt), t.letterSpacing = g.letterSpacing;
|
|
2028
|
+
let r = j(Math.min(e / 72, 1));
|
|
2029
|
+
L(o.current, d.current), p.current = [], [
|
|
1841
2030
|
0,
|
|
1842
2031
|
.25,
|
|
1843
2032
|
.5,
|
|
@@ -1845,8 +2034,8 @@ function yt({ points: e = [], "data-testid": t }) {
|
|
|
1845
2034
|
1
|
|
1846
2035
|
].forEach((e) => {
|
|
1847
2036
|
let r = 48 + i - e * i;
|
|
1848
|
-
t.strokeStyle =
|
|
1849
|
-
}), t.save(), t.translate(12, 48 + i / 2), t.rotate(-Math.PI / 2), t.font =
|
|
2037
|
+
t.strokeStyle = y(u.bd, .18), t.lineWidth = 1, t.setLineDash([3, 5]), t.beginPath(), t.moveTo(64, r), t.lineTo(64 + n, r), t.stroke(), t.setLineDash([]), t.font = g.font, t.fillStyle = g.color, t.textAlign = "right", t.fillText(String(Math.round(a * e)), 58, r + 3);
|
|
2038
|
+
}), t.save(), t.translate(12, 48 + i / 2), t.rotate(-Math.PI / 2), t.font = g.font, t.fillStyle = g.color, t.textAlign = "center", t.fillText("Count", 0, 0), t.restore(), t.strokeStyle = y(u.bd, .3), t.lineWidth = 1, t.setLineDash([]), t.beginPath(), t.moveTo(64, 48 + i), t.lineTo(64 + n, 48 + i), t.stroke();
|
|
1850
2039
|
let c = r * (s - 1), m = Math.floor(c) + 1;
|
|
1851
2040
|
if (m >= 2) {
|
|
1852
2041
|
t.beginPath(), t.moveTo(f[0].x, 48 + i), t.lineTo(f[0].x, f[0].y);
|
|
@@ -1857,30 +2046,30 @@ function yt({ points: e = [], "data-testid": t }) {
|
|
|
1857
2046
|
let e = f[Math.min(m - 1, s - 1)];
|
|
1858
2047
|
t.lineTo(e.x, 48 + i), t.closePath();
|
|
1859
2048
|
let n = t.createLinearGradient(0, 48, 0, 48 + i);
|
|
1860
|
-
n.addColorStop(0,
|
|
2049
|
+
n.addColorStop(0, y(u.teal, .12)), n.addColorStop(1, y(u.teal, .02)), t.fillStyle = n, t.fill();
|
|
1861
2050
|
}
|
|
1862
2051
|
t.beginPath();
|
|
1863
2052
|
for (let e = 0; e < m; e++) {
|
|
1864
2053
|
let n = c - Math.floor(c), r = e === m - 1 && e > 0 && e === Math.ceil(c), i = e === 0 || e < m - 1 ? f[e].x : f[e - 1].x + (f[e].x - f[e - 1].x) * (r ? n : 1), a = e === 0 || e < m - 1 ? f[e].y : f[e - 1].y + (f[e].y - f[e - 1].y) * (r ? n : 1);
|
|
1865
2054
|
e === 0 ? t.moveTo(i, a) : t.lineTo(i, a);
|
|
1866
2055
|
}
|
|
1867
|
-
t.strokeStyle =
|
|
2056
|
+
t.strokeStyle = y(u.teal, .85), t.lineWidth = 2, t.stroke(), f.forEach((e, n) => {
|
|
1868
2057
|
if (n >= m) return;
|
|
1869
2058
|
let r = `pt-${n}`, s = o.current.get(r) ?? 0;
|
|
1870
|
-
|
|
2059
|
+
k(p.current, r, e.x, e.y, 10, {
|
|
1871
2060
|
label: e.point.week,
|
|
1872
2061
|
value: String(e.point.count),
|
|
1873
2062
|
color: u.teal
|
|
1874
|
-
}), s > 0 &&
|
|
2063
|
+
}), s > 0 && E(t, e.x, 48, 48 + i, y(u.teal, .15 * s));
|
|
1875
2064
|
let c = e.point.count === a;
|
|
1876
|
-
(s > 0 || c) &&
|
|
1877
|
-
}),
|
|
2065
|
+
(s > 0 || c) && C(t, e.x, e.y, 14, u.teal, (c ? .3 : 0) + s * .25), t.beginPath(), t.arc(e.x, e.y, s > 0 ? 5 : 3.5, 0, Math.PI * 2), t.fillStyle = y(u.teal, s > 0 ? 1 : .8), t.fill(), (s > 0 || c) && (t.font = g.font, t.fillStyle = u.teal, t.textAlign = "center", t.fillText(String(e.point.count), e.x, e.y - 10)), t.font = g.font, t.fillStyle = s > 0 ? u.teal : g.color, t.textAlign = "center", t.fillText(e.point.week, e.x, gt - 68 + 14);
|
|
2066
|
+
}), h = requestAnimationFrame(_);
|
|
1878
2067
|
};
|
|
1879
|
-
return _(), () => cancelAnimationFrame(
|
|
1880
|
-
}, [m]), m.length < 2 ? /* @__PURE__ */ s(
|
|
1881
|
-
width:
|
|
1882
|
-
height:
|
|
1883
|
-
|
|
2068
|
+
return _(), () => cancelAnimationFrame(h);
|
|
2069
|
+
}, [m]), m.length < 2 ? /* @__PURE__ */ s(G, {
|
|
2070
|
+
width: ht,
|
|
2071
|
+
height: gt,
|
|
2072
|
+
testID: t
|
|
1884
2073
|
}) : /* @__PURE__ */ s("div", {
|
|
1885
2074
|
"data-testid": t,
|
|
1886
2075
|
className: "trend-scroll",
|
|
@@ -1891,80 +2080,80 @@ function yt({ points: e = [], "data-testid": t }) {
|
|
|
1891
2080
|
children: /* @__PURE__ */ c("div", {
|
|
1892
2081
|
style: {
|
|
1893
2082
|
position: "relative",
|
|
1894
|
-
width:
|
|
1895
|
-
height:
|
|
2083
|
+
width: ht,
|
|
2084
|
+
height: gt
|
|
1896
2085
|
},
|
|
1897
2086
|
children: [/* @__PURE__ */ s("canvas", {
|
|
1898
2087
|
ref: r,
|
|
1899
2088
|
role: "img",
|
|
1900
2089
|
"aria-label": "Trend chart — count over time",
|
|
1901
2090
|
style: {
|
|
1902
|
-
width:
|
|
1903
|
-
height:
|
|
2091
|
+
width: ht,
|
|
2092
|
+
height: gt,
|
|
1904
2093
|
display: "block"
|
|
1905
2094
|
}
|
|
1906
|
-
}), /* @__PURE__ */ s(
|
|
2095
|
+
}), /* @__PURE__ */ s(D, {
|
|
1907
2096
|
...f,
|
|
1908
|
-
parentW:
|
|
1909
|
-
parentH:
|
|
2097
|
+
parentW: ht,
|
|
2098
|
+
parentH: gt
|
|
1910
2099
|
})]
|
|
1911
2100
|
})
|
|
1912
2101
|
});
|
|
1913
2102
|
}
|
|
1914
2103
|
//#endregion
|
|
1915
2104
|
//#region src/components/trend/Trend.tsx
|
|
1916
|
-
var
|
|
1917
|
-
function
|
|
1918
|
-
let
|
|
1919
|
-
if (
|
|
2105
|
+
var vt = 680, X = 280, yt = 80, bt = 48, xt = 64, St = g.font, Ct = 12, wt = Math.PI * 2, Tt = 72, Et = 20, Dt = 5e3;
|
|
2106
|
+
function Ot({ points: e = [], selectedId: t, seriesByEntity: r, colorOffset: o = 0, testID: l }) {
|
|
2107
|
+
let d = a(null), f = a(null), p = a(0), m = t && r?.[t] ? r[t] : e, _ = i(() => m.filter((e) => typeof e == "object" && !!e), [m]), v = i(() => {
|
|
2108
|
+
if (_.length <= 1) return xt;
|
|
1920
2109
|
let e = document.createElement("canvas").getContext("2d");
|
|
1921
|
-
if (!e) return
|
|
1922
|
-
e.font =
|
|
1923
|
-
let t = Math.max(1, Math.ceil(
|
|
1924
|
-
return Math.max(
|
|
1925
|
-
}, [
|
|
1926
|
-
width:
|
|
1927
|
-
height:
|
|
2110
|
+
if (!e) return xt;
|
|
2111
|
+
e.font = St;
|
|
2112
|
+
let t = Math.max(1, Math.ceil(_.length / Et)), n = Math.max(..._.filter((e, n) => n % t === 0).map((t) => e.measureText(t.week).width));
|
|
2113
|
+
return Math.max(xt, n + Ct);
|
|
2114
|
+
}, [_]), b = Math.round(v / 2), x = bt + b + Math.max(0, _.length - 1) * v, C = Math.max(vt - yt, Math.min(x, Dt)), { tooltip: w, hitZonesRef: T } = O(d, {
|
|
2115
|
+
width: C,
|
|
2116
|
+
height: X
|
|
1928
2117
|
});
|
|
1929
2118
|
return n(() => {
|
|
1930
|
-
let e =
|
|
2119
|
+
let e = d.current;
|
|
1931
2120
|
if (!e) return;
|
|
1932
|
-
let
|
|
1933
|
-
|
|
1934
|
-
let
|
|
1935
|
-
x:
|
|
1936
|
-
y: 42 +
|
|
2121
|
+
let t = S(e, C, X), n = f.current ? S(f.current, yt, X) : null;
|
|
2122
|
+
p.current = 0;
|
|
2123
|
+
let r = h[o % h.length], i = _.length <= Tt ? Tt : Math.max(24, Math.round(Tt * (Tt / _.length))), a = C - bt, s = X - 42 - 54, c = _.length > 0 ? _.map((e) => e.count) : [0], l = Math.min(...c), m = Math.max(...c), x = m - l || 1, w = _.length, E = w > 1 ? (a - b) / (w - 1) : 0, D = Math.max(1, Math.ceil(v / E)), O = l < 0, A = O ? 42 + s - -l / x * s : 42 + s, M = b + (a - b) / 2, N = _.map((e, t) => ({
|
|
2124
|
+
x: w === 1 ? M : b + t * E,
|
|
2125
|
+
y: 42 + s - (O ? (e.count - l) / x : e.count / (m || 1)) * s,
|
|
1937
2126
|
point: e
|
|
1938
2127
|
}));
|
|
1939
|
-
if (
|
|
1940
|
-
|
|
1941
|
-
let e =
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
2128
|
+
if (n) {
|
|
2129
|
+
n.clearRect(0, 0, yt, X), n.letterSpacing = g.letterSpacing;
|
|
2130
|
+
let e = O ? [
|
|
2131
|
+
l,
|
|
2132
|
+
l + x * .25,
|
|
2133
|
+
l + x * .5,
|
|
2134
|
+
l + x * .75,
|
|
2135
|
+
m
|
|
1947
2136
|
] : [
|
|
1948
2137
|
0,
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
2138
|
+
m * .25,
|
|
2139
|
+
m * .5,
|
|
2140
|
+
m * .75,
|
|
2141
|
+
m
|
|
1953
2142
|
];
|
|
1954
|
-
e.forEach((t,
|
|
1955
|
-
let i =
|
|
1956
|
-
|
|
1957
|
-
}),
|
|
2143
|
+
e.forEach((t, r) => {
|
|
2144
|
+
let i = r / (e.length - 1), a = 42 + s - i * s;
|
|
2145
|
+
n.font = g.font, n.fillStyle = g.color, n.textAlign = "right", n.fillText(K(t), yt - 6, a + 3);
|
|
2146
|
+
}), n.save(), n.translate(12, 42 + s / 2), n.rotate(-Math.PI / 2), n.font = g.font, n.fillStyle = g.color, n.textAlign = "center", n.fillText("Count", 0, 0), n.restore();
|
|
1958
2147
|
}
|
|
1959
|
-
let
|
|
1960
|
-
|
|
1961
|
-
let
|
|
1962
|
-
|
|
1963
|
-
for (let
|
|
1964
|
-
},
|
|
1965
|
-
|
|
1966
|
-
let e = Math.min(
|
|
1967
|
-
|
|
2148
|
+
let P = t.createLinearGradient(0, 42, 0, 42 + s);
|
|
2149
|
+
P.addColorStop(0, y(r, .12)), P.addColorStop(1, y(r, .02));
|
|
2150
|
+
let F = 0, I, L = (e) => {
|
|
2151
|
+
t.font = St, t.fillStyle = g.color, t.textAlign = "center";
|
|
2152
|
+
for (let n = 0; n < e; n++) n % D === 0 && t.fillText(N[n].point.week, N[n].x, X - 54 + 14);
|
|
2153
|
+
}, R = () => {
|
|
2154
|
+
p.current++;
|
|
2155
|
+
let e = Math.min(p.current / i, 1), n = j(e), o = e >= 1;
|
|
2156
|
+
t.clearRect(0, 0, C, X), t.letterSpacing = g.letterSpacing, (O ? [
|
|
1968
2157
|
0,
|
|
1969
2158
|
.25,
|
|
1970
2159
|
.5,
|
|
@@ -1976,61 +2165,61 @@ function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
|
|
|
1976
2165
|
.75,
|
|
1977
2166
|
1
|
|
1978
2167
|
]).forEach((e) => {
|
|
1979
|
-
let
|
|
1980
|
-
|
|
1981
|
-
}),
|
|
1982
|
-
let
|
|
2168
|
+
let n = 42 + s - e * s;
|
|
2169
|
+
t.strokeStyle = y(u.bd, .18), t.lineWidth = 1, t.setLineDash([3, 5]), t.beginPath(), t.moveTo(0, n), t.lineTo(a, n), t.stroke(), t.setLineDash([]);
|
|
2170
|
+
}), t.font = g.font, t.fillStyle = g.color, t.textAlign = "center", t.fillText("Period", b + (a - b) / 2, X - 6), t.strokeStyle = y(u.bd, O ? .5 : .3), t.lineWidth = O ? 2 : 1, t.beginPath(), t.moveTo(b, O ? A : 42 + s), t.lineTo(a, O ? A : 42 + s), t.stroke();
|
|
2171
|
+
let c = n * (w - 1), l = Math.floor(c) + 1;
|
|
1983
2172
|
if (l >= 2) {
|
|
1984
|
-
let e =
|
|
1985
|
-
|
|
2173
|
+
let e = O ? A : 42 + s;
|
|
2174
|
+
t.beginPath(), t.moveTo(N[0].x, e), t.lineTo(N[0].x, N[0].y);
|
|
1986
2175
|
for (let e = 1; e < l; e++) {
|
|
1987
|
-
let
|
|
1988
|
-
|
|
2176
|
+
let n = c - Math.floor(c), r = e === l - 1 && e === Math.ceil(c) && n > 0, i = r ? N[e - 1].x + (N[e].x - N[e - 1].x) * n : N[e].x, a = r ? N[e - 1].y + (N[e].y - N[e - 1].y) * n : N[e].y;
|
|
2177
|
+
t.lineTo(i, a);
|
|
1989
2178
|
}
|
|
1990
|
-
|
|
2179
|
+
t.lineTo(N[l - 1].x, e), t.closePath(), t.fillStyle = P, t.fill();
|
|
1991
2180
|
}
|
|
1992
|
-
|
|
2181
|
+
t.beginPath();
|
|
1993
2182
|
for (let e = 0; e < l; e++) {
|
|
1994
|
-
let
|
|
1995
|
-
e === 0 ?
|
|
2183
|
+
let n = c - Math.floor(c), r = e === l - 1 && e > 0 && e === Math.ceil(c) && n > 0, i = r ? N[e - 1].x + (N[e].x - N[e - 1].x) * n : N[e].x, a = r ? N[e - 1].y + (N[e].y - N[e - 1].y) * n : N[e].y;
|
|
2184
|
+
e === 0 ? t.moveTo(i, a) : t.lineTo(i, a);
|
|
1996
2185
|
}
|
|
1997
|
-
|
|
1998
|
-
for (let e = 0; e < l; e++)
|
|
1999
|
-
if (
|
|
2000
|
-
|
|
2001
|
-
for (let e = 0; e < l; e++)
|
|
2002
|
-
label:
|
|
2003
|
-
value: String(
|
|
2004
|
-
color:
|
|
2186
|
+
t.strokeStyle = y(r, .85), t.lineWidth = 2, t.stroke(), t.fillStyle = y(r, .8), t.beginPath();
|
|
2187
|
+
for (let e = 0; e < l; e++) t.moveTo(N[e].x + 3.5, N[e].y), t.arc(N[e].x, N[e].y, 3.5, 0, wt);
|
|
2188
|
+
if (t.fill(), l > F) {
|
|
2189
|
+
T.current = [];
|
|
2190
|
+
for (let e = 0; e < l; e++) k(T.current, `pt-${e}`, N[e].x, N[e].y, 10, {
|
|
2191
|
+
label: N[e].point.week,
|
|
2192
|
+
value: String(N[e].point.count),
|
|
2193
|
+
color: r
|
|
2005
2194
|
});
|
|
2006
|
-
|
|
2195
|
+
F = l;
|
|
2007
2196
|
}
|
|
2008
|
-
|
|
2197
|
+
o && L(w), o || (I = requestAnimationFrame(R));
|
|
2009
2198
|
};
|
|
2010
|
-
return
|
|
2199
|
+
return R(), () => cancelAnimationFrame(I);
|
|
2011
2200
|
}, [
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
]),
|
|
2018
|
-
width:
|
|
2019
|
-
height:
|
|
2020
|
-
|
|
2201
|
+
_,
|
|
2202
|
+
C,
|
|
2203
|
+
v,
|
|
2204
|
+
T,
|
|
2205
|
+
o
|
|
2206
|
+
]), _.length === 0 ? /* @__PURE__ */ s(G, {
|
|
2207
|
+
width: vt,
|
|
2208
|
+
height: X,
|
|
2209
|
+
testID: l
|
|
2021
2210
|
}) : /* @__PURE__ */ c("div", {
|
|
2022
|
-
"data-testid":
|
|
2211
|
+
"data-testid": l,
|
|
2023
2212
|
style: {
|
|
2024
2213
|
position: "relative",
|
|
2025
2214
|
width: "100%",
|
|
2026
2215
|
display: "flex"
|
|
2027
2216
|
},
|
|
2028
2217
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2029
|
-
ref:
|
|
2218
|
+
ref: f,
|
|
2030
2219
|
"aria-hidden": "true",
|
|
2031
2220
|
style: {
|
|
2032
|
-
width:
|
|
2033
|
-
height:
|
|
2221
|
+
width: yt,
|
|
2222
|
+
height: X,
|
|
2034
2223
|
display: "block",
|
|
2035
2224
|
flexShrink: 0
|
|
2036
2225
|
}
|
|
@@ -2044,22 +2233,22 @@ function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
|
|
|
2044
2233
|
children: /* @__PURE__ */ c("div", {
|
|
2045
2234
|
style: {
|
|
2046
2235
|
position: "relative",
|
|
2047
|
-
width:
|
|
2048
|
-
height:
|
|
2236
|
+
width: C,
|
|
2237
|
+
height: X
|
|
2049
2238
|
},
|
|
2050
2239
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2051
|
-
ref:
|
|
2240
|
+
ref: d,
|
|
2052
2241
|
role: "img",
|
|
2053
2242
|
"aria-label": "Trend chart — count over time",
|
|
2054
2243
|
style: {
|
|
2055
|
-
width:
|
|
2056
|
-
height:
|
|
2244
|
+
width: C,
|
|
2245
|
+
height: X,
|
|
2057
2246
|
display: "block"
|
|
2058
2247
|
}
|
|
2059
|
-
}), /* @__PURE__ */ s(
|
|
2060
|
-
...
|
|
2061
|
-
parentW:
|
|
2062
|
-
parentH:
|
|
2248
|
+
}), /* @__PURE__ */ s(D, {
|
|
2249
|
+
...w,
|
|
2250
|
+
parentW: C,
|
|
2251
|
+
parentH: X
|
|
2063
2252
|
})]
|
|
2064
2253
|
})
|
|
2065
2254
|
})]
|
|
@@ -2067,117 +2256,128 @@ function At({ points: e = [], colorOffset: t = 0, "data-testid": r }) {
|
|
|
2067
2256
|
}
|
|
2068
2257
|
//#endregion
|
|
2069
2258
|
//#region src/components/proportionalBandChart/ProportionalBandChart.tsx
|
|
2070
|
-
var
|
|
2071
|
-
function
|
|
2259
|
+
var kt = 780, At = 340, jt = 28, Mt = 4;
|
|
2260
|
+
function Nt(e, t, n) {
|
|
2072
2261
|
if (e.measureText(t).width <= n) return t;
|
|
2073
2262
|
let r = t;
|
|
2074
2263
|
for (; r.length > 0 && e.measureText(`${r}…`).width > n;) r = r.slice(0, -1);
|
|
2075
2264
|
return `${r}…`;
|
|
2076
2265
|
}
|
|
2077
|
-
function
|
|
2078
|
-
let
|
|
2079
|
-
|
|
2080
|
-
|
|
2266
|
+
function Pt({ severities: e = [], colorOffset: r = 0, onItemClick: o, testID: l }) {
|
|
2267
|
+
let [d, f] = ee(kt), p = a(null), m = a(/* @__PURE__ */ new Map()), _ = a(0), v = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), b = a(v);
|
|
2268
|
+
b.current = v;
|
|
2269
|
+
let x = t((e, t) => {
|
|
2270
|
+
let n = typeof t == "object" ? t.label ?? e : e, r = b.current.find((t) => t.severity === e);
|
|
2271
|
+
o?.(e, n, r?.subentity);
|
|
2272
|
+
}, [o]), { hoveredRef: C, tooltip: w, hitZonesRef: T } = O(p, {
|
|
2273
|
+
width: f,
|
|
2274
|
+
height: At,
|
|
2275
|
+
onClick: o ? x : void 0
|
|
2081
2276
|
});
|
|
2082
2277
|
return n(() => {
|
|
2083
|
-
let e =
|
|
2278
|
+
let e = p.current;
|
|
2084
2279
|
if (!e) return;
|
|
2085
|
-
let
|
|
2086
|
-
|
|
2087
|
-
let
|
|
2088
|
-
|
|
2089
|
-
let e =
|
|
2090
|
-
|
|
2091
|
-
let
|
|
2092
|
-
|
|
2280
|
+
let t = S(e, f, At);
|
|
2281
|
+
_.current = 0;
|
|
2282
|
+
let n = v.reduce((e, t) => e + (t.count ?? 0), 0), i = jt, a = jt, o = f - i - a, s = At - 54 - 54, c = o - Math.max(0, v.length - 1) * Mt, l = v.map((e) => (e.count ?? 0) / (n || 1) * c), d = h[r % h.length], b, x = () => {
|
|
2283
|
+
_.current++;
|
|
2284
|
+
let e = _.current;
|
|
2285
|
+
t.clearRect(0, 0, f, At), t.letterSpacing = g.letterSpacing;
|
|
2286
|
+
let r = M(Math.min(e / 60, 1));
|
|
2287
|
+
L(m.current, C.current), T.current = [];
|
|
2093
2288
|
let a = i;
|
|
2094
|
-
|
|
2095
|
-
let o =
|
|
2096
|
-
if (
|
|
2289
|
+
v.forEach((e, i) => {
|
|
2290
|
+
let o = l[i] ?? 0, c = m.current.get(e.severity) ?? 0, f = a + o / 2, p = o * .78, h = o * r, _ = p * r, v = f - _ / 2;
|
|
2291
|
+
if (h > 0) {
|
|
2097
2292
|
let e = () => {
|
|
2098
|
-
|
|
2099
|
-
},
|
|
2100
|
-
u.addColorStop(0,
|
|
2293
|
+
t.beginPath(), t.moveTo(v, 54), t.lineTo(v + _, 54), t.lineTo(a + h, 54 + s), t.lineTo(a, 54 + s), t.closePath();
|
|
2294
|
+
}, n = a + o / 2, i = 54 + s / 2, l = Math.sqrt((o / 2) ** 2 + (s / 2) ** 2), u = t.createRadialGradient(n, i, 0, n, i, l);
|
|
2295
|
+
u.addColorStop(0, y(d, (.03 + c * .02) * r)), u.addColorStop(.5, y(d, (.12 + c * .04) * r)), u.addColorStop(1, y(d, (.28 + c * .08) * r)), t.save(), e(), t.clip(), e(), t.fillStyle = u, t.fill(), t.restore(), e(), t.strokeStyle = y(d, .9 * r), t.lineWidth = 1, t.stroke();
|
|
2101
2296
|
}
|
|
2102
|
-
if (
|
|
2297
|
+
if (A(T.current, e.severity, a, 54, o, s, {
|
|
2103
2298
|
label: e.severity,
|
|
2104
|
-
value:
|
|
2105
|
-
sublabel: `${Math.round((e.count ?? 0) / (
|
|
2106
|
-
color:
|
|
2107
|
-
}),
|
|
2108
|
-
let i = Math.min(1, (
|
|
2109
|
-
|
|
2299
|
+
value: K(e.count ?? 0),
|
|
2300
|
+
sublabel: `${Math.round((e.count ?? 0) / (n || 1) * 100)}%`,
|
|
2301
|
+
color: d
|
|
2302
|
+
}), r > .5) {
|
|
2303
|
+
let i = Math.min(1, (r - .5) / .5), l = a + o / 2;
|
|
2304
|
+
t.globalAlpha = i, t.font = g.font, t.fillStyle = c > 0 ? d : y(u.t1, .65), t.textAlign = "center", t.fillText(Nt(t, e.severity, o - 8), l, 40), t.font = "600 22px 'Satoshi Variable', 'DM Sans', sans-serif", t.fillStyle = y(u.t1, .92 + c * .08), t.fillText(K(e.count ?? 0), l, 54 + s / 2 + 8), t.font = g.font, t.fillStyle = c > 0 ? d : y(u.t1, .5), t.fillText(`${Math.round((e.count ?? 0) / (n || 1) * 100)}%`, l, 54 + s + 22), t.globalAlpha = 1;
|
|
2110
2305
|
}
|
|
2111
|
-
a += o +
|
|
2112
|
-
}),
|
|
2306
|
+
a += o + Mt;
|
|
2307
|
+
}), b = requestAnimationFrame(x);
|
|
2113
2308
|
};
|
|
2114
|
-
return
|
|
2309
|
+
return x(), () => cancelAnimationFrame(b);
|
|
2115
2310
|
}, [
|
|
2311
|
+
v,
|
|
2116
2312
|
f,
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
width:
|
|
2121
|
-
|
|
2122
|
-
|
|
2313
|
+
r
|
|
2314
|
+
]), v.length === 0 ? /* @__PURE__ */ s("div", {
|
|
2315
|
+
ref: d,
|
|
2316
|
+
style: { width: "100%" },
|
|
2317
|
+
children: /* @__PURE__ */ s(G, {
|
|
2318
|
+
width: f,
|
|
2319
|
+
height: At,
|
|
2320
|
+
testID: l
|
|
2321
|
+
})
|
|
2123
2322
|
}) : /* @__PURE__ */ c("div", {
|
|
2124
|
-
|
|
2323
|
+
ref: d,
|
|
2324
|
+
"data-testid": l,
|
|
2125
2325
|
style: {
|
|
2126
2326
|
position: "relative",
|
|
2127
|
-
width:
|
|
2128
|
-
height:
|
|
2327
|
+
width: "100%",
|
|
2328
|
+
height: At
|
|
2129
2329
|
},
|
|
2130
2330
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2131
|
-
ref:
|
|
2331
|
+
ref: p,
|
|
2132
2332
|
role: "img",
|
|
2133
2333
|
"aria-label": "Early Warning severity distribution — prism spectrum bands",
|
|
2134
2334
|
style: {
|
|
2135
|
-
width:
|
|
2136
|
-
height:
|
|
2335
|
+
width: "100%",
|
|
2336
|
+
height: At,
|
|
2137
2337
|
display: "block"
|
|
2138
2338
|
}
|
|
2139
|
-
}), /* @__PURE__ */ s(
|
|
2140
|
-
...
|
|
2141
|
-
parentW:
|
|
2142
|
-
parentH:
|
|
2339
|
+
}), /* @__PURE__ */ s(D, {
|
|
2340
|
+
...w,
|
|
2341
|
+
parentW: f,
|
|
2342
|
+
parentH: At
|
|
2143
2343
|
})]
|
|
2144
2344
|
});
|
|
2145
2345
|
}
|
|
2146
2346
|
//#endregion
|
|
2147
2347
|
//#region src/components/hubAndSpokeRadialChart/HubAndSpokeRadialChart.tsx
|
|
2148
|
-
var
|
|
2348
|
+
var Ft = 300, It = 280, Lt = 100, Rt = {
|
|
2149
2349
|
Open: u.red,
|
|
2150
2350
|
Submitted: u.amber,
|
|
2151
2351
|
Closed: u.green
|
|
2152
2352
|
};
|
|
2153
|
-
function
|
|
2154
|
-
let l = a(null), d = a(0), f = a(/* @__PURE__ */ new Map()), { hoveredRef: p, tooltip: m, hitZonesRef:
|
|
2155
|
-
width:
|
|
2156
|
-
height:
|
|
2157
|
-
}),
|
|
2353
|
+
function zt({ segments: e = [], title: t, unitLabel: r = "", testID: o }) {
|
|
2354
|
+
let l = a(null), d = a(0), f = a(/* @__PURE__ */ new Map()), { hoveredRef: p, tooltip: m, hitZonesRef: h } = O(l, {
|
|
2355
|
+
width: Ft,
|
|
2356
|
+
height: It
|
|
2357
|
+
}), v = i(() => e.filter((e) => typeof e == "object" && !!e), [e]);
|
|
2158
2358
|
return n(() => {
|
|
2159
2359
|
let e = l.current;
|
|
2160
2360
|
if (!e) return;
|
|
2161
|
-
let n =
|
|
2361
|
+
let n = S(e, Ft, It);
|
|
2162
2362
|
d.current = 0;
|
|
2163
|
-
let i =
|
|
2363
|
+
let i = Ft * .5, a = It * .56, o = Lt, s = v.reduce((e, t) => e + (t.count ?? 0), 0), c = Math.max(...v.map((e) => e.count ?? 0), 1), m, b = () => {
|
|
2164
2364
|
d.current++;
|
|
2165
2365
|
let e = d.current;
|
|
2166
|
-
n.clearRect(0, 0,
|
|
2366
|
+
n.clearRect(0, 0, Ft, It), n.letterSpacing = g.letterSpacing, h.current = [], f.current.forEach((e, t) => {
|
|
2167
2367
|
let n = t === p.current ? 1 : 0, r = e + (n - e) * .12;
|
|
2168
2368
|
Math.abs(r - n) < .005 ? n === 0 ? f.current.delete(t) : f.current.set(t, 1) : f.current.set(t, r);
|
|
2169
|
-
}), p.current && !f.current.has(p.current) && f.current.set(p.current, 0),
|
|
2170
|
-
let s = r / 3 * Math.PI * 2 - Math.PI / 2, l = i + Math.cos(s) * o, d = a + Math.sin(s) * o, f =
|
|
2171
|
-
n.beginPath(), n.moveTo(i, a), n.lineTo(l, d), n.strokeStyle =
|
|
2172
|
-
let m = (e * .005 + r * .33) % 1, h = i + (l - i) * m,
|
|
2173
|
-
|
|
2174
|
-
let
|
|
2175
|
-
n.font =
|
|
2176
|
-
}),
|
|
2177
|
-
let l = t / 3 * Math.PI * 2 - Math.PI / 2, d = i + Math.cos(l) * o, p = a + Math.sin(l) * o, m =
|
|
2178
|
-
|
|
2179
|
-
let b = n.createRadialGradient(d, p -
|
|
2180
|
-
b.addColorStop(0,
|
|
2369
|
+
}), p.current && !f.current.has(p.current) && f.current.set(p.current, 0), w(n, Ft, It, e, 40, y(u.blue, .04)), v.forEach((t, r) => {
|
|
2370
|
+
let s = r / 3 * Math.PI * 2 - Math.PI / 2, l = i + Math.cos(s) * o, d = a + Math.sin(s) * o, f = Rt[t.status] ?? u.blue, p = 2 + t.count / c * 8;
|
|
2371
|
+
n.beginPath(), n.moveTo(i, a), n.lineTo(l, d), n.strokeStyle = y(f, .08), n.lineWidth = p * 2, n.stroke(), n.beginPath(), n.moveTo(i, a), n.lineTo(l, d), n.strokeStyle = y(f, .25), n.lineWidth = 1, n.stroke();
|
|
2372
|
+
let m = (e * .005 + r * .33) % 1, h = i + (l - i) * m, g = a + (d - a) * m;
|
|
2373
|
+
C(n, h, g, 6, f, .4), n.beginPath(), n.arc(h, g, 2, 0, Math.PI * 2), n.fillStyle = y(f, .8), n.fill();
|
|
2374
|
+
let v = (i + l) / 2, b = (a + d) / 2;
|
|
2375
|
+
n.font = _.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = y(f, .85), n.fillText(String(t.count), v, b);
|
|
2376
|
+
}), v.forEach((e, t) => {
|
|
2377
|
+
let l = t / 3 * Math.PI * 2 - Math.PI / 2, d = i + Math.cos(l) * o, p = a + Math.sin(l) * o, m = Rt[e.status] ?? u.blue, _ = 10 + e.count / c * 18, v = f.current.get(e.status) ?? 0;
|
|
2378
|
+
C(n, d, p, _ * 2.5, m, .2 + v * .15);
|
|
2379
|
+
let b = n.createRadialGradient(d, p - _ * .2, 0, d, p, _);
|
|
2380
|
+
b.addColorStop(0, y(m, .8 + v * .2)), b.addColorStop(1, y(m, .4 + v * .1)), n.beginPath(), n.arc(d, p, _, 0, Math.PI * 2), n.fillStyle = b, n.fill(), n.font = "bold " + g.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = y(u.t1, .9), n.fillText(e.status, d, p), k(h.current, e.status, d, p, _ + 6, {
|
|
2181
2381
|
label: e.status,
|
|
2182
2382
|
value: r ? `${e.count} ${r}` : String(e.count),
|
|
2183
2383
|
sublabel: `${Math.round((e.count ?? 0) / (s || 1) * 100)}%`,
|
|
@@ -2185,50 +2385,50 @@ function Bt({ segments: e = [], title: t, unitLabel: r = "", "data-testid": o })
|
|
|
2185
2385
|
});
|
|
2186
2386
|
});
|
|
2187
2387
|
let l = f.current.get("center") ?? 0;
|
|
2188
|
-
|
|
2388
|
+
C(n, i, a, 36, u.t2, .2 + l * .15);
|
|
2189
2389
|
let x = n.createRadialGradient(i, a - 4, 0, i, a, 22);
|
|
2190
|
-
x.addColorStop(0,
|
|
2390
|
+
x.addColorStop(0, y(u.t2, .9)), x.addColorStop(1, y(u.t2, .5)), n.beginPath(), n.arc(i, a, 22, 0, Math.PI * 2), n.fillStyle = x, n.fill(), n.font = _.font, n.textAlign = "center", n.textBaseline = "middle", n.fillStyle = y(u.t1, .9), n.fillText(t ?? "", i, a - 4), n.font = "bold " + g.font, n.fillStyle = u.t1, n.fillText(String(s), i, a + 8), k(h.current, "center", i, a, 28, {
|
|
2191
2391
|
label: t ?? "Total",
|
|
2192
2392
|
value: r ? `${s} ${r}` : String(s),
|
|
2193
2393
|
color: u.t2
|
|
2194
|
-
}),
|
|
2394
|
+
}), T(n, Ft, It, e, .015), m = requestAnimationFrame(b);
|
|
2195
2395
|
};
|
|
2196
2396
|
return b(), () => cancelAnimationFrame(m);
|
|
2197
2397
|
}, [
|
|
2198
|
-
|
|
2398
|
+
v,
|
|
2199
2399
|
t,
|
|
2200
2400
|
r
|
|
2201
|
-
]),
|
|
2202
|
-
width:
|
|
2203
|
-
height:
|
|
2204
|
-
|
|
2401
|
+
]), v.length === 0 ? /* @__PURE__ */ s(G, {
|
|
2402
|
+
width: Ft,
|
|
2403
|
+
height: It,
|
|
2404
|
+
testID: o
|
|
2205
2405
|
}) : /* @__PURE__ */ c("div", {
|
|
2206
2406
|
"data-testid": o,
|
|
2207
2407
|
style: {
|
|
2208
2408
|
position: "relative",
|
|
2209
|
-
width:
|
|
2210
|
-
height:
|
|
2409
|
+
width: Ft,
|
|
2410
|
+
height: It
|
|
2211
2411
|
},
|
|
2212
2412
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2213
2413
|
ref: l,
|
|
2214
2414
|
role: "img",
|
|
2215
2415
|
"aria-label": t ?? "EW status arc visualization",
|
|
2216
2416
|
style: {
|
|
2217
|
-
width:
|
|
2218
|
-
height:
|
|
2417
|
+
width: Ft,
|
|
2418
|
+
height: It,
|
|
2219
2419
|
display: "block",
|
|
2220
2420
|
borderRadius: 8
|
|
2221
2421
|
}
|
|
2222
|
-
}), /* @__PURE__ */ s(
|
|
2422
|
+
}), /* @__PURE__ */ s(D, {
|
|
2223
2423
|
...m,
|
|
2224
|
-
parentW:
|
|
2225
|
-
parentH:
|
|
2424
|
+
parentW: Ft,
|
|
2425
|
+
parentH: It
|
|
2226
2426
|
})]
|
|
2227
2427
|
});
|
|
2228
2428
|
}
|
|
2229
2429
|
//#endregion
|
|
2230
2430
|
//#region src/components/trendChart/TrendChart.tsx
|
|
2231
|
-
var
|
|
2431
|
+
var Bt = 280, Vt = 96;
|
|
2232
2432
|
function Ht({ points: e = [], className: t, colors: r }) {
|
|
2233
2433
|
let o = a(null), d = a(/* @__PURE__ */ new Map()), f = a(0), p = i(() => e.filter(Array.isArray).map(([e, t]) => {
|
|
2234
2434
|
let n = String(t).match(/-?\d+(\.\d+)?/);
|
|
@@ -2236,19 +2436,19 @@ function Ht({ points: e = [], className: t, colors: r }) {
|
|
|
2236
2436
|
label: e,
|
|
2237
2437
|
value: n ? Number(n[0]) : 0
|
|
2238
2438
|
};
|
|
2239
|
-
}), [e]), { mouseRef: m, hoveredRef: h, tooltip: g, hitZonesRef: _ } =
|
|
2240
|
-
width:
|
|
2241
|
-
height:
|
|
2439
|
+
}), [e]), { mouseRef: m, hoveredRef: h, tooltip: g, hitZonesRef: _ } = O(o, {
|
|
2440
|
+
width: Bt,
|
|
2441
|
+
height: Vt
|
|
2242
2442
|
});
|
|
2243
2443
|
return n(() => {
|
|
2244
2444
|
let e = o.current;
|
|
2245
2445
|
if (!e) return;
|
|
2246
|
-
let t =
|
|
2446
|
+
let t = S(e, Bt, Vt);
|
|
2247
2447
|
f.current = 0;
|
|
2248
2448
|
let n = r?.line ?? u.teal, i = r?.point ?? u.teal, a = r?.axisLine ?? u.bd, s, c = () => {
|
|
2249
2449
|
f.current++;
|
|
2250
2450
|
let e = f.current;
|
|
2251
|
-
if (t.clearRect(0, 0,
|
|
2451
|
+
if (t.clearRect(0, 0, Bt, Vt), p.length < 2) {
|
|
2252
2452
|
s = requestAnimationFrame(c);
|
|
2253
2453
|
return;
|
|
2254
2454
|
}
|
|
@@ -2257,35 +2457,35 @@ function Ht({ points: e = [], className: t, colors: r }) {
|
|
|
2257
2457
|
right: 12,
|
|
2258
2458
|
top: 16,
|
|
2259
2459
|
bottom: 20
|
|
2260
|
-
}, o =
|
|
2261
|
-
if (
|
|
2262
|
-
t.fillText(e.label.replace("Day ", "D"), x(n),
|
|
2460
|
+
}, o = Bt - r.left - r.right, l = Vt - r.top - r.bottom, g = p.map((e) => e.value), v = Math.min(...g), b = Math.max(...g) - v || 1, x = (e) => r.left + e / (p.length - 1) * o, S = (e) => r.top + (1 - (e - v) / b) * l, w = 1 - (1 - Math.min(e / 48, 1)) ** 3, T = Math.max(2, Math.floor(w * p.length));
|
|
2461
|
+
if (L(d.current, h.current), _.current = [], t.strokeStyle = y(a, .3), t.lineWidth = .5, t.setLineDash([]), t.beginPath(), t.moveTo(r.left, Vt - r.bottom), t.lineTo(Bt - r.right, Vt - r.bottom), t.stroke(), t.font = "9px 'JetBrains Mono', monospace", t.fillStyle = y(u.t4, .9), t.textAlign = "center", p.forEach((e, n) => {
|
|
2462
|
+
t.fillText(e.label.replace("Day ", "D"), x(n), Vt - 4);
|
|
2263
2463
|
}), m.current.over && h.current) {
|
|
2264
2464
|
let e = parseInt(h.current.split("-")[1]);
|
|
2265
|
-
isNaN(e) ||
|
|
2465
|
+
isNaN(e) || E(t, x(e), r.top, r.top + l);
|
|
2266
2466
|
}
|
|
2267
|
-
if (
|
|
2467
|
+
if (T > 1) {
|
|
2268
2468
|
let e = t.createLinearGradient(0, r.top, 0, r.top + l);
|
|
2269
|
-
e.addColorStop(0,
|
|
2270
|
-
for (let e = 0; e <
|
|
2271
|
-
t.lineTo(x(
|
|
2272
|
-
for (let e = 0; e <
|
|
2273
|
-
let n = x(e), r =
|
|
2469
|
+
e.addColorStop(0, y(n, .15)), e.addColorStop(1, y(n, 0)), t.fillStyle = e, t.beginPath(), t.moveTo(x(0), r.top + l);
|
|
2470
|
+
for (let e = 0; e < T; e++) t.lineTo(x(e), S(p[e].value));
|
|
2471
|
+
t.lineTo(x(T - 1), r.top + l), t.closePath(), t.fill(), t.strokeStyle = y(n, .8), t.lineWidth = 1.5, t.setLineDash([]), t.beginPath();
|
|
2472
|
+
for (let e = 0; e < T; e++) {
|
|
2473
|
+
let n = x(e), r = S(p[e].value);
|
|
2274
2474
|
e === 0 ? t.moveTo(n, r) : t.lineTo(n, r);
|
|
2275
2475
|
}
|
|
2276
2476
|
t.stroke();
|
|
2277
2477
|
}
|
|
2278
|
-
for (let e = 0; e <
|
|
2279
|
-
let n = x(e), r =
|
|
2280
|
-
|
|
2478
|
+
for (let e = 0; e < T; e++) {
|
|
2479
|
+
let n = x(e), r = S(p[e].value), a = `tp-${e}`, o = d.current.get(a) ?? 0, s = e === p.length - 1;
|
|
2480
|
+
k(_.current, a, n, r, 10, {
|
|
2281
2481
|
label: p[e].label,
|
|
2282
2482
|
value: String(p[e].value),
|
|
2283
2483
|
color: s ? u.red : i
|
|
2284
|
-
}), o > 0 && !s && (
|
|
2484
|
+
}), o > 0 && !s && (C(t, n, r, 12 * o, i, .2 * o), t.fillStyle = y(i, .8), t.beginPath(), t.arc(n, r, 3 + o * 2, 0, Math.PI * 2), t.fill());
|
|
2285
2485
|
}
|
|
2286
|
-
if (
|
|
2287
|
-
let n = p.length - 1, r = x(n), i =
|
|
2288
|
-
t.shadowColor =
|
|
2486
|
+
if (T >= p.length) {
|
|
2487
|
+
let n = p.length - 1, r = x(n), i = S(p[n].value), a = d.current.get(`tp-${n}`) ?? 0, o = F(e, .05, 5e-4), s = 1 + a * .5;
|
|
2488
|
+
t.shadowColor = y(u.red, .5), t.shadowBlur = (8 + o * 4) * s, t.fillStyle = u.red, t.beginPath(), t.arc(r, i, (3.5 + o * 1.5) * s, 0, Math.PI * 2), t.fill(), t.shadowBlur = 0;
|
|
2289
2489
|
}
|
|
2290
2490
|
s = requestAnimationFrame(c);
|
|
2291
2491
|
};
|
|
@@ -2295,23 +2495,23 @@ function Ht({ points: e = [], className: t, colors: r }) {
|
|
|
2295
2495
|
children: /* @__PURE__ */ c("div", {
|
|
2296
2496
|
style: {
|
|
2297
2497
|
position: "relative",
|
|
2298
|
-
width:
|
|
2299
|
-
height:
|
|
2498
|
+
width: Bt,
|
|
2499
|
+
height: Vt
|
|
2300
2500
|
},
|
|
2301
2501
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2302
2502
|
ref: o,
|
|
2303
2503
|
role: "img",
|
|
2304
2504
|
"aria-label": "trend chart",
|
|
2305
2505
|
style: {
|
|
2306
|
-
width:
|
|
2307
|
-
height:
|
|
2506
|
+
width: Bt,
|
|
2507
|
+
height: Vt,
|
|
2308
2508
|
display: "block",
|
|
2309
2509
|
borderRadius: 8
|
|
2310
2510
|
}
|
|
2311
|
-
}), /* @__PURE__ */ s(
|
|
2511
|
+
}), /* @__PURE__ */ s(D, {
|
|
2312
2512
|
...g,
|
|
2313
|
-
parentW:
|
|
2314
|
-
parentH:
|
|
2513
|
+
parentW: Bt,
|
|
2514
|
+
parentH: Vt
|
|
2315
2515
|
})]
|
|
2316
2516
|
})
|
|
2317
2517
|
});
|
|
@@ -2324,89 +2524,107 @@ function Ut(e, t, n) {
|
|
|
2324
2524
|
for (; r.length > 0 && e.measureText(r + "…").width > n;) r = r.slice(0, -1);
|
|
2325
2525
|
return r + "…";
|
|
2326
2526
|
}
|
|
2327
|
-
var Wt = 680, Gt = 8, Z =
|
|
2328
|
-
function Zt({ items: e = [], labelA:
|
|
2329
|
-
let
|
|
2330
|
-
|
|
2331
|
-
|
|
2527
|
+
var Wt = 680, Gt = 8, Z = 4, Kt = 8, qt = Z * 2 + Kt, Jt = 36, Yt = Jt / 2, Xt = 48;
|
|
2528
|
+
function Zt({ items: e = [], itemsByEntity: r, onItemClick: l, selectedId: d, labelA: f = "Implemented", labelB: p = "Unimplemented", unit: m = "variations", testID: h }) {
|
|
2529
|
+
let [b, x] = ee(Wt), w = a(null), T = a(/* @__PURE__ */ new Map()), E = a(0), k = a(d);
|
|
2530
|
+
k.current = d;
|
|
2531
|
+
let j = a([]), N = t((e, t) => {
|
|
2532
|
+
let n = e.replace(/-impl$|-un$/, ""), r = typeof t == "object" ? t.label ?? n : n, i = j.current.find((e) => e.id === n);
|
|
2533
|
+
l?.(n, r, i?.subentity);
|
|
2534
|
+
}, [l]), [P, F] = o(!1), R = i(() => e.filter((e) => typeof e == "object" && !!e), [e]), z = !!(d && r?.[d]), B = z ? r[d] : e, V = i(() => B.filter((e) => typeof e == "object" && !!e), [B]), H = i(() => P ? V : V.slice(0, Gt), [V, P]);
|
|
2535
|
+
j.current = H;
|
|
2536
|
+
let U = Yt + Xt + H.length * (qt + Jt) - Jt, { hoveredRef: W, tooltip: ne, hitZonesRef: re } = O(w, {
|
|
2537
|
+
width: x,
|
|
2538
|
+
height: U,
|
|
2539
|
+
onClick: l ? N : void 0
|
|
2332
2540
|
});
|
|
2333
2541
|
return n(() => {
|
|
2334
|
-
let e =
|
|
2542
|
+
let e = w.current;
|
|
2335
2543
|
if (!e) return;
|
|
2336
|
-
let
|
|
2337
|
-
|
|
2338
|
-
let
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
let
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2544
|
+
let t = S(e, x, U);
|
|
2545
|
+
E.current = 0, t.font = g.font;
|
|
2546
|
+
let n = H.reduce((e, n) => Math.max(e, t.measureText(n.abbreviation ?? n.name ?? "").width), 0);
|
|
2547
|
+
t.font = _.font;
|
|
2548
|
+
let r = H.reduce((e, n) => Math.max(e, t.measureText(K(n.implemented ?? 0)).width, t.measureText(K(n.unimplemented ?? 0)).width), 0), i = Math.max(Math.min(n + 20, x * .3), 40), a = Math.max(r + 24, 32), o = x - i - a, s = Math.max(...H.map((e) => e.implemented ?? 0), ...H.map((e) => e.unimplemented ?? 0), 1), c = H.length * (qt + Jt) - Jt, l = Yt + (U - Yt - Xt - c) / 2, d, h = () => {
|
|
2549
|
+
E.current++;
|
|
2550
|
+
let e = E.current;
|
|
2551
|
+
t.clearRect(0, 0, x, U);
|
|
2552
|
+
let n = M(Math.min(e / 60, 1));
|
|
2553
|
+
L(T.current, W.current), re.current = [], H.forEach((e, a) => {
|
|
2554
|
+
let c = I(n, a, H.length, M), d = l + a * (qt + Jt), h = d, v = d + Z + Kt, b = `${e.id}-impl`, x = `${e.id}-un`, S = T.current.get(b) ?? 0, w = T.current.get(x) ?? 0, E = !z && k.current && e.id !== k.current ? .6 : 1, D = (e.implemented ?? 0) / s * o * c, O = (e.unimplemented ?? 0) / s * o * c;
|
|
2555
|
+
if (t.font = g.font, t.fillStyle = S > 0 || w > 0 ? u.t1 : u.t2, t.textAlign = "right", t.textBaseline = "middle", t.fillText(Ut(t, e.abbreviation ?? e.name ?? "", i - 16), i - 8, d + qt / 2), t.textBaseline = "alphabetic", A(re.current, b, 0, d, i, qt, {
|
|
2346
2556
|
label: e.name ?? e.abbreviation ?? "",
|
|
2347
|
-
value: `${
|
|
2348
|
-
sublabel: `${
|
|
2557
|
+
value: `${K((e.implemented ?? 0) + (e.unimplemented ?? 0))} total ${m}`,
|
|
2558
|
+
sublabel: `${f}: ${K(e.implemented ?? 0)} · ${p}: ${K(e.unimplemented ?? 0)}`,
|
|
2349
2559
|
color: u.green
|
|
2350
|
-
}),
|
|
2351
|
-
|
|
2352
|
-
let e =
|
|
2353
|
-
e.addColorStop(0,
|
|
2560
|
+
}, void 0, i + Math.max(D, O) + 16 + r + 14), D > 0) {
|
|
2561
|
+
S > 0 && C(t, i + D / 2, h + Z / 2, D * .15, u.green, .18 * S);
|
|
2562
|
+
let e = t.createLinearGradient(i, 0, i + D, 0);
|
|
2563
|
+
e.addColorStop(0, y(u.green, .7 * E)), e.addColorStop(1, y(u.green, 1 * E)), t.fillStyle = e, t.beginPath(), t.roundRect(i, h, D, Z, Z / 2), t.fill();
|
|
2354
2564
|
}
|
|
2355
|
-
if (
|
|
2565
|
+
if (A(re.current, b, i, h, Math.max(D, 1), Z, {
|
|
2356
2566
|
label: e.name,
|
|
2357
|
-
value:
|
|
2567
|
+
value: K(e.implemented ?? 0),
|
|
2358
2568
|
color: u.green
|
|
2359
|
-
}), c > .4 && (
|
|
2360
|
-
|
|
2361
|
-
let e =
|
|
2362
|
-
e.addColorStop(0,
|
|
2569
|
+
}, d + qt / 2, i + Math.max(D, O) + 16 + r + 14), c > .4 && (t.globalAlpha = Math.min(1, (c - .4) / .4), t.font = _.font, t.fillStyle = u.t1, t.textAlign = "left", t.textBaseline = "middle", t.fillText(K(e.implemented ?? 0), i + D + 16, h + Z / 2), t.globalAlpha = 1, t.textBaseline = "alphabetic"), O > 0) {
|
|
2570
|
+
w > 0 && C(t, i + O / 2, v + Z / 2, O * .15, u.amber, .18 * w);
|
|
2571
|
+
let e = t.createLinearGradient(i, 0, i + O, 0);
|
|
2572
|
+
e.addColorStop(0, y(u.amber, .5 * E)), e.addColorStop(1, y(u.amber, .9 * E)), t.fillStyle = e, t.beginPath(), t.roundRect(i, v, O, Z, Z / 2), t.fill();
|
|
2363
2573
|
}
|
|
2364
|
-
|
|
2574
|
+
A(re.current, x, i, v, Math.max(O, 1), Z, {
|
|
2365
2575
|
label: e.name,
|
|
2366
|
-
value:
|
|
2576
|
+
value: K(e.unimplemented ?? 0),
|
|
2367
2577
|
color: u.amber
|
|
2368
|
-
}), c > .4 && (
|
|
2578
|
+
}, d + qt / 2, i + Math.max(D, O) + 16 + r + 14), c > .4 && (t.globalAlpha = Math.min(1, (c - .4) / .4), t.font = _.font, t.fillStyle = u.t1, t.textAlign = "left", t.textBaseline = "middle", t.fillText(K(e.unimplemented ?? 0), i + O + 16, v + Z / 2), t.globalAlpha = 1, t.textBaseline = "alphabetic");
|
|
2369
2579
|
});
|
|
2370
|
-
let
|
|
2371
|
-
|
|
2372
|
-
let b =
|
|
2373
|
-
|
|
2374
|
-
let N =
|
|
2375
|
-
P.addColorStop(0,
|
|
2580
|
+
let a = l + c + 28;
|
|
2581
|
+
t.font = v.font, t.textBaseline = "middle", t.textAlign = "left";
|
|
2582
|
+
let b = t.measureText(f).width, S = t.measureText(p).width, w = 18 + b, D = 18 + S, O = (x - (w + 24 + D)) / 2, j = t.createLinearGradient(O, 0, O + 12, 0);
|
|
2583
|
+
j.addColorStop(0, y(u.green, .7)), j.addColorStop(1, y(u.green, 1)), t.fillStyle = j, t.beginPath(), t.rect(O, a - 6, 12, 12), t.fill(), t.fillStyle = v.color, t.fillText(f, O + 12 + 6, a);
|
|
2584
|
+
let N = O + w + 24, P = t.createLinearGradient(N, 0, N + 12, 0);
|
|
2585
|
+
P.addColorStop(0, y(u.amber, .5)), P.addColorStop(1, y(u.amber, .9)), t.fillStyle = P, t.beginPath(), t.rect(N, a - 6, 12, 12), t.fill(), t.fillStyle = v.color, t.fillText(p, N + 12 + 6, a), t.textBaseline = "alphabetic", d = requestAnimationFrame(h);
|
|
2376
2586
|
};
|
|
2377
|
-
return
|
|
2378
|
-
}, [
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2587
|
+
return h(), () => cancelAnimationFrame(d);
|
|
2588
|
+
}, [
|
|
2589
|
+
H,
|
|
2590
|
+
U,
|
|
2591
|
+
x
|
|
2592
|
+
]), R.length === 0 ? /* @__PURE__ */ s("div", {
|
|
2593
|
+
ref: b,
|
|
2594
|
+
style: { width: "100%" },
|
|
2595
|
+
children: /* @__PURE__ */ s(G, {
|
|
2596
|
+
width: x,
|
|
2597
|
+
height: 160,
|
|
2598
|
+
testID: h
|
|
2599
|
+
})
|
|
2382
2600
|
}) : /* @__PURE__ */ c("div", {
|
|
2383
|
-
|
|
2384
|
-
|
|
2601
|
+
ref: b,
|
|
2602
|
+
"data-testid": h,
|
|
2603
|
+
style: { width: "100%" },
|
|
2385
2604
|
children: [/* @__PURE__ */ c("div", {
|
|
2386
2605
|
style: {
|
|
2387
2606
|
position: "relative",
|
|
2388
|
-
|
|
2389
|
-
height: T
|
|
2607
|
+
height: U
|
|
2390
2608
|
},
|
|
2391
2609
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2392
|
-
ref:
|
|
2610
|
+
ref: w,
|
|
2393
2611
|
role: "img",
|
|
2394
2612
|
"aria-label": "Implemented vs unimplemented variations per contractor — split bar",
|
|
2395
2613
|
style: {
|
|
2396
|
-
width:
|
|
2397
|
-
height:
|
|
2614
|
+
width: "100%",
|
|
2615
|
+
height: U,
|
|
2398
2616
|
display: "block"
|
|
2399
2617
|
}
|
|
2400
|
-
}), /* @__PURE__ */ s(
|
|
2401
|
-
...
|
|
2402
|
-
parentW:
|
|
2403
|
-
parentH:
|
|
2618
|
+
}), /* @__PURE__ */ s(D, {
|
|
2619
|
+
...ne,
|
|
2620
|
+
parentW: x,
|
|
2621
|
+
parentH: U
|
|
2404
2622
|
})]
|
|
2405
|
-
}),
|
|
2623
|
+
}), R.length > Gt && /* @__PURE__ */ s("div", {
|
|
2406
2624
|
style: { marginTop: 8 },
|
|
2407
|
-
children: /* @__PURE__ */ s(
|
|
2408
|
-
expanded:
|
|
2409
|
-
onToggle: () =>
|
|
2625
|
+
children: /* @__PURE__ */ s(te, {
|
|
2626
|
+
expanded: P,
|
|
2627
|
+
onToggle: () => F((e) => !e)
|
|
2410
2628
|
})
|
|
2411
2629
|
})]
|
|
2412
2630
|
});
|
|
@@ -2414,111 +2632,118 @@ function Zt({ items: e = [], labelA: t = "Implemented", labelB: r = "Unimplement
|
|
|
2414
2632
|
//#endregion
|
|
2415
2633
|
//#region src/components/weeklyFlow/WeeklyFlow.tsx
|
|
2416
2634
|
var Qt = 800, $t = 360;
|
|
2417
|
-
function en({ items: e = [],
|
|
2418
|
-
let
|
|
2419
|
-
|
|
2420
|
-
|
|
2635
|
+
function en({ items: e = [], onItemClick: r, testID: i }) {
|
|
2636
|
+
let [o, l] = ee(Qt), d = a(null), f = a(/* @__PURE__ */ new Map()), m = a(0), h = a(e);
|
|
2637
|
+
h.current = e;
|
|
2638
|
+
let v = t((e, t) => {
|
|
2639
|
+
let n = typeof t == "object" ? t.label ?? e : e, i = h.current.find((t) => t.id === e);
|
|
2640
|
+
r?.(e, n, i?.subentity);
|
|
2641
|
+
}, [r]), { hoveredRef: b, tooltip: x, hitZonesRef: w } = O(d, {
|
|
2642
|
+
width: l,
|
|
2643
|
+
height: $t,
|
|
2644
|
+
onClick: r ? v : void 0
|
|
2421
2645
|
});
|
|
2422
2646
|
return n(() => {
|
|
2423
|
-
let t =
|
|
2647
|
+
let t = d.current;
|
|
2424
2648
|
if (!t) return;
|
|
2425
|
-
let n =
|
|
2426
|
-
|
|
2427
|
-
let a = e.reduce((e, t) => e + (t.base ?? 0), 0),
|
|
2428
|
-
let n = Math.max(24, (e.total ?? 0) / (
|
|
2429
|
-
x:
|
|
2430
|
-
y:
|
|
2649
|
+
let n = S(t, l, $t);
|
|
2650
|
+
m.current = 0;
|
|
2651
|
+
let r = Math.round(l * .125), i = Math.round(l * .525), a = Math.round(l * .9), o = Math.max(60, Math.round(l * .1375)), s = e.reduce((e, t) => e + (t.base ?? 0), 0), c = e.reduce((e, t) => e + (t.variation ?? 0), 0), h = e.reduce((e, t) => e + (t.total ?? 0), 0), v = $t - 20 - 26, x = v - 6 * (e.length - 1), T = 20, E = e.map((e, t) => {
|
|
2652
|
+
let n = Math.max(24, (e.total ?? 0) / (h || 1) * x), i = {
|
|
2653
|
+
x: r - o / 2,
|
|
2654
|
+
y: T,
|
|
2431
2655
|
h: n,
|
|
2432
|
-
cy:
|
|
2656
|
+
cy: T + n / 2,
|
|
2433
2657
|
c: e,
|
|
2434
2658
|
color: p[t % p.length]
|
|
2435
2659
|
};
|
|
2436
|
-
return
|
|
2437
|
-
}),
|
|
2438
|
-
x:
|
|
2439
|
-
y:
|
|
2440
|
-
h:
|
|
2441
|
-
cy:
|
|
2442
|
-
},
|
|
2443
|
-
x:
|
|
2444
|
-
y:
|
|
2445
|
-
h:
|
|
2446
|
-
cy:
|
|
2447
|
-
},
|
|
2448
|
-
x:
|
|
2660
|
+
return T += n + 6, i;
|
|
2661
|
+
}), D = x - 14, O = Math.max(28, s / (h || 1) * D), k = Math.max(18, c / (h || 1) * D), M = 20 + (v - (O + k + 14)) / 2, N = {
|
|
2662
|
+
x: i - o / 2,
|
|
2663
|
+
y: M,
|
|
2664
|
+
h: O,
|
|
2665
|
+
cy: M + O / 2
|
|
2666
|
+
}, P = {
|
|
2667
|
+
x: i - o / 2,
|
|
2668
|
+
y: M + O + 14,
|
|
2669
|
+
h: k,
|
|
2670
|
+
cy: M + O + 14 + k / 2
|
|
2671
|
+
}, F = {
|
|
2672
|
+
x: a - o / 2,
|
|
2449
2673
|
y: 20,
|
|
2450
|
-
h:
|
|
2451
|
-
cy: 20 +
|
|
2452
|
-
},
|
|
2453
|
-
|
|
2454
|
-
let t =
|
|
2455
|
-
n.clearRect(0, 0,
|
|
2456
|
-
let
|
|
2457
|
-
if (
|
|
2458
|
-
let
|
|
2674
|
+
h: v,
|
|
2675
|
+
cy: 20 + v / 2
|
|
2676
|
+
}, R, z = () => {
|
|
2677
|
+
m.current++;
|
|
2678
|
+
let t = m.current;
|
|
2679
|
+
n.clearRect(0, 0, l, $t), n.letterSpacing = g.letterSpacing;
|
|
2680
|
+
let d = j(Math.min(t / 80, 1));
|
|
2681
|
+
if (L(f.current, b.current), w.current = [], e.forEach((t, r) => {
|
|
2682
|
+
let a = E[r], l = I(d, r, e.length, j), u = f.current.get(t.id) ?? 0;
|
|
2459
2683
|
if (l < .01) return;
|
|
2460
|
-
let
|
|
2461
|
-
tn(n,
|
|
2462
|
-
}),
|
|
2463
|
-
let e = Math.min(1, (
|
|
2464
|
-
tn(n,
|
|
2684
|
+
let p = (t.base ?? 0) / (t.total || 1), m = (t.variation ?? 0) / (t.total || 1), h = a.h * p, g = a.h * m, _ = a.y + h / 2, v = a.y + h + g / 2, y = Math.max(2, (t.base ?? 0) / s * O), b = Math.max(2, (t.variation ?? 0) / c * k), x = N.y + e.slice(0, r).reduce((e, t) => e + (t.base ?? 0) / s * O, 0) + y / 2, S = P.y + e.slice(0, r).reduce((e, t) => e + (t.variation ?? 0) / c * k, 0) + b / 2, C = u * .2 + .18;
|
|
2685
|
+
tn(n, a.x + o, _, i - o / 2, x, y * l, a.color, C), tn(n, a.x + o, v, i - o / 2, S, b * l, a.color, C * .75);
|
|
2686
|
+
}), d > .3) {
|
|
2687
|
+
let e = Math.min(1, (d - .3) / .7), t = F.y + s / h * v / 2, r = F.y + v - c / h * v / 2;
|
|
2688
|
+
tn(n, i + o / 2, N.cy, a - o / 2, t, O * e, u.blue, .25 * e), tn(n, i + o / 2, P.cy, a - o / 2, r, k * e, u.amber, .22 * e);
|
|
2465
2689
|
}
|
|
2466
2690
|
if ([
|
|
2467
2691
|
"Contractors",
|
|
2468
2692
|
"Components",
|
|
2469
2693
|
"Total"
|
|
2470
2694
|
].forEach((e, t) => {
|
|
2471
|
-
let
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2695
|
+
let o = [
|
|
2696
|
+
r,
|
|
2697
|
+
i,
|
|
2698
|
+
a
|
|
2475
2699
|
][t];
|
|
2476
|
-
n.font =
|
|
2477
|
-
}), e.forEach((t,
|
|
2478
|
-
let
|
|
2479
|
-
|
|
2700
|
+
n.font = g.font, n.fillStyle = g.color, n.textAlign = "center", n.fillText(e, o, $t - 8);
|
|
2701
|
+
}), e.forEach((t, r) => {
|
|
2702
|
+
let i = E[r], a = I(d, r, e.length, j), s = f.current.get(t.id) ?? 0;
|
|
2703
|
+
A(w.current, t.id, i.x, i.y, o, i.h, {
|
|
2480
2704
|
label: t.name,
|
|
2481
2705
|
value: t.totalLabel ?? String(t.total ?? 0),
|
|
2482
2706
|
sublabel: `${t.baseLabel ?? String(t.base ?? 0)} + ${t.variationLabel ?? String(t.variation ?? 0)}`,
|
|
2483
|
-
color:
|
|
2484
|
-
}),
|
|
2485
|
-
}),
|
|
2486
|
-
let e = Math.min(1, (
|
|
2487
|
-
|
|
2707
|
+
color: i.color
|
|
2708
|
+
}), s > 0 && C(n, i.x + o / 2, i.cy, o * .6, i.color, .12 * s), n.fillStyle = y(i.color, (.3 + s * .15) * a), n.strokeStyle = y(i.color, (.55 + s * .25) * a), n.lineWidth = 1, n.beginPath(), n.roundRect(i.x, i.y, o * a, i.h, 4), n.fill(), n.stroke(), a > .6 && i.h >= 24 && (n.globalAlpha = Math.min(1, (a - .6) / .4), n.font = g.font, n.fillStyle = s > 0 ? i.color : y(u.t2, .9), n.textAlign = "center", n.textBaseline = "middle", n.fillText(t.abbreviation ?? t.name?.slice(0, 6) ?? "", i.x + o / 2, i.h >= 36 ? i.cy - 5 : i.cy), i.h >= 36 && (n.font = "400 12px 'Satoshi Variable', 'DM Sans', sans-serif", n.fillStyle = y(u.t3, .8), n.fillText(t.totalLabel ?? String(t.total ?? 0), i.x + o / 2, i.cy + 7)), n.globalAlpha = 1, n.textBaseline = "alphabetic");
|
|
2709
|
+
}), d > .2) {
|
|
2710
|
+
let e = Math.min(1, (d - .2) / .4);
|
|
2711
|
+
C(n, i, N.cy, 30, u.blue, .1 * e), n.fillStyle = y(u.blue, .3 * e), n.strokeStyle = y(u.blue, .5 * e), n.lineWidth = 1, n.beginPath(), n.roundRect(N.x, N.y, o, N.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = g.font, n.fillStyle = u.blue, n.textAlign = "center", n.fillText("Base Value", i, N.cy - 6), n.font = _.font, n.fillStyle = _.color, n.fillText(K(s), i, N.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic", C(n, i, P.cy, 24, u.amber, .1 * e), n.fillStyle = y(u.amber, .22 * e), n.strokeStyle = y(u.amber, .4 * e), n.beginPath(), n.roundRect(P.x, P.y, o, P.h * e, 4), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = g.font, n.fillStyle = u.amber, n.textAlign = "center", n.fillText("Variations", i, P.cy - 4), n.font = _.font, n.fillStyle = _.color, n.fillText(K(c), i, P.cy + 8), n.globalAlpha = 1, n.textBaseline = "alphabetic";
|
|
2488
2712
|
}
|
|
2489
|
-
if (
|
|
2490
|
-
let e = Math.min(1, (
|
|
2491
|
-
|
|
2713
|
+
if (d > .5) {
|
|
2714
|
+
let e = Math.min(1, (d - .5) / .5);
|
|
2715
|
+
C(n, a, F.cy, 44, u.blue, .2 * e), n.fillStyle = y(u.blue, .25 * e), n.strokeStyle = y(u.blue, .6 * e), n.lineWidth = 1.5, n.beginPath(), n.roundRect(F.x, F.y, o, F.h * e, 6), n.fill(), n.stroke(), n.globalAlpha = e, n.textBaseline = "middle", n.font = g.font, n.fillStyle = u.t2, n.textAlign = "center", n.fillText("Total Commitment", a, F.cy - 12), n.font = _.font, n.fillStyle = u.blue, n.fillText(K(h), a, F.cy + 6), n.globalAlpha = 1, n.textBaseline = "alphabetic";
|
|
2492
2716
|
}
|
|
2493
|
-
|
|
2717
|
+
R = requestAnimationFrame(z);
|
|
2494
2718
|
};
|
|
2495
|
-
return
|
|
2496
|
-
}, [e]), /* @__PURE__ */ c("div", {
|
|
2497
|
-
|
|
2719
|
+
return z(), () => cancelAnimationFrame(R);
|
|
2720
|
+
}, [e, l]), /* @__PURE__ */ c("div", {
|
|
2721
|
+
ref: o,
|
|
2722
|
+
"data-testid": i,
|
|
2498
2723
|
style: {
|
|
2499
2724
|
position: "relative",
|
|
2500
|
-
width:
|
|
2725
|
+
width: "100%",
|
|
2501
2726
|
height: $t
|
|
2502
2727
|
},
|
|
2503
2728
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2504
|
-
ref:
|
|
2729
|
+
ref: d,
|
|
2505
2730
|
role: "img",
|
|
2506
2731
|
"aria-label": "Weekly report flow — base value and variations per contractor flowing to total commitment",
|
|
2507
2732
|
style: {
|
|
2508
|
-
width:
|
|
2733
|
+
width: "100%",
|
|
2509
2734
|
height: $t,
|
|
2510
2735
|
display: "block"
|
|
2511
2736
|
}
|
|
2512
|
-
}), /* @__PURE__ */ s(
|
|
2513
|
-
...
|
|
2514
|
-
parentW:
|
|
2737
|
+
}), /* @__PURE__ */ s(D, {
|
|
2738
|
+
...x,
|
|
2739
|
+
parentW: l,
|
|
2515
2740
|
parentH: $t
|
|
2516
2741
|
})]
|
|
2517
2742
|
});
|
|
2518
2743
|
}
|
|
2519
2744
|
function tn(e, t, n, r, i, a, o, s) {
|
|
2520
2745
|
let c = (t + r) / 2;
|
|
2521
|
-
e.beginPath(), e.moveTo(t, n - a / 2), e.bezierCurveTo(c, n - a / 2, c, i - a / 2, r, i - a / 2), e.lineTo(r, i + a / 2), e.bezierCurveTo(c, i + a / 2, c, n + a / 2, t, n + a / 2), e.closePath(), e.fillStyle =
|
|
2746
|
+
e.beginPath(), e.moveTo(t, n - a / 2), e.bezierCurveTo(c, n - a / 2, c, i - a / 2, r, i - a / 2), e.lineTo(r, i + a / 2), e.bezierCurveTo(c, i + a / 2, c, n + a / 2, t, n + a / 2), e.closePath(), e.fillStyle = y(o, s), e.fill();
|
|
2522
2747
|
}
|
|
2523
2748
|
//#endregion
|
|
2524
2749
|
//#region src/components/horizontalBarChart/HorizontalBarChart.tsx
|
|
@@ -2538,133 +2763,221 @@ function dn(e, t) {
|
|
|
2538
2763
|
let n = Math.abs(e), r = e < 0 ? "-" : "";
|
|
2539
2764
|
return n >= 1e6 ? `${r}${t}${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${r}${t}${(n / 1e3).toFixed(1)}K` : `${r}${t}${n.toFixed(0)}`;
|
|
2540
2765
|
}
|
|
2541
|
-
function fn({ rows: e, valuePrefix:
|
|
2542
|
-
let
|
|
2543
|
-
|
|
2544
|
-
|
|
2766
|
+
function fn({ rows: e, valuePrefix: n = "$", onItemClick: r, testID: i }) {
|
|
2767
|
+
let [l, d] = ee(nn), f = a(null), p = a(/* @__PURE__ */ new Map()), [m, h] = o(!1), v = a(e);
|
|
2768
|
+
v.current = e;
|
|
2769
|
+
let b = t((e, t) => {
|
|
2770
|
+
let n = typeof t == "object" ? t.label ?? e : e, i = v.current.find((t) => t.id === e);
|
|
2771
|
+
r?.(e, n, i?.subentity);
|
|
2772
|
+
}, [r]), x = e.filter((e) => e != null && typeof e.value == "number"), S = m ? x : x.slice(0, ln), w = S.length, T = Math.max(...x.map((e) => Math.abs(e.value)), 1), E = d - an.left - on - an.right, k = w * cn, j = an.top + an.bottom + k, { hoveredRef: N, tooltip: P, hitZonesRef: F } = O(f, {
|
|
2773
|
+
width: d,
|
|
2774
|
+
height: j,
|
|
2775
|
+
onClick: r ? b : void 0
|
|
2545
2776
|
});
|
|
2546
|
-
return
|
|
2547
|
-
|
|
2548
|
-
let
|
|
2549
|
-
if (e.save(), e.font =
|
|
2777
|
+
return ge(f, d, j, (e, t) => {
|
|
2778
|
+
L(p.current, N.current), F.current = [], S.forEach((r, i) => {
|
|
2779
|
+
let a = I(t, i, w, M), o = an.top + i * cn, s = o + (cn - sn) / 2, c = o + cn / 2, l = an.left + on, f = p.current.get(r.id) ?? 0, m = Math.abs(r.value) / T * E * a, h = r.valueLabel ?? dn(r.value, n);
|
|
2780
|
+
if (e.save(), e.font = g.font, e.fillStyle = f > 0 ? u.cyan : g.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(un(e, r.name, on - 16), l - 8, c), A(F.current, r.id, 0, o, l, cn, {
|
|
2550
2781
|
label: r.name,
|
|
2551
|
-
value:
|
|
2782
|
+
value: h,
|
|
2552
2783
|
color: u.cyan
|
|
2553
|
-
}), e.fillStyle =
|
|
2554
|
-
f > 0 &&
|
|
2555
|
-
let t = e.createLinearGradient(
|
|
2556
|
-
t.addColorStop(0,
|
|
2784
|
+
}), e.fillStyle = y(u.cyan, .1), e.beginPath(), e.roundRect(l, s, E, sn, sn / 2), e.fill(), m > 0) {
|
|
2785
|
+
f > 0 && C(e, l + m, s + sn / 2, m * .25, u.cyan, .14 * f);
|
|
2786
|
+
let t = e.createLinearGradient(l, s, l + m, s);
|
|
2787
|
+
t.addColorStop(0, y(u.cyan, .2 + f * .05)), t.addColorStop(.55, y(u.cyan, .55 + f * .15)), t.addColorStop(1, y(u.cyan, .72 + f * .18)), e.fillStyle = t, e.beginPath(), e.roundRect(l, s, m, sn, sn / 2), e.fill();
|
|
2557
2788
|
}
|
|
2558
|
-
f > 0 &&
|
|
2789
|
+
f > 0 && m > 0 && (e.strokeStyle = y(u.cyan, .6 * f), e.lineWidth = 1, e.beginPath(), e.roundRect(l, s, m, sn, sn / 2), e.stroke()), a > .35 && (e.globalAlpha = Math.min(1, (a - .35) / .4), e.font = _.font, e.fillStyle = f > 0 ? u.cyan : _.color, e.textAlign = "right", e.textBaseline = "middle", e.fillText(h, d - 8, c)), e.restore(), A(F.current, r.id, l, o, Math.max(m, 1), cn, {
|
|
2559
2790
|
label: r.name,
|
|
2560
|
-
value:
|
|
2791
|
+
value: h,
|
|
2561
2792
|
color: u.cyan
|
|
2562
2793
|
});
|
|
2563
2794
|
});
|
|
2564
|
-
}, !0, { easing:
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2795
|
+
}, !0, { easing: M }), x.length === 0 ? /* @__PURE__ */ s("div", {
|
|
2796
|
+
ref: l,
|
|
2797
|
+
style: { width: "100%" },
|
|
2798
|
+
children: /* @__PURE__ */ s(G, {
|
|
2799
|
+
width: d,
|
|
2800
|
+
height: rn,
|
|
2801
|
+
message: "No data available",
|
|
2802
|
+
testID: i
|
|
2803
|
+
})
|
|
2569
2804
|
}) : /* @__PURE__ */ c("div", {
|
|
2570
|
-
|
|
2571
|
-
|
|
2805
|
+
ref: l,
|
|
2806
|
+
"data-testid": i,
|
|
2807
|
+
style: { width: "100%" },
|
|
2572
2808
|
children: [/* @__PURE__ */ c("div", {
|
|
2573
2809
|
style: { position: "relative" },
|
|
2574
2810
|
children: [/* @__PURE__ */ s("canvas", {
|
|
2575
|
-
ref:
|
|
2811
|
+
ref: f,
|
|
2576
2812
|
role: "img",
|
|
2577
2813
|
"aria-label": "Horizontal bar chart",
|
|
2578
2814
|
style: {
|
|
2579
|
-
width:
|
|
2580
|
-
height:
|
|
2815
|
+
width: "100%",
|
|
2816
|
+
height: j,
|
|
2581
2817
|
display: "block",
|
|
2582
2818
|
borderRadius: 8
|
|
2583
2819
|
}
|
|
2584
|
-
}), /* @__PURE__ */ s(
|
|
2585
|
-
...
|
|
2586
|
-
parentW:
|
|
2587
|
-
parentH:
|
|
2820
|
+
}), /* @__PURE__ */ s(D, {
|
|
2821
|
+
...P,
|
|
2822
|
+
parentW: d,
|
|
2823
|
+
parentH: j
|
|
2588
2824
|
})]
|
|
2589
|
-
}),
|
|
2825
|
+
}), x.length > ln && /* @__PURE__ */ s("div", {
|
|
2590
2826
|
style: { marginTop: 8 },
|
|
2591
|
-
children: /* @__PURE__ */ s(
|
|
2592
|
-
expanded:
|
|
2593
|
-
onToggle: () =>
|
|
2594
|
-
"data-testid":
|
|
2827
|
+
children: /* @__PURE__ */ s(te, {
|
|
2828
|
+
expanded: m,
|
|
2829
|
+
onToggle: () => h((e) => !e),
|
|
2830
|
+
"data-testid": i ? `${i}-toggle` : void 0
|
|
2595
2831
|
})
|
|
2596
2832
|
})]
|
|
2597
2833
|
});
|
|
2598
2834
|
}
|
|
2599
2835
|
//#endregion
|
|
2600
2836
|
//#region src/components/visualizationRenderer/VisualizationRenderer.tsx
|
|
2601
|
-
function pn({ config: e, className: t, colorOffset: n = 0 }) {
|
|
2602
|
-
|
|
2837
|
+
function pn({ config: e, className: t, colorOffset: n = 0, onItemClick: r, selectedId: i, listenerItems: a }) {
|
|
2838
|
+
let o = a ? void 0 : i;
|
|
2839
|
+
if (e.type === Y.LINE) return /* @__PURE__ */ s(He, {
|
|
2603
2840
|
rows: e.rows,
|
|
2604
2841
|
className: t
|
|
2605
|
-
})
|
|
2842
|
+
});
|
|
2843
|
+
if (e.type === Y.AREA) return /* @__PURE__ */ s(V, {
|
|
2606
2844
|
rows: e.rows,
|
|
2607
2845
|
className: t
|
|
2608
|
-
})
|
|
2846
|
+
});
|
|
2847
|
+
if (e.type === Y.BAR) return /* @__PURE__ */ s(W, {
|
|
2609
2848
|
rows: e.rows,
|
|
2610
2849
|
className: t
|
|
2611
|
-
})
|
|
2850
|
+
});
|
|
2851
|
+
if (e.type === Y.PIE) return /* @__PURE__ */ s(et, {
|
|
2612
2852
|
rows: e.rows,
|
|
2613
2853
|
variant: "pie",
|
|
2614
2854
|
className: t
|
|
2615
|
-
})
|
|
2855
|
+
});
|
|
2856
|
+
if (e.type === Y.DONUT) return /* @__PURE__ */ s(et, {
|
|
2616
2857
|
rows: e.rows,
|
|
2617
2858
|
variant: "donut",
|
|
2618
2859
|
className: t
|
|
2619
|
-
})
|
|
2860
|
+
});
|
|
2861
|
+
if (e.type === Y.SANKEY) return /* @__PURE__ */ s(dt, {
|
|
2620
2862
|
rows: e.rows,
|
|
2621
2863
|
className: t
|
|
2622
|
-
})
|
|
2864
|
+
});
|
|
2865
|
+
if (e.type === Y.FLOW) return /* @__PURE__ */ s(ut, {
|
|
2623
2866
|
selectedEntity: e.selectedEntity,
|
|
2624
2867
|
className: t
|
|
2625
|
-
})
|
|
2868
|
+
});
|
|
2869
|
+
if (e.type === Y.TREND) return /* @__PURE__ */ s(Ht, {
|
|
2626
2870
|
points: e.points,
|
|
2627
2871
|
className: t
|
|
2628
|
-
})
|
|
2872
|
+
});
|
|
2873
|
+
if (e.type === Y.MINI_BARS) return /* @__PURE__ */ s(Ge, {
|
|
2629
2874
|
rows: e.rows,
|
|
2630
2875
|
className: t
|
|
2631
|
-
})
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2876
|
+
});
|
|
2877
|
+
if (e.type === Y.STACKED_HORIZONTAL_BAR) {
|
|
2878
|
+
let t = e.data ?? { items: e.items ?? [] };
|
|
2879
|
+
return /* @__PURE__ */ s(Me, {
|
|
2880
|
+
data: a ? { items: a } : t,
|
|
2881
|
+
dataByEntity: e.dataByEntity,
|
|
2882
|
+
onItemClick: r,
|
|
2883
|
+
selectedId: o
|
|
2884
|
+
});
|
|
2885
|
+
}
|
|
2886
|
+
if (e.type === Y.MULTI_METRIC_CONSTELLATION) return /* @__PURE__ */ s(Ce, { items: e.items });
|
|
2887
|
+
if (e.type === Y.PROGRESS_RACE) return /* @__PURE__ */ s(ue, {
|
|
2888
|
+
items: a || e.items,
|
|
2889
|
+
itemsByEntity: e.itemsByEntity,
|
|
2890
|
+
colorOffset: n,
|
|
2891
|
+
onItemClick: r,
|
|
2892
|
+
selectedId: o
|
|
2893
|
+
});
|
|
2894
|
+
if (e.type === Y.HUB_AND_SPOKE_RADIAL) return /* @__PURE__ */ s(zt, {
|
|
2635
2895
|
segments: e.segments,
|
|
2636
2896
|
title: e.title,
|
|
2637
2897
|
unitLabel: e.unitLabel
|
|
2638
|
-
})
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2898
|
+
});
|
|
2899
|
+
if (e.type === Y.DOT_MATRIX) return /* @__PURE__ */ s(Ve, { items: e.items });
|
|
2900
|
+
if (e.type === Y.RANKED_CARD_LEADERBOARD) return /* @__PURE__ */ s(Re, {
|
|
2901
|
+
items: a || e.items,
|
|
2902
|
+
onItemClick: r
|
|
2903
|
+
});
|
|
2904
|
+
if (e.type === Y.PROPORTIONAL_BAND) return /* @__PURE__ */ s(Pt, {
|
|
2905
|
+
severities: a || e.severities,
|
|
2906
|
+
colorOffset: n,
|
|
2907
|
+
onItemClick: r
|
|
2908
|
+
});
|
|
2909
|
+
if (e.type === Y.RADIAL_FAN_TREE) {
|
|
2910
|
+
let t = a && !Array.isArray(a) ? a : null, i = t ? t.items : a || e.items;
|
|
2911
|
+
return /* @__PURE__ */ s(Xe, {
|
|
2912
|
+
total: t ? t.total : a ? a.reduce((e, t) => e + (t.count ?? 0), 0) : e.total,
|
|
2913
|
+
totalLabel: t ? t.totalLabel : e.totalLabel,
|
|
2914
|
+
items: i,
|
|
2915
|
+
dataByEntity: e.dataByEntity,
|
|
2916
|
+
colorOffset: n,
|
|
2917
|
+
onItemClick: r,
|
|
2918
|
+
selectedId: o
|
|
2919
|
+
});
|
|
2920
|
+
}
|
|
2921
|
+
if (e.type === Y.SEMI_CIRCULAR_GAUGE) {
|
|
2922
|
+
let t = Array.isArray(a) ? a[0] : void 0;
|
|
2923
|
+
return /* @__PURE__ */ s(he, {
|
|
2924
|
+
confirmed: t ? Number(t.confirmed ?? 0) : e.confirmed,
|
|
2925
|
+
total: t ? Number(t.total ?? 1) : e.total,
|
|
2926
|
+
label: e.label,
|
|
2927
|
+
gaugeByEntity: e.gaugeByEntity,
|
|
2928
|
+
colorOffset: n,
|
|
2929
|
+
selectedId: o,
|
|
2930
|
+
onItemClick: r,
|
|
2931
|
+
subentity: e.subentity
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
if (e.type === Y.SEGMENTED_SPLIT_BAR) return /* @__PURE__ */ s(Zt, {
|
|
2935
|
+
items: a || e.items,
|
|
2936
|
+
itemsByEntity: e.itemsByEntity,
|
|
2653
2937
|
labelA: e.labelA,
|
|
2654
2938
|
labelB: e.labelB,
|
|
2655
|
-
unit: e.unit
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2939
|
+
unit: e.unit,
|
|
2940
|
+
onItemClick: r,
|
|
2941
|
+
selectedId: o
|
|
2942
|
+
});
|
|
2943
|
+
if (e.type === Y.BALANCE_SCALE) {
|
|
2944
|
+
let t = e.left, n = e.right;
|
|
2945
|
+
if (a && !Array.isArray(a)) {
|
|
2946
|
+
let e = a;
|
|
2947
|
+
if (e.items?.length >= 2) {
|
|
2948
|
+
let r = Number(e.items[0].count ?? 0), i = Number(e.items[1].count ?? 0);
|
|
2949
|
+
t = {
|
|
2950
|
+
value: r,
|
|
2951
|
+
count: 1,
|
|
2952
|
+
label: "£" + K(r, 2)
|
|
2953
|
+
}, n = {
|
|
2954
|
+
value: i,
|
|
2955
|
+
count: 1,
|
|
2956
|
+
label: "£" + K(i, 2)
|
|
2957
|
+
};
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
return /* @__PURE__ */ s(mt, {
|
|
2961
|
+
left: t,
|
|
2962
|
+
right: n,
|
|
2963
|
+
leftTitle: e.leftTitle,
|
|
2964
|
+
rightTitle: e.rightTitle,
|
|
2965
|
+
unit: e.unit,
|
|
2966
|
+
dataByEntity: e.dataByEntity,
|
|
2967
|
+
onItemClick: r,
|
|
2968
|
+
selectedId: o
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
return e.type === Y.AREA_LINE ? /* @__PURE__ */ s(_t, { points: e.points }) : e.type === Y.TREND_VIEW ? /* @__PURE__ */ s(Ot, {
|
|
2972
|
+
points: (a && !Array.isArray(a) ? a.points ?? [] : void 0) ?? e.points,
|
|
2664
2973
|
colorOffset: n
|
|
2665
|
-
}) : e.type ===
|
|
2666
|
-
|
|
2667
|
-
|
|
2974
|
+
}) : e.type === Y.WEEKLY_FLOW ? /* @__PURE__ */ s(en, {
|
|
2975
|
+
items: a || e.items,
|
|
2976
|
+
onItemClick: r
|
|
2977
|
+
}) : e.type === Y.HORIZONTAL_BAR ? /* @__PURE__ */ s(fn, {
|
|
2978
|
+
rows: a || e.rows,
|
|
2979
|
+
valuePrefix: e.valuePrefix,
|
|
2980
|
+
onItemClick: r
|
|
2668
2981
|
}) : /* @__PURE__ */ s("div", {
|
|
2669
2982
|
className: "viz-empty",
|
|
2670
2983
|
children: "Visualization unavailable"
|
|
@@ -2702,7 +3015,7 @@ function vn(e) {
|
|
|
2702
3015
|
//#endregion
|
|
2703
3016
|
//#region src/components/donutChart/DonutChart.tsx
|
|
2704
3017
|
function yn({ rows: e = [], className: t, colors: n }) {
|
|
2705
|
-
return /* @__PURE__ */ s(
|
|
3018
|
+
return /* @__PURE__ */ s(et, {
|
|
2706
3019
|
rows: e,
|
|
2707
3020
|
variant: "donut",
|
|
2708
3021
|
className: t,
|
|
@@ -3535,4 +3848,130 @@ function Ln({ text: e }) {
|
|
|
3535
3848
|
});
|
|
3536
3849
|
}
|
|
3537
3850
|
//#endregion
|
|
3538
|
-
|
|
3851
|
+
//#region src/assets/ArrowClockwise.svg
|
|
3852
|
+
var Rn = "data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_3072_19126)'%3e%3cpath%20d='M14.375%208.125H18.125V4.375'%20stroke='%2369DFE9'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M14.7188%2015C13.736%2015.9274%2012.5017%2016.5446%2011.1701%2016.7745C9.83859%2017.0044%208.46881%2016.8368%207.23196%2016.2926C5.99511%2015.7485%204.94602%2014.852%204.21579%2013.715C3.48556%2012.5781%203.10656%2011.2511%203.12615%209.90004C3.14574%208.54893%203.56304%207.23355%204.32593%206.11825C5.08881%205.00295%206.16344%204.13719%207.41555%203.62914C8.66765%203.12109%2010.0417%202.99329%2011.366%203.26169C12.6904%203.5301%2013.9062%204.18281%2014.8617%205.13828L18.125%208.125'%20stroke='%2369DFE9'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_3072_19126'%3e%3crect%20width='20'%20height='20'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";
|
|
3853
|
+
//#endregion
|
|
3854
|
+
//#region src/components/visualizationGroup/VisualizationGroup.tsx
|
|
3855
|
+
function zn(e) {
|
|
3856
|
+
return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
3857
|
+
}
|
|
3858
|
+
var Bn = 56;
|
|
3859
|
+
function Vn({ items: e, colorOffset: i = 0, title: l, "data-testid": u }) {
|
|
3860
|
+
let [d, f] = o(void 0), [p, m] = o(void 0), [h, g] = o(null), [_, v] = o(null), [y, b] = o(null), [x, S] = o(null), [C, w] = o(null), [T, E] = o(0), [D, O] = o(0), k = a(null), A = a(null), j = a(null), M = a(null), N = a(null);
|
|
3861
|
+
n(() => {
|
|
3862
|
+
let e = k.current;
|
|
3863
|
+
if (!e) return;
|
|
3864
|
+
let t = (t) => {
|
|
3865
|
+
let { centerClientY: n, centerClientX: r, sourceClientY: i } = t.detail, a = e.getBoundingClientRect(), o = t.target, s = o.getBoundingClientRect();
|
|
3866
|
+
A.current = o, j.current = n - s.top, M.current = r - s.left, N.current = i == null ? null : i - s.top, b(n - a.top), S(r - a.left), w(i == null ? null : i - a.top), E(a.height), O(a.width);
|
|
3867
|
+
};
|
|
3868
|
+
return e.addEventListener("viz-item-click", t), () => e.removeEventListener("viz-item-click", t);
|
|
3869
|
+
}, []), r(() => {
|
|
3870
|
+
if (!h || A.current === null || j.current === null) return;
|
|
3871
|
+
let e = k.current;
|
|
3872
|
+
if (!e) return;
|
|
3873
|
+
let t = A.current.getBoundingClientRect(), n = e.getBoundingClientRect();
|
|
3874
|
+
b(t.top - n.top + j.current), M.current !== null && S(t.left - n.left + M.current), N.current !== null && w(t.top - n.top + N.current), E(n.height), O(n.width);
|
|
3875
|
+
}, [h]);
|
|
3876
|
+
let P = t((e, t, n, r) => {
|
|
3877
|
+
if (!(r != null && (!Array.isArray(r) || r.length > 0))) return;
|
|
3878
|
+
let i = zn(t);
|
|
3879
|
+
f((t) => {
|
|
3880
|
+
let a = t === i ? void 0 : i;
|
|
3881
|
+
return m(a ? n : void 0), a ? (v(e), g(r)) : (g(null), v(null)), a;
|
|
3882
|
+
});
|
|
3883
|
+
}, []), F = t(() => {
|
|
3884
|
+
f(void 0), m(void 0), g(null), v(null), b(null), S(null), w(null), A.current = null, j.current = null, M.current = null, N.current = null;
|
|
3885
|
+
}, []), I = _ !== null && y !== null, L = y ?? T / 2, R = e.length - 1, z = D > 0 ? (D - R * Bn) / e.length : null, B = (t) => I && _ === t && e[t]?.type === Y.BALANCE_SCALE, V = _ !== null && e[_]?.type === Y.BALANCE_SCALE && I && x !== null && C !== null && z !== null;
|
|
3886
|
+
return /* @__PURE__ */ c("div", {
|
|
3887
|
+
className: "viz-group",
|
|
3888
|
+
"data-testid": u,
|
|
3889
|
+
children: [
|
|
3890
|
+
l && /* @__PURE__ */ s("div", {
|
|
3891
|
+
className: "viz-group__title",
|
|
3892
|
+
children: l
|
|
3893
|
+
}),
|
|
3894
|
+
/* @__PURE__ */ s("div", {
|
|
3895
|
+
className: "viz-group__bar",
|
|
3896
|
+
children: d ? /* @__PURE__ */ c("button", {
|
|
3897
|
+
type: "button",
|
|
3898
|
+
className: "viz-group__reset-btn",
|
|
3899
|
+
onClick: F,
|
|
3900
|
+
"aria-label": "Reset selection",
|
|
3901
|
+
children: [/* @__PURE__ */ s("img", {
|
|
3902
|
+
src: Rn,
|
|
3903
|
+
alt: "",
|
|
3904
|
+
className: "viz-group__reset-icon"
|
|
3905
|
+
}), "Reset"]
|
|
3906
|
+
}) : /* @__PURE__ */ s("span", {
|
|
3907
|
+
className: "viz-group__hint",
|
|
3908
|
+
children: "↑ Click a row to drill down"
|
|
3909
|
+
})
|
|
3910
|
+
}),
|
|
3911
|
+
/* @__PURE__ */ c("div", {
|
|
3912
|
+
ref: k,
|
|
3913
|
+
className: "viz-group__charts",
|
|
3914
|
+
children: [e.flatMap((t, n) => {
|
|
3915
|
+
let r = _ === null ? n === e.length - 1 : n !== _, a = B(n) && x !== null && C !== null && z !== null, o = /* @__PURE__ */ c("div", {
|
|
3916
|
+
className: `viz-group__chart viz-group__chart--${t.type}${r ? " viz-group__chart--listener" : ""}`,
|
|
3917
|
+
children: [r && /* @__PURE__ */ s("div", {
|
|
3918
|
+
className: "viz-group__listener-label",
|
|
3919
|
+
children: _ === null ? null : p
|
|
3920
|
+
}), /* @__PURE__ */ s(pn, {
|
|
3921
|
+
config: t,
|
|
3922
|
+
colorOffset: i + n,
|
|
3923
|
+
onItemClick: (e, t, r) => P(n, e, t, r),
|
|
3924
|
+
selectedId: d,
|
|
3925
|
+
listenerItems: n !== _ && h ? h : void 0
|
|
3926
|
+
})]
|
|
3927
|
+
}, n);
|
|
3928
|
+
if (n === e.length - 1) return [o];
|
|
3929
|
+
let l = _ !== null && _ > n, u = l ? -.7 : Bn + .7, f = x !== null && z !== null ? x - z : l ? Bn + 20 : -20, m = `M ${a ? l ? Bn : 0 : f} ${L} H ${u}`;
|
|
3930
|
+
return [o, /* @__PURE__ */ s("div", {
|
|
3931
|
+
className: `viz-group__connector${I ? " viz-group__connector--active" : ""}`,
|
|
3932
|
+
children: /* @__PURE__ */ c("svg", {
|
|
3933
|
+
className: "viz-group__connector-svg",
|
|
3934
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3935
|
+
"aria-hidden": "true",
|
|
3936
|
+
children: [
|
|
3937
|
+
!a && /* @__PURE__ */ s("line", {
|
|
3938
|
+
x1: f,
|
|
3939
|
+
y1: L - 7,
|
|
3940
|
+
x2: f,
|
|
3941
|
+
y2: L + 7,
|
|
3942
|
+
className: "viz-group__connector-tick"
|
|
3943
|
+
}),
|
|
3944
|
+
/* @__PURE__ */ s("path", {
|
|
3945
|
+
d: m,
|
|
3946
|
+
className: "viz-group__connector-path"
|
|
3947
|
+
}),
|
|
3948
|
+
/* @__PURE__ */ s("circle", {
|
|
3949
|
+
cx: u,
|
|
3950
|
+
cy: L,
|
|
3951
|
+
r: "4",
|
|
3952
|
+
className: "viz-group__connector-dot"
|
|
3953
|
+
})
|
|
3954
|
+
]
|
|
3955
|
+
})
|
|
3956
|
+
}, `connector-${n}`)];
|
|
3957
|
+
}), V && /* @__PURE__ */ c("svg", {
|
|
3958
|
+
className: "viz-group__route-svg",
|
|
3959
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3960
|
+
"aria-hidden": "true",
|
|
3961
|
+
children: [/* @__PURE__ */ s("line", {
|
|
3962
|
+
x1: x - 7,
|
|
3963
|
+
y1: C,
|
|
3964
|
+
x2: x + 7,
|
|
3965
|
+
y2: C,
|
|
3966
|
+
className: "viz-group__connector-tick"
|
|
3967
|
+
}), /* @__PURE__ */ s("path", {
|
|
3968
|
+
d: `M ${x} ${C} L ${x} ${L} H ${z}`,
|
|
3969
|
+
className: "viz-group__connector-path"
|
|
3970
|
+
})]
|
|
3971
|
+
})]
|
|
3972
|
+
})
|
|
3973
|
+
]
|
|
3974
|
+
});
|
|
3975
|
+
}
|
|
3976
|
+
//#endregion
|
|
3977
|
+
export { V as AreaChart, W as BarChart, h as CHART_PALETTE, l as ChartFrame, yn as DonutChart, d as GRAD, Pn as KeyHighlights, He as LineChart, Ge as MiniBars, p as PALETTE, et as PieChart, ut as ProcessSankey, dt as RankingSankey, f as SOLID, nt as SankeySvg, B as SeriesChart, Ln as Takeaway, Ot as Trend, Ht as TrendChart, Vn as VisualizationGroup, pn as VisualizationRenderer, gn as cleanupVisualizationMounts, _n as hydrateVisualizationMounts, vn as serializeVisualizationConfig };
|