@empoweredvote/ev-ui 0.2.3 → 0.4.0
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 +306 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +299 -69
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,9 @@ __export(index_exports, {
|
|
|
34
34
|
BranchIcon: () => BranchIcon,
|
|
35
35
|
CategorySection: () => CategorySection,
|
|
36
36
|
CommitteeTable: () => CommitteeTable,
|
|
37
|
+
CompassCoverageCallout: () => CompassCoverageCallout,
|
|
37
38
|
CompassIcon: () => CompassIcon,
|
|
39
|
+
ExpandCompassNudge: () => ExpandCompassNudge,
|
|
38
40
|
FilterSidebar: () => FilterSidebar,
|
|
39
41
|
GovernmentBodySection: () => GovernmentBodySection,
|
|
40
42
|
Header: () => Header,
|
|
@@ -56,6 +58,7 @@ __export(index_exports, {
|
|
|
56
58
|
breakpoints: () => breakpoints,
|
|
57
59
|
colorScales: () => colorScales,
|
|
58
60
|
colors: () => colors,
|
|
61
|
+
computeTierCoverage: () => computeTierCoverage,
|
|
59
62
|
dataVizPalette: () => dataVizPalette,
|
|
60
63
|
defaultCtaButton: () => defaultCtaButton,
|
|
61
64
|
defaultNavItems: () => defaultNavItems,
|
|
@@ -4115,28 +4118,99 @@ var styles = {
|
|
|
4115
4118
|
|
|
4116
4119
|
// src/TopicTierBadge.jsx
|
|
4117
4120
|
var import_react20 = __toESM(require("react"));
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4121
|
+
function LandmarkIcon({ size = 14 }) {
|
|
4122
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
4123
|
+
"svg",
|
|
4124
|
+
{
|
|
4125
|
+
width: size,
|
|
4126
|
+
height: size,
|
|
4127
|
+
viewBox: "0 0 24 24",
|
|
4128
|
+
fill: "none",
|
|
4129
|
+
stroke: "currentColor",
|
|
4130
|
+
strokeWidth: "2",
|
|
4131
|
+
strokeLinecap: "round",
|
|
4132
|
+
strokeLinejoin: "round",
|
|
4133
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4134
|
+
"aria-hidden": "true"
|
|
4135
|
+
},
|
|
4136
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M10 18v-7" }),
|
|
4137
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M11.12 2.198a2 2 0 0 1 1.76.006l7.866 3.847c.476.233.31.949-.22.949H3.474c-.53 0-.695-.716-.22-.949z" }),
|
|
4138
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M14 18v-7" }),
|
|
4139
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M18 18v-7" }),
|
|
4140
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M3 22h18" }),
|
|
4141
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M6 18v-7" })
|
|
4142
|
+
);
|
|
4143
|
+
}
|
|
4144
|
+
function Building2Icon({ size = 14 }) {
|
|
4145
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
4146
|
+
"svg",
|
|
4147
|
+
{
|
|
4148
|
+
width: size,
|
|
4149
|
+
height: size,
|
|
4150
|
+
viewBox: "0 0 24 24",
|
|
4151
|
+
fill: "none",
|
|
4152
|
+
stroke: "currentColor",
|
|
4153
|
+
strokeWidth: "2",
|
|
4154
|
+
strokeLinecap: "round",
|
|
4155
|
+
strokeLinejoin: "round",
|
|
4156
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4157
|
+
"aria-hidden": "true"
|
|
4158
|
+
},
|
|
4159
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z" }),
|
|
4160
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M6 12H4a2 2 0 0 0-2 2v8h4" }),
|
|
4161
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M18 9h2a2 2 0 0 1 2 2v11h-4" }),
|
|
4162
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M10 6h4" }),
|
|
4163
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M10 10h4" }),
|
|
4164
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M10 14h4" }),
|
|
4165
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "M10 18h4" })
|
|
4166
|
+
);
|
|
4167
|
+
}
|
|
4168
|
+
function HomeIcon({ size = 14 }) {
|
|
4169
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
4170
|
+
"svg",
|
|
4171
|
+
{
|
|
4172
|
+
width: size,
|
|
4173
|
+
height: size,
|
|
4174
|
+
viewBox: "0 0 24 24",
|
|
4175
|
+
fill: "none",
|
|
4176
|
+
stroke: "currentColor",
|
|
4177
|
+
strokeWidth: "2",
|
|
4178
|
+
strokeLinecap: "round",
|
|
4179
|
+
strokeLinejoin: "round",
|
|
4180
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4181
|
+
"aria-hidden": "true"
|
|
4182
|
+
},
|
|
4183
|
+
/* @__PURE__ */ import_react20.default.createElement("path", { d: "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }),
|
|
4184
|
+
/* @__PURE__ */ import_react20.default.createElement("polyline", { points: "9 22 9 12 15 12 15 22" })
|
|
4185
|
+
);
|
|
4186
|
+
}
|
|
4187
|
+
var TIER_INFO = {
|
|
4188
|
+
federal: { label: "Federal", Icon: LandmarkIcon },
|
|
4189
|
+
state: { label: "State", Icon: Building2Icon },
|
|
4190
|
+
local: { label: "Local", Icon: HomeIcon }
|
|
4122
4191
|
};
|
|
4123
4192
|
var SIZE_STYLES = {
|
|
4124
4193
|
xs: {
|
|
4194
|
+
iconSize: 12,
|
|
4125
4195
|
fontSize: fontSizes.xs,
|
|
4126
|
-
|
|
4127
|
-
gap: spacing[1]
|
|
4196
|
+
pillPadding: `${spacing[1]} ${spacing[2]}`,
|
|
4197
|
+
gap: spacing[1],
|
|
4198
|
+
iconGap: "3px"
|
|
4128
4199
|
},
|
|
4129
4200
|
sm: {
|
|
4201
|
+
iconSize: 14,
|
|
4130
4202
|
fontSize: fontSizes.xs,
|
|
4131
|
-
|
|
4132
|
-
gap: spacing[
|
|
4203
|
+
pillPadding: `${spacing[1]} ${spacing[2]}`,
|
|
4204
|
+
gap: spacing[2],
|
|
4205
|
+
iconGap: "4px"
|
|
4133
4206
|
}
|
|
4134
4207
|
};
|
|
4135
4208
|
function TopicTierBadge({
|
|
4136
4209
|
topic,
|
|
4137
4210
|
tiers,
|
|
4138
4211
|
size = "sm",
|
|
4139
|
-
|
|
4212
|
+
iconOnly = false,
|
|
4213
|
+
variant = "tinted",
|
|
4140
4214
|
style = {}
|
|
4141
4215
|
}) {
|
|
4142
4216
|
const effectiveTiers = tiers != null ? tiers : topic ? [
|
|
@@ -4153,41 +4227,197 @@ function TopicTierBadge({
|
|
|
4153
4227
|
flexWrap: "wrap",
|
|
4154
4228
|
...style
|
|
4155
4229
|
};
|
|
4156
|
-
const
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
}
|
|
4230
|
+
const itemStyle = (tier) => {
|
|
4231
|
+
const color = variant === "muted" ? "#6B7280" : tierColors[tier].text;
|
|
4232
|
+
return {
|
|
4233
|
+
display: "inline-flex",
|
|
4234
|
+
alignItems: "center",
|
|
4235
|
+
gap: sizeStyle.iconGap,
|
|
4236
|
+
fontFamily: fonts.primary,
|
|
4237
|
+
fontWeight: fontWeights.medium,
|
|
4238
|
+
fontSize: sizeStyle.fontSize,
|
|
4239
|
+
color,
|
|
4240
|
+
lineHeight: 1,
|
|
4241
|
+
userSelect: "none"
|
|
4242
|
+
};
|
|
4243
|
+
};
|
|
4170
4244
|
return /* @__PURE__ */ import_react20.default.createElement(
|
|
4171
4245
|
"span",
|
|
4172
4246
|
{
|
|
4173
4247
|
className: "ev-topic-tier-badge",
|
|
4174
4248
|
style: containerStyle2,
|
|
4175
4249
|
role: "group",
|
|
4176
|
-
"aria-label": `Applies at: ${effectiveTiers.map((t) =>
|
|
4250
|
+
"aria-label": `Applies at: ${effectiveTiers.map((t) => TIER_INFO[t].label).join(", ")}`
|
|
4177
4251
|
},
|
|
4178
|
-
effectiveTiers.map((tier) =>
|
|
4252
|
+
effectiveTiers.map((tier) => {
|
|
4253
|
+
const { label, Icon } = TIER_INFO[tier];
|
|
4254
|
+
return /* @__PURE__ */ import_react20.default.createElement("span", { key: tier, style: itemStyle(tier) }, /* @__PURE__ */ import_react20.default.createElement(Icon, { size: sizeStyle.iconSize }), !iconOnly && /* @__PURE__ */ import_react20.default.createElement("span", null, label));
|
|
4255
|
+
})
|
|
4179
4256
|
);
|
|
4180
4257
|
}
|
|
4181
4258
|
|
|
4182
|
-
// src/
|
|
4259
|
+
// src/CompassCoverageCallout.jsx
|
|
4260
|
+
var import_react21 = __toESM(require("react"));
|
|
4261
|
+
var TIER_LABELS = {
|
|
4262
|
+
federal: "federal",
|
|
4263
|
+
state: "state",
|
|
4264
|
+
local: "local"
|
|
4265
|
+
};
|
|
4266
|
+
function CompassCoverageCallout({
|
|
4267
|
+
tier,
|
|
4268
|
+
count,
|
|
4269
|
+
totalSelected,
|
|
4270
|
+
compassUrl,
|
|
4271
|
+
onDismiss
|
|
4272
|
+
}) {
|
|
4273
|
+
const [dismissed, setDismissed] = (0, import_react21.useState)(false);
|
|
4274
|
+
if (dismissed) return null;
|
|
4275
|
+
const tierLabel = TIER_LABELS[tier] || tier;
|
|
4276
|
+
const tierStyle = tierColors[tier] || tierColors.federal;
|
|
4277
|
+
const containerStyle2 = {
|
|
4278
|
+
display: "flex",
|
|
4279
|
+
alignItems: "flex-start",
|
|
4280
|
+
gap: spacing[3],
|
|
4281
|
+
padding: `${spacing[3]} ${spacing[4]}`,
|
|
4282
|
+
borderLeft: `4px solid ${tierStyle.text}`,
|
|
4283
|
+
backgroundColor: tierStyle.bg,
|
|
4284
|
+
borderRadius: `0 ${borderRadius.md} ${borderRadius.md} 0`,
|
|
4285
|
+
fontFamily: fonts.primary,
|
|
4286
|
+
margin: `${spacing[3]} 0`
|
|
4287
|
+
};
|
|
4288
|
+
const textStyle = {
|
|
4289
|
+
flex: 1,
|
|
4290
|
+
fontSize: fontSizes.sm,
|
|
4291
|
+
color: "#2d3748",
|
|
4292
|
+
lineHeight: 1.5
|
|
4293
|
+
};
|
|
4294
|
+
const headlineStyle = {
|
|
4295
|
+
fontWeight: fontWeights.semibold,
|
|
4296
|
+
marginBottom: spacing[1],
|
|
4297
|
+
color: tierStyle.text
|
|
4298
|
+
};
|
|
4299
|
+
const ctaStyle = {
|
|
4300
|
+
display: "inline-block",
|
|
4301
|
+
marginTop: spacing[2],
|
|
4302
|
+
padding: `${spacing[2]} ${spacing[4]}`,
|
|
4303
|
+
backgroundColor: tierStyle.text,
|
|
4304
|
+
color: "#ffffff",
|
|
4305
|
+
borderRadius: borderRadius.full,
|
|
4306
|
+
fontSize: fontSizes.sm,
|
|
4307
|
+
fontWeight: fontWeights.semibold,
|
|
4308
|
+
textDecoration: "none",
|
|
4309
|
+
cursor: "pointer"
|
|
4310
|
+
};
|
|
4311
|
+
const closeStyle = {
|
|
4312
|
+
background: "none",
|
|
4313
|
+
border: "none",
|
|
4314
|
+
padding: spacing[1],
|
|
4315
|
+
cursor: "pointer",
|
|
4316
|
+
color: "#718096",
|
|
4317
|
+
fontSize: fontSizes.lg,
|
|
4318
|
+
lineHeight: 1
|
|
4319
|
+
};
|
|
4320
|
+
const handleDismiss = () => {
|
|
4321
|
+
setDismissed(true);
|
|
4322
|
+
if (onDismiss) onDismiss();
|
|
4323
|
+
};
|
|
4324
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
4325
|
+
"div",
|
|
4326
|
+
{
|
|
4327
|
+
className: "ev-compass-coverage-callout",
|
|
4328
|
+
role: "status",
|
|
4329
|
+
style: containerStyle2
|
|
4330
|
+
},
|
|
4331
|
+
/* @__PURE__ */ import_react21.default.createElement("div", { style: textStyle }, /* @__PURE__ */ import_react21.default.createElement("div", { style: headlineStyle }, "Your compass covers ", tierLabel, " issues lightly"), /* @__PURE__ */ import_react21.default.createElement("div", null, count === 0 ? `None of your ${totalSelected != null ? totalSelected : "selected"} compass topics apply at the ${tierLabel} level. ` : `Only ${count} of your ${totalSelected != null ? totalSelected : "selected"} compass topics apply at the ${tierLabel} level. `, "Add more ", tierLabel, "-applicable topics to get better comparisons with ", tierLabel, " officials."), /* @__PURE__ */ import_react21.default.createElement("a", { href: compassUrl, style: ctaStyle }, "Add ", tierLabel, " topics \u2192")),
|
|
4332
|
+
onDismiss !== void 0 && /* @__PURE__ */ import_react21.default.createElement(
|
|
4333
|
+
"button",
|
|
4334
|
+
{
|
|
4335
|
+
onClick: handleDismiss,
|
|
4336
|
+
style: closeStyle,
|
|
4337
|
+
"aria-label": "Dismiss coverage callout"
|
|
4338
|
+
},
|
|
4339
|
+
"\xD7"
|
|
4340
|
+
)
|
|
4341
|
+
);
|
|
4342
|
+
}
|
|
4343
|
+
|
|
4344
|
+
// src/ExpandCompassNudge.jsx
|
|
4183
4345
|
var import_react22 = __toESM(require("react"));
|
|
4346
|
+
function ExpandCompassNudge({
|
|
4347
|
+
politicianName,
|
|
4348
|
+
missingCount,
|
|
4349
|
+
compassUrl,
|
|
4350
|
+
style = {}
|
|
4351
|
+
}) {
|
|
4352
|
+
if (!missingCount || missingCount <= 0) return null;
|
|
4353
|
+
const containerStyle2 = {
|
|
4354
|
+
display: "flex",
|
|
4355
|
+
flexDirection: "column",
|
|
4356
|
+
alignItems: "flex-start",
|
|
4357
|
+
gap: spacing[2],
|
|
4358
|
+
padding: spacing[4],
|
|
4359
|
+
marginTop: spacing[4],
|
|
4360
|
+
backgroundColor: "#F5F9FA",
|
|
4361
|
+
borderRadius: borderRadius.lg,
|
|
4362
|
+
border: "1px solid #e0e6eb",
|
|
4363
|
+
fontFamily: fonts.primary,
|
|
4364
|
+
...style
|
|
4365
|
+
};
|
|
4366
|
+
const headlineStyle = {
|
|
4367
|
+
fontSize: fontSizes.base,
|
|
4368
|
+
fontWeight: fontWeights.semibold,
|
|
4369
|
+
color: "#2d3748",
|
|
4370
|
+
margin: 0
|
|
4371
|
+
};
|
|
4372
|
+
const bodyStyle = {
|
|
4373
|
+
fontSize: fontSizes.sm,
|
|
4374
|
+
color: "#4a5568",
|
|
4375
|
+
lineHeight: 1.5,
|
|
4376
|
+
margin: 0
|
|
4377
|
+
};
|
|
4378
|
+
const ctaStyle = {
|
|
4379
|
+
display: "inline-block",
|
|
4380
|
+
marginTop: spacing[2],
|
|
4381
|
+
padding: `${spacing[2]} ${spacing[4]}`,
|
|
4382
|
+
backgroundColor: "#00657c",
|
|
4383
|
+
color: "#ffffff",
|
|
4384
|
+
borderRadius: borderRadius.full,
|
|
4385
|
+
fontSize: fontSizes.sm,
|
|
4386
|
+
fontWeight: fontWeights.semibold,
|
|
4387
|
+
textDecoration: "none",
|
|
4388
|
+
cursor: "pointer"
|
|
4389
|
+
};
|
|
4390
|
+
const topicsLabel = missingCount === 1 ? "topic" : "topics";
|
|
4391
|
+
const speakerName = politicianName || "This politician";
|
|
4392
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "ev-expand-compass-nudge", style: containerStyle2, role: "region" }, /* @__PURE__ */ import_react22.default.createElement("p", { style: headlineStyle }, "Want a richer comparison?"), /* @__PURE__ */ import_react22.default.createElement("p", { style: bodyStyle }, speakerName, " has stances on ", missingCount, " more ", topicsLabel, " you haven't answered yet. Expand your compass to see where you stand on all of them."), /* @__PURE__ */ import_react22.default.createElement("a", { href: compassUrl, style: ctaStyle }, "Expand my compass \u2192"));
|
|
4393
|
+
}
|
|
4394
|
+
|
|
4395
|
+
// src/computeTierCoverage.js
|
|
4396
|
+
function computeTierCoverage(topics) {
|
|
4397
|
+
const counts = { federal: 0, state: 0, local: 0 };
|
|
4398
|
+
if (!Array.isArray(topics)) return counts;
|
|
4399
|
+
for (const t of topics) {
|
|
4400
|
+
if (!t) continue;
|
|
4401
|
+
const hasFlags = "applies_federal" in t || "applies_state" in t || "applies_local" in t;
|
|
4402
|
+
const f = hasFlags ? Boolean(t.applies_federal) : true;
|
|
4403
|
+
const s = hasFlags ? Boolean(t.applies_state) : true;
|
|
4404
|
+
const l = hasFlags ? Boolean(t.applies_local) : true;
|
|
4405
|
+
if (f) counts.federal++;
|
|
4406
|
+
if (s) counts.state++;
|
|
4407
|
+
if (l) counts.local++;
|
|
4408
|
+
}
|
|
4409
|
+
return counts;
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4412
|
+
// src/StanceAccordion.jsx
|
|
4413
|
+
var import_react24 = __toESM(require("react"));
|
|
4184
4414
|
|
|
4185
4415
|
// src/Favicon.jsx
|
|
4186
|
-
var
|
|
4416
|
+
var import_react23 = __toESM(require("react"));
|
|
4187
4417
|
function Favicon({ url, size = 16 }) {
|
|
4188
4418
|
try {
|
|
4189
4419
|
const domain = new URL(url).hostname;
|
|
4190
|
-
return /* @__PURE__ */
|
|
4420
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
4191
4421
|
"img",
|
|
4192
4422
|
{
|
|
4193
4423
|
src: `https://www.google.com/s2/favicons?sz=${size}&domain=${domain}`,
|
|
@@ -4198,7 +4428,7 @@ function Favicon({ url, size = 16 }) {
|
|
|
4198
4428
|
}
|
|
4199
4429
|
);
|
|
4200
4430
|
} catch {
|
|
4201
|
-
return /* @__PURE__ */
|
|
4431
|
+
return /* @__PURE__ */ import_react23.default.createElement(
|
|
4202
4432
|
"svg",
|
|
4203
4433
|
{
|
|
4204
4434
|
width: size,
|
|
@@ -4209,8 +4439,8 @@ function Favicon({ url, size = 16 }) {
|
|
|
4209
4439
|
strokeWidth: "1.5",
|
|
4210
4440
|
style: { verticalAlign: "middle", flexShrink: 0 }
|
|
4211
4441
|
},
|
|
4212
|
-
/* @__PURE__ */
|
|
4213
|
-
/* @__PURE__ */
|
|
4442
|
+
/* @__PURE__ */ import_react23.default.createElement("circle", { cx: "12", cy: "12", r: "10" }),
|
|
4443
|
+
/* @__PURE__ */ import_react23.default.createElement("path", { d: "M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" })
|
|
4214
4444
|
);
|
|
4215
4445
|
}
|
|
4216
4446
|
}
|
|
@@ -4241,11 +4471,11 @@ function StanceAccordion({
|
|
|
4241
4471
|
apiUrl = "https://api.empowered.vote"
|
|
4242
4472
|
}) {
|
|
4243
4473
|
var _a;
|
|
4244
|
-
const [expandedTopicId, setExpandedTopicId] = (0,
|
|
4245
|
-
const [loadingId, setLoadingId] = (0,
|
|
4246
|
-
const [showAll, setShowAll] = (0,
|
|
4247
|
-
const contextCache = (0,
|
|
4248
|
-
const quotesCache = (0,
|
|
4474
|
+
const [expandedTopicId, setExpandedTopicId] = (0, import_react24.useState)(null);
|
|
4475
|
+
const [loadingId, setLoadingId] = (0, import_react24.useState)(null);
|
|
4476
|
+
const [showAll, setShowAll] = (0, import_react24.useState)(false);
|
|
4477
|
+
const contextCache = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
4478
|
+
const quotesCache = (0, import_react24.useRef)(null);
|
|
4249
4479
|
const polAnswerMap = {};
|
|
4250
4480
|
if (polAnswers) {
|
|
4251
4481
|
polAnswers.forEach((a) => {
|
|
@@ -4304,7 +4534,7 @@ function StanceAccordion({
|
|
|
4304
4534
|
quotesCache.current = [];
|
|
4305
4535
|
}
|
|
4306
4536
|
}
|
|
4307
|
-
const handleToggle = (0,
|
|
4537
|
+
const handleToggle = (0, import_react24.useCallback)(
|
|
4308
4538
|
async (topicId) => {
|
|
4309
4539
|
if (expandedTopicId === topicId) {
|
|
4310
4540
|
setExpandedTopicId(null);
|
|
@@ -4321,7 +4551,7 @@ function StanceAccordion({
|
|
|
4321
4551
|
},
|
|
4322
4552
|
[expandedTopicId, politicianId, apiUrl]
|
|
4323
4553
|
);
|
|
4324
|
-
(0,
|
|
4554
|
+
(0, import_react24.useEffect)(() => {
|
|
4325
4555
|
if (initialExpandedTopicId && topics && topics.length > 0) {
|
|
4326
4556
|
handleToggle(String(initialExpandedTopicId));
|
|
4327
4557
|
}
|
|
@@ -4337,13 +4567,13 @@ function StanceAccordion({
|
|
|
4337
4567
|
visibleTopics = [pinned, ...baseTopics.filter((t) => String(t.id) !== String(initialExpandedTopicId))];
|
|
4338
4568
|
}
|
|
4339
4569
|
}
|
|
4340
|
-
return /* @__PURE__ */
|
|
4570
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
4341
4571
|
"div",
|
|
4342
4572
|
{
|
|
4343
4573
|
className: "flex flex-col",
|
|
4344
4574
|
style: { fontFamily: "'Manrope', sans-serif" }
|
|
4345
4575
|
},
|
|
4346
|
-
/* @__PURE__ */
|
|
4576
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
4347
4577
|
"h3",
|
|
4348
4578
|
{
|
|
4349
4579
|
className: "text-sm font-semibold text-neutral-400 uppercase tracking-wider mb-2",
|
|
@@ -4365,15 +4595,15 @@ function StanceAccordion({
|
|
|
4365
4595
|
if (topic.topic_key) return q.issue === topic.topic_key;
|
|
4366
4596
|
return topic.short_title && q.issue.toLowerCase() === topic.short_title.toLowerCase();
|
|
4367
4597
|
}) : [];
|
|
4368
|
-
return /* @__PURE__ */
|
|
4598
|
+
return /* @__PURE__ */ import_react24.default.createElement("div", { key: topicId, className: "border-b border-neutral-100" }, /* @__PURE__ */ import_react24.default.createElement(
|
|
4369
4599
|
"button",
|
|
4370
4600
|
{
|
|
4371
4601
|
type: "button",
|
|
4372
4602
|
onClick: () => handleToggle(topicId),
|
|
4373
4603
|
className: "w-full flex items-center justify-between py-3 px-2 text-left cursor-pointer hover:bg-neutral-50 transition-colors"
|
|
4374
4604
|
},
|
|
4375
|
-
/* @__PURE__ */
|
|
4376
|
-
/* @__PURE__ */
|
|
4605
|
+
/* @__PURE__ */ import_react24.default.createElement("div", { className: "flex flex-col min-w-0" }, /* @__PURE__ */ import_react24.default.createElement("span", { className: "text-sm font-medium text-neutral-800 truncate" }, topic.short_title), questionText && /* @__PURE__ */ import_react24.default.createElement("span", { className: "text-xs text-neutral-400 mt-0.5" }, questionText), /* @__PURE__ */ import_react24.default.createElement("span", { className: "text-xs text-neutral-500 mt-0.5" }, label)),
|
|
4606
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
4377
4607
|
"svg",
|
|
4378
4608
|
{
|
|
4379
4609
|
width: "16",
|
|
@@ -4390,9 +4620,9 @@ function StanceAccordion({
|
|
|
4390
4620
|
transition: "transform 0.2s ease"
|
|
4391
4621
|
}
|
|
4392
4622
|
},
|
|
4393
|
-
/* @__PURE__ */
|
|
4623
|
+
/* @__PURE__ */ import_react24.default.createElement("polyline", { points: "9 18 15 12 9 6" })
|
|
4394
4624
|
)
|
|
4395
|
-
), /* @__PURE__ */
|
|
4625
|
+
), /* @__PURE__ */ import_react24.default.createElement(
|
|
4396
4626
|
"div",
|
|
4397
4627
|
{
|
|
4398
4628
|
style: {
|
|
@@ -4401,7 +4631,7 @@ function StanceAccordion({
|
|
|
4401
4631
|
transition: "grid-template-rows 0.25s ease"
|
|
4402
4632
|
}
|
|
4403
4633
|
},
|
|
4404
|
-
/* @__PURE__ */
|
|
4634
|
+
/* @__PURE__ */ import_react24.default.createElement("div", { style: { overflow: "hidden" } }, /* @__PURE__ */ import_react24.default.createElement("div", { className: "px-2 pb-4" }, isLoading && /* @__PURE__ */ import_react24.default.createElement("div", { className: "flex items-center py-3" }, /* @__PURE__ */ import_react24.default.createElement(
|
|
4405
4635
|
"div",
|
|
4406
4636
|
{
|
|
4407
4637
|
style: {
|
|
@@ -4413,14 +4643,14 @@ function StanceAccordion({
|
|
|
4413
4643
|
animation: "ev-spin 0.8s linear infinite"
|
|
4414
4644
|
}
|
|
4415
4645
|
}
|
|
4416
|
-
)), !isLoading && cached && /* @__PURE__ */
|
|
4646
|
+
)), !isLoading && cached && /* @__PURE__ */ import_react24.default.createElement(import_react24.default.Fragment, null, cached.reasoning ? /* @__PURE__ */ import_react24.default.createElement(
|
|
4417
4647
|
"p",
|
|
4418
4648
|
{
|
|
4419
4649
|
className: "text-sm text-neutral-700 mb-3",
|
|
4420
4650
|
style: { whiteSpace: "pre-wrap", lineHeight: 1.6 }
|
|
4421
4651
|
},
|
|
4422
4652
|
cached.reasoning
|
|
4423
|
-
) : null, cached.sources && cached.sources.length > 0 && /* @__PURE__ */
|
|
4653
|
+
) : null, cached.sources && cached.sources.length > 0 && /* @__PURE__ */ import_react24.default.createElement("div", { className: "mt-2" }, /* @__PURE__ */ import_react24.default.createElement("p", { className: "text-xs font-semibold text-neutral-500 uppercase tracking-wider mb-1.5" }, "References"), /* @__PURE__ */ import_react24.default.createElement("ol", { className: "list-decimal list-inside space-y-1" }, cached.sources.map((src, i) => /* @__PURE__ */ import_react24.default.createElement("li", { key: i, className: "text-xs text-neutral-600" }, /* @__PURE__ */ import_react24.default.createElement(
|
|
4424
4654
|
"a",
|
|
4425
4655
|
{
|
|
4426
4656
|
href: src,
|
|
@@ -4428,9 +4658,9 @@ function StanceAccordion({
|
|
|
4428
4658
|
rel: "noreferrer",
|
|
4429
4659
|
className: "inline-flex items-center gap-1.5 hover:text-[#00657c] transition-colors"
|
|
4430
4660
|
},
|
|
4431
|
-
/* @__PURE__ */
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
))))), topicQuotes.length > 0 && /* @__PURE__ */
|
|
4661
|
+
/* @__PURE__ */ import_react24.default.createElement(Favicon, { url: src }),
|
|
4662
|
+
/* @__PURE__ */ import_react24.default.createElement("span", { className: "underline underline-offset-2" }, getDisplayUrl(src))
|
|
4663
|
+
))))), topicQuotes.length > 0 && /* @__PURE__ */ import_react24.default.createElement("div", { style: { marginTop: "12px" } }, /* @__PURE__ */ import_react24.default.createElement(
|
|
4434
4664
|
"p",
|
|
4435
4665
|
{
|
|
4436
4666
|
style: {
|
|
@@ -4447,7 +4677,7 @@ function StanceAccordion({
|
|
|
4447
4677
|
const verdict = verdictsByQuote ? verdictsByQuote[quote.id] : void 0;
|
|
4448
4678
|
const borderColor = verdict === "agreed" ? "#0e7490" : verdict === "disagreed" ? "#b45309" : "#e2e8f0";
|
|
4449
4679
|
const sourceName = quote.source_name || quote.sourceName;
|
|
4450
|
-
return /* @__PURE__ */
|
|
4680
|
+
return /* @__PURE__ */ import_react24.default.createElement(
|
|
4451
4681
|
"div",
|
|
4452
4682
|
{
|
|
4453
4683
|
key: quote.id,
|
|
@@ -4459,7 +4689,7 @@ function StanceAccordion({
|
|
|
4459
4689
|
marginBottom: "8px"
|
|
4460
4690
|
}
|
|
4461
4691
|
},
|
|
4462
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
4463
4693
|
"p",
|
|
4464
4694
|
{
|
|
4465
4695
|
style: {
|
|
@@ -4472,7 +4702,7 @@ function StanceAccordion({
|
|
|
4472
4702
|
},
|
|
4473
4703
|
quote.text
|
|
4474
4704
|
),
|
|
4475
|
-
verdict === "agreed" && /* @__PURE__ */
|
|
4705
|
+
verdict === "agreed" && /* @__PURE__ */ import_react24.default.createElement(
|
|
4476
4706
|
"span",
|
|
4477
4707
|
{
|
|
4478
4708
|
style: {
|
|
@@ -4489,10 +4719,10 @@ function StanceAccordion({
|
|
|
4489
4719
|
flexShrink: 0
|
|
4490
4720
|
}
|
|
4491
4721
|
},
|
|
4492
|
-
/* @__PURE__ */
|
|
4722
|
+
/* @__PURE__ */ import_react24.default.createElement("svg", { width: "11", height: "11", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react24.default.createElement("path", { d: "M5 13l4 4L19 7" })),
|
|
4493
4723
|
"Agreed"
|
|
4494
4724
|
),
|
|
4495
|
-
verdict === "disagreed" && /* @__PURE__ */
|
|
4725
|
+
verdict === "disagreed" && /* @__PURE__ */ import_react24.default.createElement(
|
|
4496
4726
|
"span",
|
|
4497
4727
|
{
|
|
4498
4728
|
style: {
|
|
@@ -4509,10 +4739,10 @@ function StanceAccordion({
|
|
|
4509
4739
|
flexShrink: 0
|
|
4510
4740
|
}
|
|
4511
4741
|
},
|
|
4512
|
-
/* @__PURE__ */
|
|
4742
|
+
/* @__PURE__ */ import_react24.default.createElement("svg", { width: "11", height: "11", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ import_react24.default.createElement("path", { d: "M6 18L18 6M6 6l12 12" })),
|
|
4513
4743
|
"Disagreed"
|
|
4514
4744
|
),
|
|
4515
|
-
sourceName && /* @__PURE__ */
|
|
4745
|
+
sourceName && /* @__PURE__ */ import_react24.default.createElement(
|
|
4516
4746
|
"a",
|
|
4517
4747
|
{
|
|
4518
4748
|
href: quote.source_url || quote.sourceUrl,
|
|
@@ -4529,10 +4759,10 @@ function StanceAccordion({
|
|
|
4529
4759
|
sourceName
|
|
4530
4760
|
)
|
|
4531
4761
|
);
|
|
4532
|
-
})), !cached.reasoning && (!cached.sources || cached.sources.length === 0) && topicQuotes.length === 0 && /* @__PURE__ */
|
|
4762
|
+
})), !cached.reasoning && (!cached.sources || cached.sources.length === 0) && topicQuotes.length === 0 && /* @__PURE__ */ import_react24.default.createElement("p", { className: "text-sm text-neutral-400 italic py-2" }, "No detailed reasoning available for this topic."))))
|
|
4533
4763
|
));
|
|
4534
4764
|
}),
|
|
4535
|
-
hasToggle && /* @__PURE__ */
|
|
4765
|
+
hasToggle && /* @__PURE__ */ import_react24.default.createElement(
|
|
4536
4766
|
"button",
|
|
4537
4767
|
{
|
|
4538
4768
|
type: "button",
|
|
@@ -4546,9 +4776,9 @@ function StanceAccordion({
|
|
|
4546
4776
|
}
|
|
4547
4777
|
|
|
4548
4778
|
// src/icons.js
|
|
4549
|
-
var
|
|
4779
|
+
var import_react25 = __toESM(require("react"));
|
|
4550
4780
|
function BallotIcon({ size = 16, color = "currentColor" }) {
|
|
4551
|
-
return /* @__PURE__ */
|
|
4781
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
4552
4782
|
"svg",
|
|
4553
4783
|
{
|
|
4554
4784
|
width: size,
|
|
@@ -4561,13 +4791,13 @@ function BallotIcon({ size = 16, color = "currentColor" }) {
|
|
|
4561
4791
|
strokeLinejoin: "round",
|
|
4562
4792
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4563
4793
|
},
|
|
4564
|
-
/* @__PURE__ */
|
|
4565
|
-
/* @__PURE__ */
|
|
4566
|
-
/* @__PURE__ */
|
|
4794
|
+
/* @__PURE__ */ import_react25.default.createElement("path", { d: "m9 12 2 2 4-4" }),
|
|
4795
|
+
/* @__PURE__ */ import_react25.default.createElement("path", { d: "M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z" }),
|
|
4796
|
+
/* @__PURE__ */ import_react25.default.createElement("path", { d: "M22 19H2" })
|
|
4567
4797
|
);
|
|
4568
4798
|
}
|
|
4569
4799
|
function CompassIcon({ size = 16, color = "currentColor" }) {
|
|
4570
|
-
return /* @__PURE__ */
|
|
4800
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
4571
4801
|
"svg",
|
|
4572
4802
|
{
|
|
4573
4803
|
width: size,
|
|
@@ -4580,27 +4810,27 @@ function CompassIcon({ size = 16, color = "currentColor" }) {
|
|
|
4580
4810
|
strokeLinejoin: "round",
|
|
4581
4811
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4582
4812
|
},
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4813
|
+
/* @__PURE__ */ import_react25.default.createElement("circle", { cx: "12", cy: "12", r: "10" }),
|
|
4814
|
+
/* @__PURE__ */ import_react25.default.createElement("path", { d: "m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z" })
|
|
4585
4815
|
);
|
|
4586
4816
|
}
|
|
4587
4817
|
function BranchIcon({ size = 16, color = "currentColor", branch }) {
|
|
4588
4818
|
let paths;
|
|
4589
4819
|
switch (branch) {
|
|
4590
4820
|
case "executive":
|
|
4591
|
-
paths = /* @__PURE__ */
|
|
4821
|
+
paths = /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement("path", { d: "M3 21h18" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M5 21V7l8-4v18" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M19 21V11l-6-4" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M9 9v.01" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M9 12v.01" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M9 15v.01" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M9 18v.01" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M5 21h14" }), /* @__PURE__ */ import_react25.default.createElement("line", { x1: "13", y1: "5", x2: "13", y2: "3" }), /* @__PURE__ */ import_react25.default.createElement("line", { x1: "13", y1: "3", x2: "15", y2: "4" }));
|
|
4592
4822
|
break;
|
|
4593
4823
|
case "legislative":
|
|
4594
|
-
paths = /* @__PURE__ */
|
|
4824
|
+
paths = /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement("path", { d: "M8 21h12a2 2 0 0 0 2-2v-2H10v2a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v3h4" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M19 17V5a2 2 0 0 0-2-2H4" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M15 8h-5" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M15 12h-5" }));
|
|
4595
4825
|
break;
|
|
4596
4826
|
case "judicial":
|
|
4597
|
-
paths = /* @__PURE__ */
|
|
4827
|
+
paths = /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement("path", { d: "M12 3v19" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M5 8l7-5 7 5" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M3 13l2-5 2 5a3 3 0 0 1-4 0z" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M17 13l2-5 2 5a3 3 0 0 1-4 0z" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M8 21h8" }));
|
|
4598
4828
|
break;
|
|
4599
4829
|
default:
|
|
4600
|
-
paths = /* @__PURE__ */
|
|
4830
|
+
paths = /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement("path", { d: "M10 18v-7" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M11.12 2.198a2 2 0 0 1 1.76.006l7.866 3.847c.476.233.31.949-.22.949H3.474c-.53 0-.695-.716-.22-.949z" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M14 18v-7" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M18 18v-7" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M3 22h18" }), /* @__PURE__ */ import_react25.default.createElement("path", { d: "M6 18v-7" }));
|
|
4601
4831
|
break;
|
|
4602
4832
|
}
|
|
4603
|
-
return /* @__PURE__ */
|
|
4833
|
+
return /* @__PURE__ */ import_react25.default.createElement(
|
|
4604
4834
|
"svg",
|
|
4605
4835
|
{
|
|
4606
4836
|
width: size,
|
|
@@ -4623,7 +4853,9 @@ function BranchIcon({ size = 16, color = "currentColor", branch }) {
|
|
|
4623
4853
|
BranchIcon,
|
|
4624
4854
|
CategorySection,
|
|
4625
4855
|
CommitteeTable,
|
|
4856
|
+
CompassCoverageCallout,
|
|
4626
4857
|
CompassIcon,
|
|
4858
|
+
ExpandCompassNudge,
|
|
4627
4859
|
FilterSidebar,
|
|
4628
4860
|
GovernmentBodySection,
|
|
4629
4861
|
Header,
|
|
@@ -4645,6 +4877,7 @@ function BranchIcon({ size = 16, color = "currentColor", branch }) {
|
|
|
4645
4877
|
breakpoints,
|
|
4646
4878
|
colorScales,
|
|
4647
4879
|
colors,
|
|
4880
|
+
computeTierCoverage,
|
|
4648
4881
|
dataVizPalette,
|
|
4649
4882
|
defaultCtaButton,
|
|
4650
4883
|
defaultNavItems,
|