@burdenoff/microfe-theglobalfuel 2026.705.3 → 2026.705.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.
Files changed (66) hide show
  1. package/dist/theglobalfuel/TheGlobalFuelRoot.js +54 -46
  2. package/dist/theglobalfuel/TheGlobalFuelRoot.js.map +1 -1
  3. package/dist/theglobalfuel/TheGlobalFuelRoutes.js +10 -6
  4. package/dist/theglobalfuel/TheGlobalFuelRoutes.js.map +1 -1
  5. package/dist/theglobalfuel/components/DataTable.js +126 -58
  6. package/dist/theglobalfuel/components/DataTable.js.map +1 -1
  7. package/dist/theglobalfuel/components/EmptyState.js +4 -4
  8. package/dist/theglobalfuel/components/EmptyState.js.map +1 -1
  9. package/dist/theglobalfuel/components/MetricsCard.js +2 -2
  10. package/dist/theglobalfuel/components/MetricsCard.js.map +1 -1
  11. package/dist/theglobalfuel/components/WorldMap.js +115 -0
  12. package/dist/theglobalfuel/components/WorldMap.js.map +1 -0
  13. package/dist/theglobalfuel/components/index.js +9 -0
  14. package/dist/theglobalfuel/components/viz/AllocationBar.js +68 -0
  15. package/dist/theglobalfuel/components/viz/AllocationBar.js.map +1 -0
  16. package/dist/theglobalfuel/components/viz/AreaChart.js +102 -0
  17. package/dist/theglobalfuel/components/viz/AreaChart.js.map +1 -0
  18. package/dist/theglobalfuel/components/viz/AvatarStack.js +2 -0
  19. package/dist/theglobalfuel/components/viz/BarChart.js +4 -0
  20. package/dist/theglobalfuel/components/viz/CertificateCard.js +4 -0
  21. package/dist/theglobalfuel/components/viz/DonutChart.js +109 -0
  22. package/dist/theglobalfuel/components/viz/DonutChart.js.map +1 -0
  23. package/dist/theglobalfuel/components/viz/HBarFunnel.js +3 -0
  24. package/dist/theglobalfuel/components/viz/Heatmap.js +3 -0
  25. package/dist/theglobalfuel/components/viz/KanbanBoard.js +2 -0
  26. package/dist/theglobalfuel/components/viz/LineChart.js +4 -0
  27. package/dist/theglobalfuel/components/viz/OrgTree.js +2 -0
  28. package/dist/theglobalfuel/components/viz/PathSteps.js +68 -0
  29. package/dist/theglobalfuel/components/viz/PathSteps.js.map +1 -0
  30. package/dist/theglobalfuel/components/viz/ProgressRing.js +6 -0
  31. package/dist/theglobalfuel/components/viz/ProgressRing.js.map +1 -0
  32. package/dist/theglobalfuel/components/viz/RatingStars.js +3 -0
  33. package/dist/theglobalfuel/components/viz/SegmentedTabs.js +3 -0
  34. package/dist/theglobalfuel/components/viz/SkillBar.js +3 -0
  35. package/dist/theglobalfuel/components/viz/Sparkline.js +74 -0
  36. package/dist/theglobalfuel/components/viz/Sparkline.js.map +1 -0
  37. package/dist/theglobalfuel/components/viz/StatCard.js +3 -0
  38. package/dist/theglobalfuel/components/viz/StepProgress.js +64 -0
  39. package/dist/theglobalfuel/components/viz/StepProgress.js.map +1 -0
  40. package/dist/theglobalfuel/components/viz/Timeline.js +66 -0
  41. package/dist/theglobalfuel/components/viz/Timeline.js.map +1 -0
  42. package/dist/theglobalfuel/components/viz/index.js +23 -0
  43. package/dist/theglobalfuel/components/viz/lib/Avatar.js +1 -0
  44. package/dist/theglobalfuel/components/viz/lib/CartesianFrame.js +119 -0
  45. package/dist/theglobalfuel/components/viz/lib/CartesianFrame.js.map +1 -0
  46. package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.js +35 -0
  47. package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.js.map +1 -0
  48. package/dist/theglobalfuel/components/viz/lib/format.js +17 -0
  49. package/dist/theglobalfuel/components/viz/lib/format.js.map +1 -0
  50. package/dist/theglobalfuel/components/viz/lib/geometry.js +61 -0
  51. package/dist/theglobalfuel/components/viz/lib/geometry.js.map +1 -0
  52. package/dist/theglobalfuel/components/viz/lib/hooks.js +39 -0
  53. package/dist/theglobalfuel/components/viz/lib/hooks.js.map +1 -0
  54. package/dist/theglobalfuel/components/viz/lib/palette.js +27 -0
  55. package/dist/theglobalfuel/components/viz/lib/palette.js.map +1 -0
  56. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +431 -316
  57. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
  58. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +525 -227
  59. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
  60. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +255 -206
  61. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
  62. package/dist/theglobalfuel/pages/provenance/ProvenancePage.js +465 -0
  63. package/dist/theglobalfuel/pages/provenance/ProvenancePage.js.map +1 -0
  64. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +356 -227
  65. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
  66. package/package.json +1 -1
@@ -3,25 +3,27 @@ import { MetricsCard as t } from "../../components/MetricsCard.js";
3
3
  import { formatDate as n, formatEnumLabel as r, formatPercent as i, formatRelativeTime as ee, formatTonnesCo2e as a, toBackendDate as o } from "../../utils/formatters.js";
4
4
  import { StatusBadge as te } from "../../components/StatusBadge.js";
5
5
  import { MiniBar as s } from "../../components/MiniBar.js";
6
- import { DataTable as ne } from "../../components/DataTable.js";
7
- import { ErrorView as re, LoadingView as c } from "../../components/StateViews.js";
8
- import { EmptyState as l } from "../../components/EmptyState.js";
9
- import { useTheAssets as ie, useTheEmissionRecords as ae, useTheRecordEmission as oe, useTheVerifyEmission as se } from "../../hooks/useTheGlobalFuelApi.js";
10
- import { useCursorPager as ce } from "../../hooks/useCursorPager.js";
11
- import { useNotify as le } from "../../hooks/useNotify.js";
6
+ import { DataTable as c } from "../../components/DataTable.js";
7
+ import { ErrorView as ne, LoadingView as re } from "../../components/StateViews.js";
8
+ import { EmptyState as ie } from "../../components/EmptyState.js";
9
+ import { DonutChart as ae } from "../../components/viz/DonutChart.js";
10
+ import { useTheAssets as oe, useTheEmissionRecords as l, useTheRecordEmission as se, useTheVerifyEmission as ce } from "../../hooks/useTheGlobalFuelApi.js";
11
+ import { useCursorPager as le } from "../../hooks/useCursorPager.js";
12
+ import { useNotify as ue } from "../../hooks/useNotify.js";
12
13
  import "../../hooks/index.js";
13
- import { FilterTabs as ue } from "../../components/FilterTabs.js";
14
- import { Pagination as de } from "../../components/Pagination.js";
14
+ import { FilterTabs as de } from "../../components/FilterTabs.js";
15
+ import { Pagination as fe } from "../../components/Pagination.js";
16
+ import "../../components/index.js";
15
17
  import { useMemo as u, useState as d } from "react";
16
- import { CheckCircle2 as fe, Circle as pe, Cloud as f, Factory as p, Flame as me, Plus as m, Truck as h, Zap as g } from "lucide-react";
17
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
18
- import { Button as b, Input as x, Label as S, ResponsiveDialog as he, ResponsiveDialogContent as ge, ResponsiveDialogDescription as _e, ResponsiveDialogFooter as ve, ResponsiveDialogHeader as ye, ResponsiveDialogTitle as be, Select as C, SelectContent as w, SelectItem as T, SelectTrigger as E, SelectValue as D, Textarea as O } from "@burdenoff/fe-libs/ui";
18
+ import { CheckCircle2 as pe, Circle as me, Cloud as f, Factory as he, Flame as ge, Plus as p, Truck as _e, Zap as ve } from "lucide-react";
19
+ import { Fragment as ye, jsx as m, jsxs as h } from "react/jsx-runtime";
20
+ import { Button as g, Input as _, Label as v, ResponsiveDialog as be, ResponsiveDialogContent as xe, ResponsiveDialogDescription as Se, ResponsiveDialogFooter as Ce, ResponsiveDialogHeader as y, ResponsiveDialogTitle as we, Select as b, SelectContent as x, SelectItem as S, SelectTrigger as C, SelectValue as w, Textarea as Te } from "@burdenoff/fe-libs/ui";
19
21
  //#region src/theglobalfuel/pages/emissions/EmissionsPage.tsx
20
- var k = [
22
+ var T = [
21
23
  "SCOPE_1",
22
24
  "SCOPE_2",
23
25
  "SCOPE_3"
24
- ], A = [
26
+ ], E = [
25
27
  {
26
28
  value: "ALL",
27
29
  label: "All scopes"
@@ -38,69 +40,87 @@ var k = [
38
40
  value: "SCOPE_3",
39
41
  label: "Scope 3"
40
42
  }
41
- ], j = {
43
+ ], D = {
42
44
  SCOPE_1: "bg-status-error-text",
43
45
  SCOPE_2: "bg-status-warning-text",
44
46
  SCOPE_3: "bg-accent"
45
- }, M = 25, N = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), P = () => ({
47
+ }, O = {
48
+ SCOPE_1: "Scope 1",
49
+ SCOPE_2: "Scope 2",
50
+ SCOPE_3: "Scope 3"
51
+ }, Ee = {
52
+ SCOPE_1: "var(--color-status-error-text)",
53
+ SCOPE_2: "var(--color-status-warning-text)",
54
+ SCOPE_3: "var(--color-accent-blue)"
55
+ }, De = (e) => new Intl.NumberFormat("en", {
56
+ notation: "compact",
57
+ maximumFractionDigits: 1
58
+ }).format(e), k = 25, A = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), j = () => ({
46
59
  assetId: "",
47
60
  scope: "SCOPE_1",
48
61
  co2eTonnes: "",
49
- periodStart: N(),
50
- periodEnd: N(),
62
+ periodStart: A(),
63
+ periodEnd: A(),
51
64
  source: "",
52
65
  methodology: "",
53
66
  notes: ""
54
- }), F = (e, t, n) => {
67
+ }), M = (e, t, n) => {
55
68
  if (t <= 0) return;
56
69
  let r = e / t * 100;
57
- return /* @__PURE__ */ y("div", {
70
+ return /* @__PURE__ */ h("div", {
58
71
  className: "space-y-2",
59
- children: [/* @__PURE__ */ v(s, {
72
+ children: [/* @__PURE__ */ m(s, {
60
73
  value: r,
61
- barClassName: j[n],
74
+ barClassName: D[n],
62
75
  height: 4
63
- }), /* @__PURE__ */ y("p", {
76
+ }), /* @__PURE__ */ h("p", {
64
77
  className: "text-xs tabular-nums text-text-tertiary",
65
78
  children: [i(r), " of total"]
66
79
  })]
67
80
  });
68
81
  };
69
- function I() {
70
- let i = le(), [s, j] = d("ALL"), [N, I] = d("ALL"), L = ce(), [xe, R] = d(!1), [z, B] = d(P), [V, H] = d(null), [U, W] = d(null), G = ie({ pagination: { limit: 100 } }), Se = u(() => {
82
+ function N() {
83
+ let i = ue(), [s, D] = d("ALL"), [A, N] = d("ALL"), P = le(), [Oe, F] = d(!1), [I, L] = d(j), [R, z] = d(null), [B, V] = d(null), H = oe({ pagination: { limit: 100 } }), ke = u(() => {
71
84
  let e = {};
72
- for (let t of G.data?.items ?? []) e[t.id] = t.name;
85
+ for (let t of H.data?.items ?? []) e[t.id] = t.name;
73
86
  return e;
74
- }, [G.data]), K = G.data?.items ?? [], { data: q, isLoading: Ce, isError: we, refetch: J } = ae({
87
+ }, [H.data]), U = H.data?.items ?? [], { data: W, isLoading: Ae, isError: je, refetch: Me } = l({
75
88
  scope: s === "ALL" ? void 0 : s,
76
- assetId: N === "ALL" ? void 0 : N,
89
+ assetId: A === "ALL" ? void 0 : A,
77
90
  pagination: {
78
- limit: M,
79
- offset: L.page * M
91
+ limit: k,
92
+ offset: P.page * k
80
93
  }
81
- }), Y = oe(), Te = se(), X = u(() => q?.items ?? [], [q]), { total: Z, byScope: Q } = u(() => {
94
+ }), G = se(), Ne = ce(), K = u(() => W?.items ?? [], [W]), q = l({
95
+ assetId: A === "ALL" ? void 0 : A,
96
+ pagination: { limit: 200 }
97
+ }), J = u(() => q.data?.items ?? [], [q.data]), Y = J.length, { total: X, byScope: Z } = u(() => {
82
98
  let e = {
83
99
  SCOPE_1: 0,
84
100
  SCOPE_2: 0,
85
101
  SCOPE_3: 0
86
102
  }, t = 0;
87
- for (let n of X) t += n.co2eTonnes, e[n.scope] += n.co2eTonnes;
103
+ for (let n of J) t += n.co2eTonnes, e[n.scope] += n.co2eTonnes;
88
104
  return {
89
105
  total: t,
90
106
  byScope: e
91
107
  };
92
- }, [X]), Ee = [
108
+ }, [J]), Q = u(() => T.filter((e) => Z[e] > 0).map((e) => ({
109
+ label: O[e],
110
+ value: Z[e],
111
+ color: Ee[e]
112
+ })), [Z]), Pe = [
93
113
  {
94
114
  key: "scope",
95
115
  header: "Scope",
96
- render: (e) => /* @__PURE__ */ v(te, { status: e.scope })
116
+ render: (e) => /* @__PURE__ */ m(te, { status: e.scope })
97
117
  },
98
118
  {
99
119
  key: "asset",
100
120
  header: "Asset",
101
- render: (e) => /* @__PURE__ */ v("span", {
121
+ render: (e) => /* @__PURE__ */ m("span", {
102
122
  className: "text-text-secondary",
103
- children: e.assetId ? Se[e.assetId] ?? `${e.assetId.slice(0, 8)}…` : "—"
123
+ children: e.assetId ? ke[e.assetId] ?? `${e.assetId.slice(0, 8)}…` : "—"
104
124
  })
105
125
  },
106
126
  {
@@ -108,7 +128,7 @@ function I() {
108
128
  header: "CO₂e",
109
129
  align: "right",
110
130
  sortValue: (e) => e.co2eTonnes,
111
- render: (e) => /* @__PURE__ */ v("span", {
131
+ render: (e) => /* @__PURE__ */ m("span", {
112
132
  className: "tabular-nums font-medium text-text-primary",
113
133
  children: a(e.co2eTonnes)
114
134
  })
@@ -118,7 +138,7 @@ function I() {
118
138
  header: "Period",
119
139
  hideOnMobile: !0,
120
140
  sortValue: (e) => new Date(e.periodStart).getTime(),
121
- render: (e) => /* @__PURE__ */ y("span", {
141
+ render: (e) => /* @__PURE__ */ h("span", {
122
142
  className: "text-text-secondary",
123
143
  children: [
124
144
  n(e.periodStart),
@@ -131,7 +151,7 @@ function I() {
131
151
  key: "source",
132
152
  header: "Source",
133
153
  hideOnMobile: !0,
134
- render: (e) => /* @__PURE__ */ v("span", {
154
+ render: (e) => /* @__PURE__ */ m("span", {
135
155
  className: "text-text-secondary",
136
156
  children: e.source ?? "—"
137
157
  })
@@ -139,22 +159,22 @@ function I() {
139
159
  {
140
160
  key: "verified",
141
161
  header: "Verified",
142
- render: (e) => e.verified ? /* @__PURE__ */ y("span", {
162
+ render: (e) => e.verified ? /* @__PURE__ */ h("span", {
143
163
  className: "inline-flex items-center gap-1.5 text-status-success-text",
144
164
  children: [
145
- /* @__PURE__ */ v(fe, { className: "h-4 w-4" }),
146
- /* @__PURE__ */ v("span", {
165
+ /* @__PURE__ */ m(pe, { className: "h-4 w-4" }),
166
+ /* @__PURE__ */ m("span", {
147
167
  className: "text-xs font-medium",
148
168
  children: "Verified"
149
169
  }),
150
- e.verifiedAt && /* @__PURE__ */ v("span", {
170
+ e.verifiedAt && /* @__PURE__ */ m("span", {
151
171
  className: "text-xs font-normal tabular-nums text-text-tertiary",
152
172
  children: n(e.verifiedAt)
153
173
  })
154
174
  ]
155
- }) : /* @__PURE__ */ y("span", {
175
+ }) : /* @__PURE__ */ h("span", {
156
176
  className: "inline-flex items-center gap-1.5 text-text-tertiary",
157
- children: [/* @__PURE__ */ v(pe, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ v("span", {
177
+ children: [/* @__PURE__ */ m(me, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ m("span", {
158
178
  className: "text-xs",
159
179
  children: "Unverified"
160
180
  })]
@@ -165,7 +185,7 @@ function I() {
165
185
  header: "Logged",
166
186
  align: "right",
167
187
  hideOnMobile: !0,
168
- render: (e) => /* @__PURE__ */ v("span", {
188
+ render: (e) => /* @__PURE__ */ m("span", {
169
189
  className: "text-text-tertiary",
170
190
  children: ee(e.createdAt)
171
191
  })
@@ -174,323 +194,352 @@ function I() {
174
194
  key: "verify",
175
195
  header: "",
176
196
  align: "right",
177
- render: (e) => e.verified ? null : /* @__PURE__ */ v(b, {
197
+ render: (e) => e.verified ? null : /* @__PURE__ */ m(g, {
178
198
  size: "sm",
179
199
  variant: "outline",
180
200
  onClick: () => {
181
- W(e.id), Te.mutate(e.id, {
201
+ V(e.id), Ne.mutate(e.id, {
182
202
  onSuccess: () => i.success("Emission verified"),
183
203
  onError: (e) => i.fromError(e),
184
- onSettled: () => W(null)
204
+ onSettled: () => V(null)
185
205
  });
186
206
  },
187
- disabled: U === e.id,
188
- children: U === e.id ? "Verifying…" : "Verify"
207
+ disabled: B === e.id,
208
+ children: B === e.id ? "Verifying…" : "Verify"
189
209
  })
190
210
  }
191
211
  ], $ = () => {
192
- B(P()), H(null), R(!0);
193
- }, De = async () => {
194
- let e = Number(z.co2eTonnes);
195
- if (!z.co2eTonnes || Number.isNaN(e) || e <= 0) {
212
+ L(j()), z(null), F(!0);
213
+ }, Fe = async () => {
214
+ let e = Number(I.co2eTonnes);
215
+ if (!I.co2eTonnes || Number.isNaN(e) || e <= 0) {
196
216
  let e = "CO₂e (tonnes) must be greater than zero.";
197
- H(e), i.error(e);
217
+ z(e), i.error(e);
198
218
  return;
199
219
  }
200
- if (!z.periodStart || !z.periodEnd) {
201
- H("Period start and end are required.");
220
+ if (!I.periodStart || !I.periodEnd) {
221
+ z("Period start and end are required.");
202
222
  return;
203
223
  }
204
- let t = o(z.periodStart), n = o(z.periodEnd);
224
+ let t = o(I.periodStart), n = o(I.periodEnd);
205
225
  if (!t || !n) {
206
- H("Period start and end are required.");
226
+ z("Period start and end are required.");
207
227
  return;
208
228
  }
209
229
  if (new Date(n).getTime() < new Date(t).getTime()) {
210
- H("Period end must be on or after the period start.");
230
+ z("Period end must be on or after the period start.");
211
231
  return;
212
232
  }
213
- H(null);
233
+ z(null);
214
234
  try {
215
- await Y.mutateAsync({
216
- assetId: z.assetId || null,
217
- scope: z.scope,
235
+ await G.mutateAsync({
236
+ assetId: I.assetId || null,
237
+ scope: I.scope,
218
238
  co2eTonnes: e,
219
239
  periodStart: t,
220
240
  periodEnd: n,
221
- source: z.source.trim() || null,
222
- methodology: z.methodology.trim() || null,
223
- notes: z.notes.trim() || null
224
- }), i.success("Emission recorded"), R(!1), B(P());
241
+ source: I.source.trim() || null,
242
+ methodology: I.methodology.trim() || null,
243
+ notes: I.notes.trim() || null
244
+ }), i.success("Emission recorded"), F(!1), L(j());
225
245
  } catch (e) {
226
- i.fromError(e), H(e instanceof Error ? e.message : "Failed to record emission.");
246
+ i.fromError(e), z(e instanceof Error ? e.message : "Failed to record emission.");
227
247
  }
228
248
  };
229
- return /* @__PURE__ */ y(e, {
249
+ return /* @__PURE__ */ h(e, {
230
250
  title: "Emissions",
231
251
  description: "ESG greenhouse-gas ledger across every asset — GHG Protocol Scope 1 / 2 / 3, with third-party verification.",
232
- actions: /* @__PURE__ */ y(b, {
252
+ actions: /* @__PURE__ */ h(g, {
233
253
  onClick: $,
234
- children: [/* @__PURE__ */ v(m, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
254
+ children: [/* @__PURE__ */ m(p, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
235
255
  }),
236
256
  children: [
237
- /* @__PURE__ */ y("div", {
238
- className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
239
- children: [
240
- /* @__PURE__ */ v(t, {
241
- icon: /* @__PURE__ */ v(p, { className: "h-5 w-5" }),
242
- value: X.length > 0 ? a(Z) : "—",
243
- label: "CO₂e on this page",
244
- featured: !0,
245
- footer: /* @__PURE__ */ y("p", {
246
- className: "text-xs tabular-nums text-text-tertiary",
247
- children: [
248
- X.length,
249
- " record",
250
- X.length === 1 ? "" : "s",
251
- " · Scope 1 · 2 · 3"
252
- ]
257
+ /* @__PURE__ */ h("div", {
258
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
259
+ children: [/* @__PURE__ */ h("div", {
260
+ className: "flex flex-col rounded-[var(--radius-card)] border border-border-subtle bg-bg-surface p-5 shadow-elevation-1",
261
+ children: [/* @__PURE__ */ h("div", {
262
+ className: "mb-1 flex items-center justify-between gap-2",
263
+ children: [/* @__PURE__ */ m("h3", {
264
+ className: "text-sm font-semibold text-text-secondary",
265
+ children: "Emissions by scope"
266
+ }), /* @__PURE__ */ m(f, {
267
+ className: "h-4 w-4 shrink-0 text-text-muted",
268
+ "aria-hidden": "true"
269
+ })]
270
+ }), q.isLoading ? /* @__PURE__ */ m("p", {
271
+ className: "flex flex-1 items-center py-8 text-sm text-text-tertiary",
272
+ children: "Loading breakdown…"
273
+ }) : Q.length > 0 ? /* @__PURE__ */ m(ae, {
274
+ className: "mt-3",
275
+ segments: Q,
276
+ size: 148,
277
+ thickness: .32,
278
+ centerLabel: De(X),
279
+ centerCaption: "t CO₂e",
280
+ valueFormatter: a
281
+ }) : /* @__PURE__ */ m("p", {
282
+ className: "flex flex-1 items-center py-8 text-sm text-text-tertiary",
283
+ children: "No emissions recorded yet."
284
+ })]
285
+ }), /* @__PURE__ */ h("div", {
286
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:col-span-2",
287
+ children: [
288
+ /* @__PURE__ */ m(t, {
289
+ icon: /* @__PURE__ */ m(he, { className: "h-5 w-5" }),
290
+ value: Y > 0 ? a(X) : "—",
291
+ label: "Total CO₂e",
292
+ featured: !0,
293
+ footer: /* @__PURE__ */ h("p", {
294
+ className: "text-xs tabular-nums text-text-tertiary",
295
+ children: [
296
+ Y,
297
+ " record",
298
+ Y === 1 ? "" : "s",
299
+ " · Scope 1 · 2 · 3"
300
+ ]
301
+ })
302
+ }),
303
+ /* @__PURE__ */ m(t, {
304
+ icon: /* @__PURE__ */ m(ge, { className: "h-5 w-5" }),
305
+ value: Y > 0 ? a(Z.SCOPE_1) : "—",
306
+ label: "Scope 1 · Direct",
307
+ footer: M(Z.SCOPE_1, X, "SCOPE_1")
308
+ }),
309
+ /* @__PURE__ */ m(t, {
310
+ icon: /* @__PURE__ */ m(ve, { className: "h-5 w-5" }),
311
+ value: Y > 0 ? a(Z.SCOPE_2) : "—",
312
+ label: "Scope 2 · Purchased energy",
313
+ footer: M(Z.SCOPE_2, X, "SCOPE_2")
314
+ }),
315
+ /* @__PURE__ */ m(t, {
316
+ icon: /* @__PURE__ */ m(_e, { className: "h-5 w-5" }),
317
+ value: Y > 0 ? a(Z.SCOPE_3) : "—",
318
+ label: "Scope 3 · Value chain",
319
+ footer: M(Z.SCOPE_3, X, "SCOPE_3")
253
320
  })
254
- }),
255
- /* @__PURE__ */ v(t, {
256
- icon: /* @__PURE__ */ v(me, { className: "h-5 w-5" }),
257
- value: X.length > 0 ? a(Q.SCOPE_1) : "—",
258
- label: "Scope 1 · Direct",
259
- footer: F(Q.SCOPE_1, Z, "SCOPE_1")
260
- }),
261
- /* @__PURE__ */ v(t, {
262
- icon: /* @__PURE__ */ v(g, { className: "h-5 w-5" }),
263
- value: X.length > 0 ? a(Q.SCOPE_2) : "—",
264
- label: "Scope 2 · Purchased energy",
265
- footer: F(Q.SCOPE_2, Z, "SCOPE_2")
266
- }),
267
- /* @__PURE__ */ v(t, {
268
- icon: /* @__PURE__ */ v(h, { className: "h-5 w-5" }),
269
- value: X.length > 0 ? a(Q.SCOPE_3) : "—",
270
- label: "Scope 3 · Value chain",
271
- footer: F(Q.SCOPE_3, Z, "SCOPE_3")
272
- })
273
- ]
321
+ ]
322
+ })]
274
323
  }),
275
- /* @__PURE__ */ y("div", {
324
+ /* @__PURE__ */ h("div", {
276
325
  className: "mt-6 mb-5 flex flex-wrap items-center gap-3",
277
- children: [/* @__PURE__ */ v(ue, {
278
- options: A,
326
+ children: [/* @__PURE__ */ m(de, {
327
+ options: E,
279
328
  value: s,
280
329
  onChange: (e) => {
281
- j(e), L.reset();
330
+ D(e), P.reset();
282
331
  }
283
- }), /* @__PURE__ */ y(C, {
284
- value: N,
332
+ }), /* @__PURE__ */ h(b, {
333
+ value: A,
285
334
  onValueChange: (e) => {
286
- I(e), L.reset();
335
+ N(e), P.reset();
287
336
  },
288
- children: [/* @__PURE__ */ v(E, {
337
+ children: [/* @__PURE__ */ m(C, {
289
338
  className: "w-56",
290
339
  "aria-label": "Filter by asset",
291
- children: /* @__PURE__ */ v(D, { placeholder: "All assets" })
292
- }), /* @__PURE__ */ y(w, { children: [/* @__PURE__ */ v(T, {
340
+ children: /* @__PURE__ */ m(w, { placeholder: "All assets" })
341
+ }), /* @__PURE__ */ h(x, { children: [/* @__PURE__ */ m(S, {
293
342
  value: "ALL",
294
343
  children: "All assets"
295
- }), K.map((e) => /* @__PURE__ */ v(T, {
344
+ }), U.map((e) => /* @__PURE__ */ m(S, {
296
345
  value: e.id,
297
346
  children: e.name
298
347
  }, e.id))] })]
299
348
  })]
300
349
  }),
301
- Ce ? /* @__PURE__ */ v(c, { label: "Loading emission records…" }) : we ? /* @__PURE__ */ v(re, {
350
+ Ae ? /* @__PURE__ */ m(re, { label: "Loading emission records…" }) : je ? /* @__PURE__ */ m(ne, {
302
351
  message: "Couldn't load emission records.",
303
- onRetry: () => J()
304
- }) : X.length === 0 ? /* @__PURE__ */ v(l, {
352
+ onRetry: () => Me()
353
+ }) : K.length === 0 ? /* @__PURE__ */ m(ie, {
305
354
  illustration: "empty-data",
306
- icon: /* @__PURE__ */ v(f, { className: "h-10 w-10" }),
355
+ icon: /* @__PURE__ */ m(f, { className: "h-10 w-10" }),
307
356
  title: "No emissions recorded",
308
- description: s === "ALL" && N === "ALL" ? "Record a CO₂e figure to start building your Scope 1–3 emissions ledger." : "No emission records match these filters.",
309
- action: /* @__PURE__ */ y(b, {
357
+ description: s === "ALL" && A === "ALL" ? "Record a CO₂e figure to start building your Scope 1–3 emissions ledger." : "No emission records match these filters.",
358
+ action: /* @__PURE__ */ h(g, {
310
359
  onClick: $,
311
- children: [/* @__PURE__ */ v(m, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
360
+ children: [/* @__PURE__ */ m(p, { className: "mr-1.5 h-4 w-4" }), " Record emission"]
312
361
  })
313
- }) : /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(ne, {
314
- columns: Ee,
315
- rows: X,
362
+ }) : /* @__PURE__ */ h(ye, { children: [/* @__PURE__ */ m(c, {
363
+ columns: Pe,
364
+ rows: K,
316
365
  rowKey: (e) => e.id,
317
366
  defaultSort: {
318
367
  key: "period",
319
368
  dir: "desc"
320
369
  }
321
- }), /* @__PURE__ */ v(de, {
322
- page: L.page,
323
- pageSize: M,
324
- itemCount: X.length,
325
- hasMore: q?.pageInfo?.hasMore ?? !1,
326
- onPageChange: L.onPageChange
370
+ }), /* @__PURE__ */ m(fe, {
371
+ page: P.page,
372
+ pageSize: k,
373
+ itemCount: K.length,
374
+ hasMore: W?.pageInfo?.hasMore ?? !1,
375
+ onPageChange: P.onPageChange
327
376
  })] }),
328
- /* @__PURE__ */ v(he, {
329
- open: xe,
377
+ /* @__PURE__ */ m(be, {
378
+ open: Oe,
330
379
  onOpenChange: (e) => {
331
- R(e), e || (B(P()), H(null));
380
+ F(e), e || (L(j()), z(null));
332
381
  },
333
- children: /* @__PURE__ */ y(ge, { children: [/* @__PURE__ */ y(ye, { children: [/* @__PURE__ */ v(be, { children: "Record emission" }), /* @__PURE__ */ v(_e, { children: "Log a CO₂e figure for a reporting period — optionally attributed to an asset." })] }), /* @__PURE__ */ y("form", {
382
+ children: /* @__PURE__ */ h(xe, { children: [/* @__PURE__ */ h(y, { children: [/* @__PURE__ */ m(we, { children: "Record emission" }), /* @__PURE__ */ m(Se, { children: "Log a CO₂e figure for a reporting period — optionally attributed to an asset." })] }), /* @__PURE__ */ h("form", {
334
383
  onSubmit: (e) => {
335
- e.preventDefault(), De();
384
+ e.preventDefault(), Fe();
336
385
  },
337
- children: [/* @__PURE__ */ y("div", {
386
+ children: [/* @__PURE__ */ h("div", {
338
387
  className: "grid gap-4 py-2",
339
388
  children: [
340
- /* @__PURE__ */ y("div", {
389
+ /* @__PURE__ */ h("div", {
341
390
  className: "grid gap-2 sm:grid-cols-2",
342
- children: [/* @__PURE__ */ y("div", {
391
+ children: [/* @__PURE__ */ h("div", {
343
392
  className: "grid gap-1.5",
344
- children: [/* @__PURE__ */ v(S, {
393
+ children: [/* @__PURE__ */ m(v, {
345
394
  htmlFor: "emScope",
346
395
  children: "Scope"
347
- }), /* @__PURE__ */ y(C, {
348
- value: z.scope,
349
- onValueChange: (e) => B({
350
- ...z,
396
+ }), /* @__PURE__ */ h(b, {
397
+ value: I.scope,
398
+ onValueChange: (e) => L({
399
+ ...I,
351
400
  scope: e
352
401
  }),
353
- children: [/* @__PURE__ */ v(E, {
402
+ children: [/* @__PURE__ */ m(C, {
354
403
  id: "emScope",
355
- children: /* @__PURE__ */ v(D, {})
356
- }), /* @__PURE__ */ v(w, { children: k.map((e) => /* @__PURE__ */ v(T, {
404
+ children: /* @__PURE__ */ m(w, {})
405
+ }), /* @__PURE__ */ m(x, { children: T.map((e) => /* @__PURE__ */ m(S, {
357
406
  value: e,
358
407
  children: r(e)
359
408
  }, e)) })]
360
409
  })]
361
- }), /* @__PURE__ */ y("div", {
410
+ }), /* @__PURE__ */ h("div", {
362
411
  className: "grid gap-1.5",
363
- children: [/* @__PURE__ */ v(S, {
412
+ children: [/* @__PURE__ */ m(v, {
364
413
  htmlFor: "emCo2e",
365
414
  children: "CO₂e (tonnes) *"
366
- }), /* @__PURE__ */ v(x, {
415
+ }), /* @__PURE__ */ m(_, {
367
416
  id: "emCo2e",
368
417
  type: "number",
369
418
  min: "0",
370
419
  step: "any",
371
- value: z.co2eTonnes,
372
- onChange: (e) => B({
373
- ...z,
420
+ value: I.co2eTonnes,
421
+ onChange: (e) => L({
422
+ ...I,
374
423
  co2eTonnes: e.target.value
375
424
  }),
376
425
  placeholder: "1250"
377
426
  })]
378
427
  })]
379
428
  }),
380
- /* @__PURE__ */ y("div", {
429
+ /* @__PURE__ */ h("div", {
381
430
  className: "grid gap-1.5",
382
- children: [/* @__PURE__ */ v(S, {
431
+ children: [/* @__PURE__ */ m(v, {
383
432
  htmlFor: "emAsset",
384
433
  children: "Asset"
385
- }), /* @__PURE__ */ y(C, {
386
- value: z.assetId,
387
- onValueChange: (e) => B({
388
- ...z,
434
+ }), /* @__PURE__ */ h(b, {
435
+ value: I.assetId,
436
+ onValueChange: (e) => L({
437
+ ...I,
389
438
  assetId: e
390
439
  }),
391
- children: [/* @__PURE__ */ v(E, {
440
+ children: [/* @__PURE__ */ m(C, {
392
441
  id: "emAsset",
393
- children: /* @__PURE__ */ v(D, { placeholder: "Optional — org-wide if unset" })
394
- }), /* @__PURE__ */ v(w, { children: K.map((e) => /* @__PURE__ */ v(T, {
442
+ children: /* @__PURE__ */ m(w, { placeholder: "Optional — org-wide if unset" })
443
+ }), /* @__PURE__ */ m(x, { children: U.map((e) => /* @__PURE__ */ m(S, {
395
444
  value: e.id,
396
445
  children: e.name
397
446
  }, e.id)) })]
398
447
  })]
399
448
  }),
400
- /* @__PURE__ */ y("div", {
449
+ /* @__PURE__ */ h("div", {
401
450
  className: "grid gap-2 sm:grid-cols-2",
402
- children: [/* @__PURE__ */ y("div", {
451
+ children: [/* @__PURE__ */ h("div", {
403
452
  className: "grid gap-1.5",
404
- children: [/* @__PURE__ */ v(S, {
453
+ children: [/* @__PURE__ */ m(v, {
405
454
  htmlFor: "emStart",
406
455
  children: "Period start *"
407
- }), /* @__PURE__ */ v(x, {
456
+ }), /* @__PURE__ */ m(_, {
408
457
  id: "emStart",
409
458
  type: "date",
410
- value: z.periodStart,
411
- onChange: (e) => B({
412
- ...z,
459
+ value: I.periodStart,
460
+ onChange: (e) => L({
461
+ ...I,
413
462
  periodStart: e.target.value
414
463
  })
415
464
  })]
416
- }), /* @__PURE__ */ y("div", {
465
+ }), /* @__PURE__ */ h("div", {
417
466
  className: "grid gap-1.5",
418
- children: [/* @__PURE__ */ v(S, {
467
+ children: [/* @__PURE__ */ m(v, {
419
468
  htmlFor: "emEnd",
420
469
  children: "Period end *"
421
- }), /* @__PURE__ */ v(x, {
470
+ }), /* @__PURE__ */ m(_, {
422
471
  id: "emEnd",
423
472
  type: "date",
424
- value: z.periodEnd,
425
- onChange: (e) => B({
426
- ...z,
473
+ value: I.periodEnd,
474
+ onChange: (e) => L({
475
+ ...I,
427
476
  periodEnd: e.target.value
428
477
  })
429
478
  })]
430
479
  })]
431
480
  }),
432
- /* @__PURE__ */ y("div", {
481
+ /* @__PURE__ */ h("div", {
433
482
  className: "grid gap-2 sm:grid-cols-2",
434
- children: [/* @__PURE__ */ y("div", {
483
+ children: [/* @__PURE__ */ h("div", {
435
484
  className: "grid gap-1.5",
436
- children: [/* @__PURE__ */ v(S, {
485
+ children: [/* @__PURE__ */ m(v, {
437
486
  htmlFor: "emSource",
438
487
  children: "Source"
439
- }), /* @__PURE__ */ v(x, {
488
+ }), /* @__PURE__ */ m(_, {
440
489
  id: "emSource",
441
- value: z.source,
442
- onChange: (e) => B({
443
- ...z,
490
+ value: I.source,
491
+ onChange: (e) => L({
492
+ ...I,
444
493
  source: e.target.value
445
494
  }),
446
495
  placeholder: "Flaring, grid electricity…"
447
496
  })]
448
- }), /* @__PURE__ */ y("div", {
497
+ }), /* @__PURE__ */ h("div", {
449
498
  className: "grid gap-1.5",
450
- children: [/* @__PURE__ */ v(S, {
499
+ children: [/* @__PURE__ */ m(v, {
451
500
  htmlFor: "emMethod",
452
501
  children: "Methodology"
453
- }), /* @__PURE__ */ v(x, {
502
+ }), /* @__PURE__ */ m(_, {
454
503
  id: "emMethod",
455
- value: z.methodology,
456
- onChange: (e) => B({
457
- ...z,
504
+ value: I.methodology,
505
+ onChange: (e) => L({
506
+ ...I,
458
507
  methodology: e.target.value
459
508
  }),
460
509
  placeholder: "GHG Protocol / IPCC / API"
461
510
  })]
462
511
  })]
463
512
  }),
464
- /* @__PURE__ */ y("div", {
513
+ /* @__PURE__ */ h("div", {
465
514
  className: "grid gap-1.5",
466
- children: [/* @__PURE__ */ v(S, {
515
+ children: [/* @__PURE__ */ m(v, {
467
516
  htmlFor: "emNotes",
468
517
  children: "Notes"
469
- }), /* @__PURE__ */ v(O, {
518
+ }), /* @__PURE__ */ m(Te, {
470
519
  id: "emNotes",
471
520
  rows: 2,
472
- value: z.notes,
473
- onChange: (e) => B({
474
- ...z,
521
+ value: I.notes,
522
+ onChange: (e) => L({
523
+ ...I,
475
524
  notes: e.target.value
476
525
  }),
477
526
  placeholder: "Optional context about this figure."
478
527
  })]
479
528
  }),
480
- V && /* @__PURE__ */ v("p", {
529
+ R && /* @__PURE__ */ m("p", {
481
530
  className: "text-sm text-status-error-text",
482
- children: V
531
+ children: R
483
532
  })
484
533
  ]
485
- }), /* @__PURE__ */ y(ve, { children: [/* @__PURE__ */ v(b, {
534
+ }), /* @__PURE__ */ h(Ce, { children: [/* @__PURE__ */ m(g, {
486
535
  type: "button",
487
536
  variant: "outline",
488
- onClick: () => R(!1),
537
+ onClick: () => F(!1),
489
538
  children: "Cancel"
490
- }), /* @__PURE__ */ v(b, {
539
+ }), /* @__PURE__ */ m(g, {
491
540
  type: "submit",
492
- disabled: Y.isPending,
493
- children: Y.isPending ? "Recording…" : "Record emission"
541
+ disabled: G.isPending,
542
+ children: G.isPending ? "Recording…" : "Record emission"
494
543
  })] })]
495
544
  })] })
496
545
  })
@@ -498,6 +547,6 @@ function I() {
498
547
  });
499
548
  }
500
549
  //#endregion
501
- export { I as EmissionsPage };
550
+ export { N as EmissionsPage };
502
551
 
503
552
  //# sourceMappingURL=EmissionsPage.js.map