@burdenoff/microfe-govcitizenhub 2026.720.7 → 2026.730.1

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.
Files changed (155) hide show
  1. package/dist/govcitizenhub/GovCitizenHubRoot.d.ts.map +1 -1
  2. package/dist/govcitizenhub/GovCitizenHubRoot.js +44 -36
  3. package/dist/govcitizenhub/GovCitizenHubRoot.js.map +1 -1
  4. package/dist/govcitizenhub/GovCitizenHubRoutes.d.ts.map +1 -1
  5. package/dist/govcitizenhub/GovCitizenHubRoutes.js +134 -6
  6. package/dist/govcitizenhub/GovCitizenHubRoutes.js.map +1 -1
  7. package/dist/govcitizenhub/components/DocumentUploadField.d.ts +17 -11
  8. package/dist/govcitizenhub/components/DocumentUploadField.d.ts.map +1 -1
  9. package/dist/govcitizenhub/components/DocumentUploadField.js +45 -42
  10. package/dist/govcitizenhub/components/DocumentUploadField.js.map +1 -1
  11. package/dist/govcitizenhub/components/GovCharts.js +127 -51
  12. package/dist/govcitizenhub/components/GovCharts.js.map +1 -1
  13. package/dist/govcitizenhub/hooks/index.d.ts +1 -0
  14. package/dist/govcitizenhub/hooks/index.d.ts.map +1 -1
  15. package/dist/govcitizenhub/hooks/index.js +1 -0
  16. package/dist/govcitizenhub/hooks/useGovApi.d.ts +3 -0
  17. package/dist/govcitizenhub/hooks/useGovApi.d.ts.map +1 -1
  18. package/dist/govcitizenhub/hooks/useGovApi.js +1 -1
  19. package/dist/govcitizenhub/hooks/useGovApi.js.map +1 -1
  20. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts +214 -0
  21. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts.map +1 -0
  22. package/dist/govcitizenhub/hooks/useIntelligenceApi.js +1140 -0
  23. package/dist/govcitizenhub/hooks/useIntelligenceApi.js.map +1 -0
  24. package/dist/govcitizenhub/index.d.ts +1 -0
  25. package/dist/govcitizenhub/index.d.ts.map +1 -1
  26. package/dist/govcitizenhub/index.js +18 -0
  27. package/dist/govcitizenhub/pages/agencies/AgenciesPage.js +7 -7
  28. package/dist/govcitizenhub/pages/agencies/AgencyFormDialog.js +6 -6
  29. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +16 -16
  30. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +35 -35
  31. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
  32. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +1 -1
  33. package/dist/govcitizenhub/pages/documents/DocumentsPage.js +5 -5
  34. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js +30 -30
  35. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js.map +1 -1
  36. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +15 -15
  37. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts +4 -0
  38. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts.map +1 -0
  39. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js +634 -0
  40. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -0
  41. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts +20 -0
  42. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts.map +1 -0
  43. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js +537 -0
  44. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -0
  45. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts +11 -0
  46. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts.map +1 -0
  47. package/dist/govcitizenhub/pages/intelligence/AssetImage.js +25 -0
  48. package/dist/govcitizenhub/pages/intelligence/AssetImage.js.map +1 -0
  49. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts +15 -0
  50. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts.map +1 -0
  51. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js +203 -0
  52. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js.map +1 -0
  53. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts +4 -0
  54. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts.map +1 -0
  55. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js +497 -0
  56. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -0
  57. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts +4 -0
  58. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts.map +1 -0
  59. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js +1084 -0
  60. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -0
  61. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts +13 -0
  62. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts.map +1 -0
  63. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js +581 -0
  64. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -0
  65. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts +11 -0
  66. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts.map +1 -0
  67. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js +429 -0
  68. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -0
  69. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts +8 -0
  70. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts.map +1 -0
  71. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js +235 -0
  72. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js.map +1 -0
  73. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts +4 -0
  74. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts.map +1 -0
  75. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js +534 -0
  76. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -0
  77. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts +4 -0
  78. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts.map +1 -0
  79. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js +723 -0
  80. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -0
  81. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts +5 -0
  82. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts.map +1 -0
  83. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js +1029 -0
  84. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js.map +1 -0
  85. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts +5 -0
  86. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts.map +1 -0
  87. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js +1545 -0
  88. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js.map +1 -0
  89. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts +4 -0
  90. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts.map +1 -0
  91. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js +960 -0
  92. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -0
  93. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts +13 -0
  94. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts.map +1 -0
  95. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js +927 -0
  96. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js.map +1 -0
  97. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts +4 -0
  98. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts.map +1 -0
  99. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js +620 -0
  100. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -0
  101. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts +20 -0
  102. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts.map +1 -0
  103. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js +183 -0
  104. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -0
  105. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts +4 -0
  106. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts.map +1 -0
  107. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js +629 -0
  108. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -0
  109. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts +4 -0
  110. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts.map +1 -0
  111. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +1124 -0
  112. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -0
  113. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts +4 -0
  114. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts.map +1 -0
  115. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js +1518 -0
  116. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -0
  117. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts +4 -0
  118. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts.map +1 -0
  119. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js +577 -0
  120. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -0
  121. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts +4 -0
  122. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts.map +1 -0
  123. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js +534 -0
  124. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -0
  125. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts +5 -0
  126. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts.map +1 -0
  127. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js +538 -0
  128. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js.map +1 -0
  129. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts +53 -0
  130. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts.map +1 -0
  131. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js +138 -0
  132. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js.map +1 -0
  133. package/dist/govcitizenhub/pages/intelligence/index.d.ts +27 -0
  134. package/dist/govcitizenhub/pages/intelligence/index.d.ts.map +1 -0
  135. package/dist/govcitizenhub/pages/intelligence/index.js +17 -0
  136. package/dist/govcitizenhub/pages/payments/PaymentsPage.js +11 -11
  137. package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
  138. package/dist/govcitizenhub/pages/permits/PermitsPage.js +6 -6
  139. package/dist/govcitizenhub/pages/services/ServiceDetailPage.js +8 -8
  140. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +98 -98
  141. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
  142. package/dist/govcitizenhub/types/index.d.ts +1 -0
  143. package/dist/govcitizenhub/types/index.d.ts.map +1 -1
  144. package/dist/govcitizenhub/types/intelligence.d.ts +1559 -0
  145. package/dist/govcitizenhub/types/intelligence.d.ts.map +1 -0
  146. package/dist/govcitizenhub/types/intelligence.js +125 -0
  147. package/dist/govcitizenhub/types/intelligence.js.map +1 -0
  148. package/dist/index.js +19 -2
  149. package/dist/node_modules/recharts/es6/chart/BarChart.js +24 -0
  150. package/dist/node_modules/recharts/es6/chart/BarChart.js.map +1 -0
  151. package/dist/utils/pageContext.d.ts +1 -0
  152. package/dist/utils/pageContext.d.ts.map +1 -1
  153. package/dist/utils/pageContext.js +44 -17
  154. package/dist/utils/pageContext.js.map +1 -1
  155. package/package.json +1 -1
@@ -0,0 +1,235 @@
1
+ import { CHART_SERIES_COLORS as e, ChartLegend as t, GovBarChart as n, GovDonutChart as r } from "../../components/GovCharts.js";
2
+ import { formatCurrency as i, formatDateTime as a, formatNumber as o } from "../../utils/formatters.js";
3
+ import { EmptyState as s } from "../../components/EmptyState.js";
4
+ import { useGovConsultationResults as c } from "../../hooks/useIntelligenceApi.js";
5
+ import "../../hooks/index.js";
6
+ import { ErrorView as l, LoadingView as u } from "../../components/StateViews.js";
7
+ import { CONSULTATION_QUESTION_TYPES as d, QUESTION_TYPE_LABELS as f, readAggregateNumber as p, readCountMap as m, readNumericBuckets as h } from "./consultationQuestions.js";
8
+ import { BarChart3 as g, EyeOff as _, Lock as v } from "lucide-react";
9
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
10
+ //#region src/govcitizenhub/pages/intelligence/ConsultationResultsPanel.tsx
11
+ var x = new Set(["CLOSED", "PUBLISHED"]), S = ({ consultation: e }) => {
12
+ let { data: t, isLoading: n, isError: r, refetch: i } = c(e.id);
13
+ if (n) return /* @__PURE__ */ y(u, {
14
+ label: "Loading results…",
15
+ className: "min-h-[12rem]"
16
+ });
17
+ if (r) return /* @__PURE__ */ y(l, {
18
+ className: "min-h-[12rem]",
19
+ message: "We couldn't load the results for this consultation.",
20
+ onRetry: () => {
21
+ i();
22
+ }
23
+ });
24
+ if (!t) return /* @__PURE__ */ y(s, {
25
+ icon: /* @__PURE__ */ y(g, {
26
+ className: "size-8",
27
+ "aria-hidden": "true"
28
+ }),
29
+ title: "No result set yet",
30
+ description: "This consultation has no computed results."
31
+ });
32
+ if (t.isSuppressed) {
33
+ let e = !x.has(t.status);
34
+ return /* @__PURE__ */ b("div", {
35
+ className: "rounded-xl border border-border-seam bg-bg-sunken/40 p-5",
36
+ children: [
37
+ /* @__PURE__ */ b("p", {
38
+ className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
39
+ children: [y(e ? v : _, {
40
+ className: "size-4 shrink-0 text-text-muted",
41
+ "aria-hidden": "true"
42
+ }), "Results are withheld"]
43
+ }),
44
+ /* @__PURE__ */ y("p", {
45
+ className: "mt-2 text-sm text-text-secondary",
46
+ children: e ? "Aggregates are computed once the consultation closes, so nobody can watch the tally move while responses are still being collected." : "Too few responses have been received for the aggregate to be published: with a small number of respondents the totals themselves would identify who said what. Results are released once enough people have taken part."
47
+ }),
48
+ /* @__PURE__ */ b("p", {
49
+ className: "mt-2 text-sm text-text-secondary tabular-nums",
50
+ children: [
51
+ o(t.responseCount),
52
+ " response",
53
+ t.responseCount === 1 ? "" : "s",
54
+ " received so far."
55
+ ]
56
+ })
57
+ ]
58
+ });
59
+ }
60
+ return /* @__PURE__ */ b("div", {
61
+ className: "flex flex-col gap-5",
62
+ children: [/* @__PURE__ */ b("div", {
63
+ className: "flex flex-wrap items-center gap-x-6 gap-y-1 text-sm text-text-secondary",
64
+ children: [/* @__PURE__ */ b("span", {
65
+ className: "tabular-nums",
66
+ children: [
67
+ /* @__PURE__ */ y("span", {
68
+ className: "font-semibold text-text-primary",
69
+ children: o(t.responseCount)
70
+ }),
71
+ " ",
72
+ "response",
73
+ t.responseCount === 1 ? "" : "s"
74
+ ]
75
+ }), t.resultsPublishedAt && /* @__PURE__ */ b("span", { children: ["Published ", a(t.resultsPublishedAt)] })]
76
+ }), t.questions.length === 0 ? /* @__PURE__ */ y(s, {
77
+ icon: /* @__PURE__ */ y(g, {
78
+ className: "size-8",
79
+ "aria-hidden": "true"
80
+ }),
81
+ title: "Nothing to aggregate",
82
+ description: "The published result set carries no questions."
83
+ }) : t.questions.map((t) => /* @__PURE__ */ y(C, {
84
+ result: t,
85
+ currency: e.currencyCode
86
+ }, t.questionId))]
87
+ });
88
+ };
89
+ function C({ result: e, currency: t }) {
90
+ let r = d.find((t) => t === e.type);
91
+ return /* @__PURE__ */ b("section", {
92
+ className: "rounded-xl border border-border-seam bg-bg-surface p-4",
93
+ children: [
94
+ /* @__PURE__ */ b("header", {
95
+ className: "mb-3 flex flex-wrap items-baseline justify-between gap-2",
96
+ children: [/* @__PURE__ */ y("h4", {
97
+ className: "text-sm font-semibold text-text-primary",
98
+ children: e.label
99
+ }), /* @__PURE__ */ b("span", {
100
+ className: "text-xs text-text-muted",
101
+ children: [
102
+ r ? f[r] : e.type,
103
+ " ·",
104
+ " ",
105
+ /* @__PURE__ */ y("span", {
106
+ className: "tabular-nums",
107
+ children: o(e.responseCount)
108
+ }),
109
+ " answered"
110
+ ]
111
+ })]
112
+ }),
113
+ r === "SINGLE_CHOICE" && /* @__PURE__ */ y(w, { result: e }),
114
+ r === "MULTI_CHOICE" && /* @__PURE__ */ y(n, {
115
+ data: m(e.aggregate, "counts"),
116
+ height: 220
117
+ }),
118
+ r === "RATING" && /* @__PURE__ */ y(T, { result: e }),
119
+ r === "TEXT" && /* @__PURE__ */ y(E, { result: e }),
120
+ r === "BUDGET_ALLOCATION" && /* @__PURE__ */ y(D, {
121
+ result: e,
122
+ currency: t
123
+ }),
124
+ r === void 0 && /* @__PURE__ */ y("p", {
125
+ className: "text-sm text-text-muted",
126
+ children: "This question uses a type this build does not know how to chart."
127
+ })
128
+ ]
129
+ });
130
+ }
131
+ function w({ result: n }) {
132
+ let i = m(n.aggregate, "counts"), a = i.map((t, n) => ({
133
+ label: t.name,
134
+ color: e[n % e.length],
135
+ value: t.value
136
+ }));
137
+ return /* @__PURE__ */ b("div", {
138
+ className: "grid gap-4 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] sm:items-center",
139
+ children: [/* @__PURE__ */ y(r, {
140
+ data: i.map((e) => ({
141
+ name: e.name,
142
+ value: e.value
143
+ })),
144
+ height: 200,
145
+ centerValue: o(n.responseCount),
146
+ centerLabel: "answered"
147
+ }), /* @__PURE__ */ y(t, { items: a })]
148
+ });
149
+ }
150
+ function T({ result: e }) {
151
+ let t = h(e.aggregate, "distribution"), r = p(e.aggregate, "mean"), i = p(e.aggregate, "min"), a = p(e.aggregate, "max");
152
+ return /* @__PURE__ */ b("div", {
153
+ className: "flex flex-col gap-3",
154
+ children: [/* @__PURE__ */ b("div", {
155
+ className: "flex flex-wrap items-baseline gap-x-6 gap-y-1 text-sm text-text-secondary",
156
+ children: [/* @__PURE__ */ b("span", { children: [
157
+ "Mean",
158
+ " ",
159
+ /* @__PURE__ */ y("span", {
160
+ className: "font-semibold tabular-nums text-text-primary",
161
+ children: r === null ? "not available" : o(r)
162
+ })
163
+ ] }), i !== null && a !== null && /* @__PURE__ */ b("span", {
164
+ className: "tabular-nums",
165
+ children: [
166
+ "Scale ",
167
+ o(i),
168
+ "–",
169
+ o(a)
170
+ ]
171
+ })]
172
+ }), /* @__PURE__ */ y(n, {
173
+ data: t,
174
+ height: 200,
175
+ emptyLabel: "No ratings recorded"
176
+ })]
177
+ });
178
+ }
179
+ function E({ result: e }) {
180
+ let t = p(e.aggregate, "answeredCount");
181
+ return /* @__PURE__ */ b("div", {
182
+ className: "rounded-lg border border-border-seam bg-bg-sunken/40 p-3",
183
+ children: [/* @__PURE__ */ b("p", {
184
+ className: "text-sm text-text-secondary tabular-nums",
185
+ children: [
186
+ /* @__PURE__ */ y("span", {
187
+ className: "font-semibold text-text-primary",
188
+ children: t === null ? "—" : o(t)
189
+ }),
190
+ " ",
191
+ "free-text answer",
192
+ t === 1 ? "" : "s",
193
+ " received."
194
+ ]
195
+ }), /* @__PURE__ */ y("p", {
196
+ className: "mt-1 text-xs text-text-muted",
197
+ children: "The text itself is never published — respondents wrote it for their government, not for the public record."
198
+ })]
199
+ });
200
+ }
201
+ function D({ result: r, currency: a }) {
202
+ let o = m(r.aggregate, "meanAllocation"), s = p(r.aggregate, "totalPot"), c = o.map((t, n) => ({
203
+ label: t.name,
204
+ color: e[n % e.length],
205
+ value: i(t.value, a)
206
+ }));
207
+ return /* @__PURE__ */ b("div", {
208
+ className: "flex flex-col gap-3",
209
+ children: [
210
+ s !== null && /* @__PURE__ */ b("p", {
211
+ className: "text-sm text-text-secondary",
212
+ children: [
213
+ "Average allocation per respondent of a",
214
+ " ",
215
+ /* @__PURE__ */ y("span", {
216
+ className: "font-semibold text-text-primary",
217
+ children: i(s, a)
218
+ }),
219
+ " ",
220
+ "pot."
221
+ ]
222
+ }),
223
+ /* @__PURE__ */ y(n, {
224
+ data: o,
225
+ height: 200,
226
+ emptyLabel: "No allocations recorded"
227
+ }),
228
+ /* @__PURE__ */ y(t, { items: c })
229
+ ]
230
+ });
231
+ }
232
+ //#endregion
233
+ export { S as ConsultationResultsPanel };
234
+
235
+ //# sourceMappingURL=ConsultationResultsPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsultationResultsPanel.js","names":[],"sources":["../../../../src/govcitizenhub/pages/intelligence/ConsultationResultsPanel.tsx"],"sourcesContent":["/**\n * ConsultationResultsPanel — the publishable aggregate for one consultation.\n * @module govcitizenhub/pages/intelligence\n *\n * Reads `govConsultationResults`, which publishes AGGREGATES ONLY: option\n * counts, a rating distribution and mean, a free-text answered-count (never the\n * text) and mean budget allocations.\n *\n * Suppression is a first-class state, not an empty chart. The service returns\n * `isSuppressed: true` with NO aggregates in two cases — the consultation has\n * not closed yet, or too few people have responded for the aggregate to be\n * non-identifying. This panel says which of the two it is and shows the real\n * response count, instead of rendering empty axes that would read as \"nobody\n * agreed with anything\".\n */\n\nimport type { FC, ReactElement } from 'react';\nimport { BarChart3, EyeOff, Lock } from 'lucide-react';\n\nimport { EmptyState } from '../../components/EmptyState';\nimport { ErrorView, LoadingView } from '../../components/StateViews';\nimport {\n CHART_SERIES_COLORS,\n ChartLegend,\n GovBarChart,\n GovDonutChart,\n type ChartLegendItem,\n} from '../../components/GovCharts';\nimport {\n readAggregateNumber,\n readCountMap,\n readNumericBuckets,\n QUESTION_TYPE_LABELS,\n CONSULTATION_QUESTION_TYPES,\n} from './consultationQuestions';\nimport { useGovConsultationResults } from '../../hooks';\nimport { formatCurrency, formatDateTime, formatNumber } from '../../utils/formatters';\nimport type { GovConsultation, GovConsultationQuestionResult } from '../../types';\n\n/** Statuses whose aggregate the service will compute at all. */\nconst RESULT_READABLE_STATUSES = new Set(['CLOSED', 'PUBLISHED']);\n\nexport interface ConsultationResultsPanelProps {\n consultation: GovConsultation;\n}\n\nexport const ConsultationResultsPanel: FC<ConsultationResultsPanelProps> = ({ consultation }) => {\n const { data, isLoading, isError, refetch } = useGovConsultationResults(consultation.id);\n\n if (isLoading) {\n return <LoadingView label=\"Loading results…\" className=\"min-h-[12rem]\" />;\n }\n\n if (isError) {\n return (\n <ErrorView\n className=\"min-h-[12rem]\"\n message=\"We couldn't load the results for this consultation.\"\n onRetry={() => {\n void refetch();\n }}\n />\n );\n }\n\n if (!data) {\n return (\n <EmptyState\n icon={<BarChart3 className=\"size-8\" aria-hidden=\"true\" />}\n title=\"No result set yet\"\n description=\"This consultation has no computed results.\"\n />\n );\n }\n\n if (data.isSuppressed) {\n const notClosedYet = !RESULT_READABLE_STATUSES.has(data.status);\n return (\n <div className=\"rounded-xl border border-border-seam bg-bg-sunken/40 p-5\">\n <p className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\">\n {notClosedYet ? (\n <Lock className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n ) : (\n <EyeOff className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n )}\n Results are withheld\n </p>\n <p className=\"mt-2 text-sm text-text-secondary\">\n {notClosedYet\n ? 'Aggregates are computed once the consultation closes, so nobody can watch the tally move while responses are still being collected.'\n : 'Too few responses have been received for the aggregate to be published: with a small number of respondents the totals themselves would identify who said what. Results are released once enough people have taken part.'}\n </p>\n <p className=\"mt-2 text-sm text-text-secondary tabular-nums\">\n {formatNumber(data.responseCount)} response\n {data.responseCount === 1 ? '' : 's'} received so far.\n </p>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col gap-5\">\n <div className=\"flex flex-wrap items-center gap-x-6 gap-y-1 text-sm text-text-secondary\">\n <span className=\"tabular-nums\">\n <span className=\"font-semibold text-text-primary\">{formatNumber(data.responseCount)}</span>{' '}\n response{data.responseCount === 1 ? '' : 's'}\n </span>\n {data.resultsPublishedAt && (\n <span>Published {formatDateTime(data.resultsPublishedAt)}</span>\n )}\n </div>\n\n {data.questions.length === 0 ? (\n <EmptyState\n icon={<BarChart3 className=\"size-8\" aria-hidden=\"true\" />}\n title=\"Nothing to aggregate\"\n description=\"The published result set carries no questions.\"\n />\n ) : (\n data.questions.map((question) => (\n <QuestionResult\n key={question.questionId}\n result={question}\n currency={consultation.currencyCode}\n />\n ))\n )}\n </div>\n );\n};\n\ninterface QuestionResultProps {\n result: GovConsultationQuestionResult;\n currency?: string | null;\n}\n\n/** One question's aggregate, rendered per its declared type. */\nfunction QuestionResult({ result, currency }: QuestionResultProps): ReactElement {\n const type = CONSULTATION_QUESTION_TYPES.find((candidate) => candidate === result.type);\n\n return (\n <section className=\"rounded-xl border border-border-seam bg-bg-surface p-4\">\n <header className=\"mb-3 flex flex-wrap items-baseline justify-between gap-2\">\n <h4 className=\"text-sm font-semibold text-text-primary\">{result.label}</h4>\n <span className=\"text-xs text-text-muted\">\n {type ? QUESTION_TYPE_LABELS[type] : result.type} ·{' '}\n <span className=\"tabular-nums\">{formatNumber(result.responseCount)}</span> answered\n </span>\n </header>\n\n {type === 'SINGLE_CHOICE' && <SingleChoiceResult result={result} />}\n {type === 'MULTI_CHOICE' && (\n <GovBarChart data={readCountMap(result.aggregate, 'counts')} height={220} />\n )}\n {type === 'RATING' && <RatingResult result={result} />}\n {type === 'TEXT' && <TextResult result={result} />}\n {type === 'BUDGET_ALLOCATION' && <BudgetResult result={result} currency={currency} />}\n {type === undefined && (\n <p className=\"text-sm text-text-muted\">\n This question uses a type this build does not know how to chart.\n </p>\n )}\n </section>\n );\n}\n\nfunction SingleChoiceResult({ result }: { result: GovConsultationQuestionResult }): ReactElement {\n const counts = readCountMap(result.aggregate, 'counts');\n const legend: ChartLegendItem[] = counts.map((entry, index) => ({\n label: entry.name,\n color: CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length],\n value: entry.value,\n }));\n\n return (\n <div className=\"grid gap-4 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] sm:items-center\">\n <GovDonutChart\n data={counts.map((entry) => ({ name: entry.name, value: entry.value }))}\n height={200}\n centerValue={formatNumber(result.responseCount)}\n centerLabel=\"answered\"\n />\n <ChartLegend items={legend} />\n </div>\n );\n}\n\nfunction RatingResult({ result }: { result: GovConsultationQuestionResult }): ReactElement {\n const distribution = readNumericBuckets(result.aggregate, 'distribution');\n const mean = readAggregateNumber(result.aggregate, 'mean');\n const min = readAggregateNumber(result.aggregate, 'min');\n const max = readAggregateNumber(result.aggregate, 'max');\n\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex flex-wrap items-baseline gap-x-6 gap-y-1 text-sm text-text-secondary\">\n <span>\n Mean{' '}\n <span className=\"font-semibold tabular-nums text-text-primary\">\n {mean === null ? 'not available' : formatNumber(mean)}\n </span>\n </span>\n {min !== null && max !== null && (\n <span className=\"tabular-nums\">\n Scale {formatNumber(min)}–{formatNumber(max)}\n </span>\n )}\n </div>\n <GovBarChart data={distribution} height={200} emptyLabel=\"No ratings recorded\" />\n </div>\n );\n}\n\nfunction TextResult({ result }: { result: GovConsultationQuestionResult }): ReactElement {\n const answered = readAggregateNumber(result.aggregate, 'answeredCount');\n\n return (\n <div className=\"rounded-lg border border-border-seam bg-bg-sunken/40 p-3\">\n <p className=\"text-sm text-text-secondary tabular-nums\">\n <span className=\"font-semibold text-text-primary\">\n {answered === null ? '—' : formatNumber(answered)}\n </span>{' '}\n free-text answer{answered === 1 ? '' : 's'} received.\n </p>\n <p className=\"mt-1 text-xs text-text-muted\">\n The text itself is never published — respondents wrote it for their government, not for the\n public record.\n </p>\n </div>\n );\n}\n\nfunction BudgetResult({\n result,\n currency,\n}: {\n result: GovConsultationQuestionResult;\n currency?: string | null;\n}): ReactElement {\n const meanAllocation = readCountMap(result.aggregate, 'meanAllocation');\n const totalPot = readAggregateNumber(result.aggregate, 'totalPot');\n const legend: ChartLegendItem[] = meanAllocation.map((entry, index) => ({\n label: entry.name,\n color: CHART_SERIES_COLORS[index % CHART_SERIES_COLORS.length],\n value: formatCurrency(entry.value, currency),\n }));\n\n return (\n <div className=\"flex flex-col gap-3\">\n {totalPot !== null && (\n <p className=\"text-sm text-text-secondary\">\n Average allocation per respondent of a{' '}\n <span className=\"font-semibold text-text-primary\">\n {formatCurrency(totalPot, currency)}\n </span>{' '}\n pot.\n </p>\n )}\n <GovBarChart data={meanAllocation} height={200} emptyLabel=\"No allocations recorded\" />\n <ChartLegend items={legend} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAwCA,IAAM,IAA2B,IAAI,IAAI,CAAC,UAAU,WAAW,CAAC,GAMnD,KAA+D,EAAE,sBAAmB;CAC/F,IAAM,EAAE,SAAM,cAAW,YAAS,eAAY,EAA0B,EAAa,EAAE;CAEvF,IAAI,GACF,OAAO,kBAAC,GAAD;EAAa,OAAM;EAAmB,WAAU;CAAiB,CAAA;CAG1E,IAAI,GACF,OACE,kBAAC,GAAD;EACE,WAAU;EACV,SAAQ;EACR,eAAe;GACb,EAAa;EACf;CACD,CAAA;CAIL,IAAI,CAAC,GACH,OACE,kBAAC,GAAD;EACE,MAAM,kBAAC,GAAD;GAAW,WAAU;GAAS,eAAY;EAAQ,CAAA;EACxD,OAAM;EACN,aAAY;CACb,CAAA;CAIL,IAAI,EAAK,cAAc;EACrB,IAAM,IAAe,CAAC,EAAyB,IAAI,EAAK,MAAM;EAC9D,OACE,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,KAAD;KAAG,WAAU;eAAb,CAEI,EADD,IACE,IAEA,GAFD;MAAM,WAAU;MAAkC,eAAY;KAAQ,CAEE,GACxE,sBAED;;IACH,kBAAC,K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U;cAAhB;KAA+B;KACtB,EAAa,CAAG;KAAE;KAAE,EAAa,CAAG;IACvC;KAEL;MACL,kBAAC,GAAD;GAAa,MAAM;GAAc,QAAQ;GAAK,YAAW;EAAuB,CAAA,CAC7E;;AAET;AAEA,SAAS,EAAW,EAAE,aAAmE;CACvF,IAAM,IAAW,EAAoB,EAAO,WAAW,eAAe;CAEtE,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,KAAD;GAAG,WAAU;aAAb;IACE,kBAAC,QAAD;KAAM,WAAU;eACb,MAAa,OAAO,MAAM,EAAa,CAAQ;IAC5C,CAAA;IAAE;IAAI;IACK,MAAa,IAAI,KAAK;IAAI;GAC1C;MACH,kBAAC,KAAD;GAAG,WAAU;aAA+B;EAGzC,CAAA,CACA;;AAET;AAEA,SAAS,EAAa,EACpB,WACA,eAIe;CACf,IAAM,IAAiB,EAAa,EAAO,WAAW,gBAAgB,GAChE,IAAW,EAAoB,EAAO,WAAW,UAAU,GAC3D,IAA4B,EAAe,KAAK,GAAO,OAAW;EACtE,OAAO,EAAM;EACb,OAAO,EAAoB,IAAQ,EAAoB;EACvD,OAAO,EAAe,EAAM,OAAO,CAAQ;CAC7C,EAAE;CAEF,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACG,MAAa,QACZ,kBAAC,KAAD;IAAG,WAAU;cAAb;KAA2C;KACF;KACvC,kBAAC,QAAD;MAAM,WAAU;gBACb,EAAe,GAAU,CAAQ;KAC9B,CAAA;KAAE;KAAI;IAEX;;GAEL,kBAAC,GAAD;IAAa,MAAM;IAAgB,QAAQ;IAAK,YAAW;GAA2B,CAAA;GACtF,kBAAC,GAAD,EAAa,OAAO,EAAS,CAAA;EAC1B;;AAET"}
@@ -0,0 +1,4 @@
1
+ import { ReactElement } from 'react';
2
+
3
+ export declare function ConsultationsPage(): ReactElement;
4
+ //# sourceMappingURL=ConsultationsPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsultationsPage.d.ts","sourceRoot":"","sources":["../../../../src/govcitizenhub/pages/intelligence/ConsultationsPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AA4G7D,wBAAgB,iBAAiB,IAAI,YAAY,CAoShD"}