@empoweredvote/ev-ui 0.8.2 → 0.8.4
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 +69 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14,10 +14,11 @@ function RadarChartCore({
|
|
|
14
14
|
size = 400,
|
|
15
15
|
labelFontSize = 13,
|
|
16
16
|
padding = 80,
|
|
17
|
-
labelOffset =
|
|
17
|
+
labelOffset = 52,
|
|
18
18
|
tightFit = false,
|
|
19
19
|
activeSpoke = null,
|
|
20
|
-
writeIns = {}
|
|
20
|
+
writeIns = {},
|
|
21
|
+
darkMode = false
|
|
21
22
|
}) {
|
|
22
23
|
var _a;
|
|
23
24
|
const radius = size / 2 - 40;
|
|
@@ -129,7 +130,7 @@ function RadarChartCore({
|
|
|
129
130
|
ring.push(`${centerX + radius * scale * Math.sin(angle)},${centerY - radius * scale * Math.cos(angle)}`);
|
|
130
131
|
}
|
|
131
132
|
guidePolygons.push(
|
|
132
|
-
/* @__PURE__ */ React.createElement("polygon", { key: level, points: ring.join(" "), fill: "none", stroke: "#ccc" })
|
|
133
|
+
/* @__PURE__ */ React.createElement("polygon", { key: level, points: ring.join(" "), fill: "none", stroke: darkMode ? "#555" : "#ccc" })
|
|
133
134
|
);
|
|
134
135
|
}
|
|
135
136
|
const getStanceText = (shortTitle, value) => {
|
|
@@ -166,7 +167,7 @@ function RadarChartCore({
|
|
|
166
167
|
y1: centerY,
|
|
167
168
|
x2: endX,
|
|
168
169
|
y2: endY,
|
|
169
|
-
stroke: isUnanswered ? "#9ca3af" : "#
|
|
170
|
+
stroke: isUnanswered ? "#9ca3af" : darkMode ? "#bbb" : "#888",
|
|
170
171
|
strokeDasharray: isUnanswered ? "4 3" : void 0,
|
|
171
172
|
opacity: isUnanswered ? 0.6 : 1
|
|
172
173
|
}
|
|
@@ -198,7 +199,7 @@ function RadarChartCore({
|
|
|
198
199
|
if (isTop && lines.length > 1) labelY -= (lines.length - 1) * lineHeight;
|
|
199
200
|
const isActive = shortTitle === activeSpoke;
|
|
200
201
|
const isUnansweredLabel = !!unansweredSpokes[shortTitle];
|
|
201
|
-
const fSize =
|
|
202
|
+
const fSize = labelFontSize;
|
|
202
203
|
return /* @__PURE__ */ React.createElement(
|
|
203
204
|
"text",
|
|
204
205
|
{
|
|
@@ -208,7 +209,7 @@ function RadarChartCore({
|
|
|
208
209
|
textAnchor: "middle",
|
|
209
210
|
dominantBaseline: isBottom ? "hanging" : "auto",
|
|
210
211
|
onClick: () => onReplaceTopic(shortTitle),
|
|
211
|
-
fill: isActive ? "#E85D26" : isUnansweredLabel ? "#9ca3af" : "#555",
|
|
212
|
+
fill: isActive ? "#E85D26" : isUnansweredLabel ? "#9ca3af" : darkMode ? "#D3D7DE" : "#555",
|
|
212
213
|
fontWeight: isActive ? "bold" : "normal",
|
|
213
214
|
style: { cursor: "pointer", userSelect: "none", fontSize: fSize, fontFamily: "sans-serif" }
|
|
214
215
|
},
|
|
@@ -330,14 +331,14 @@ function RadarChartCore({
|
|
|
330
331
|
{
|
|
331
332
|
xmlns: "http://www.w3.org/1999/xhtml",
|
|
332
333
|
style: {
|
|
333
|
-
background: "
|
|
334
|
-
border: "1px solid #d1d5db",
|
|
335
|
-
borderRadius:
|
|
336
|
-
padding: "
|
|
337
|
-
fontSize:
|
|
334
|
+
background: darkMode ? "#2F3237" : "#ffffff",
|
|
335
|
+
border: darkMode ? "1px solid #59B0C4" : "1px solid #d1d5db",
|
|
336
|
+
borderRadius: 8,
|
|
337
|
+
padding: "7px 11px",
|
|
338
|
+
fontSize: 12,
|
|
338
339
|
lineHeight: 1.4,
|
|
339
|
-
color: "#111",
|
|
340
|
-
boxShadow: "0 2px 8px rgba(0,0,0,0.12)",
|
|
340
|
+
color: darkMode ? "#EBEDEF" : "#111",
|
|
341
|
+
boxShadow: darkMode ? "0 2px 12px rgba(0,0,0,0.4)" : "0 2px 8px rgba(0,0,0,0.12)",
|
|
341
342
|
width: tipW + "px",
|
|
342
343
|
wordWrap: "break-word"
|
|
343
344
|
}
|
|
@@ -795,6 +796,16 @@ function useMediaQuery(query) {
|
|
|
795
796
|
}
|
|
796
797
|
|
|
797
798
|
// src/Header.jsx
|
|
799
|
+
var dark = {
|
|
800
|
+
bg: "#1C1F23",
|
|
801
|
+
bgElevated: "#2F3237",
|
|
802
|
+
bgHover: "#41454E",
|
|
803
|
+
border: "#41454E",
|
|
804
|
+
link: "#59B0C4",
|
|
805
|
+
text: "#D3D7DE",
|
|
806
|
+
textMuted: "#9CA3AF",
|
|
807
|
+
shadow: "0 10px 40px rgba(0,0,0,0.4)"
|
|
808
|
+
};
|
|
798
809
|
function Header({
|
|
799
810
|
logoSrc,
|
|
800
811
|
logoAlt = "Empowered Vote",
|
|
@@ -805,6 +816,7 @@ function Header({
|
|
|
805
816
|
currentPath,
|
|
806
817
|
onNavigate,
|
|
807
818
|
profileMenu,
|
|
819
|
+
darkMode = false,
|
|
808
820
|
style = {}
|
|
809
821
|
}) {
|
|
810
822
|
const [mobileMenuOpen, setMobileMenuOpen] = useState3(false);
|
|
@@ -828,9 +840,16 @@ function Header({
|
|
|
828
840
|
onNavigate(href);
|
|
829
841
|
}
|
|
830
842
|
};
|
|
843
|
+
const linkColor = darkMode ? dark.link : colors.evTeal;
|
|
844
|
+
const dropdownBg = darkMode ? dark.bgElevated : colors.bgWhite;
|
|
845
|
+
const dropdownShadow = darkMode ? dark.shadow : "0 10px 40px rgba(0,0,0,0.1)";
|
|
846
|
+
const hoverBg = darkMode ? dark.bgHover : colors.bgLight;
|
|
847
|
+
const borderColor = darkMode ? dark.border : colors.borderLight;
|
|
848
|
+
const mobileShadow = darkMode ? "0 4px 20px rgba(0,0,0,0.4)" : "0 4px 20px rgba(0,0,0,0.1)";
|
|
831
849
|
const styles2 = {
|
|
832
850
|
header: {
|
|
833
|
-
backgroundColor: colors.bgWhite,
|
|
851
|
+
backgroundColor: darkMode ? dark.bg : colors.bgWhite,
|
|
852
|
+
borderBottom: darkMode ? `1px solid ${dark.border}` : "none",
|
|
834
853
|
position: "sticky",
|
|
835
854
|
top: 0,
|
|
836
855
|
zIndex: 50,
|
|
@@ -858,7 +877,7 @@ function Header({
|
|
|
858
877
|
fontFamily: fonts.primary,
|
|
859
878
|
fontWeight: fontWeights.bold,
|
|
860
879
|
fontSize: fontSizes.xl,
|
|
861
|
-
color:
|
|
880
|
+
color: linkColor,
|
|
862
881
|
textDecoration: "none",
|
|
863
882
|
cursor: "pointer",
|
|
864
883
|
display: "flex",
|
|
@@ -881,11 +900,12 @@ function Header({
|
|
|
881
900
|
zIndex: 100
|
|
882
901
|
},
|
|
883
902
|
dropdownInner: {
|
|
884
|
-
backgroundColor:
|
|
903
|
+
backgroundColor: dropdownBg,
|
|
885
904
|
borderRadius: borderRadius.lg,
|
|
886
|
-
boxShadow:
|
|
905
|
+
boxShadow: dropdownShadow,
|
|
887
906
|
minWidth: "200px",
|
|
888
|
-
padding: spacing[2]
|
|
907
|
+
padding: spacing[2],
|
|
908
|
+
border: darkMode ? `1px solid ${dark.border}` : "none"
|
|
889
909
|
},
|
|
890
910
|
dropdownItem: {
|
|
891
911
|
display: "block",
|
|
@@ -893,7 +913,7 @@ function Header({
|
|
|
893
913
|
fontFamily: fonts.primary,
|
|
894
914
|
fontWeight: fontWeights.medium,
|
|
895
915
|
fontSize: fontSizes.base,
|
|
896
|
-
color:
|
|
916
|
+
color: linkColor,
|
|
897
917
|
textDecoration: "none",
|
|
898
918
|
borderRadius: borderRadius.md,
|
|
899
919
|
cursor: "pointer"
|
|
@@ -915,13 +935,13 @@ function Header({
|
|
|
915
935
|
display: "inline-flex",
|
|
916
936
|
alignItems: "center",
|
|
917
937
|
backgroundColor: "transparent",
|
|
918
|
-
color:
|
|
938
|
+
color: linkColor,
|
|
919
939
|
fontFamily: fonts.primary,
|
|
920
940
|
fontWeight: fontWeights.bold,
|
|
921
941
|
fontSize: fontSizes.base,
|
|
922
942
|
padding: `${spacing[2]} ${spacing[5]}`,
|
|
923
943
|
borderRadius: borderRadius.full || "999px",
|
|
924
|
-
border: `1.5px solid ${
|
|
944
|
+
border: `1.5px solid ${linkColor}`,
|
|
925
945
|
cursor: "pointer",
|
|
926
946
|
textDecoration: "none",
|
|
927
947
|
lineHeight: 1.2,
|
|
@@ -937,7 +957,7 @@ function Header({
|
|
|
937
957
|
hamburger: {
|
|
938
958
|
width: "24px",
|
|
939
959
|
height: "2px",
|
|
940
|
-
backgroundColor:
|
|
960
|
+
backgroundColor: linkColor,
|
|
941
961
|
position: "relative"
|
|
942
962
|
},
|
|
943
963
|
mobileMenu: {
|
|
@@ -947,25 +967,26 @@ function Header({
|
|
|
947
967
|
top: "100%",
|
|
948
968
|
left: 0,
|
|
949
969
|
right: 0,
|
|
950
|
-
backgroundColor: colors.bgWhite,
|
|
970
|
+
backgroundColor: darkMode ? dark.bg : colors.bgWhite,
|
|
951
971
|
padding: spacing[4],
|
|
952
|
-
boxShadow:
|
|
972
|
+
boxShadow: mobileShadow,
|
|
973
|
+
borderTop: darkMode ? `1px solid ${dark.border}` : "none"
|
|
953
974
|
},
|
|
954
975
|
mobileNavItem: {
|
|
955
976
|
fontFamily: fonts.primary,
|
|
956
977
|
fontWeight: fontWeights.bold,
|
|
957
978
|
fontSize: fontSizes.lg,
|
|
958
|
-
color:
|
|
979
|
+
color: linkColor,
|
|
959
980
|
textDecoration: "none",
|
|
960
981
|
padding: `${spacing[3]} 0`,
|
|
961
|
-
borderBottom: `1px solid ${
|
|
982
|
+
borderBottom: `1px solid ${borderColor}`
|
|
962
983
|
},
|
|
963
984
|
profileButton: {
|
|
964
985
|
width: "40px",
|
|
965
986
|
height: "40px",
|
|
966
987
|
borderRadius: borderRadius.full,
|
|
967
|
-
border: `2px solid ${
|
|
968
|
-
backgroundColor: colors.bgLight,
|
|
988
|
+
border: `2px solid ${linkColor}`,
|
|
989
|
+
backgroundColor: darkMode ? dark.bgElevated : colors.bgLight,
|
|
969
990
|
cursor: "pointer",
|
|
970
991
|
display: "flex",
|
|
971
992
|
alignItems: "center",
|
|
@@ -980,11 +1001,12 @@ function Header({
|
|
|
980
1001
|
zIndex: 100
|
|
981
1002
|
},
|
|
982
1003
|
profileDropdownInner: {
|
|
983
|
-
backgroundColor:
|
|
1004
|
+
backgroundColor: dropdownBg,
|
|
984
1005
|
borderRadius: borderRadius.lg,
|
|
985
|
-
boxShadow:
|
|
1006
|
+
boxShadow: dropdownShadow,
|
|
986
1007
|
minWidth: "160px",
|
|
987
|
-
padding: spacing[2]
|
|
1008
|
+
padding: spacing[2],
|
|
1009
|
+
border: darkMode ? `1px solid ${dark.border}` : "none"
|
|
988
1010
|
},
|
|
989
1011
|
profileDropdownItem: {
|
|
990
1012
|
display: "block",
|
|
@@ -993,7 +1015,7 @@ function Header({
|
|
|
993
1015
|
fontFamily: fonts.primary,
|
|
994
1016
|
fontWeight: fontWeights.medium,
|
|
995
1017
|
fontSize: fontSizes.base,
|
|
996
|
-
color:
|
|
1018
|
+
color: linkColor,
|
|
997
1019
|
textDecoration: "none",
|
|
998
1020
|
borderRadius: borderRadius.md,
|
|
999
1021
|
cursor: "pointer",
|
|
@@ -1003,7 +1025,7 @@ function Header({
|
|
|
1003
1025
|
},
|
|
1004
1026
|
mobileDivider: {
|
|
1005
1027
|
height: "1px",
|
|
1006
|
-
backgroundColor:
|
|
1028
|
+
backgroundColor: borderColor,
|
|
1007
1029
|
margin: `${spacing[3]} 0`
|
|
1008
1030
|
},
|
|
1009
1031
|
profileLabel: {
|
|
@@ -1011,8 +1033,8 @@ function Header({
|
|
|
1011
1033
|
fontFamily: fonts.primary,
|
|
1012
1034
|
fontWeight: fontWeights.semibold,
|
|
1013
1035
|
fontSize: fontSizes.sm,
|
|
1014
|
-
color: colors.textMuted,
|
|
1015
|
-
borderBottom: `1px solid ${
|
|
1036
|
+
color: darkMode ? dark.textMuted : colors.textMuted,
|
|
1037
|
+
borderBottom: `1px solid ${borderColor}`,
|
|
1016
1038
|
marginBottom: spacing[1],
|
|
1017
1039
|
overflow: "hidden",
|
|
1018
1040
|
textOverflow: "ellipsis",
|
|
@@ -1053,7 +1075,7 @@ function Header({
|
|
|
1053
1075
|
"path",
|
|
1054
1076
|
{
|
|
1055
1077
|
d: "M1 1L8 8L15 1",
|
|
1056
|
-
stroke:
|
|
1078
|
+
stroke: linkColor,
|
|
1057
1079
|
strokeWidth: "2",
|
|
1058
1080
|
strokeLinecap: "round",
|
|
1059
1081
|
strokeLinejoin: "round"
|
|
@@ -1069,7 +1091,7 @@ function Header({
|
|
|
1069
1091
|
onClick: (e) => handleNavClick(e, dropdownItem.href),
|
|
1070
1092
|
style: styles2.dropdownItem,
|
|
1071
1093
|
onMouseEnter: (e) => {
|
|
1072
|
-
e.target.style.backgroundColor =
|
|
1094
|
+
e.target.style.backgroundColor = hoverBg;
|
|
1073
1095
|
},
|
|
1074
1096
|
onMouseLeave: (e) => {
|
|
1075
1097
|
e.target.style.backgroundColor = "transparent";
|
|
@@ -1093,7 +1115,7 @@ function Header({
|
|
|
1093
1115
|
fontFamily: fonts.primary,
|
|
1094
1116
|
fontWeight: fontWeights.bold,
|
|
1095
1117
|
fontSize: fontSizes["2xl"],
|
|
1096
|
-
color:
|
|
1118
|
+
color: linkColor
|
|
1097
1119
|
}
|
|
1098
1120
|
},
|
|
1099
1121
|
"empowered.vote"
|
|
@@ -1112,12 +1134,12 @@ function Header({
|
|
|
1112
1134
|
style: styles2.secondaryAction,
|
|
1113
1135
|
className: "ev-header-secondary",
|
|
1114
1136
|
onMouseEnter: (e) => {
|
|
1115
|
-
e.currentTarget.style.backgroundColor =
|
|
1137
|
+
e.currentTarget.style.backgroundColor = linkColor;
|
|
1116
1138
|
e.currentTarget.style.color = colors.textWhite;
|
|
1117
1139
|
},
|
|
1118
1140
|
onMouseLeave: (e) => {
|
|
1119
1141
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1120
|
-
e.currentTarget.style.color =
|
|
1142
|
+
e.currentTarget.style.color = linkColor;
|
|
1121
1143
|
}
|
|
1122
1144
|
},
|
|
1123
1145
|
secondaryAction.label
|
|
@@ -1151,7 +1173,7 @@ function Header({
|
|
|
1151
1173
|
height: "20",
|
|
1152
1174
|
viewBox: "0 0 24 24",
|
|
1153
1175
|
fill: "none",
|
|
1154
|
-
stroke:
|
|
1176
|
+
stroke: linkColor,
|
|
1155
1177
|
strokeWidth: "2",
|
|
1156
1178
|
strokeLinecap: "round",
|
|
1157
1179
|
strokeLinejoin: "round"
|
|
@@ -1175,7 +1197,7 @@ function Header({
|
|
|
1175
1197
|
},
|
|
1176
1198
|
style: styles2.profileDropdownItem,
|
|
1177
1199
|
onMouseEnter: (e) => {
|
|
1178
|
-
e.target.style.backgroundColor =
|
|
1200
|
+
e.target.style.backgroundColor = hoverBg;
|
|
1179
1201
|
},
|
|
1180
1202
|
onMouseLeave: (e) => {
|
|
1181
1203
|
e.target.style.backgroundColor = "transparent";
|
|
@@ -1195,7 +1217,7 @@ function Header({
|
|
|
1195
1217
|
},
|
|
1196
1218
|
style: styles2.profileDropdownItem,
|
|
1197
1219
|
onMouseEnter: (e) => {
|
|
1198
|
-
e.target.style.backgroundColor =
|
|
1220
|
+
e.target.style.backgroundColor = hoverBg;
|
|
1199
1221
|
},
|
|
1200
1222
|
onMouseLeave: (e) => {
|
|
1201
1223
|
e.target.style.backgroundColor = "transparent";
|
|
@@ -1221,7 +1243,7 @@ function Header({
|
|
|
1221
1243
|
left: 0,
|
|
1222
1244
|
width: "100%",
|
|
1223
1245
|
height: "2px",
|
|
1224
|
-
backgroundColor:
|
|
1246
|
+
backgroundColor: linkColor
|
|
1225
1247
|
}
|
|
1226
1248
|
}
|
|
1227
1249
|
), /* @__PURE__ */ React2.createElement(
|
|
@@ -1233,7 +1255,7 @@ function Header({
|
|
|
1233
1255
|
left: 0,
|
|
1234
1256
|
width: "100%",
|
|
1235
1257
|
height: "2px",
|
|
1236
|
-
backgroundColor:
|
|
1258
|
+
backgroundColor: linkColor
|
|
1237
1259
|
}
|
|
1238
1260
|
}
|
|
1239
1261
|
))
|
|
@@ -1486,6 +1508,7 @@ function SiteHeader({
|
|
|
1486
1508
|
profileMenu,
|
|
1487
1509
|
secondaryAction,
|
|
1488
1510
|
feedbackFeature,
|
|
1511
|
+
darkMode = false,
|
|
1489
1512
|
style = {}
|
|
1490
1513
|
}) {
|
|
1491
1514
|
const handleNavigate = (href) => {
|
|
@@ -1514,6 +1537,7 @@ function SiteHeader({
|
|
|
1514
1537
|
currentPath,
|
|
1515
1538
|
onNavigate: handleNavigate,
|
|
1516
1539
|
profileMenu,
|
|
1540
|
+
darkMode,
|
|
1517
1541
|
style
|
|
1518
1542
|
}
|
|
1519
1543
|
);
|