@empoweredvote/ev-ui 0.8.6 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +50 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -111,7 +111,11 @@ function RadarChartCore({
|
|
|
111
111
|
writeIns = {},
|
|
112
112
|
darkMode = false,
|
|
113
113
|
lineColor,
|
|
114
|
-
ringColor
|
|
114
|
+
ringColor,
|
|
115
|
+
// replacedSpokes: short_titles of substitute spokes (not the user's original defaults)
|
|
116
|
+
replacedSpokes = {},
|
|
117
|
+
// boldOriginalSpokes: when true, bold spokes that are NOT replacements
|
|
118
|
+
boldOriginalSpokes = false
|
|
115
119
|
}) {
|
|
116
120
|
var _a;
|
|
117
121
|
const radius = size / 2 - 40;
|
|
@@ -292,6 +296,8 @@ function RadarChartCore({
|
|
|
292
296
|
if (isTop && lines.length > 1) labelY -= (lines.length - 1) * lineHeight;
|
|
293
297
|
const isActive = shortTitle === activeSpoke;
|
|
294
298
|
const isUnansweredLabel = !!unansweredSpokes[shortTitle];
|
|
299
|
+
const isReplaced = !!replacedSpokes[shortTitle];
|
|
300
|
+
const shouldBold = boldOriginalSpokes && !isReplaced;
|
|
295
301
|
const fSize = labelFontSize;
|
|
296
302
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
297
303
|
"text",
|
|
@@ -303,7 +309,7 @@ function RadarChartCore({
|
|
|
303
309
|
dominantBaseline: isBottom ? "hanging" : "auto",
|
|
304
310
|
onClick: () => onReplaceTopic(shortTitle),
|
|
305
311
|
fill: isActive ? "#E85D26" : isUnansweredLabel ? "#9ca3af" : darkMode ? "#D3D7DE" : "#555",
|
|
306
|
-
fontWeight: isActive ? "bold" : "normal",
|
|
312
|
+
fontWeight: isActive || shouldBold ? "bold" : "normal",
|
|
307
313
|
style: { cursor: "pointer", userSelect: "none", fontSize: fSize, fontFamily: "sans-serif" }
|
|
308
314
|
},
|
|
309
315
|
isUnansweredLabel && /* @__PURE__ */ import_react.default.createElement("title", null, "No stance on file for this topic."),
|
|
@@ -341,9 +347,7 @@ function RadarChartCore({
|
|
|
341
347
|
fill: matches ? "#fed12e" : "#7C6B9E",
|
|
342
348
|
stroke: "#FFFFFF",
|
|
343
349
|
strokeWidth: 3,
|
|
344
|
-
style: {
|
|
345
|
-
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, userVal) }),
|
|
346
|
-
onMouseLeave: () => setTooltip(null)
|
|
350
|
+
style: { pointerEvents: "none" }
|
|
347
351
|
}
|
|
348
352
|
);
|
|
349
353
|
}),
|
|
@@ -352,14 +356,14 @@ function RadarChartCore({
|
|
|
352
356
|
{
|
|
353
357
|
key: "compare-static",
|
|
354
358
|
points: comparePoints,
|
|
355
|
-
style: { fill: "rgba(90, 154, 110, 0.
|
|
359
|
+
style: { fill: "rgba(90, 154, 110, 0.45)", stroke: "#5A9A6E", strokeWidth: 2, mixBlendMode: "multiply" }
|
|
356
360
|
}
|
|
357
361
|
) : /* @__PURE__ */ import_react.default.createElement(
|
|
358
362
|
import_web.animated.polygon,
|
|
359
363
|
{
|
|
360
364
|
key: "compare-animated",
|
|
361
365
|
points: compareSpring.points,
|
|
362
|
-
style: { fill: "rgba(90, 154, 110, 0.
|
|
366
|
+
style: { fill: "rgba(90, 154, 110, 0.45)", stroke: "#5A9A6E", strokeWidth: 2, mixBlendMode: "multiply" }
|
|
363
367
|
}
|
|
364
368
|
) : null,
|
|
365
369
|
hasCompareData && compareCoords && compareCoords.map(([cx, cy], i) => {
|
|
@@ -378,9 +382,7 @@ function RadarChartCore({
|
|
|
378
382
|
fill: matches ? "#fed12e" : "#5A9A6E",
|
|
379
383
|
stroke: "#FFFFFF",
|
|
380
384
|
strokeWidth: 3,
|
|
381
|
-
style: {
|
|
382
|
-
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, compareVal) }),
|
|
383
|
-
onMouseLeave: () => setTooltip(null)
|
|
385
|
+
style: { pointerEvents: "none" }
|
|
384
386
|
}
|
|
385
387
|
);
|
|
386
388
|
}),
|
|
@@ -404,6 +406,44 @@ function RadarChartCore({
|
|
|
404
406
|
}
|
|
405
407
|
);
|
|
406
408
|
}),
|
|
409
|
+
pointsArr.map(([cx, cy], i) => {
|
|
410
|
+
const shortTitle = spokes[i][0];
|
|
411
|
+
const userVal = spokes[i][1];
|
|
412
|
+
if (!userVal || Number(userVal) === 0) return null;
|
|
413
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
414
|
+
"circle",
|
|
415
|
+
{
|
|
416
|
+
key: `user-sensor-${i}`,
|
|
417
|
+
cx,
|
|
418
|
+
cy,
|
|
419
|
+
r: 14,
|
|
420
|
+
fill: "transparent",
|
|
421
|
+
stroke: "none",
|
|
422
|
+
style: { cursor: "default" },
|
|
423
|
+
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, userVal) }),
|
|
424
|
+
onMouseLeave: () => setTooltip(null)
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}),
|
|
428
|
+
hasCompareData && compareCoords && compareCoords.map(([cx, cy], i) => {
|
|
429
|
+
const shortTitle = spokes[i][0];
|
|
430
|
+
const compareVal = compareData[shortTitle];
|
|
431
|
+
if (!compareVal || Number(compareVal) === 0) return null;
|
|
432
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
433
|
+
"circle",
|
|
434
|
+
{
|
|
435
|
+
key: `compare-sensor-${i}`,
|
|
436
|
+
cx,
|
|
437
|
+
cy,
|
|
438
|
+
r: 14,
|
|
439
|
+
fill: "transparent",
|
|
440
|
+
stroke: "none",
|
|
441
|
+
style: { cursor: "default" },
|
|
442
|
+
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, compareVal) }),
|
|
443
|
+
onMouseLeave: () => setTooltip(null)
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
}),
|
|
407
447
|
tooltip && (() => {
|
|
408
448
|
const tipW = 190;
|
|
409
449
|
const tipH = 70;
|