@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 CHANGED
@@ -105,10 +105,11 @@ function RadarChartCore({
105
105
  size = 400,
106
106
  labelFontSize = 13,
107
107
  padding = 80,
108
- labelOffset = 32,
108
+ labelOffset = 52,
109
109
  tightFit = false,
110
110
  activeSpoke = null,
111
- writeIns = {}
111
+ writeIns = {},
112
+ darkMode = false
112
113
  }) {
113
114
  var _a;
114
115
  const radius = size / 2 - 40;
@@ -220,7 +221,7 @@ function RadarChartCore({
220
221
  ring.push(`${centerX + radius * scale * Math.sin(angle)},${centerY - radius * scale * Math.cos(angle)}`);
221
222
  }
222
223
  guidePolygons.push(
223
- /* @__PURE__ */ import_react.default.createElement("polygon", { key: level, points: ring.join(" "), fill: "none", stroke: "#ccc" })
224
+ /* @__PURE__ */ import_react.default.createElement("polygon", { key: level, points: ring.join(" "), fill: "none", stroke: darkMode ? "#555" : "#ccc" })
224
225
  );
225
226
  }
226
227
  const getStanceText = (shortTitle, value) => {
@@ -257,7 +258,7 @@ function RadarChartCore({
257
258
  y1: centerY,
258
259
  x2: endX,
259
260
  y2: endY,
260
- stroke: isUnanswered ? "#9ca3af" : "#aaa",
261
+ stroke: isUnanswered ? "#9ca3af" : darkMode ? "#bbb" : "#888",
261
262
  strokeDasharray: isUnanswered ? "4 3" : void 0,
262
263
  opacity: isUnanswered ? 0.6 : 1
263
264
  }
@@ -289,7 +290,7 @@ function RadarChartCore({
289
290
  if (isTop && lines.length > 1) labelY -= (lines.length - 1) * lineHeight;
290
291
  const isActive = shortTitle === activeSpoke;
291
292
  const isUnansweredLabel = !!unansweredSpokes[shortTitle];
292
- const fSize = isActive ? labelFontSize * 1.2 : labelFontSize;
293
+ const fSize = labelFontSize;
293
294
  return /* @__PURE__ */ import_react.default.createElement(
294
295
  "text",
295
296
  {
@@ -299,7 +300,7 @@ function RadarChartCore({
299
300
  textAnchor: "middle",
300
301
  dominantBaseline: isBottom ? "hanging" : "auto",
301
302
  onClick: () => onReplaceTopic(shortTitle),
302
- fill: isActive ? "#E85D26" : isUnansweredLabel ? "#9ca3af" : "#555",
303
+ fill: isActive ? "#E85D26" : isUnansweredLabel ? "#9ca3af" : darkMode ? "#D3D7DE" : "#555",
303
304
  fontWeight: isActive ? "bold" : "normal",
304
305
  style: { cursor: "pointer", userSelect: "none", fontSize: fSize, fontFamily: "sans-serif" }
305
306
  },
@@ -421,14 +422,14 @@ function RadarChartCore({
421
422
  {
422
423
  xmlns: "http://www.w3.org/1999/xhtml",
423
424
  style: {
424
- background: "white",
425
- border: "1px solid #d1d5db",
426
- borderRadius: 6,
427
- padding: "6px 10px",
428
- fontSize: 11,
425
+ background: darkMode ? "#2F3237" : "#ffffff",
426
+ border: darkMode ? "1px solid #59B0C4" : "1px solid #d1d5db",
427
+ borderRadius: 8,
428
+ padding: "7px 11px",
429
+ fontSize: 12,
429
430
  lineHeight: 1.4,
430
- color: "#111",
431
- boxShadow: "0 2px 8px rgba(0,0,0,0.12)",
431
+ color: darkMode ? "#EBEDEF" : "#111",
432
+ boxShadow: darkMode ? "0 2px 12px rgba(0,0,0,0.4)" : "0 2px 8px rgba(0,0,0,0.12)",
432
433
  width: tipW + "px",
433
434
  wordWrap: "break-word"
434
435
  }
@@ -886,6 +887,16 @@ function useMediaQuery(query) {
886
887
  }
887
888
 
888
889
  // src/Header.jsx
890
+ var dark = {
891
+ bg: "#1C1F23",
892
+ bgElevated: "#2F3237",
893
+ bgHover: "#41454E",
894
+ border: "#41454E",
895
+ link: "#59B0C4",
896
+ text: "#D3D7DE",
897
+ textMuted: "#9CA3AF",
898
+ shadow: "0 10px 40px rgba(0,0,0,0.4)"
899
+ };
889
900
  function Header({
890
901
  logoSrc,
891
902
  logoAlt = "Empowered Vote",
@@ -896,6 +907,7 @@ function Header({
896
907
  currentPath,
897
908
  onNavigate,
898
909
  profileMenu,
910
+ darkMode = false,
899
911
  style = {}
900
912
  }) {
901
913
  const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react3.useState)(false);
@@ -919,9 +931,16 @@ function Header({
919
931
  onNavigate(href);
920
932
  }
921
933
  };
934
+ const linkColor = darkMode ? dark.link : colors.evTeal;
935
+ const dropdownBg = darkMode ? dark.bgElevated : colors.bgWhite;
936
+ const dropdownShadow = darkMode ? dark.shadow : "0 10px 40px rgba(0,0,0,0.1)";
937
+ const hoverBg = darkMode ? dark.bgHover : colors.bgLight;
938
+ const borderColor = darkMode ? dark.border : colors.borderLight;
939
+ const mobileShadow = darkMode ? "0 4px 20px rgba(0,0,0,0.4)" : "0 4px 20px rgba(0,0,0,0.1)";
922
940
  const styles2 = {
923
941
  header: {
924
- backgroundColor: colors.bgWhite,
942
+ backgroundColor: darkMode ? dark.bg : colors.bgWhite,
943
+ borderBottom: darkMode ? `1px solid ${dark.border}` : "none",
925
944
  position: "sticky",
926
945
  top: 0,
927
946
  zIndex: 50,
@@ -949,7 +968,7 @@ function Header({
949
968
  fontFamily: fonts.primary,
950
969
  fontWeight: fontWeights.bold,
951
970
  fontSize: fontSizes.xl,
952
- color: colors.evTeal,
971
+ color: linkColor,
953
972
  textDecoration: "none",
954
973
  cursor: "pointer",
955
974
  display: "flex",
@@ -972,11 +991,12 @@ function Header({
972
991
  zIndex: 100
973
992
  },
974
993
  dropdownInner: {
975
- backgroundColor: colors.bgWhite,
994
+ backgroundColor: dropdownBg,
976
995
  borderRadius: borderRadius.lg,
977
- boxShadow: "0 10px 40px rgba(0,0,0,0.1)",
996
+ boxShadow: dropdownShadow,
978
997
  minWidth: "200px",
979
- padding: spacing[2]
998
+ padding: spacing[2],
999
+ border: darkMode ? `1px solid ${dark.border}` : "none"
980
1000
  },
981
1001
  dropdownItem: {
982
1002
  display: "block",
@@ -984,7 +1004,7 @@ function Header({
984
1004
  fontFamily: fonts.primary,
985
1005
  fontWeight: fontWeights.medium,
986
1006
  fontSize: fontSizes.base,
987
- color: colors.evTeal,
1007
+ color: linkColor,
988
1008
  textDecoration: "none",
989
1009
  borderRadius: borderRadius.md,
990
1010
  cursor: "pointer"
@@ -1006,13 +1026,13 @@ function Header({
1006
1026
  display: "inline-flex",
1007
1027
  alignItems: "center",
1008
1028
  backgroundColor: "transparent",
1009
- color: colors.evTeal,
1029
+ color: linkColor,
1010
1030
  fontFamily: fonts.primary,
1011
1031
  fontWeight: fontWeights.bold,
1012
1032
  fontSize: fontSizes.base,
1013
1033
  padding: `${spacing[2]} ${spacing[5]}`,
1014
1034
  borderRadius: borderRadius.full || "999px",
1015
- border: `1.5px solid ${colors.evTeal}`,
1035
+ border: `1.5px solid ${linkColor}`,
1016
1036
  cursor: "pointer",
1017
1037
  textDecoration: "none",
1018
1038
  lineHeight: 1.2,
@@ -1028,7 +1048,7 @@ function Header({
1028
1048
  hamburger: {
1029
1049
  width: "24px",
1030
1050
  height: "2px",
1031
- backgroundColor: colors.evTeal,
1051
+ backgroundColor: linkColor,
1032
1052
  position: "relative"
1033
1053
  },
1034
1054
  mobileMenu: {
@@ -1038,25 +1058,26 @@ function Header({
1038
1058
  top: "100%",
1039
1059
  left: 0,
1040
1060
  right: 0,
1041
- backgroundColor: colors.bgWhite,
1061
+ backgroundColor: darkMode ? dark.bg : colors.bgWhite,
1042
1062
  padding: spacing[4],
1043
- boxShadow: "0 4px 20px rgba(0,0,0,0.1)"
1063
+ boxShadow: mobileShadow,
1064
+ borderTop: darkMode ? `1px solid ${dark.border}` : "none"
1044
1065
  },
1045
1066
  mobileNavItem: {
1046
1067
  fontFamily: fonts.primary,
1047
1068
  fontWeight: fontWeights.bold,
1048
1069
  fontSize: fontSizes.lg,
1049
- color: colors.evTeal,
1070
+ color: linkColor,
1050
1071
  textDecoration: "none",
1051
1072
  padding: `${spacing[3]} 0`,
1052
- borderBottom: `1px solid ${colors.borderLight}`
1073
+ borderBottom: `1px solid ${borderColor}`
1053
1074
  },
1054
1075
  profileButton: {
1055
1076
  width: "40px",
1056
1077
  height: "40px",
1057
1078
  borderRadius: borderRadius.full,
1058
- border: `2px solid ${colors.evTeal}`,
1059
- backgroundColor: colors.bgLight,
1079
+ border: `2px solid ${linkColor}`,
1080
+ backgroundColor: darkMode ? dark.bgElevated : colors.bgLight,
1060
1081
  cursor: "pointer",
1061
1082
  display: "flex",
1062
1083
  alignItems: "center",
@@ -1071,11 +1092,12 @@ function Header({
1071
1092
  zIndex: 100
1072
1093
  },
1073
1094
  profileDropdownInner: {
1074
- backgroundColor: colors.bgWhite,
1095
+ backgroundColor: dropdownBg,
1075
1096
  borderRadius: borderRadius.lg,
1076
- boxShadow: "0 10px 40px rgba(0,0,0,0.1)",
1097
+ boxShadow: dropdownShadow,
1077
1098
  minWidth: "160px",
1078
- padding: spacing[2]
1099
+ padding: spacing[2],
1100
+ border: darkMode ? `1px solid ${dark.border}` : "none"
1079
1101
  },
1080
1102
  profileDropdownItem: {
1081
1103
  display: "block",
@@ -1084,7 +1106,7 @@ function Header({
1084
1106
  fontFamily: fonts.primary,
1085
1107
  fontWeight: fontWeights.medium,
1086
1108
  fontSize: fontSizes.base,
1087
- color: colors.evTeal,
1109
+ color: linkColor,
1088
1110
  textDecoration: "none",
1089
1111
  borderRadius: borderRadius.md,
1090
1112
  cursor: "pointer",
@@ -1094,7 +1116,7 @@ function Header({
1094
1116
  },
1095
1117
  mobileDivider: {
1096
1118
  height: "1px",
1097
- backgroundColor: colors.borderLight,
1119
+ backgroundColor: borderColor,
1098
1120
  margin: `${spacing[3]} 0`
1099
1121
  },
1100
1122
  profileLabel: {
@@ -1102,8 +1124,8 @@ function Header({
1102
1124
  fontFamily: fonts.primary,
1103
1125
  fontWeight: fontWeights.semibold,
1104
1126
  fontSize: fontSizes.sm,
1105
- color: colors.textMuted,
1106
- borderBottom: `1px solid ${colors.borderLight}`,
1127
+ color: darkMode ? dark.textMuted : colors.textMuted,
1128
+ borderBottom: `1px solid ${borderColor}`,
1107
1129
  marginBottom: spacing[1],
1108
1130
  overflow: "hidden",
1109
1131
  textOverflow: "ellipsis",
@@ -1144,7 +1166,7 @@ function Header({
1144
1166
  "path",
1145
1167
  {
1146
1168
  d: "M1 1L8 8L15 1",
1147
- stroke: colors.evTeal,
1169
+ stroke: linkColor,
1148
1170
  strokeWidth: "2",
1149
1171
  strokeLinecap: "round",
1150
1172
  strokeLinejoin: "round"
@@ -1160,7 +1182,7 @@ function Header({
1160
1182
  onClick: (e) => handleNavClick(e, dropdownItem.href),
1161
1183
  style: styles2.dropdownItem,
1162
1184
  onMouseEnter: (e) => {
1163
- e.target.style.backgroundColor = colors.bgLight;
1185
+ e.target.style.backgroundColor = hoverBg;
1164
1186
  },
1165
1187
  onMouseLeave: (e) => {
1166
1188
  e.target.style.backgroundColor = "transparent";
@@ -1184,7 +1206,7 @@ function Header({
1184
1206
  fontFamily: fonts.primary,
1185
1207
  fontWeight: fontWeights.bold,
1186
1208
  fontSize: fontSizes["2xl"],
1187
- color: colors.evTeal
1209
+ color: linkColor
1188
1210
  }
1189
1211
  },
1190
1212
  "empowered.vote"
@@ -1203,12 +1225,12 @@ function Header({
1203
1225
  style: styles2.secondaryAction,
1204
1226
  className: "ev-header-secondary",
1205
1227
  onMouseEnter: (e) => {
1206
- e.currentTarget.style.backgroundColor = colors.evTeal;
1228
+ e.currentTarget.style.backgroundColor = linkColor;
1207
1229
  e.currentTarget.style.color = colors.textWhite;
1208
1230
  },
1209
1231
  onMouseLeave: (e) => {
1210
1232
  e.currentTarget.style.backgroundColor = "transparent";
1211
- e.currentTarget.style.color = colors.evTeal;
1233
+ e.currentTarget.style.color = linkColor;
1212
1234
  }
1213
1235
  },
1214
1236
  secondaryAction.label
@@ -1242,7 +1264,7 @@ function Header({
1242
1264
  height: "20",
1243
1265
  viewBox: "0 0 24 24",
1244
1266
  fill: "none",
1245
- stroke: colors.evTeal,
1267
+ stroke: linkColor,
1246
1268
  strokeWidth: "2",
1247
1269
  strokeLinecap: "round",
1248
1270
  strokeLinejoin: "round"
@@ -1266,7 +1288,7 @@ function Header({
1266
1288
  },
1267
1289
  style: styles2.profileDropdownItem,
1268
1290
  onMouseEnter: (e) => {
1269
- e.target.style.backgroundColor = colors.bgLight;
1291
+ e.target.style.backgroundColor = hoverBg;
1270
1292
  },
1271
1293
  onMouseLeave: (e) => {
1272
1294
  e.target.style.backgroundColor = "transparent";
@@ -1286,7 +1308,7 @@ function Header({
1286
1308
  },
1287
1309
  style: styles2.profileDropdownItem,
1288
1310
  onMouseEnter: (e) => {
1289
- e.target.style.backgroundColor = colors.bgLight;
1311
+ e.target.style.backgroundColor = hoverBg;
1290
1312
  },
1291
1313
  onMouseLeave: (e) => {
1292
1314
  e.target.style.backgroundColor = "transparent";
@@ -1312,7 +1334,7 @@ function Header({
1312
1334
  left: 0,
1313
1335
  width: "100%",
1314
1336
  height: "2px",
1315
- backgroundColor: colors.evTeal
1337
+ backgroundColor: linkColor
1316
1338
  }
1317
1339
  }
1318
1340
  ), /* @__PURE__ */ import_react3.default.createElement(
@@ -1324,7 +1346,7 @@ function Header({
1324
1346
  left: 0,
1325
1347
  width: "100%",
1326
1348
  height: "2px",
1327
- backgroundColor: colors.evTeal
1349
+ backgroundColor: linkColor
1328
1350
  }
1329
1351
  }
1330
1352
  ))
@@ -1577,6 +1599,7 @@ function SiteHeader({
1577
1599
  profileMenu,
1578
1600
  secondaryAction,
1579
1601
  feedbackFeature,
1602
+ darkMode = false,
1580
1603
  style = {}
1581
1604
  }) {
1582
1605
  const handleNavigate = (href) => {
@@ -1605,6 +1628,7 @@ function SiteHeader({
1605
1628
  currentPath,
1606
1629
  onNavigate: handleNavigate,
1607
1630
  profileMenu,
1631
+ darkMode,
1608
1632
  style
1609
1633
  }
1610
1634
  );