@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.mjs
CHANGED
|
@@ -20,7 +20,11 @@ function RadarChartCore({
|
|
|
20
20
|
writeIns = {},
|
|
21
21
|
darkMode = false,
|
|
22
22
|
lineColor,
|
|
23
|
-
ringColor
|
|
23
|
+
ringColor,
|
|
24
|
+
// replacedSpokes: short_titles of substitute spokes (not the user's original defaults)
|
|
25
|
+
replacedSpokes = {},
|
|
26
|
+
// boldOriginalSpokes: when true, bold spokes that are NOT replacements
|
|
27
|
+
boldOriginalSpokes = false
|
|
24
28
|
}) {
|
|
25
29
|
var _a;
|
|
26
30
|
const radius = size / 2 - 40;
|
|
@@ -201,6 +205,8 @@ function RadarChartCore({
|
|
|
201
205
|
if (isTop && lines.length > 1) labelY -= (lines.length - 1) * lineHeight;
|
|
202
206
|
const isActive = shortTitle === activeSpoke;
|
|
203
207
|
const isUnansweredLabel = !!unansweredSpokes[shortTitle];
|
|
208
|
+
const isReplaced = !!replacedSpokes[shortTitle];
|
|
209
|
+
const shouldBold = boldOriginalSpokes && !isReplaced;
|
|
204
210
|
const fSize = labelFontSize;
|
|
205
211
|
return /* @__PURE__ */ React.createElement(
|
|
206
212
|
"text",
|
|
@@ -212,7 +218,7 @@ function RadarChartCore({
|
|
|
212
218
|
dominantBaseline: isBottom ? "hanging" : "auto",
|
|
213
219
|
onClick: () => onReplaceTopic(shortTitle),
|
|
214
220
|
fill: isActive ? "#E85D26" : isUnansweredLabel ? "#9ca3af" : darkMode ? "#D3D7DE" : "#555",
|
|
215
|
-
fontWeight: isActive ? "bold" : "normal",
|
|
221
|
+
fontWeight: isActive || shouldBold ? "bold" : "normal",
|
|
216
222
|
style: { cursor: "pointer", userSelect: "none", fontSize: fSize, fontFamily: "sans-serif" }
|
|
217
223
|
},
|
|
218
224
|
isUnansweredLabel && /* @__PURE__ */ React.createElement("title", null, "No stance on file for this topic."),
|
|
@@ -250,9 +256,7 @@ function RadarChartCore({
|
|
|
250
256
|
fill: matches ? "#fed12e" : "#7C6B9E",
|
|
251
257
|
stroke: "#FFFFFF",
|
|
252
258
|
strokeWidth: 3,
|
|
253
|
-
style: {
|
|
254
|
-
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, userVal) }),
|
|
255
|
-
onMouseLeave: () => setTooltip(null)
|
|
259
|
+
style: { pointerEvents: "none" }
|
|
256
260
|
}
|
|
257
261
|
);
|
|
258
262
|
}),
|
|
@@ -261,14 +265,14 @@ function RadarChartCore({
|
|
|
261
265
|
{
|
|
262
266
|
key: "compare-static",
|
|
263
267
|
points: comparePoints,
|
|
264
|
-
style: { fill: "rgba(90, 154, 110, 0.
|
|
268
|
+
style: { fill: "rgba(90, 154, 110, 0.45)", stroke: "#5A9A6E", strokeWidth: 2, mixBlendMode: "multiply" }
|
|
265
269
|
}
|
|
266
270
|
) : /* @__PURE__ */ React.createElement(
|
|
267
271
|
animated.polygon,
|
|
268
272
|
{
|
|
269
273
|
key: "compare-animated",
|
|
270
274
|
points: compareSpring.points,
|
|
271
|
-
style: { fill: "rgba(90, 154, 110, 0.
|
|
275
|
+
style: { fill: "rgba(90, 154, 110, 0.45)", stroke: "#5A9A6E", strokeWidth: 2, mixBlendMode: "multiply" }
|
|
272
276
|
}
|
|
273
277
|
) : null,
|
|
274
278
|
hasCompareData && compareCoords && compareCoords.map(([cx, cy], i) => {
|
|
@@ -287,9 +291,7 @@ function RadarChartCore({
|
|
|
287
291
|
fill: matches ? "#fed12e" : "#5A9A6E",
|
|
288
292
|
stroke: "#FFFFFF",
|
|
289
293
|
strokeWidth: 3,
|
|
290
|
-
style: {
|
|
291
|
-
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, compareVal) }),
|
|
292
|
-
onMouseLeave: () => setTooltip(null)
|
|
294
|
+
style: { pointerEvents: "none" }
|
|
293
295
|
}
|
|
294
296
|
);
|
|
295
297
|
}),
|
|
@@ -313,6 +315,44 @@ function RadarChartCore({
|
|
|
313
315
|
}
|
|
314
316
|
);
|
|
315
317
|
}),
|
|
318
|
+
pointsArr.map(([cx, cy], i) => {
|
|
319
|
+
const shortTitle = spokes[i][0];
|
|
320
|
+
const userVal = spokes[i][1];
|
|
321
|
+
if (!userVal || Number(userVal) === 0) return null;
|
|
322
|
+
return /* @__PURE__ */ React.createElement(
|
|
323
|
+
"circle",
|
|
324
|
+
{
|
|
325
|
+
key: `user-sensor-${i}`,
|
|
326
|
+
cx,
|
|
327
|
+
cy,
|
|
328
|
+
r: 14,
|
|
329
|
+
fill: "transparent",
|
|
330
|
+
stroke: "none",
|
|
331
|
+
style: { cursor: "default" },
|
|
332
|
+
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, userVal) }),
|
|
333
|
+
onMouseLeave: () => setTooltip(null)
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}),
|
|
337
|
+
hasCompareData && compareCoords && compareCoords.map(([cx, cy], i) => {
|
|
338
|
+
const shortTitle = spokes[i][0];
|
|
339
|
+
const compareVal = compareData[shortTitle];
|
|
340
|
+
if (!compareVal || Number(compareVal) === 0) return null;
|
|
341
|
+
return /* @__PURE__ */ React.createElement(
|
|
342
|
+
"circle",
|
|
343
|
+
{
|
|
344
|
+
key: `compare-sensor-${i}`,
|
|
345
|
+
cx,
|
|
346
|
+
cy,
|
|
347
|
+
r: 14,
|
|
348
|
+
fill: "transparent",
|
|
349
|
+
stroke: "none",
|
|
350
|
+
style: { cursor: "default" },
|
|
351
|
+
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, compareVal) }),
|
|
352
|
+
onMouseLeave: () => setTooltip(null)
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}),
|
|
316
356
|
tooltip && (() => {
|
|
317
357
|
const tipW = 190;
|
|
318
358
|
const tipH = 70;
|