@burdenoff/microfe-theglobalfuel 2026.705.5 → 2026.709.2
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/README.md +3 -0
- package/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/generated/global-operations.d.ts +2 -0
- package/dist/generated/global-operations.d.ts.map +1 -0
- package/dist/generated/global-types.d.ts +18199 -0
- package/dist/generated/global-types.d.ts.map +1 -0
- package/dist/generated/wspace-operations.d.ts +2 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -0
- package/dist/generated/wspace-types.d.ts +43046 -0
- package/dist/generated/wspace-types.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -1
- package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts +5 -0
- package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts.map +1 -0
- package/dist/theglobalfuel/TheGlobalFuelRoot.js +106 -104
- package/dist/theglobalfuel/TheGlobalFuelRoot.js.map +1 -1
- package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts +4 -0
- package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts.map +1 -0
- package/dist/theglobalfuel/TheGlobalFuelRoutes.js +60 -38
- package/dist/theglobalfuel/TheGlobalFuelRoutes.js.map +1 -1
- package/dist/theglobalfuel/components/DataTable.d.ts +30 -0
- package/dist/theglobalfuel/components/DataTable.d.ts.map +1 -0
- package/dist/theglobalfuel/components/DataTable.js.map +1 -1
- package/dist/theglobalfuel/components/EmptyState.d.ts +18 -0
- package/dist/theglobalfuel/components/EmptyState.d.ts.map +1 -0
- package/dist/theglobalfuel/components/EvidenceUpload.d.ts +14 -0
- package/dist/theglobalfuel/components/EvidenceUpload.d.ts.map +1 -0
- package/dist/theglobalfuel/components/FileLink.d.ts +15 -0
- package/dist/theglobalfuel/components/FileLink.d.ts.map +1 -0
- package/dist/theglobalfuel/components/FilterTabs.d.ts +18 -0
- package/dist/theglobalfuel/components/FilterTabs.d.ts.map +1 -0
- package/dist/theglobalfuel/components/MetricsCard.d.ts +23 -0
- package/dist/theglobalfuel/components/MetricsCard.d.ts.map +1 -0
- package/dist/theglobalfuel/components/MiniBar.d.ts +16 -0
- package/dist/theglobalfuel/components/MiniBar.d.ts.map +1 -0
- package/dist/theglobalfuel/components/PageLayout.d.ts +18 -0
- package/dist/theglobalfuel/components/PageLayout.d.ts.map +1 -0
- package/dist/theglobalfuel/components/PageLayout.js +2 -1
- package/dist/theglobalfuel/components/PageLayout.js.map +1 -1
- package/dist/theglobalfuel/components/Pagination.d.ts +22 -0
- package/dist/theglobalfuel/components/Pagination.d.ts.map +1 -0
- package/dist/theglobalfuel/components/StateViews.d.ts +24 -0
- package/dist/theglobalfuel/components/StateViews.d.ts.map +1 -0
- package/dist/theglobalfuel/components/StatusBadge.d.ts +9 -0
- package/dist/theglobalfuel/components/StatusBadge.d.ts.map +1 -0
- package/dist/theglobalfuel/components/Tabs.d.ts +17 -0
- package/dist/theglobalfuel/components/Tabs.d.ts.map +1 -0
- package/dist/theglobalfuel/components/TheDiscussion.d.ts +18 -0
- package/dist/theglobalfuel/components/TheDiscussion.d.ts.map +1 -0
- package/dist/theglobalfuel/components/TheTags.d.ts +17 -0
- package/dist/theglobalfuel/components/TheTags.d.ts.map +1 -0
- package/dist/theglobalfuel/components/WorldMap.d.ts +18 -0
- package/dist/theglobalfuel/components/WorldMap.d.ts.map +1 -0
- package/dist/theglobalfuel/components/WorldMap.js.map +1 -1
- package/dist/theglobalfuel/components/index.d.ts +21 -0
- package/dist/theglobalfuel/components/index.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/AllocationBar.d.ts +21 -0
- package/dist/theglobalfuel/components/viz/AllocationBar.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/AreaChart.d.ts +18 -0
- package/dist/theglobalfuel/components/viz/AreaChart.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/AvatarStack.d.ts +13 -0
- package/dist/theglobalfuel/components/viz/AvatarStack.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/BarChart.d.ts +17 -0
- package/dist/theglobalfuel/components/viz/BarChart.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/CertificateCard.d.ts +14 -0
- package/dist/theglobalfuel/components/viz/CertificateCard.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/DonutChart.d.ts +20 -0
- package/dist/theglobalfuel/components/viz/DonutChart.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/HBarFunnel.d.ts +17 -0
- package/dist/theglobalfuel/components/viz/HBarFunnel.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/Heatmap.d.ts +26 -0
- package/dist/theglobalfuel/components/viz/Heatmap.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/KanbanBoard.d.ts +17 -0
- package/dist/theglobalfuel/components/viz/KanbanBoard.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/LineChart.d.ts +20 -0
- package/dist/theglobalfuel/components/viz/LineChart.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/OrgTree.d.ts +14 -0
- package/dist/theglobalfuel/components/viz/OrgTree.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/PathSteps.d.ts +17 -0
- package/dist/theglobalfuel/components/viz/PathSteps.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/ProgressRing.d.ts +20 -0
- package/dist/theglobalfuel/components/viz/ProgressRing.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/RatingStars.d.ts +14 -0
- package/dist/theglobalfuel/components/viz/RatingStars.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/SegmentedTabs.d.ts +26 -0
- package/dist/theglobalfuel/components/viz/SegmentedTabs.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/SkillBar.d.ts +17 -0
- package/dist/theglobalfuel/components/viz/SkillBar.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/Sparkline.d.ts +16 -0
- package/dist/theglobalfuel/components/viz/Sparkline.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/StatCard.d.ts +22 -0
- package/dist/theglobalfuel/components/viz/StatCard.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/StepProgress.d.ts +17 -0
- package/dist/theglobalfuel/components/viz/StepProgress.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/Timeline.d.ts +21 -0
- package/dist/theglobalfuel/components/viz/Timeline.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/index.d.ts +35 -0
- package/dist/theglobalfuel/components/viz/index.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/Avatar.d.ts +15 -0
- package/dist/theglobalfuel/components/viz/lib/Avatar.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/CartesianFrame.d.ts +44 -0
- package/dist/theglobalfuel/components/viz/lib/CartesianFrame.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.d.ts +27 -0
- package/dist/theglobalfuel/components/viz/lib/ResponsiveSvg.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/format.d.ts +10 -0
- package/dist/theglobalfuel/components/viz/lib/format.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/geometry.d.ts +41 -0
- package/dist/theglobalfuel/components/viz/lib/geometry.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/hooks.d.ts +18 -0
- package/dist/theglobalfuel/components/viz/lib/hooks.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/palette.d.ts +31 -0
- package/dist/theglobalfuel/components/viz/lib/palette.d.ts.map +1 -0
- package/dist/theglobalfuel/components/viz/lib/types.d.ts +27 -0
- package/dist/theglobalfuel/components/viz/lib/types.d.ts.map +1 -0
- package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts +16 -0
- package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts.map +1 -0
- package/dist/theglobalfuel/context/index.d.ts +6 -0
- package/dist/theglobalfuel/context/index.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/index.d.ts +15 -0
- package/dist/theglobalfuel/hooks/index.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/index.js +4 -0
- package/dist/theglobalfuel/hooks/useCursorPager.d.ts +26 -0
- package/dist/theglobalfuel/hooks/useCursorPager.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useNotify.d.ts +23 -0
- package/dist/theglobalfuel/hooks/useNotify.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheAnalytics.d.ts +38 -0
- package/dist/theglobalfuel/hooks/useTheAnalytics.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheAnalytics.js +46 -0
- package/dist/theglobalfuel/hooks/useTheAnalytics.js.map +1 -0
- package/dist/theglobalfuel/hooks/useTheComments.d.ts +36 -0
- package/dist/theglobalfuel/hooks/useTheComments.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheFiles.d.ts +47 -0
- package/dist/theglobalfuel/hooks/useTheFiles.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +79 -0
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +2 -9
- package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -1
- package/dist/theglobalfuel/hooks/useTheNativeControls.d.ts +20 -0
- package/dist/theglobalfuel/hooks/useTheNativeControls.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheNativeControls.js +22 -0
- package/dist/theglobalfuel/hooks/useTheNativeControls.js.map +1 -0
- package/dist/theglobalfuel/hooks/useThePageView.d.ts +10 -0
- package/dist/theglobalfuel/hooks/useThePageView.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useThePageView.js +13 -0
- package/dist/theglobalfuel/hooks/useThePageView.js.map +1 -0
- package/dist/theglobalfuel/hooks/useTheTags.d.ts +44 -0
- package/dist/theglobalfuel/hooks/useTheTags.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheTranslation.d.ts +4 -0
- package/dist/theglobalfuel/hooks/useTheTranslation.d.ts.map +1 -0
- package/dist/theglobalfuel/hooks/useTheTranslation.js +12 -0
- package/dist/theglobalfuel/hooks/useTheTranslation.js.map +1 -0
- package/dist/theglobalfuel/index.d.ts +11 -0
- package/dist/theglobalfuel/index.d.ts.map +1 -0
- package/dist/theglobalfuel/index.js +2 -0
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts +13 -0
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +395 -353
- package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -1
- package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts +10 -0
- package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/assets/AssetsPage.js +152 -146
- package/dist/theglobalfuel/pages/assets/AssetsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts +11 -0
- package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js +233 -229
- package/dist/theglobalfuel/pages/compliance/CompliancePage.js.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts +9 -0
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js +410 -389
- package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js.map +1 -1
- package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts +8 -0
- package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js +237 -231
- package/dist/theglobalfuel/pages/contracts/ContractsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts +17 -0
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +255 -250
- package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -1
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts +13 -0
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +154 -150
- package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -1
- package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts +11 -0
- package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js +151 -147
- package/dist/theglobalfuel/pages/inventory/InventoryPage.js.map +1 -1
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +11 -0
- package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/production/ProductionPage.js +175 -171
- package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -1
- package/dist/theglobalfuel/pages/provenance/ProvenancePage.d.ts +23 -0
- package/dist/theglobalfuel/pages/provenance/ProvenancePage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/provenance/ProvenancePage.js +153 -146
- package/dist/theglobalfuel/pages/provenance/ProvenancePage.js.map +1 -1
- package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts +10 -0
- package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js +168 -164
- package/dist/theglobalfuel/pages/reserves/ReservesPage.js.map +1 -1
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts +11 -0
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts.map +1 -0
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +179 -175
- package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -1
- package/dist/theglobalfuel/services/assistantApi.d.ts +25 -0
- package/dist/theglobalfuel/services/assistantApi.d.ts.map +1 -0
- package/dist/theglobalfuel/services/assistantApi.js +225 -0
- package/dist/theglobalfuel/services/assistantApi.js.map +1 -0
- package/dist/theglobalfuel/services/createSandboxAssistantTransport.d.ts +38 -0
- package/dist/theglobalfuel/services/createSandboxAssistantTransport.d.ts.map +1 -0
- package/dist/theglobalfuel/services/createSandboxAssistantTransport.js +120 -0
- package/dist/theglobalfuel/services/createSandboxAssistantTransport.js.map +1 -0
- package/dist/theglobalfuel/services/index.d.ts +7 -0
- package/dist/theglobalfuel/services/index.d.ts.map +1 -0
- package/dist/theglobalfuel/types/assistant.d.ts +65 -0
- package/dist/theglobalfuel/types/assistant.d.ts.map +1 -0
- package/dist/theglobalfuel/types/index.d.ts +376 -0
- package/dist/theglobalfuel/types/index.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/cn.d.ts +4 -0
- package/dist/theglobalfuel/utils/cn.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/formatters.d.ts +44 -0
- package/dist/theglobalfuel/utils/formatters.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/i18n.d.ts +5 -0
- package/dist/theglobalfuel/utils/i18n.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/i18n.js +15 -0
- package/dist/theglobalfuel/utils/i18n.js.map +1 -0
- package/dist/theglobalfuel/utils/index.d.ts +10 -0
- package/dist/theglobalfuel/utils/index.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/navigation.d.ts +14 -0
- package/dist/theglobalfuel/utils/navigation.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/pageContext.d.ts +26 -0
- package/dist/theglobalfuel/utils/pageContext.d.ts.map +1 -0
- package/dist/theglobalfuel/utils/pageContext.js +65 -0
- package/dist/theglobalfuel/utils/pageContext.js.map +1 -0
- package/dist/theglobalfuel/utils/transitions.d.ts +17 -0
- package/dist/theglobalfuel/utils/transitions.d.ts.map +1 -0
- package/package.json +5 -1
- package/dist/node_modules/clsx/dist/clsx.js +0 -18
- package/dist/node_modules/clsx/dist/clsx.js.map +0 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -1716
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,7 @@ import { TheGlobalFuelProvider as t, useTheGlobalFuel as n } from "./theglobalfu
|
|
|
3
3
|
import { cn as r } from "./theglobalfuel/utils/cn.js";
|
|
4
4
|
import { formatCo2e as i, formatCoords as a, formatDate as o, formatDateTime as s, formatEnumLabel as c, formatMoney as l, formatNumber as u, formatPercent as d, formatQuantity as f, formatRelativeTime as p, formatTonnesCo2e as m, formatUnit as h, formatVolume as g, isExpired as _ } from "./theglobalfuel/utils/formatters.js";
|
|
5
5
|
import { TheGlobalFuelRoot as v } from "./theglobalfuel/TheGlobalFuelRoot.js";
|
|
6
|
+
import { gatherPageContext as y } from "./theglobalfuel/utils/pageContext.js";
|
|
7
|
+
import { useSandboxAssistantTransport as b } from "./theglobalfuel/services/createSandboxAssistantTransport.js";
|
|
6
8
|
import "./theglobalfuel/index.js";
|
|
7
|
-
export { t as TheGlobalFuelProvider, v as TheGlobalFuelRoot, r as cn, i as formatCo2e, a as formatCoords, o as formatDate, s as formatDateTime, c as formatEnumLabel, l as formatMoney, u as formatNumber, d as formatPercent, f as formatQuantity, p as formatRelativeTime, m as formatTonnesCo2e, h as formatUnit, g as formatVolume, _ as isExpired, e as joinPath, n as useTheGlobalFuel };
|
|
9
|
+
export { t as TheGlobalFuelProvider, v as TheGlobalFuelRoot, r as cn, i as formatCo2e, a as formatCoords, o as formatDate, s as formatDateTime, c as formatEnumLabel, l as formatMoney, u as formatNumber, d as formatPercent, f as formatQuantity, p as formatRelativeTime, m as formatTonnesCo2e, h as formatUnit, g as formatVolume, y as gatherPageContext, _ as isExpired, e as joinPath, b as useSandboxAssistantTransport, n as useTheGlobalFuel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TheGlobalFuelRoot.d.ts","sourceRoot":"","sources":["../../src/theglobalfuel/TheGlobalFuelRoot.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAoBhC,OAAO,KAAK,EAAE,sBAAsB,EAAW,MAAM,SAAS,CAAC;AAY/D,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAsIxD,CAAC"}
|
|
@@ -1,131 +1,133 @@
|
|
|
1
1
|
import { joinPath as e } from "./utils/navigation.js";
|
|
2
2
|
import { TheGlobalFuelProvider as t } from "./context/TheGlobalFuelContext.js";
|
|
3
3
|
import { TheGlobalFuelRoutes as n } from "./TheGlobalFuelRoutes.js";
|
|
4
|
-
import { useCallback as r, useEffect as i } from "react";
|
|
5
|
-
import { QueryClient as
|
|
6
|
-
import { FeatureFlagProvider as
|
|
7
|
-
import { useI18n as
|
|
8
|
-
import { Boxes as
|
|
9
|
-
import { jsx as
|
|
4
|
+
import { useCallback as r, useEffect as i, useMemo as a } from "react";
|
|
5
|
+
import { QueryClient as o, QueryClientProvider as s } from "@tanstack/react-query";
|
|
6
|
+
import { FeatureFlagProvider as c, useFeatureFlags as l } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
7
|
+
import { useI18n as u } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
8
|
+
import { Boxes as d, Factory as f, FileText as p, Gauge as m, Layers as h, LayoutDashboard as g, Leaf as _, ShieldCheck as v, Truck as y, Waypoints as b } from "lucide-react";
|
|
9
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
10
10
|
//#region src/theglobalfuel/TheGlobalFuelRoot.tsx
|
|
11
|
-
var
|
|
11
|
+
var S = new o({ defaultOptions: { queries: {
|
|
12
12
|
staleTime: 300 * 1e3,
|
|
13
13
|
retry: 1,
|
|
14
14
|
refetchOnWindowFocus: !1
|
|
15
|
-
} } }),
|
|
16
|
-
let { registerNavItems:
|
|
17
|
-
let n =
|
|
15
|
+
} } }), C = (o) => {
|
|
16
|
+
let { registerNavItems: C, registerFooterItems: w, basePath: T = "/" } = o, { t: E } = u(), { isEnabled: D, evaluations: O } = l(), k = r((e, t) => {
|
|
17
|
+
let n = E(e);
|
|
18
18
|
return n === e ? t : n;
|
|
19
|
-
}, [
|
|
19
|
+
}, [E]), A = a(() => [
|
|
20
|
+
{
|
|
21
|
+
id: "theglobalfuel-dashboard",
|
|
22
|
+
label: k("theglobalfuel.nav.dashboard", "Dashboard"),
|
|
23
|
+
path: e(T, ""),
|
|
24
|
+
icon: /* @__PURE__ */ x(g, { size: 20 }),
|
|
25
|
+
order: 0,
|
|
26
|
+
group: "products"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "theglobalfuel-assets",
|
|
30
|
+
label: k("theglobalfuel.nav.assets", "Assets"),
|
|
31
|
+
path: e(T, "assets"),
|
|
32
|
+
icon: /* @__PURE__ */ x(f, { size: 20 }),
|
|
33
|
+
order: 1,
|
|
34
|
+
group: "products"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "theglobalfuel-production",
|
|
38
|
+
label: k("theglobalfuel.nav.production", "Production"),
|
|
39
|
+
path: e(T, "production"),
|
|
40
|
+
icon: /* @__PURE__ */ x(m, { size: 20 }),
|
|
41
|
+
order: 2,
|
|
42
|
+
group: "products"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "theglobalfuel-reserves",
|
|
46
|
+
label: k("theglobalfuel.nav.reserves", "Reserves"),
|
|
47
|
+
path: e(T, "reserves"),
|
|
48
|
+
icon: /* @__PURE__ */ x(h, { size: 20 }),
|
|
49
|
+
order: 3,
|
|
50
|
+
group: "products"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "theglobalfuel-contracts",
|
|
54
|
+
label: k("theglobalfuel.nav.contracts", "Offtake Contracts"),
|
|
55
|
+
path: e(T, "contracts"),
|
|
56
|
+
icon: /* @__PURE__ */ x(p, { size: 20 }),
|
|
57
|
+
order: 4,
|
|
58
|
+
group: "products"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "theglobalfuel-shipments",
|
|
62
|
+
label: k("theglobalfuel.nav.shipments", "Shipments"),
|
|
63
|
+
path: e(T, "shipments"),
|
|
64
|
+
icon: /* @__PURE__ */ x(y, { size: 20 }),
|
|
65
|
+
order: 5,
|
|
66
|
+
group: "products"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "theglobalfuel-inventory",
|
|
70
|
+
label: k("theglobalfuel.nav.inventory", "Inventory"),
|
|
71
|
+
path: e(T, "inventory"),
|
|
72
|
+
icon: /* @__PURE__ */ x(d, { size: 20 }),
|
|
73
|
+
order: 6,
|
|
74
|
+
group: "products"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "theglobalfuel-emissions",
|
|
78
|
+
label: k("theglobalfuel.nav.emissions", "Emissions"),
|
|
79
|
+
path: e(T, "emissions"),
|
|
80
|
+
icon: /* @__PURE__ */ x(_, { size: 20 }),
|
|
81
|
+
order: 7,
|
|
82
|
+
group: "products"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "theglobalfuel-compliance",
|
|
86
|
+
label: k("theglobalfuel.nav.compliance", "Compliance"),
|
|
87
|
+
path: e(T, "compliance"),
|
|
88
|
+
icon: /* @__PURE__ */ x(v, { size: 20 }),
|
|
89
|
+
order: 8,
|
|
90
|
+
group: "products"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "theglobalfuel-provenance",
|
|
94
|
+
label: k("theglobalfuel.nav.provenance", "Provenance"),
|
|
95
|
+
path: e(T, "provenance"),
|
|
96
|
+
icon: /* @__PURE__ */ x(b, { size: 20 }),
|
|
97
|
+
order: 9,
|
|
98
|
+
group: "products"
|
|
99
|
+
}
|
|
100
|
+
], [T, k]), j = r((e) => `theglobalfuel.${e.replace("theglobalfuel-", "")}`, []);
|
|
20
101
|
return i(() => {
|
|
21
|
-
if (
|
|
22
|
-
{
|
|
23
|
-
id: "theglobalfuel-dashboard",
|
|
24
|
-
label: T("theglobalfuel.nav.dashboard", "Dashboard"),
|
|
25
|
-
path: e(C, ""),
|
|
26
|
-
icon: /* @__PURE__ */ y(m, { size: 20 }),
|
|
27
|
-
order: 0,
|
|
28
|
-
group: "products"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
id: "theglobalfuel-assets",
|
|
32
|
-
label: T("theglobalfuel.nav.assets", "Assets"),
|
|
33
|
-
path: e(C, "assets"),
|
|
34
|
-
icon: /* @__PURE__ */ y(u, { size: 20 }),
|
|
35
|
-
order: 1,
|
|
36
|
-
group: "products"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "theglobalfuel-production",
|
|
40
|
-
label: T("theglobalfuel.nav.production", "Production"),
|
|
41
|
-
path: e(C, "production"),
|
|
42
|
-
icon: /* @__PURE__ */ y(f, { size: 20 }),
|
|
43
|
-
order: 2,
|
|
44
|
-
group: "products"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: "theglobalfuel-reserves",
|
|
48
|
-
label: T("theglobalfuel.nav.reserves", "Reserves"),
|
|
49
|
-
path: e(C, "reserves"),
|
|
50
|
-
icon: /* @__PURE__ */ y(p, { size: 20 }),
|
|
51
|
-
order: 3,
|
|
52
|
-
group: "products"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "theglobalfuel-contracts",
|
|
56
|
-
label: T("theglobalfuel.nav.contracts", "Offtake Contracts"),
|
|
57
|
-
path: e(C, "contracts"),
|
|
58
|
-
icon: /* @__PURE__ */ y(d, { size: 20 }),
|
|
59
|
-
order: 4,
|
|
60
|
-
group: "products"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
id: "theglobalfuel-shipments",
|
|
64
|
-
label: T("theglobalfuel.nav.shipments", "Shipments"),
|
|
65
|
-
path: e(C, "shipments"),
|
|
66
|
-
icon: /* @__PURE__ */ y(_, { size: 20 }),
|
|
67
|
-
order: 5,
|
|
68
|
-
group: "products"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
id: "theglobalfuel-inventory",
|
|
72
|
-
label: T("theglobalfuel.nav.inventory", "Inventory"),
|
|
73
|
-
path: e(C, "inventory"),
|
|
74
|
-
icon: /* @__PURE__ */ y(l, { size: 20 }),
|
|
75
|
-
order: 6,
|
|
76
|
-
group: "products"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: "theglobalfuel-emissions",
|
|
80
|
-
label: T("theglobalfuel.nav.emissions", "Emissions"),
|
|
81
|
-
path: e(C, "emissions"),
|
|
82
|
-
icon: /* @__PURE__ */ y(h, { size: 20 }),
|
|
83
|
-
order: 7,
|
|
84
|
-
group: "products"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: "theglobalfuel-compliance",
|
|
88
|
-
label: T("theglobalfuel.nav.compliance", "Compliance"),
|
|
89
|
-
path: e(C, "compliance"),
|
|
90
|
-
icon: /* @__PURE__ */ y(g, { size: 20 }),
|
|
91
|
-
order: 8,
|
|
92
|
-
group: "products"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: "theglobalfuel-provenance",
|
|
96
|
-
label: T("theglobalfuel.nav.provenance", "Provenance"),
|
|
97
|
-
path: e(C, "provenance"),
|
|
98
|
-
icon: /* @__PURE__ */ y(v, { size: 20 }),
|
|
99
|
-
order: 9,
|
|
100
|
-
group: "products"
|
|
101
|
-
}
|
|
102
|
-
]);
|
|
102
|
+
if (C) return C(A.filter((e) => D(j(e.id), !0)));
|
|
103
103
|
}, [
|
|
104
|
-
x,
|
|
105
104
|
C,
|
|
106
|
-
|
|
105
|
+
A,
|
|
106
|
+
D,
|
|
107
|
+
O,
|
|
108
|
+
j
|
|
107
109
|
]), i(() => {
|
|
108
|
-
if (
|
|
110
|
+
if (w) return w([{
|
|
109
111
|
id: "theglobalfuel-status",
|
|
110
|
-
label:
|
|
112
|
+
label: k("theglobalfuel.footer.ready", "TheGlobalFuel Ready"),
|
|
111
113
|
type: "status",
|
|
112
114
|
section: "left",
|
|
113
115
|
order: 10
|
|
114
116
|
}]);
|
|
115
|
-
}, [
|
|
116
|
-
client:
|
|
117
|
-
children: /* @__PURE__ */
|
|
117
|
+
}, [w, k]), /* @__PURE__ */ x(s, {
|
|
118
|
+
client: S,
|
|
119
|
+
children: /* @__PURE__ */ x(c, {
|
|
118
120
|
workspaceId: null,
|
|
119
121
|
gateway: "global",
|
|
120
122
|
defaultEnabled: !0,
|
|
121
|
-
children: /* @__PURE__ */
|
|
122
|
-
...
|
|
123
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ x(t, {
|
|
124
|
+
...o,
|
|
125
|
+
children: /* @__PURE__ */ x(n, {})
|
|
124
126
|
})
|
|
125
127
|
})
|
|
126
128
|
});
|
|
127
129
|
};
|
|
128
130
|
//#endregion
|
|
129
|
-
export {
|
|
131
|
+
export { C as TheGlobalFuelRoot };
|
|
130
132
|
|
|
131
133
|
//# sourceMappingURL=TheGlobalFuelRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TheGlobalFuelRoot.js","names":[],"sources":["../../src/theglobalfuel/TheGlobalFuelRoot.tsx"],"sourcesContent":["/**\n * TheGlobalFuel Root Component\n * @module theglobalfuel\n *\n * Host-contract entry point. Registers the product's sidebar nav (nine sections\n * that map 1:1 to the wspace-theglobalfuel-svc `the*` backend) and mounts the\n * routed pages inside the shared QueryClient + FeatureFlag providers.\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n LayoutDashboard,\n Factory,\n Gauge,\n Layers,\n FileText,\n Truck,\n Boxes,\n Leaf,\n ShieldCheck,\n Waypoints,\n} from 'lucide-react';\nimport { TheGlobalFuelProvider } from './context/TheGlobalFuelContext';\nimport { TheGlobalFuelRoutes } from './TheGlobalFuelRoutes';\nimport { joinPath } from './utils/navigation';\nimport type { TheGlobalFuelRootProps, NavItem } from './types';\n\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n});\n\nexport const TheGlobalFuelRoot: FC<TheGlobalFuelRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { t: translate } = useI18n();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Register navigation items with the shell on mount. Ids/paths/orders match\n // the app-shell static NavRegistration block so the two are a single,\n // consistent source of truth.\n
|
|
1
|
+
{"version":3,"file":"TheGlobalFuelRoot.js","names":[],"sources":["../../src/theglobalfuel/TheGlobalFuelRoot.tsx"],"sourcesContent":["/**\n * TheGlobalFuel Root Component\n * @module theglobalfuel\n *\n * Host-contract entry point. Registers the product's sidebar nav (nine sections\n * that map 1:1 to the wspace-theglobalfuel-svc `the*` backend) and mounts the\n * routed pages inside the shared QueryClient + FeatureFlag providers.\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect, useMemo } from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { FeatureFlagProvider, useFeatureFlags } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n LayoutDashboard,\n Factory,\n Gauge,\n Layers,\n FileText,\n Truck,\n Boxes,\n Leaf,\n ShieldCheck,\n Waypoints,\n} from 'lucide-react';\nimport { TheGlobalFuelProvider } from './context/TheGlobalFuelContext';\nimport { TheGlobalFuelRoutes } from './TheGlobalFuelRoutes';\nimport { joinPath } from './utils/navigation';\nimport type { TheGlobalFuelRootProps, NavItem } from './types';\n\nconst queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 5 * 60 * 1000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n});\n\nexport const TheGlobalFuelRoot: FC<TheGlobalFuelRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { t: translate } = useI18n();\n const { isEnabled, evaluations } = useFeatureFlags();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Register navigation items with the shell on mount. Ids/paths/orders match\n // the app-shell static NavRegistration block so the two are a single,\n // consistent source of truth.\n const navItems = useMemo<NavItem[]>(\n () => [\n {\n id: 'theglobalfuel-dashboard',\n label: t('theglobalfuel.nav.dashboard', 'Dashboard'),\n path: joinPath(basePath, ''),\n icon: <LayoutDashboard size={20} />,\n order: 0,\n group: 'products',\n },\n {\n id: 'theglobalfuel-assets',\n label: t('theglobalfuel.nav.assets', 'Assets'),\n path: joinPath(basePath, 'assets'),\n icon: <Factory size={20} />,\n order: 1,\n group: 'products',\n },\n {\n id: 'theglobalfuel-production',\n label: t('theglobalfuel.nav.production', 'Production'),\n path: joinPath(basePath, 'production'),\n icon: <Gauge size={20} />,\n order: 2,\n group: 'products',\n },\n {\n id: 'theglobalfuel-reserves',\n label: t('theglobalfuel.nav.reserves', 'Reserves'),\n path: joinPath(basePath, 'reserves'),\n icon: <Layers size={20} />,\n order: 3,\n group: 'products',\n },\n {\n id: 'theglobalfuel-contracts',\n label: t('theglobalfuel.nav.contracts', 'Offtake Contracts'),\n path: joinPath(basePath, 'contracts'),\n icon: <FileText size={20} />,\n order: 4,\n group: 'products',\n },\n {\n id: 'theglobalfuel-shipments',\n label: t('theglobalfuel.nav.shipments', 'Shipments'),\n path: joinPath(basePath, 'shipments'),\n icon: <Truck size={20} />,\n order: 5,\n group: 'products',\n },\n {\n id: 'theglobalfuel-inventory',\n label: t('theglobalfuel.nav.inventory', 'Inventory'),\n path: joinPath(basePath, 'inventory'),\n icon: <Boxes size={20} />,\n order: 6,\n group: 'products',\n },\n {\n id: 'theglobalfuel-emissions',\n label: t('theglobalfuel.nav.emissions', 'Emissions'),\n path: joinPath(basePath, 'emissions'),\n icon: <Leaf size={20} />,\n order: 7,\n group: 'products',\n },\n {\n id: 'theglobalfuel-compliance',\n label: t('theglobalfuel.nav.compliance', 'Compliance'),\n path: joinPath(basePath, 'compliance'),\n icon: <ShieldCheck size={20} />,\n order: 8,\n group: 'products',\n },\n {\n id: 'theglobalfuel-provenance',\n label: t('theglobalfuel.nav.provenance', 'Provenance'),\n path: joinPath(basePath, 'provenance'),\n icon: <Waypoints size={20} />,\n order: 9,\n group: 'products',\n },\n ],\n [basePath, t]\n );\n\n const flagForNav = useCallback((itemId: string): string => {\n const suffix = itemId.replace('theglobalfuel-', '');\n return `theglobalfuel.${suffix}`;\n }, []);\n\n useEffect(() => {\n if (!registerNavItems) return;\n const visible = navItems.filter((item) => isEnabled(flagForNav(item.id), true));\n return registerNavItems(visible);\n }, [registerNavItems, navItems, isEnabled, evaluations, flagForNav]);\n\n useEffect(() => {\n if (!registerFooterItems) return;\n return registerFooterItems([\n {\n id: 'theglobalfuel-status',\n label: t('theglobalfuel.footer.ready', 'TheGlobalFuel Ready'),\n type: 'status',\n section: 'left',\n order: 10,\n },\n ]);\n }, [registerFooterItems, t]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <TheGlobalFuelProvider {...props}>\n <TheGlobalFuelRoutes />\n </TheGlobalFuelProvider>\n </FeatureFlagProvider>\n </QueryClientProvider>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;YAC3B,kBAAC,GAAD;GAAqB,aAAa;GAAM,SAAQ;GAAS,gBAAgB;aACvE,kBAAC,GAAD;IAAuB,GAAI;cACzB,kBAAC,GAAD,EAAuB,CAAA;IACD,CAAA;GACJ,CAAA;EACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TheGlobalFuelRoutes.d.ts","sourceRoot":"","sources":["../../src/theglobalfuel/TheGlobalFuelRoutes.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAkC,MAAM,OAAO,CAAC;AAuEhE,eAAO,MAAM,mBAAmB,EAAE,EA8DjC,CAAC"}
|
|
@@ -1,71 +1,93 @@
|
|
|
1
1
|
import { useTheGlobalFuel as e } from "./context/TheGlobalFuelContext.js";
|
|
2
2
|
import { DashboardPage as t } from "./pages/dashboard/DashboardPage.js";
|
|
3
3
|
import { Suspense as n, lazy as r } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { FeatureGate as i } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
5
|
+
import { Navigate as a, Route as o, Routes as s, useLocation as c } from "react-router-dom";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { Spinner as d } from "@burdenoff/fe-libs/ui";
|
|
7
8
|
//#region src/theglobalfuel/TheGlobalFuelRoutes.tsx
|
|
8
|
-
var
|
|
9
|
+
var f = r(() => import("./pages/assets/AssetsPage.js").then((e) => ({ default: e.AssetsPage }))), p = r(() => import("./pages/assets/AssetDetailPage.js").then((e) => ({ default: e.AssetDetailPage }))), m = r(() => import("./pages/production/ProductionPage.js").then((e) => ({ default: e.ProductionPage }))), h = r(() => import("./pages/reserves/ReservesPage.js").then((e) => ({ default: e.ReservesPage }))), g = r(() => import("./pages/contracts/ContractsPage.js").then((e) => ({ default: e.ContractsPage }))), _ = r(() => import("./pages/contracts/ContractDetailPage.js").then((e) => ({ default: e.ContractDetailPage }))), v = r(() => import("./pages/shipments/ShipmentsPage.js").then((e) => ({ default: e.ShipmentsPage }))), y = r(() => import("./pages/inventory/InventoryPage.js").then((e) => ({ default: e.InventoryPage }))), b = r(() => import("./pages/emissions/EmissionsPage.js").then((e) => ({ default: e.EmissionsPage }))), x = r(() => import("./pages/compliance/CompliancePage.js").then((e) => ({ default: e.CompliancePage }))), S = r(() => import("./pages/provenance/ProvenancePage.js").then((e) => ({ default: e.ProvenancePage }))), C = () => /* @__PURE__ */ l("div", {
|
|
9
10
|
className: "flex min-h-[400px] items-center justify-center",
|
|
10
|
-
children: /* @__PURE__ */
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
return
|
|
11
|
+
children: /* @__PURE__ */ l(d, { size: "lg" })
|
|
12
|
+
});
|
|
13
|
+
function w() {
|
|
14
|
+
return /* @__PURE__ */ u("div", {
|
|
15
|
+
className: "flex min-h-[400px] flex-col items-center justify-center gap-3 text-center p-6",
|
|
16
|
+
children: [/* @__PURE__ */ l("p", {
|
|
17
|
+
className: "text-sm font-medium text-text-secondary",
|
|
18
|
+
children: "This feature is not available."
|
|
19
|
+
}), /* @__PURE__ */ l("p", {
|
|
20
|
+
className: "text-xs text-text-tertiary",
|
|
21
|
+
children: "Ask your workspace admin to enable it."
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function T(e, t) {
|
|
26
|
+
return /* @__PURE__ */ l(i, {
|
|
27
|
+
flag: e,
|
|
28
|
+
defaultValue: !0,
|
|
29
|
+
fallback: /* @__PURE__ */ l(w, {}),
|
|
30
|
+
children: t
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
var E = () => {
|
|
34
|
+
let { basePath: r, isStandalone: i } = e(), d = c(), w = r === "/" ? "" : (r ?? "").replace(/\/$/, "");
|
|
35
|
+
return w && !i && !(d.pathname === w || d.pathname.startsWith(w + "/")) ? null : /* @__PURE__ */ l("div", {
|
|
14
36
|
className: "flex min-h-full flex-col",
|
|
15
|
-
children: /* @__PURE__ */
|
|
16
|
-
fallback: /* @__PURE__ */
|
|
17
|
-
children: /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ l(n, {
|
|
38
|
+
fallback: /* @__PURE__ */ l(C, {}),
|
|
39
|
+
children: /* @__PURE__ */ u(s, { children: [
|
|
40
|
+
/* @__PURE__ */ l(o, {
|
|
19
41
|
index: !0,
|
|
20
|
-
element: /* @__PURE__ */
|
|
42
|
+
element: T("theglobalfuel.dashboard", /* @__PURE__ */ l(t, {}))
|
|
21
43
|
}),
|
|
22
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ l(o, {
|
|
23
45
|
path: "assets",
|
|
24
|
-
element: /* @__PURE__ */
|
|
46
|
+
element: T("theglobalfuel.assets", /* @__PURE__ */ l(f, {}))
|
|
25
47
|
}),
|
|
26
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ l(o, {
|
|
27
49
|
path: "assets/:id",
|
|
28
|
-
element: /* @__PURE__ */
|
|
50
|
+
element: T("theglobalfuel.assets", /* @__PURE__ */ l(p, {}))
|
|
29
51
|
}),
|
|
30
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ l(o, {
|
|
31
53
|
path: "production",
|
|
32
|
-
element: /* @__PURE__ */
|
|
54
|
+
element: T("theglobalfuel.production", /* @__PURE__ */ l(m, {}))
|
|
33
55
|
}),
|
|
34
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ l(o, {
|
|
35
57
|
path: "reserves",
|
|
36
|
-
element: /* @__PURE__ */
|
|
58
|
+
element: T("theglobalfuel.reserves", /* @__PURE__ */ l(h, {}))
|
|
37
59
|
}),
|
|
38
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ l(o, {
|
|
39
61
|
path: "contracts",
|
|
40
|
-
element: /* @__PURE__ */
|
|
62
|
+
element: T("theglobalfuel.contracts", /* @__PURE__ */ l(g, {}))
|
|
41
63
|
}),
|
|
42
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ l(o, {
|
|
43
65
|
path: "contracts/:id",
|
|
44
|
-
element: /* @__PURE__ */
|
|
66
|
+
element: T("theglobalfuel.contracts", /* @__PURE__ */ l(_, {}))
|
|
45
67
|
}),
|
|
46
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ l(o, {
|
|
47
69
|
path: "shipments",
|
|
48
|
-
element: /* @__PURE__ */
|
|
70
|
+
element: T("theglobalfuel.shipments", /* @__PURE__ */ l(v, {}))
|
|
49
71
|
}),
|
|
50
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ l(o, {
|
|
51
73
|
path: "inventory",
|
|
52
|
-
element: /* @__PURE__ */
|
|
74
|
+
element: T("theglobalfuel.inventory", /* @__PURE__ */ l(y, {}))
|
|
53
75
|
}),
|
|
54
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ l(o, {
|
|
55
77
|
path: "emissions",
|
|
56
|
-
element: /* @__PURE__ */
|
|
78
|
+
element: T("theglobalfuel.emissions", /* @__PURE__ */ l(b, {}))
|
|
57
79
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ l(o, {
|
|
59
81
|
path: "compliance",
|
|
60
|
-
element: /* @__PURE__ */
|
|
82
|
+
element: T("theglobalfuel.compliance", /* @__PURE__ */ l(x, {}))
|
|
61
83
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ l(o, {
|
|
63
85
|
path: "provenance",
|
|
64
|
-
element: /* @__PURE__ */
|
|
86
|
+
element: T("theglobalfuel.provenance", /* @__PURE__ */ l(S, {}))
|
|
65
87
|
}),
|
|
66
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ l(o, {
|
|
67
89
|
path: "*",
|
|
68
|
-
element: /* @__PURE__ */
|
|
90
|
+
element: /* @__PURE__ */ l(a, {
|
|
69
91
|
to: w || "/",
|
|
70
92
|
replace: !0
|
|
71
93
|
})
|
|
@@ -75,6 +97,6 @@ var d = r(() => import("./pages/assets/AssetsPage.js").then((e) => ({ default: e
|
|
|
75
97
|
});
|
|
76
98
|
};
|
|
77
99
|
//#endregion
|
|
78
|
-
export {
|
|
100
|
+
export { E as TheGlobalFuelRoutes };
|
|
79
101
|
|
|
80
102
|
//# sourceMappingURL=TheGlobalFuelRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TheGlobalFuelRoutes.js","names":[],"sources":["../../src/theglobalfuel/TheGlobalFuelRoutes.tsx"],"sourcesContent":["/**\n * TheGlobalFuel Routes\n * @module theglobalfuel\n *\n * Domain routes. The dashboard is eager-loaded (primary landing); all other\n * pages are lazy-loaded. Every route maps to a real `the*` backend capability.\n */\n\nimport { type FC, lazy, Suspense } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router-dom';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { useTheGlobalFuel } from './context/TheGlobalFuelContext';\n\n// Eager — primary landing\nimport { DashboardPage } from './pages/dashboard/DashboardPage';\n\n// Registry — Assets, Production, Reserves\nconst AssetsPage = lazy(() =>\n import('./pages/assets/AssetsPage').then((m) => ({ default: m.AssetsPage }))\n);\nconst AssetDetailPage = lazy(() =>\n import('./pages/assets/AssetDetailPage').then((m) => ({ default: m.AssetDetailPage }))\n);\nconst ProductionPage = lazy(() =>\n import('./pages/production/ProductionPage').then((m) => ({ default: m.ProductionPage }))\n);\nconst ReservesPage = lazy(() =>\n import('./pages/reserves/ReservesPage').then((m) => ({ default: m.ReservesPage }))\n);\n\n// Commerce — Offtake Contracts, Shipments, Inventory\nconst ContractsPage = lazy(() =>\n import('./pages/contracts/ContractsPage').then((m) => ({ default: m.ContractsPage }))\n);\nconst ContractDetailPage = lazy(() =>\n import('./pages/contracts/ContractDetailPage').then((m) => ({ default: m.ContractDetailPage }))\n);\nconst ShipmentsPage = lazy(() =>\n import('./pages/shipments/ShipmentsPage').then((m) => ({ default: m.ShipmentsPage }))\n);\nconst InventoryPage = lazy(() =>\n import('./pages/inventory/InventoryPage').then((m) => ({ default: m.InventoryPage }))\n);\n\n// Sustainability — Emissions, Compliance\nconst EmissionsPage = lazy(() =>\n import('./pages/emissions/EmissionsPage').then((m) => ({ default: m.EmissionsPage }))\n);\nconst CompliancePage = lazy(() =>\n import('./pages/compliance/CompliancePage').then((m) => ({ default: m.CompliancePage }))\n);\nconst ProvenancePage = lazy(() =>\n import('./pages/provenance/ProvenancePage').then((m) => ({ default: m.ProvenancePage }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nexport const TheGlobalFuelRoutes: FC = () => {\n const { basePath, isStandalone } = useTheGlobalFuel();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={<DashboardPage />} />\n\n <Route path=\"assets\" element={<AssetsPage />} />\n <Route path=\"assets/:id\" element={<AssetDetailPage />} />\n\n <Route
|
|
1
|
+
{"version":3,"file":"TheGlobalFuelRoutes.js","names":[],"sources":["../../src/theglobalfuel/TheGlobalFuelRoutes.tsx"],"sourcesContent":["/**\n * TheGlobalFuel Routes\n * @module theglobalfuel\n *\n * Domain routes. The dashboard is eager-loaded (primary landing); all other\n * pages are lazy-loaded. Every route maps to a real `the*` backend capability.\n */\n\nimport { type FC, lazy, Suspense, type ReactNode } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router-dom';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport { FeatureGate } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { useTheGlobalFuel } from './context/TheGlobalFuelContext';\n\n// Eager — primary landing\nimport { DashboardPage } from './pages/dashboard/DashboardPage';\n\n// Registry — Assets, Production, Reserves\nconst AssetsPage = lazy(() =>\n import('./pages/assets/AssetsPage').then((m) => ({ default: m.AssetsPage }))\n);\nconst AssetDetailPage = lazy(() =>\n import('./pages/assets/AssetDetailPage').then((m) => ({ default: m.AssetDetailPage }))\n);\nconst ProductionPage = lazy(() =>\n import('./pages/production/ProductionPage').then((m) => ({ default: m.ProductionPage }))\n);\nconst ReservesPage = lazy(() =>\n import('./pages/reserves/ReservesPage').then((m) => ({ default: m.ReservesPage }))\n);\n\n// Commerce — Offtake Contracts, Shipments, Inventory\nconst ContractsPage = lazy(() =>\n import('./pages/contracts/ContractsPage').then((m) => ({ default: m.ContractsPage }))\n);\nconst ContractDetailPage = lazy(() =>\n import('./pages/contracts/ContractDetailPage').then((m) => ({ default: m.ContractDetailPage }))\n);\nconst ShipmentsPage = lazy(() =>\n import('./pages/shipments/ShipmentsPage').then((m) => ({ default: m.ShipmentsPage }))\n);\nconst InventoryPage = lazy(() =>\n import('./pages/inventory/InventoryPage').then((m) => ({ default: m.InventoryPage }))\n);\n\n// Sustainability — Emissions, Compliance\nconst EmissionsPage = lazy(() =>\n import('./pages/emissions/EmissionsPage').then((m) => ({ default: m.EmissionsPage }))\n);\nconst CompliancePage = lazy(() =>\n import('./pages/compliance/CompliancePage').then((m) => ({ default: m.CompliancePage }))\n);\nconst ProvenancePage = lazy(() =>\n import('./pages/provenance/ProvenancePage').then((m) => ({ default: m.ProvenancePage }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <Spinner size=\"lg\" />\n </div>\n);\n\nfunction FeatureDisabledFallback() {\n return (\n <div className=\"flex min-h-[400px] flex-col items-center justify-center gap-3 text-center p-6\">\n <p className=\"text-sm font-medium text-text-secondary\">This feature is not available.</p>\n <p className=\"text-xs text-text-tertiary\">Ask your workspace admin to enable it.</p>\n </div>\n );\n}\n\nfunction gated(flag: string, element: ReactNode): React.ReactElement {\n return (\n <FeatureGate flag={flag} defaultValue={true} fallback={<FeatureDisabledFallback />}>\n {element}\n </FeatureGate>\n );\n}\n\nexport const TheGlobalFuelRoutes: FC = () => {\n const { basePath, isStandalone } = useTheGlobalFuel();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the current path matches basePath (integrated mode).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n <Route index element={gated('theglobalfuel.dashboard', <DashboardPage />)} />\n\n <Route path=\"assets\" element={gated('theglobalfuel.assets', <AssetsPage />)} />\n <Route path=\"assets/:id\" element={gated('theglobalfuel.assets', <AssetDetailPage />)} />\n\n <Route\n path=\"production\"\n element={gated('theglobalfuel.production', <ProductionPage />)}\n />\n\n <Route path=\"reserves\" element={gated('theglobalfuel.reserves', <ReservesPage />)} />\n\n <Route path=\"contracts\" element={gated('theglobalfuel.contracts', <ContractsPage />)} />\n <Route\n path=\"contracts/:id\"\n element={gated('theglobalfuel.contracts', <ContractDetailPage />)}\n />\n\n <Route path=\"shipments\" element={gated('theglobalfuel.shipments', <ShipmentsPage />)} />\n\n <Route path=\"inventory\" element={gated('theglobalfuel.inventory', <InventoryPage />)} />\n\n <Route path=\"emissions\" element={gated('theglobalfuel.emissions', <EmissionsPage />)} />\n\n <Route\n path=\"compliance\"\n element={gated('theglobalfuel.compliance', <CompliancePage />)}\n />\n\n <Route\n path=\"provenance\"\n element={gated('theglobalfuel.provenance', <ProvenancePage />)}\n />\n\n {/* Unknown subpaths (e.g. /theglobalfuel/dashboard, stale bookmarks) canonicalize\n to the product root (the dashboard index). An absolute target avoids the\n self-referential `to=\"\"` loop that renders blank inside the nested Routes. */}\n <Route path=\"*\" element={<Navigate to={normalizedBasePath || '/'} replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAkBA,IAAM,IAAa,QACjB,OAAO,gCAA6B,MAAM,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAC7E,EACK,IAAkB,QACtB,OAAO,qCAAkC,MAAM,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CACvF,EACK,IAAiB,QACrB,OAAO,wCAAqC,MAAM,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CACzF,EACK,IAAe,QACnB,OAAO,oCAAiC,MAAM,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CACnF,EAGK,IAAgB,QACpB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CACtF,EACK,IAAqB,QACzB,OAAO,2CAAwC,MAAM,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAChG,EACK,IAAgB,QACpB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CACtF,EACK,IAAgB,QACpB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CACtF,EAGK,IAAgB,QACpB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CACtF,EACK,IAAiB,QACrB,OAAO,wCAAqC,MAAM,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CACzF,EACK,IAAiB,QACrB,OAAO,wCAAqC,MAAM,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CACzF,EAEK,UACJ,kBAAC,OAAD;CAAK,WAAU;WACb,kBAAC,GAAD,EAAS,MAAK,MAAO,CAAA;CACjB,CAAA;AAGR,SAAS,IAA0B;AACjC,QACE,kBAAC,OAAD;EA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,kBAAC,GAAD;KACE,MAAK;KACL,SAAS,EAAM,2BAA2B,kBAAC,GAAD,EAAsB,CAAA,CAAC;KACjE,CAAA;IAEF,kBAAC,GAAD;KAAO,MAAK;KAAY,SAAS,EAAM,2BAA2B,kBAAC,GAAD,EAAiB,CAAA,CAAC;KAAI,CAAA;IAExF,kBAAC,GAAD;KAAO,MAAK;KAAY,SAAS,EAAM,2BAA2B,kBAAC,GAAD,EAAiB,CAAA,CAAC;KAAI,CAAA;IAExF,kBAAC,GAAD;KAAO,MAAK;KAAY,SAAS,EAAM,2BAA2B,kBAAC,GAAD,EAAiB,CAAA,CAAC;KAAI,CAAA;IAExF,kBAAC,GAAD;KACE,MAAK;KACL,SAAS,EAAM,4BAA4B,kBAAC,GAAD,EAAkB,CAAA,CAAC;KAC9D,CAAA;IAEF,kBAAC,GAAD;KACE,MAAK;KACL,SAAS,EAAM,4BAA4B,kBAAC,GAAD,EAAkB,CAAA,CAAC;KAC9D,CAAA;IAKF,kBAAC,GAAD;KAAO,MAAK;KAAI,SAAS,kBAAC,GAAD;MAAU,IAAI,KAAsB;MAAK,SAAA;MAAU,CAAA;KAAI,CAAA;IACzE,EAAA,CAAA;GACA,CAAA;EACP,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface Column<T> {
|
|
4
|
+
key: string;
|
|
5
|
+
header: ReactNode;
|
|
6
|
+
render: (row: T) => ReactNode;
|
|
7
|
+
align?: 'left' | 'right' | 'center';
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Hide below the `md` breakpoint for a mobile-friendly layout. */
|
|
10
|
+
hideOnMobile?: boolean;
|
|
11
|
+
/** Provide to make this column click-sortable (returns a comparable value). */
|
|
12
|
+
sortValue?: (row: T) => string | number;
|
|
13
|
+
}
|
|
14
|
+
interface DataTableProps<T> {
|
|
15
|
+
columns: Column<T>[];
|
|
16
|
+
rows: T[];
|
|
17
|
+
rowKey: (row: T) => string;
|
|
18
|
+
onRowClick?: (row: T) => void;
|
|
19
|
+
/** Accessible label for a clickable row (e.g. `(a) => `Open ${a.name}``). */
|
|
20
|
+
rowLabel?: (row: T) => string;
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Default sort: a column key + direction. */
|
|
23
|
+
defaultSort?: {
|
|
24
|
+
key: string;
|
|
25
|
+
dir: 'asc' | 'desc';
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function DataTable<T>({ columns, rows, rowKey, onRowClick, rowLabel, className, defaultSort, }: DataTableProps<T>): import("react").JSX.Element;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=DataTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/DataTable.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKrF,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;CACzC;AAED,UAAU,cAAc,CAAC,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC;CACpD;AAoBD,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAC3B,OAAO,EACP,IAAI,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,SAAS,EACT,WAAW,GACZ,EAAE,cAAc,CAAC,CAAC,CAAC,+BA+MnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","names":[],"sources":["../../../src/theglobalfuel/components/DataTable.tsx"],"sourcesContent":["/**\n * DataTable — a lightweight, semantic-token table for list pages.\n * @module theglobalfuel/components\n *\n * Deliberately minimal (no external table lib). Columns declare a header, a\n * render fn, optional alignment, and optionally a `sortValue` to make the column\n * click-sortable.\n *\n * Responsive strategy:\n * - At `md` and up it renders a horizontally-scrollable table wrapped in a\n * GlassCard (the classic desktop layout).\n * - Below `md` it renders each row as a native-feeling, stacked \"card\": the\n * first column becomes the card's headline (with a chevron affordance when\n * the row is clickable) and the remaining columns render as label→value\n * pairs. Sort + click behavior carry over, so every list page is usable on\n * mobile with zero page-level changes.\n */\n\nimport { useId, useMemo, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { ChevronUp, ChevronDown, ChevronsUpDown, ChevronRight } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\nexport interface Column<T> {\n key: string;\n header: ReactNode;\n render: (row: T) => ReactNode;\n align?: 'left' | 'right' | 'center';\n className?: string;\n /** Hide below the `md` breakpoint for a mobile-friendly layout. */\n hideOnMobile?: boolean;\n /** Provide to make this column click-sortable (returns a comparable value). */\n sortValue?: (row: T) => string | number;\n}\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n rows: T[];\n rowKey: (row: T) => string;\n onRowClick?: (row: T) => void;\n /** Accessible label for a clickable row (e.g. `(a) => `Open ${a.name}``). */\n rowLabel?: (row: T) => string;\n className?: string;\n /** Default sort: a column key + direction. */\n defaultSort?: { key: string; dir: 'asc' | 'desc' };\n}\n\n/** Enter/Space activate — only when the event originates on the element itself\n * (not on an interactive descendant like a Select or Button inside a cell). */\nconst activateOnKey = (e: KeyboardEvent, fn: () => void) => {\n if (e.target !== e.currentTarget) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n fn();\n }\n};\n\nconst alignClass = {\n left: 'text-left',\n right: 'text-right',\n center: 'text-center',\n} as const;\n\ntype Sort = { key: string; dir: 'asc' | 'desc' };\n\nexport function DataTable<T>({\n columns,\n rows,\n rowKey,\n onRowClick,\n rowLabel,\n className,\n defaultSort,\n}: DataTableProps<T>) {\n const [sort, setSort] = useState<Sort | null>(defaultSort ?? null);\n const sortSelectId = useId();\n\n const sortedRows = useMemo(() => {\n if (!sort) return rows;\n const col = columns.find((c) => c.key === sort.key);\n if (!col?.sortValue) return rows;\n const dir = sort.dir === 'asc' ? 1 : -1;\n return [...rows].sort((a, b) => {\n const va = col.sortValue!(a);\n const vb = col.sortValue!(b);\n if (va < vb) return -1 * dir;\n if (va > vb) return 1 * dir;\n return 0;\n });\n }, [rows, sort, columns]);\n\n const toggleSort = (key: string) => {\n setSort((prev) =>\n prev?.key === key ? { key, dir: prev.dir === 'asc' ? 'desc' : 'asc' } : { key, dir: 'asc' }\n );\n };\n\n const flipDir = () =>\n setSort((prev) => (prev ? { key: prev.key, dir: prev.dir === 'asc' ? 'desc' : 'asc' } : prev));\n\n const sortableColumns = useMemo(() => columns.filter((c) => c.sortValue), [columns]);\n\n const rowInteractive = (row: T) =>\n onRowClick\n ? {\n role: 'button' as const,\n tabIndex: 0,\n 'aria-label': rowLabel?.(row),\n onClick: () => onRowClick(row),\n onKeyDown: (e: KeyboardEvent) => activateOnKey(e, () => onRowClick(row)),\n }\n : {};\n\n const [headCol, ...restCols] = columns;\n\n return (\n <div className={className}>\n {/* ── md and up: full table ─────────────────────────────────────── */}\n <GlassCard treatment=\"plain\" className=\"hidden overflow-hidden md:block\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"border-b border-border-seam\">\n {columns.map((col) => {\n const sortable = Boolean(col.sortValue);\n const active = sort?.key === col.key;\n return (\n <th\n key={col.key}\n scope=\"col\"\n role={sortable ? 'button' : undefined}\n tabIndex={sortable ? 0 : undefined}\n onClick={sortable ? () => toggleSort(col.key) : undefined}\n onKeyDown={\n sortable ? (e) => activateOnKey(e, () => toggleSort(col.key)) : undefined\n }\n aria-sort={\n active ? (sort?.dir === 'asc' ? 'ascending' : 'descending') : undefined\n }\n className={cn(\n 'px-4 py-3 font-medium text-text-secondary whitespace-nowrap',\n alignClass[col.align ?? 'left'],\n col.hideOnMobile && 'hidden md:table-cell',\n sortable &&\n 'cursor-pointer select-none hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n <span\n className={cn(\n 'inline-flex items-center gap-1',\n col.align === 'right' && 'flex-row-reverse'\n )}\n >\n {col.header}\n {sortable &&\n (active ? (\n sort?.dir === 'asc' ? (\n <ChevronUp className=\"h-3.5 w-3.5 text-accent\" />\n ) : (\n <ChevronDown className=\"h-3.5 w-3.5 text-accent\" />\n )\n ) : (\n <ChevronsUpDown className=\"h-3.5 w-3.5 opacity-40\" />\n ))}\n </span>\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {sortedRows.map((row) => (\n <tr\n key={rowKey(row)}\n {...rowInteractive(row)}\n className={cn(\n 'group border-b border-border-seam/60 last:border-0',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-bg-sunken/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n 'px-4 py-3 text-text-primary align-middle',\n alignClass[col.align ?? 'left'],\n col.hideOnMobile && 'hidden md:table-cell',\n col.className\n )}\n >\n {col.render(row)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </GlassCard>\n\n {/* ── below md: stacked cards ───────────────────────────────────── */}\n <div className=\"space-y-2.5 md:hidden\">\n {sortableColumns.length > 0 && (\n <div className=\"flex items-center justify-end gap-1.5 px-0.5\">\n <label htmlFor={sortSelectId} className=\"text-xs text-text-tertiary\">\n Sort\n </label>\n <select\n id={sortSelectId}\n value={sort?.key ?? ''}\n onChange={(e) =>\n setSort(\n e.target.value ? { key: e.target.value, dir: sort?.dir ?? 'asc' } : null\n )\n }\n className=\"rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-xs text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"\">Default order</option>\n {sortableColumns.map((col) => (\n <option key={col.key} value={col.key}>\n {typeof col.header === 'string' ? col.header : col.key}\n </option>\n ))}\n </select>\n {sort && (\n <button\n type=\"button\"\n onClick={flipDir}\n aria-label={sort.dir === 'asc' ? 'Sort ascending' : 'Sort descending'}\n className=\"inline-flex h-7 w-7 items-center justify-center rounded-md border border-border-subtle bg-bg-surface text-text-secondary transition-colors hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n {sort.dir === 'asc' ? (\n <ChevronUp className=\"h-4 w-4\" />\n ) : (\n <ChevronDown className=\"h-4 w-4\" />\n )}\n </button>\n )}\n </div>\n )}\n\n {sortedRows.map((row) => (\n <div\n key={rowKey(row)}\n {...rowInteractive(row)}\n className={cn(\n 'rounded-xl border border-border-subtle bg-bg-surface p-4',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-bg-sunken/40 active:bg-bg-sunken/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n {headCol && (\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1\">{headCol.render(row)}</div>\n {onRowClick && (\n <ChevronRight\n className=\"mt-0.5 h-4 w-4 shrink-0 text-text-tertiary\"\n aria-hidden\n />\n )}\n </div>\n )}\n {restCols.length > 0 && (\n <dl className=\"mt-3 grid grid-cols-2 gap-x-4 gap-y-2.5 border-t border-border-subtle/70 pt-3\">\n {restCols.map((col) => (\n <div key={col.key} className=\"min-w-0\">\n <dt className=\"text-[11px] uppercase tracking-wide text-text-tertiary\">\n {col.header}\n </dt>\n <dd className=\"mt-0.5 text-sm text-text-primary break-words\">\n {col.render(row)}\n </dd>\n </div>\n ))}\n </dl>\n )}\n </div>\n ))}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAiDA,IAAM,KAAiB,GAAkB,MAAmB;AACtD,GAAE,WAAW,EAAE,kBACf,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,GAAI;GAIF,IAAa;CACjB,MAAM;CACN,OAAO;CACP,QAAQ;CACT;AAID,SAAgB,EAAa,EAC3B,YACA,SACA,WACA,eACA,aACA,cACA,kBACoB;CACpB,IAAM,CAAC,GAAM,KAAW,EAAsB,KAAe,KAAK,EAC5D,IAAe,GAAO,EAEtB,IAAa,QAAc;AAC/B,MAAI,CAAC,EAAM,QAAO;EAClB,IAAM,IAAM,EAAQ,MAAM,MAAM,EAAE,QAAQ,EAAK,IAAI;AACnD,MAAI,CAAC,GAAK,UAAW,QAAO;EAC5B,IAAM,IAAM,EAAK,QAAQ,QAAQ,IAAI;AACrC,SAAO,CAAC,GAAG,EAAK,CAAC,MAAM,GAAG,MAAM;GAC9B,IAAM,IAAK,EAAI,UAAW,EAAE,EACtB,IAAK,EAAI,UAAW,EAAE;AAG5B,UAFI,IAAK,IA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,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,cAAY,EAAK,QAAQ,QAAQ,mBAAmB;MACpD,WAAU;gBAET,EAAK,QAAQ,QACZ,kBAAC,GAAD,EAAW,WAAU,WAAY,CAAA,GAEjC,kBAAC,GAAD,EAAa,WAAU,WAAY,CAAA;MAE9B,CAAA;KAEP;OAGP,EAAW,KAAK,MACf,kBAAC,OAAD;IAEE,GAAI,EAAe,EAAI;IACvB,WAAW,EACT,4DACA,KACE,6KACH;cAPH,CASG,KACC,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,OAAD;MAAK,WAAU;gBAAkB,EAAQ,OAAO,EAAI;MAAO,CAAA,EAC1D,KACC,kBAAC,GAAD;MACE,WAAU;MACV,eAAA;MACA,CAAA,CAEA;QAEP,EAAS,SAAS,KACjB,kBAAC,MAAD;KAAI,WAAU;eACX,EAAS,KAAK,MACb,kBAAC,OAAD;MAAmB,WAAU;gBAA7B,CACE,kBAAC,MAAD;OAAI,WAAU;iBACX,EAAI;OACF,CAAA,EACL,kBAAC,MAAD;OAAI,WAAU;iBACX,EAAI,OAAO,EAAI;OACb,CAAA,CACD;QAPI,EAAI,IAOR,CACN;KACC,CAAA,CAEH;MAjCC,EAAO,EAAI,CAiCZ,CACN,CACE;KACF"}
|
|
1
|
+
{"version":3,"file":"DataTable.js","names":[],"sources":["../../../src/theglobalfuel/components/DataTable.tsx"],"sourcesContent":["/**\n * DataTable — a lightweight, semantic-token table for list pages.\n * @module theglobalfuel/components\n *\n * Deliberately minimal (no external table lib). Columns declare a header, a\n * render fn, optional alignment, and optionally a `sortValue` to make the column\n * click-sortable.\n *\n * Responsive strategy:\n * - At `md` and up it renders a horizontally-scrollable table wrapped in a\n * GlassCard (the classic desktop layout).\n * - Below `md` it renders each row as a native-feeling, stacked \"card\": the\n * first column becomes the card's headline (with a chevron affordance when\n * the row is clickable) and the remaining columns render as label→value\n * pairs. Sort + click behavior carry over, so every list page is usable on\n * mobile with zero page-level changes.\n */\n\nimport { useId, useMemo, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport { ChevronUp, ChevronDown, ChevronsUpDown, ChevronRight } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\nexport interface Column<T> {\n key: string;\n header: ReactNode;\n render: (row: T) => ReactNode;\n align?: 'left' | 'right' | 'center';\n className?: string;\n /** Hide below the `md` breakpoint for a mobile-friendly layout. */\n hideOnMobile?: boolean;\n /** Provide to make this column click-sortable (returns a comparable value). */\n sortValue?: (row: T) => string | number;\n}\n\ninterface DataTableProps<T> {\n columns: Column<T>[];\n rows: T[];\n rowKey: (row: T) => string;\n onRowClick?: (row: T) => void;\n /** Accessible label for a clickable row (e.g. `(a) => `Open ${a.name}``). */\n rowLabel?: (row: T) => string;\n className?: string;\n /** Default sort: a column key + direction. */\n defaultSort?: { key: string; dir: 'asc' | 'desc' };\n}\n\n/** Enter/Space activate — only when the event originates on the element itself\n * (not on an interactive descendant like a Select or Button inside a cell). */\nconst activateOnKey = (e: KeyboardEvent, fn: () => void) => {\n if (e.target !== e.currentTarget) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n fn();\n }\n};\n\nconst alignClass = {\n left: 'text-left',\n right: 'text-right',\n center: 'text-center',\n} as const;\n\ntype Sort = { key: string; dir: 'asc' | 'desc' };\n\nexport function DataTable<T>({\n columns,\n rows,\n rowKey,\n onRowClick,\n rowLabel,\n className,\n defaultSort,\n}: DataTableProps<T>) {\n const [sort, setSort] = useState<Sort | null>(defaultSort ?? null);\n const sortSelectId = useId();\n\n const sortedRows = useMemo(() => {\n if (!sort) return rows;\n const col = columns.find((c) => c.key === sort.key);\n if (!col?.sortValue) return rows;\n const dir = sort.dir === 'asc' ? 1 : -1;\n return [...rows].sort((a, b) => {\n const va = col.sortValue!(a);\n const vb = col.sortValue!(b);\n if (va < vb) return -1 * dir;\n if (va > vb) return 1 * dir;\n return 0;\n });\n }, [rows, sort, columns]);\n\n const toggleSort = (key: string) => {\n setSort((prev) =>\n prev?.key === key ? { key, dir: prev.dir === 'asc' ? 'desc' : 'asc' } : { key, dir: 'asc' }\n );\n };\n\n const flipDir = () =>\n setSort((prev) => (prev ? { key: prev.key, dir: prev.dir === 'asc' ? 'desc' : 'asc' } : prev));\n\n const sortableColumns = useMemo(() => columns.filter((c) => c.sortValue), [columns]);\n\n const rowInteractive = (row: T) =>\n onRowClick\n ? {\n role: 'button' as const,\n tabIndex: 0,\n 'aria-label': rowLabel?.(row),\n onClick: () => onRowClick(row),\n onKeyDown: (e: KeyboardEvent) => activateOnKey(e, () => onRowClick(row)),\n }\n : {};\n\n const [headCol, ...restCols] = columns;\n\n return (\n <div className={className}>\n {/* ── md and up: full table ─────────────────────────────────────── */}\n <GlassCard treatment=\"plain\" className=\"hidden overflow-hidden md:block\">\n <div className=\"overflow-x-auto\">\n <table className=\"w-full border-collapse text-sm\">\n <thead>\n <tr className=\"border-b border-border-seam\">\n {columns.map((col) => {\n const sortable = Boolean(col.sortValue);\n const active = sort?.key === col.key;\n return (\n <th\n key={col.key}\n scope=\"col\"\n role={sortable ? 'button' : undefined}\n tabIndex={sortable ? 0 : undefined}\n onClick={sortable ? () => toggleSort(col.key) : undefined}\n onKeyDown={\n sortable ? (e) => activateOnKey(e, () => toggleSort(col.key)) : undefined\n }\n aria-sort={\n active ? (sort?.dir === 'asc' ? 'ascending' : 'descending') : undefined\n }\n className={cn(\n 'px-4 py-3 font-medium text-text-secondary whitespace-nowrap',\n alignClass[col.align ?? 'left'],\n col.hideOnMobile && 'hidden md:table-cell',\n sortable &&\n 'cursor-pointer select-none hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n <span\n className={cn(\n 'inline-flex items-center gap-1',\n col.align === 'right' && 'flex-row-reverse'\n )}\n >\n {col.header}\n {sortable &&\n (active ? (\n sort?.dir === 'asc' ? (\n <ChevronUp className=\"h-3.5 w-3.5 text-accent\" />\n ) : (\n <ChevronDown className=\"h-3.5 w-3.5 text-accent\" />\n )\n ) : (\n <ChevronsUpDown className=\"h-3.5 w-3.5 opacity-40\" />\n ))}\n </span>\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {sortedRows.map((row) => (\n <tr\n key={rowKey(row)}\n {...rowInteractive(row)}\n className={cn(\n 'group border-b border-border-seam/60 last:border-0',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-bg-sunken/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n {columns.map((col) => (\n <td\n key={col.key}\n className={cn(\n 'px-4 py-3 text-text-primary align-middle',\n alignClass[col.align ?? 'left'],\n col.hideOnMobile && 'hidden md:table-cell',\n col.className\n )}\n >\n {col.render(row)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </GlassCard>\n\n {/* ── below md: stacked cards ───────────────────────────────────── */}\n <div className=\"space-y-2.5 md:hidden\">\n {sortableColumns.length > 0 && (\n <div className=\"flex items-center justify-end gap-1.5 px-0.5\">\n <label htmlFor={sortSelectId} className=\"text-xs text-text-tertiary\">\n Sort\n </label>\n <select\n id={sortSelectId}\n value={sort?.key ?? ''}\n onChange={(e) =>\n setSort(e.target.value ? { key: e.target.value, dir: sort?.dir ?? 'asc' } : null)\n }\n className=\"rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-xs text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <option value=\"\">Default order</option>\n {sortableColumns.map((col) => (\n <option key={col.key} value={col.key}>\n {typeof col.header === 'string' ? col.header : col.key}\n </option>\n ))}\n </select>\n {sort && (\n <button\n type=\"button\"\n onClick={flipDir}\n aria-label={sort.dir === 'asc' ? 'Sort ascending' : 'Sort descending'}\n className=\"inline-flex h-7 w-7 items-center justify-center rounded-md border border-border-subtle bg-bg-surface text-text-secondary transition-colors hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n >\n {sort.dir === 'asc' ? (\n <ChevronUp className=\"h-4 w-4\" />\n ) : (\n <ChevronDown className=\"h-4 w-4\" />\n )}\n </button>\n )}\n </div>\n )}\n\n {sortedRows.map((row) => (\n <div\n key={rowKey(row)}\n {...rowInteractive(row)}\n className={cn(\n 'rounded-xl border border-border-subtle bg-bg-surface p-4',\n onRowClick &&\n 'cursor-pointer transition-colors hover:bg-bg-sunken/40 active:bg-bg-sunken/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]'\n )}\n >\n {headCol && (\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0 flex-1\">{headCol.render(row)}</div>\n {onRowClick && (\n <ChevronRight\n className=\"mt-0.5 h-4 w-4 shrink-0 text-text-tertiary\"\n aria-hidden\n />\n )}\n </div>\n )}\n {restCols.length > 0 && (\n <dl className=\"mt-3 grid grid-cols-2 gap-x-4 gap-y-2.5 border-t border-border-subtle/70 pt-3\">\n {restCols.map((col) => (\n <div key={col.key} className=\"min-w-0\">\n <dt className=\"text-[11px] uppercase tracking-wide text-text-tertiary\">\n {col.header}\n </dt>\n <dd className=\"mt-0.5 text-sm text-text-primary break-words\">\n {col.render(row)}\n </dd>\n </div>\n ))}\n </dl>\n )}\n </div>\n ))}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AAiDA,IAAM,KAAiB,GAAkB,MAAmB;AACtD,GAAE,WAAW,EAAE,kBACf,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,GAAI;GAIF,IAAa;CACjB,MAAM;CACN,OAAO;CACP,QAAQ;CACT;AAID,SAAgB,EAAa,EAC3B,YACA,SACA,WACA,eACA,aACA,cACA,kBACoB;CACpB,IAAM,CAAC,GAAM,KAAW,EAAsB,KAAe,KAAK,EAC5D,IAAe,GAAO,EAEtB,IAAa,QAAc;AAC/B,MAAI,CAA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