@empoweredvote/ev-ui 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +45 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,9 @@ function RadarChartCore({
|
|
|
18
18
|
tightFit = false,
|
|
19
19
|
activeSpoke = null,
|
|
20
20
|
writeIns = {},
|
|
21
|
-
darkMode = false
|
|
21
|
+
darkMode = false,
|
|
22
|
+
lineColor,
|
|
23
|
+
ringColor
|
|
22
24
|
}) {
|
|
23
25
|
var _a;
|
|
24
26
|
const radius = size / 2 - 40;
|
|
@@ -130,7 +132,7 @@ function RadarChartCore({
|
|
|
130
132
|
ring.push(`${centerX + radius * scale * Math.sin(angle)},${centerY - radius * scale * Math.cos(angle)}`);
|
|
131
133
|
}
|
|
132
134
|
guidePolygons.push(
|
|
133
|
-
/* @__PURE__ */ React.createElement("polygon", { key: level, points: ring.join(" "), fill: "none", stroke: darkMode ? "#555" : "#ccc" })
|
|
135
|
+
/* @__PURE__ */ React.createElement("polygon", { key: level, points: ring.join(" "), fill: "none", stroke: ringColor != null ? ringColor : darkMode ? "#555" : "#ccc" })
|
|
134
136
|
);
|
|
135
137
|
}
|
|
136
138
|
const getStanceText = (shortTitle, value) => {
|
|
@@ -167,7 +169,7 @@ function RadarChartCore({
|
|
|
167
169
|
y1: centerY,
|
|
168
170
|
x2: endX,
|
|
169
171
|
y2: endY,
|
|
170
|
-
stroke: isUnanswered ? "#9ca3af" : darkMode ? "#bbb" : "#888",
|
|
172
|
+
stroke: isUnanswered ? "#9ca3af" : lineColor != null ? lineColor : darkMode ? "#bbb" : "#888",
|
|
171
173
|
strokeDasharray: isUnanswered ? "4 3" : void 0,
|
|
172
174
|
opacity: isUnanswered ? 0.6 : 1
|
|
173
175
|
}
|
|
@@ -248,9 +250,7 @@ function RadarChartCore({
|
|
|
248
250
|
fill: matches ? "#fed12e" : "#7C6B9E",
|
|
249
251
|
stroke: "#FFFFFF",
|
|
250
252
|
strokeWidth: 3,
|
|
251
|
-
style: {
|
|
252
|
-
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, userVal) }),
|
|
253
|
-
onMouseLeave: () => setTooltip(null)
|
|
253
|
+
style: { pointerEvents: "none" }
|
|
254
254
|
}
|
|
255
255
|
);
|
|
256
256
|
}),
|
|
@@ -285,9 +285,7 @@ function RadarChartCore({
|
|
|
285
285
|
fill: matches ? "#fed12e" : "#5A9A6E",
|
|
286
286
|
stroke: "#FFFFFF",
|
|
287
287
|
strokeWidth: 3,
|
|
288
|
-
style: {
|
|
289
|
-
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, compareVal) }),
|
|
290
|
-
onMouseLeave: () => setTooltip(null)
|
|
288
|
+
style: { pointerEvents: "none" }
|
|
291
289
|
}
|
|
292
290
|
);
|
|
293
291
|
}),
|
|
@@ -311,6 +309,44 @@ function RadarChartCore({
|
|
|
311
309
|
}
|
|
312
310
|
);
|
|
313
311
|
}),
|
|
312
|
+
pointsArr.map(([cx, cy], i) => {
|
|
313
|
+
const shortTitle = spokes[i][0];
|
|
314
|
+
const userVal = spokes[i][1];
|
|
315
|
+
if (!userVal || Number(userVal) === 0) return null;
|
|
316
|
+
return /* @__PURE__ */ React.createElement(
|
|
317
|
+
"circle",
|
|
318
|
+
{
|
|
319
|
+
key: `user-sensor-${i}`,
|
|
320
|
+
cx,
|
|
321
|
+
cy,
|
|
322
|
+
r: 14,
|
|
323
|
+
fill: "transparent",
|
|
324
|
+
stroke: "none",
|
|
325
|
+
style: { cursor: "default" },
|
|
326
|
+
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, userVal) }),
|
|
327
|
+
onMouseLeave: () => setTooltip(null)
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}),
|
|
331
|
+
hasCompareData && compareCoords && compareCoords.map(([cx, cy], i) => {
|
|
332
|
+
const shortTitle = spokes[i][0];
|
|
333
|
+
const compareVal = compareData[shortTitle];
|
|
334
|
+
if (!compareVal || Number(compareVal) === 0) return null;
|
|
335
|
+
return /* @__PURE__ */ React.createElement(
|
|
336
|
+
"circle",
|
|
337
|
+
{
|
|
338
|
+
key: `compare-sensor-${i}`,
|
|
339
|
+
cx,
|
|
340
|
+
cy,
|
|
341
|
+
r: 14,
|
|
342
|
+
fill: "transparent",
|
|
343
|
+
stroke: "none",
|
|
344
|
+
style: { cursor: "default" },
|
|
345
|
+
onMouseEnter: () => setTooltip({ x: cx, y: cy, text: getStanceText(shortTitle, compareVal) }),
|
|
346
|
+
onMouseLeave: () => setTooltip(null)
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
}),
|
|
314
350
|
tooltip && (() => {
|
|
315
351
|
const tipW = 190;
|
|
316
352
|
const tipH = 70;
|