@empoweredvote/ev-ui 0.4.3 → 0.4.5
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 +39 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -49,8 +49,9 @@ function RadarChartCore({
|
|
|
49
49
|
const hasCompareData = Object.keys(compareData).length > 0;
|
|
50
50
|
const centerPoints = spokes.map(() => `${centerX},${centerY}`).join(" ");
|
|
51
51
|
let comparePoints = null;
|
|
52
|
+
let compareCoords = null;
|
|
52
53
|
if (hasCompareData) {
|
|
53
|
-
const
|
|
54
|
+
const ccoords = spokes.map(([shortTitle], index) => {
|
|
54
55
|
var _a, _b;
|
|
55
56
|
const value = (_a = compareData[shortTitle]) != null ? _a : 0;
|
|
56
57
|
const topic = topics.find((t) => t.short_title === shortTitle);
|
|
@@ -61,9 +62,10 @@ function RadarChartCore({
|
|
|
61
62
|
const r = adjusted / 10 * radius;
|
|
62
63
|
const x = centerX + r * Math.sin(angle);
|
|
63
64
|
const y = centerY - r * Math.cos(angle);
|
|
64
|
-
return
|
|
65
|
+
return [x, y];
|
|
65
66
|
});
|
|
66
|
-
|
|
67
|
+
compareCoords = ccoords;
|
|
68
|
+
comparePoints = ccoords.map((p) => p.join(",")).join(" ");
|
|
67
69
|
}
|
|
68
70
|
const hadCompareDataRef = useRef(false);
|
|
69
71
|
const compareJustAppeared = hasCompareData && !hadCompareDataRef.current;
|
|
@@ -197,8 +199,8 @@ function RadarChartCore({
|
|
|
197
199
|
key: "user-static",
|
|
198
200
|
points: targetPoints,
|
|
199
201
|
style: {
|
|
200
|
-
fill: "rgba(
|
|
201
|
-
stroke: "
|
|
202
|
+
fill: "rgba(124, 107, 158, 0.4)",
|
|
203
|
+
stroke: "#7C6B9E",
|
|
202
204
|
strokeWidth: 3
|
|
203
205
|
}
|
|
204
206
|
}
|
|
@@ -208,20 +210,32 @@ function RadarChartCore({
|
|
|
208
210
|
key: "user-animated",
|
|
209
211
|
points: spring.points,
|
|
210
212
|
style: {
|
|
211
|
-
fill: "rgba(
|
|
212
|
-
stroke: "
|
|
213
|
+
fill: "rgba(124, 107, 158, 0.4)",
|
|
214
|
+
stroke: "#7C6B9E",
|
|
213
215
|
strokeWidth: 3
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
218
|
),
|
|
219
|
+
pointsArr.map(([cx, cy], i) => /* @__PURE__ */ React.createElement(
|
|
220
|
+
"circle",
|
|
221
|
+
{
|
|
222
|
+
key: `user-dot-${i}`,
|
|
223
|
+
cx,
|
|
224
|
+
cy,
|
|
225
|
+
r: 5,
|
|
226
|
+
fill: "#7C6B9E",
|
|
227
|
+
stroke: "#FFFFFF",
|
|
228
|
+
strokeWidth: 2
|
|
229
|
+
}
|
|
230
|
+
)),
|
|
217
231
|
hasCompareData && comparePoints ? countChanged || compareJustAppeared ? /* @__PURE__ */ React.createElement(
|
|
218
232
|
"polygon",
|
|
219
233
|
{
|
|
220
234
|
key: "compare-static",
|
|
221
235
|
points: comparePoints,
|
|
222
236
|
style: {
|
|
223
|
-
fill: "rgba(
|
|
224
|
-
stroke: "
|
|
237
|
+
fill: "rgba(90, 154, 110, 0.3)",
|
|
238
|
+
stroke: "#5A9A6E",
|
|
225
239
|
strokeWidth: 2
|
|
226
240
|
}
|
|
227
241
|
}
|
|
@@ -231,12 +245,24 @@ function RadarChartCore({
|
|
|
231
245
|
key: "compare-animated",
|
|
232
246
|
points: compareSpring.points,
|
|
233
247
|
style: {
|
|
234
|
-
fill: "rgba(
|
|
235
|
-
stroke: "
|
|
248
|
+
fill: "rgba(90, 154, 110, 0.3)",
|
|
249
|
+
stroke: "#5A9A6E",
|
|
236
250
|
strokeWidth: 2
|
|
237
251
|
}
|
|
238
252
|
}
|
|
239
253
|
) : null,
|
|
254
|
+
hasCompareData && compareCoords && compareCoords.map(([cx, cy], i) => /* @__PURE__ */ React.createElement(
|
|
255
|
+
"circle",
|
|
256
|
+
{
|
|
257
|
+
key: `compare-dot-${i}`,
|
|
258
|
+
cx,
|
|
259
|
+
cy,
|
|
260
|
+
r: 4,
|
|
261
|
+
fill: "#5A9A6E",
|
|
262
|
+
stroke: "#FFFFFF",
|
|
263
|
+
strokeWidth: 2
|
|
264
|
+
}
|
|
265
|
+
)),
|
|
240
266
|
spokes.map(([shortTitle], i) => {
|
|
241
267
|
const angle = 2 * Math.PI * i / numSpokes;
|
|
242
268
|
const x = centerX + radius * Math.sin(angle);
|
|
@@ -1512,7 +1538,8 @@ function PoliticianCard({
|
|
|
1512
1538
|
},
|
|
1513
1539
|
imageWrapper: {
|
|
1514
1540
|
width: isHorizontal ? "90px" : "100%",
|
|
1515
|
-
height: isHorizontal ?
|
|
1541
|
+
height: isHorizontal ? "100%" : "auto",
|
|
1542
|
+
maxHeight: isHorizontal ? "200px" : void 0,
|
|
1516
1543
|
aspectRatio: isHorizontal ? void 0 : "4/5",
|
|
1517
1544
|
flexShrink: 0,
|
|
1518
1545
|
overflow: "hidden"
|