@burdenoff/microfe-movethewheels 2026.703.3 → 2026.703.5

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 (173) hide show
  1. package/dist/{AIAssistantPage-C3cPsWt-.js → AIAssistantPage-D2gaEL1U.js} +16 -15
  2. package/dist/AnalyticsPage-DZMlEoBi.js +194 -0
  3. package/dist/CreateOrderPage-CWHx8yys.js +490 -0
  4. package/dist/CustomerDetailsPage-nR4oZ_ju.js +615 -0
  5. package/dist/CustomersPage-Bbvwvn8k.js +205 -0
  6. package/dist/DashboardPage-DrEhNf7N.js +542 -0
  7. package/dist/DataTable-CqMUD4er.js +340 -0
  8. package/dist/DocumentsCard-edDkgnJj.js +169 -0
  9. package/dist/DriverDetailsPage-whEMOWs9.js +490 -0
  10. package/dist/DriversPage-CHF2ZEzd.js +221 -0
  11. package/dist/FinancePage-Dn9GrW-1.js +175 -0
  12. package/dist/{FleetPage-DqkFi3s3.js → FleetPage-CrtGPy-p.js} +36 -35
  13. package/dist/{FormError-BlOjnXOq.js → FormError-BKcb_wT-.js} +1 -1
  14. package/dist/{ImportExportPage-DKJRCezl.js → ImportExportPage-WYdwZomZ.js} +52 -72
  15. package/dist/InventoryPage-l5A1f753.js +259 -0
  16. package/dist/LiveTrackingPage-DhEaNKZ4.js +429 -0
  17. package/dist/MarketplacePage-B9RYOb1Y.js +426 -0
  18. package/dist/MetricCard-y3bWHKUQ.js +191 -0
  19. package/dist/Notice-DOO-tjpV.js +46 -0
  20. package/dist/OrderDetailsPage-CwYHwk1K.js +584 -0
  21. package/dist/OrdersListPage-DhZJoQeI.js +386 -0
  22. package/dist/{PageLayout-D4LDHJJq.js → PageLayout-BniRJaQ6.js} +1 -1
  23. package/dist/{ProductDetailsPage-C9uOiYLp.js → ProductDetailsPage-1Gm9JKy0.js} +56 -56
  24. package/dist/ProductsPage-C8sn-1tN.js +186 -0
  25. package/dist/ReportsPage-D1tb0dcz.js +377 -0
  26. package/dist/RouteDetailsPage-CkMyR9b_.js +610 -0
  27. package/dist/{RoutesPage-DMfoicM1.js → RoutesPage-QkENzsE5.js} +58 -47
  28. package/dist/{SettingsPage-Bn-v0mbQ.js → SettingsPage-DV3_tU_X.js} +16 -38
  29. package/dist/Sparkline-K2RMJ58u.js +16729 -0
  30. package/dist/{StatusBadge-BZurYHMy.js → StatusBadge-BNHXYvZx.js} +7 -7
  31. package/dist/TrackingPage-BZrg4RCu.js +368 -0
  32. package/dist/VehicleDetailsPage-D-8XPZ2G.js +393 -0
  33. package/dist/VehiclesPage-D5BELbtM.js +184 -0
  34. package/dist/{WarehouseDetailsPage-L_6sWigM.js → WarehouseDetailsPage-Cmg-8Frn.js} +70 -70
  35. package/dist/WarehousesPage-C1Y1M867.js +182 -0
  36. package/dist/{arrow-left-n48Y-Wis.js → arrow-left-ClW4Isj7.js} +1 -1
  37. package/dist/arrow-right-CmKOmIkh.js +11 -0
  38. package/dist/arrow-up-BJijRLAZ.js +17 -0
  39. package/dist/{box-D9Pal4HM.js → box-BT3NsRQP.js} +1 -1
  40. package/dist/boxes-B_OGvQiW.js +54 -0
  41. package/dist/{chart-column-BFIJysDR.js → chart-column-DQTTdUPk.js} +1 -1
  42. package/dist/charts-Tj_PPTfA.js +2018 -0
  43. package/dist/chevron-left-B1rZyWWb.js +8 -0
  44. package/dist/{chevron-right-EMIIyyJ1.js → chevron-right-BIcwUJZq.js} +1 -1
  45. package/dist/chunk-BdsCSvBP.js +20 -0
  46. package/dist/{circle-alert-iY24lSlp.js → circle-alert-CNkuDNc6.js} +1 -1
  47. package/dist/circle-check-Cs1OVjtV.js +13 -0
  48. package/dist/{circle-check-big-w0TrLKMF.js → circle-check-big-C-p4eNwn.js} +1 -1
  49. package/dist/{clock-DJZtdl8u.js → clock-dRGG4rkF.js} +1 -1
  50. package/dist/{dollar-sign-CgKQRz_e.js → dollar-sign-B6RoYHHz.js} +1 -1
  51. package/dist/{download-DRXxoiQR.js → download-DP04iWTd.js} +1 -1
  52. package/dist/{file-text-DWWY6_f5.js → file-text-BuDx4hZp.js} +1 -1
  53. package/dist/{filter-DloLC2eE.js → filter-BD483_8g.js} +1 -1
  54. package/dist/{wrench-CANXWxF-.js → fuel-DLH1ag04.js} +3 -6
  55. package/dist/index.css +2 -0
  56. package/dist/index.js +150 -172
  57. package/dist/{map-CkJaULb2.js → map-DNQn9fyY.js} +1 -1
  58. package/dist/{map-pin-BGiCvyCs.js → map-pin-CqN1bbT1.js} +1 -1
  59. package/dist/mapMarkers-NCV9MRKR.js +28 -0
  60. package/dist/maps-yzLqiK_C.js +5070 -0
  61. package/dist/{navigation-D36prnAn.js → navigation-CgGUt2tR.js} +1 -1
  62. package/dist/{package-BChUzpJS.js → package-DmRF7iQD.js} +1 -1
  63. package/dist/{phone-Ac9s3mo_.js → phone-Cl32EXKW.js} +1 -1
  64. package/dist/{plus-Z76q-FZm.js → plus-DlANgOFx.js} +1 -1
  65. package/dist/{refresh-cw-DKt6f5T6.js → refresh-cw-rW59D4b7.js} +1 -1
  66. package/dist/route-CWjPrtAN.js +22 -0
  67. package/dist/{save-CojywNhG.js → save-UDlog7hg.js} +1 -1
  68. package/dist/{search-CDGefqb3.js → search-DNIG5Ck7.js} +1 -1
  69. package/dist/{square-pen-CopE9GmB.js → square-pen-BcfB3Grd.js} +1 -1
  70. package/dist/{star-nHlLjDKR.js → star-CVZHFwDx.js} +1 -1
  71. package/dist/{store-BR9Voi5E.js → store-bwnmCK9f.js} +1 -1
  72. package/dist/{trash-2-BKhar6Hs.js → trash-2-B80G12d4.js} +1 -1
  73. package/dist/{trending-up-Dohgd4t_.js → trending-up-CH4R4KOa.js} +1 -1
  74. package/dist/{triangle-alert-i-XQL9Rd.js → triangle-alert-CmS8AUU6.js} +1 -1
  75. package/dist/{truck-C0v_hbLR.js → truck-9rLDncav.js} +1 -1
  76. package/dist/upload-DanJY1Vo.js +21 -0
  77. package/dist/{useAssistant-D4v3oxD3.js → useAssistant-CnEwkTLm.js} +11 -28
  78. package/dist/{useCustomers-BmTNGxiI.js → useCustomers-ChJao1ET.js} +30 -27
  79. package/dist/{useFleet-DKqXZ16m.js → useFleet-g5Yri0G8.js} +82 -70
  80. package/dist/{useImportExport-DHr-SWSw.js → useImportExport-MYwIT3rE.js} +1 -1
  81. package/dist/{useInventory-DkyiVY_A.js → useInventory-BSOn-R1c.js} +84 -39
  82. package/dist/{useOrders-Cfk1GLiq.js → useOrders-BSiqo61w.js} +59 -48
  83. package/dist/{useReports-CTqZr-AB.js → useReports-fWESfsF9.js} +41 -35
  84. package/dist/{useRoutes-BQWO607N.js → useRoutes-zD8Yp323.js} +50 -42
  85. package/dist/{useSettings-CkDH_-gM.js → useSettings-B1lsWeZ1.js} +6 -6
  86. package/dist/{useTracking-B-va1kO3.js → useTracking-BKG0I2ln.js} +3 -3
  87. package/dist/{user-jyFU3lXk.js → user-DU51el3m.js} +1 -1
  88. package/dist/user-check-IMhk-qkX.js +20 -0
  89. package/dist/{users-DZ-ilS6B.js → users-B8KhJBGg.js} +1 -1
  90. package/dist/{warehouse-6m5kXMLu.js → warehouse-CcMMioeY.js} +1 -1
  91. package/dist/wrench-Dg-sgH2e.js +8 -0
  92. package/dist/x-C4ObLVEa.js +11 -0
  93. package/package.json +5 -1
  94. package/src/movethewheels/components/DataTable.tsx +252 -84
  95. package/src/movethewheels/components/DocumentsCard.tsx +102 -0
  96. package/src/movethewheels/components/GlassPanel.tsx +71 -0
  97. package/src/movethewheels/components/MetricCard.tsx +171 -73
  98. package/src/movethewheels/components/Notice.tsx +61 -0
  99. package/src/movethewheels/components/StatusBadge.tsx +7 -6
  100. package/src/movethewheels/components/charts/ChartShell.tsx +78 -0
  101. package/src/movethewheels/components/charts/Sparkline.tsx +85 -0
  102. package/src/movethewheels/components/charts/StatusDonut.tsx +115 -0
  103. package/src/movethewheels/components/charts/TrendChart.tsx +179 -0
  104. package/src/movethewheels/components/charts/VolumeBar.tsx +97 -0
  105. package/src/movethewheels/components/charts/chartTokens.ts +43 -0
  106. package/src/movethewheels/components/charts/index.ts +9 -0
  107. package/src/movethewheels/components/index.ts +51 -1
  108. package/src/movethewheels/components/maps/LogisticsMap.tsx +94 -0
  109. package/src/movethewheels/components/maps/MapCanvas.tsx +118 -0
  110. package/src/movethewheels/components/maps/RouteMap.tsx +71 -0
  111. package/src/movethewheels/components/maps/TrackingMap.tsx +102 -0
  112. package/src/movethewheels/components/maps/index.ts +16 -0
  113. package/src/movethewheels/components/maps/leaflet-setup.ts +124 -0
  114. package/src/movethewheels/components/maps/map-markers.css +121 -0
  115. package/src/movethewheels/hooks/index.ts +9 -0
  116. package/src/movethewheels/hooks/useAnalytics.ts +109 -4
  117. package/src/movethewheels/hooks/useCustomers.ts +11 -4
  118. package/src/movethewheels/hooks/useEntityDocuments.ts +132 -0
  119. package/src/movethewheels/hooks/useFleet.ts +26 -7
  120. package/src/movethewheels/hooks/useInventory.ts +70 -7
  121. package/src/movethewheels/hooks/useOrders.ts +32 -2
  122. package/src/movethewheels/hooks/useReports.ts +14 -4
  123. package/src/movethewheels/hooks/useRoutes.ts +20 -3
  124. package/src/movethewheels/pages/AnalyticsPage.tsx +93 -73
  125. package/src/movethewheels/pages/CreateOrderPage.tsx +48 -20
  126. package/src/movethewheels/pages/CustomerDetailsPage.tsx +239 -33
  127. package/src/movethewheels/pages/CustomersPage.tsx +53 -28
  128. package/src/movethewheels/pages/DashboardPage.tsx +238 -12
  129. package/src/movethewheels/pages/DriverDetailsPage.tsx +17 -31
  130. package/src/movethewheels/pages/DriversPage.tsx +59 -31
  131. package/src/movethewheels/pages/FinancePage.tsx +103 -82
  132. package/src/movethewheels/pages/InventoryPage.tsx +15 -3
  133. package/src/movethewheels/pages/LiveTrackingPage.tsx +124 -16
  134. package/src/movethewheels/pages/MarketplacePage.tsx +265 -50
  135. package/src/movethewheels/pages/OrderDetailsPage.tsx +214 -10
  136. package/src/movethewheels/pages/OrdersListPage.tsx +118 -47
  137. package/src/movethewheels/pages/ProductsPage.tsx +52 -28
  138. package/src/movethewheels/pages/ReportsPage.tsx +88 -4
  139. package/src/movethewheels/pages/RouteDetailsPage.tsx +119 -19
  140. package/src/movethewheels/pages/RoutesPage.tsx +22 -6
  141. package/src/movethewheels/pages/SettingsPage.tsx +5 -21
  142. package/src/movethewheels/pages/TrackingPage.tsx +76 -6
  143. package/src/movethewheels/pages/VehicleDetailsPage.tsx +4 -34
  144. package/src/movethewheels/pages/VehiclesPage.tsx +58 -27
  145. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +1 -1
  146. package/src/movethewheels/pages/WarehousesPage.tsx +47 -36
  147. package/src/movethewheels/types/index.ts +9 -1
  148. package/src/movethewheels/utils/download.ts +62 -0
  149. package/src/movethewheels/utils/mapMarkers.ts +58 -0
  150. package/dist/AnalyticsPage-Dz6g2MvK.js +0 -215
  151. package/dist/CreateOrderPage-C5iwnjp4.js +0 -479
  152. package/dist/CustomerDetailsPage-B6nwFyLO.js +0 -406
  153. package/dist/CustomersPage-BKxMS1AV.js +0 -161
  154. package/dist/DashboardPage-BVjQi0EB.js +0 -387
  155. package/dist/DataTable-DmciIKKM.js +0 -249
  156. package/dist/DriverDetailsPage-CN3WQ0B9.js +0 -507
  157. package/dist/DriversPage-CH9rjQC-.js +0 -165
  158. package/dist/FinancePage-DEDykSOP.js +0 -158
  159. package/dist/InventoryPage-e0ze63iX.js +0 -253
  160. package/dist/LiveTrackingPage-DCX-K-LR.js +0 -379
  161. package/dist/MarketplacePage-CIQ97_zp.js +0 -247
  162. package/dist/MetricCard-BY0QrMD4.js +0 -146
  163. package/dist/OrderDetailsPage-DYiZ-9UK.js +0 -429
  164. package/dist/OrdersListPage-Cn90P1Xx.js +0 -307
  165. package/dist/ProductsPage-QJfHHpqB.js +0 -169
  166. package/dist/ReportsPage-Zp53q3_8.js +0 -284
  167. package/dist/RouteDetailsPage-DUStXSf9.js +0 -531
  168. package/dist/TrackingPage-W-jtdM3Y.js +0 -325
  169. package/dist/VehicleDetailsPage-Bceo5oz3.js +0 -410
  170. package/dist/VehiclesPage-ApKThYeG.js +0 -165
  171. package/dist/WarehousesPage-DCbXXXWE.js +0 -162
  172. package/dist/useAnalytics-DS8n0xgg.js +0 -297
  173. /package/dist/{formatters-CF2S2l1m.js → formatters-FWJDwTFv.js} +0 -0
@@ -0,0 +1,340 @@
1
+ import { A as e, B as t, F as n, G as r, H as i, I as a, K as o, L as ee, P as te, R as ne, U as s, W as c, q as l, rt as u, u as d, ut as f } from "./PageLayout-BniRJaQ6.js";
2
+ import { n as re, t as ie } from "./arrow-up-BJijRLAZ.js";
3
+ import { t as p } from "./chevron-left-B1rZyWWb.js";
4
+ import { t as m } from "./chevron-right-BIcwUJZq.js";
5
+ import { t as ae } from "./search-DNIG5Ck7.js";
6
+ import { useMemo as h, useState as g } from "react";
7
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
8
+ import { IllustratedEmptyState as y } from "@burdenoff/fe-libs/ui";
9
+ //#region node_modules/lucide-react/dist/esm/icons/arrow-up-down.js
10
+ var oe = f("ArrowUpDown", [
11
+ ["path", {
12
+ d: "m21 16-4 4-4-4",
13
+ key: "f6ql7i"
14
+ }],
15
+ ["path", {
16
+ d: "M17 20V4",
17
+ key: "1ejh1v"
18
+ }],
19
+ ["path", {
20
+ d: "m3 8 4-4 4 4",
21
+ key: "11wl7u"
22
+ }],
23
+ ["path", {
24
+ d: "M7 4v16",
25
+ key: "1glfcx"
26
+ }]
27
+ ]), b = f("ChevronsLeft", [["path", {
28
+ d: "m11 17-5-5 5-5",
29
+ key: "13zhaf"
30
+ }], ["path", {
31
+ d: "m18 17-5-5 5-5",
32
+ key: "h8a8et"
33
+ }]]), se = f("ChevronsRight", [["path", {
34
+ d: "m6 17 5-5-5-5",
35
+ key: "xnjwq"
36
+ }], ["path", {
37
+ d: "m13 17 5-5-5-5",
38
+ key: "17xmmf"
39
+ }]]);
40
+ //#endregion
41
+ //#region src/movethewheels/components/DataTable.tsx
42
+ function x({ columns: f, data: x, isLoading: ce = !1, searchable: S = !1, searchPlaceholder: le = "Search...", searchFields: C, pagination: w = !0, pageSize: T = 10, pageSizeOptions: ue = [
43
+ 10,
44
+ 25,
45
+ 50,
46
+ 100
47
+ ], onRowClick: E, rowClassName: D, emptyMessage: O = "No data found", emptyIllustration: k, emptyTitle: de, emptyDescription: fe, emptyAction: pe, className: A, getRowId: j, pageIndex: me, onPageChange: M, onPageSizeChange: he, totalItems: N, hasNextPage: ge }) {
48
+ let P = typeof M == "function", F = me ?? 0, [I, _e] = g(""), [L, R] = g(null), [z, B] = g(null), [V, H] = g(1), [U, ve] = g(T), W = P ? T : U, G = h(() => {
49
+ if (!I || !C || C.length === 0) return x;
50
+ let e = I.toLowerCase();
51
+ return x.filter((t) => C.some((n) => {
52
+ let r = t[n];
53
+ return r != null && String(r).toLowerCase().includes(e);
54
+ }));
55
+ }, [
56
+ x,
57
+ I,
58
+ C
59
+ ]), K = h(() => {
60
+ if (!L || !z) return G;
61
+ let e = f.find((e) => e.id === L);
62
+ return e?.accessorKey ? [...G].sort((t, n) => {
63
+ let r = t[e.accessorKey], i = n[e.accessorKey];
64
+ if (r == null) return 1;
65
+ if (i == null) return -1;
66
+ let a = 0;
67
+ return a = typeof r == "string" && typeof i == "string" ? r.localeCompare(i) : typeof r == "number" && typeof i == "number" ? r - i : r instanceof Date && i instanceof Date ? r.getTime() - i.getTime() : String(r).localeCompare(String(i)), z === "asc" ? a : -a;
68
+ }) : G;
69
+ }, [
70
+ G,
71
+ L,
72
+ z,
73
+ f
74
+ ]), q = h(() => {
75
+ if (!w || P) return K;
76
+ let e = (V - 1) * U;
77
+ return K.slice(e, e + U);
78
+ }, [
79
+ K,
80
+ V,
81
+ U,
82
+ w,
83
+ P
84
+ ]), J = Math.max(1, Math.ceil(K.length / U)), Y = typeof N == "number", X = Y ? Math.max(1, Math.ceil(N / W)) : void 0, ye = (e) => {
85
+ L === e ? z === "asc" ? B("desc") : z === "desc" && (R(null), B(null)) : (R(e), B("asc"));
86
+ }, be = (e) => L === e ? _(z === "asc" ? ie : re, { className: "w-4 h-4 text-primary" }) : /* @__PURE__ */ _(oe, { className: "w-4 h-4 text-text-secondary/50" }), Z = (e, t) => {
87
+ if (t.cell) return t.cell(e);
88
+ if (t.accessorKey) {
89
+ let n = e[t.accessorKey];
90
+ return n == null ? "-" : n instanceof Date ? n.toLocaleDateString() : String(n);
91
+ }
92
+ return "-";
93
+ };
94
+ if (ce) return /* @__PURE__ */ v("div", {
95
+ className: u("space-y-4", A),
96
+ children: [
97
+ S && /* @__PURE__ */ _("div", {
98
+ className: "flex items-center gap-4",
99
+ children: /* @__PURE__ */ _(t, { className: "h-10 w-64" })
100
+ }),
101
+ /* @__PURE__ */ _("div", {
102
+ className: "hidden md:block rounded-card border border-border-seam bg-bg-surface shadow-elevation-1",
103
+ children: /* @__PURE__ */ v(i, { children: [/* @__PURE__ */ _(o, { children: /* @__PURE__ */ _(l, { children: f.map((e) => /* @__PURE__ */ _(r, { children: /* @__PURE__ */ _(t, { className: "h-4 w-20 motion-safe:animate-vc-shimmer" }) }, e.id)) }) }), /* @__PURE__ */ _(s, { children: Array.from({ length: 5 }).map((e, n) => /* @__PURE__ */ _(l, { children: f.map((e) => /* @__PURE__ */ _(c, { children: /* @__PURE__ */ _(t, { className: "h-4 w-full max-w-[100px] motion-safe:animate-vc-shimmer" }) }, e.id)) }, n)) })] })
104
+ }),
105
+ /* @__PURE__ */ _("div", {
106
+ className: "md:hidden space-y-3",
107
+ children: Array.from({ length: 4 }).map((e, n) => /* @__PURE__ */ v("div", {
108
+ className: "rounded-card border border-border-seam bg-bg-surface p-4 shadow-elevation-1",
109
+ children: [/* @__PURE__ */ _(t, { className: "h-4 w-2/3 mb-2 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ _(t, { className: "h-4 w-1/2 motion-safe:animate-vc-shimmer" })]
110
+ }, n))
111
+ })
112
+ ]
113
+ });
114
+ let Q = q.length === 0, $ = () => k ? I ? /* @__PURE__ */ _(y, {
115
+ illustration: "empty-search",
116
+ title: "No matches",
117
+ description: `Nothing matches “${I}”. Try a different search.`
118
+ }) : /* @__PURE__ */ _(y, {
119
+ illustration: k,
120
+ title: de ?? O,
121
+ description: fe,
122
+ action: pe
123
+ }) : /* @__PURE__ */ _("p", {
124
+ className: "text-text-secondary",
125
+ children: O
126
+ }), xe = w && (P ? K.length > 0 || F > 0 : K.length > 0);
127
+ return /* @__PURE__ */ v("div", {
128
+ className: u("space-y-4", A),
129
+ children: [
130
+ S && /* @__PURE__ */ _("div", {
131
+ className: "flex items-center gap-4",
132
+ children: /* @__PURE__ */ v("div", {
133
+ className: "relative flex-1 max-w-sm",
134
+ children: [/* @__PURE__ */ _(ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-text-secondary" }), /* @__PURE__ */ _(e, {
135
+ placeholder: le,
136
+ value: I,
137
+ onChange: (e) => {
138
+ _e(e.target.value), H(1);
139
+ },
140
+ className: "pl-9"
141
+ })]
142
+ })
143
+ }),
144
+ /* @__PURE__ */ _("div", {
145
+ className: "hidden md:block overflow-x-auto rounded-card border border-border-seam bg-bg-surface shadow-elevation-1",
146
+ children: /* @__PURE__ */ v(i, { children: [/* @__PURE__ */ _(o, { children: /* @__PURE__ */ _(l, { children: f.map((e) => /* @__PURE__ */ _(r, {
147
+ className: u(e.sortable && "cursor-pointer select-none hover:bg-bg-sunken/50", e.headerClassName),
148
+ onClick: () => e.sortable && ye(e.id),
149
+ children: /* @__PURE__ */ v("div", {
150
+ className: "flex items-center gap-2",
151
+ children: [e.header, e.sortable && be(e.id)]
152
+ })
153
+ }, e.id)) }) }), /* @__PURE__ */ _(s, { children: Q ? /* @__PURE__ */ _(l, { children: /* @__PURE__ */ _(c, {
154
+ colSpan: f.length,
155
+ className: "py-8 text-center",
156
+ children: $()
157
+ }) }) : q.map((e, t) => {
158
+ let n = j ? j(e) : t, r = typeof D == "function" ? D(e) : D;
159
+ return /* @__PURE__ */ _(l, {
160
+ className: u(E && "cursor-pointer hover:bg-bg-sunken/50", r),
161
+ onClick: () => E?.(e),
162
+ children: f.map((t) => /* @__PURE__ */ _(c, {
163
+ className: t.className,
164
+ children: Z(e, t)
165
+ }, t.id))
166
+ }, n);
167
+ }) })] })
168
+ }),
169
+ /* @__PURE__ */ _("div", {
170
+ className: "md:hidden space-y-3",
171
+ children: Q ? /* @__PURE__ */ _("div", {
172
+ className: "rounded-card border border-border-seam bg-bg-surface p-6 text-center shadow-elevation-1",
173
+ children: $()
174
+ }) : q.map((e, t) => {
175
+ let n = j ? j(e) : t, r = typeof D == "function" ? D(e) : D;
176
+ return /* @__PURE__ */ _("div", {
177
+ role: E ? "button" : void 0,
178
+ tabIndex: E ? 0 : void 0,
179
+ className: u("rounded-card border border-border-seam bg-bg-surface p-4 shadow-elevation-1", E && "cursor-pointer hover:bg-bg-sunken/50", r),
180
+ onClick: () => E?.(e),
181
+ onKeyDown: (t) => {
182
+ E && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), E(e));
183
+ },
184
+ children: /* @__PURE__ */ _("dl", {
185
+ className: "space-y-2",
186
+ children: f.map((t) => /* @__PURE__ */ v("div", {
187
+ className: "flex items-start justify-between gap-3",
188
+ children: [/* @__PURE__ */ _("dt", {
189
+ className: "text-xs font-medium text-text-secondary shrink-0",
190
+ children: t.header
191
+ }), /* @__PURE__ */ _("dd", {
192
+ className: "text-sm text-right min-w-0",
193
+ children: Z(e, t)
194
+ })]
195
+ }, t.id))
196
+ })
197
+ }, n);
198
+ })
199
+ }),
200
+ xe && /* @__PURE__ */ v("div", {
201
+ className: "flex flex-wrap items-center justify-between gap-3",
202
+ children: [/* @__PURE__ */ v("div", {
203
+ className: "flex flex-wrap items-center gap-2 text-sm text-text-secondary",
204
+ children: [
205
+ P ? /* @__PURE__ */ v("span", { children: [
206
+ "Showing ",
207
+ K.length === 0 ? 0 : F * W + 1,
208
+ " to",
209
+ " ",
210
+ F * W + K.length,
211
+ Y ? ` of ${N}` : ""
212
+ ] }) : /* @__PURE__ */ v("span", { children: [
213
+ "Showing ",
214
+ (V - 1) * U + 1,
215
+ " to",
216
+ " ",
217
+ Math.min(V * U, K.length),
218
+ " of ",
219
+ K.length
220
+ ] }),
221
+ /* @__PURE__ */ v(te, {
222
+ value: String(W),
223
+ onValueChange: (e) => {
224
+ let t = Number(e);
225
+ P ? he?.(t) : (ve(t), H(1));
226
+ },
227
+ children: [/* @__PURE__ */ _(ee, {
228
+ className: "w-[70px] h-8",
229
+ children: /* @__PURE__ */ _(ne, {})
230
+ }), /* @__PURE__ */ _(n, { children: ue.map((e) => /* @__PURE__ */ _(a, {
231
+ value: String(e),
232
+ children: e
233
+ }, e)) })]
234
+ }),
235
+ /* @__PURE__ */ _("span", { children: "per page" })
236
+ ]
237
+ }), P ? /* @__PURE__ */ v("div", {
238
+ className: "flex items-center gap-1",
239
+ children: [
240
+ /* @__PURE__ */ _(d, {
241
+ variant: "outline",
242
+ size: "icon",
243
+ className: "h-8 w-8",
244
+ "aria-label": "First page",
245
+ onClick: () => M?.(0),
246
+ disabled: F === 0,
247
+ children: /* @__PURE__ */ _(b, { className: "h-4 w-4" })
248
+ }),
249
+ /* @__PURE__ */ _(d, {
250
+ variant: "outline",
251
+ size: "icon",
252
+ className: "h-8 w-8",
253
+ "aria-label": "Previous page",
254
+ onClick: () => M?.(Math.max(0, F - 1)),
255
+ disabled: F === 0,
256
+ children: /* @__PURE__ */ _(p, { className: "h-4 w-4" })
257
+ }),
258
+ /* @__PURE__ */ v("span", {
259
+ className: "px-3 text-sm",
260
+ children: [
261
+ "Page ",
262
+ F + 1,
263
+ Y ? ` of ${X}` : ""
264
+ ]
265
+ }),
266
+ /* @__PURE__ */ _(d, {
267
+ variant: "outline",
268
+ size: "icon",
269
+ className: "h-8 w-8",
270
+ "aria-label": "Next page",
271
+ onClick: () => M?.(F + 1),
272
+ disabled: Y ? F + 1 >= (X ?? 1) : !ge,
273
+ children: /* @__PURE__ */ _(m, { className: "h-4 w-4" })
274
+ }),
275
+ Y && /* @__PURE__ */ _(d, {
276
+ variant: "outline",
277
+ size: "icon",
278
+ className: "h-8 w-8",
279
+ "aria-label": "Last page",
280
+ onClick: () => M?.((X ?? 1) - 1),
281
+ disabled: F + 1 >= (X ?? 1),
282
+ children: /* @__PURE__ */ _(se, { className: "h-4 w-4" })
283
+ })
284
+ ]
285
+ }) : /* @__PURE__ */ v("div", {
286
+ className: "flex items-center gap-1",
287
+ children: [
288
+ /* @__PURE__ */ _(d, {
289
+ variant: "outline",
290
+ size: "icon",
291
+ className: "h-8 w-8",
292
+ "aria-label": "First page",
293
+ onClick: () => H(1),
294
+ disabled: V === 1,
295
+ children: /* @__PURE__ */ _(b, { className: "h-4 w-4" })
296
+ }),
297
+ /* @__PURE__ */ _(d, {
298
+ variant: "outline",
299
+ size: "icon",
300
+ className: "h-8 w-8",
301
+ "aria-label": "Previous page",
302
+ onClick: () => H((e) => Math.max(1, e - 1)),
303
+ disabled: V === 1,
304
+ children: /* @__PURE__ */ _(p, { className: "h-4 w-4" })
305
+ }),
306
+ /* @__PURE__ */ v("span", {
307
+ className: "px-3 text-sm",
308
+ children: [
309
+ "Page ",
310
+ V,
311
+ " of ",
312
+ J
313
+ ]
314
+ }),
315
+ /* @__PURE__ */ _(d, {
316
+ variant: "outline",
317
+ size: "icon",
318
+ className: "h-8 w-8",
319
+ "aria-label": "Next page",
320
+ onClick: () => H((e) => Math.min(J, e + 1)),
321
+ disabled: V === J,
322
+ children: /* @__PURE__ */ _(m, { className: "h-4 w-4" })
323
+ }),
324
+ /* @__PURE__ */ _(d, {
325
+ variant: "outline",
326
+ size: "icon",
327
+ className: "h-8 w-8",
328
+ "aria-label": "Last page",
329
+ onClick: () => H(J),
330
+ disabled: V === J,
331
+ children: /* @__PURE__ */ _(se, { className: "h-4 w-4" })
332
+ })
333
+ ]
334
+ })]
335
+ })
336
+ ]
337
+ });
338
+ }
339
+ //#endregion
340
+ export { x as t };
@@ -0,0 +1,169 @@
1
+ import { at as e, d as t, f as n, g as r, h as i, st as a, u as o, ut as s } from "./PageLayout-BniRJaQ6.js";
2
+ import { t as c } from "./download-DP04iWTd.js";
3
+ import { t as l } from "./file-text-BuDx4hZp.js";
4
+ import { t as u } from "./upload-DanJY1Vo.js";
5
+ import { r as d } from "./formatters-FWJDwTFv.js";
6
+ import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
7
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
8
+ //#region node_modules/lucide-react/dist/esm/icons/external-link.js
9
+ var v = s("ExternalLink", [
10
+ ["path", {
11
+ d: "M15 3h6v6",
12
+ key: "1q9fwt"
13
+ }],
14
+ ["path", {
15
+ d: "M10 14 21 3",
16
+ key: "gplh6r"
17
+ }],
18
+ ["path", {
19
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
20
+ key: "a6xqqp"
21
+ }]
22
+ ]), y = "\n query ListEntityDocuments($filter: FileFilterInput, $pagination: PaginationInput) {\n files(filter: $filter, pagination: $pagination) {\n id\n name\n size\n mimeType\n createdAt\n downloadUrl\n }\n }\n";
23
+ function b(e) {
24
+ return {
25
+ id: e.id,
26
+ name: e.name,
27
+ size: e.size == null ? 0 : Number(e.size),
28
+ mimeType: e.mimeType,
29
+ createdAt: new Date(e.createdAt),
30
+ downloadUrl: e.downloadUrl ?? void 0
31
+ };
32
+ }
33
+ function x(t, n) {
34
+ let { apiGatewayUrl: r, authToken: i, workspaceToken: o, workspaceId: s, tenantId: c, currentUser: l } = a(), [u, d] = h([]), [g, _] = h(!1), [v, x] = h(null), S = m(() => ({
35
+ apiGatewayUrl: r,
36
+ authToken: i,
37
+ workspaceToken: o,
38
+ workspaceId: s,
39
+ tenantId: c,
40
+ actorId: l?.id
41
+ }), [
42
+ r,
43
+ i,
44
+ o,
45
+ s,
46
+ c,
47
+ l?.id
48
+ ]), C = f(async () => {
49
+ if (!n) {
50
+ d([]);
51
+ return;
52
+ }
53
+ _(!0), x(null);
54
+ try {
55
+ d(((await e(S, y, {
56
+ filter: { tags: [{
57
+ key: "mtwEntityType",
58
+ value: t
59
+ }, {
60
+ key: "mtwEntityId",
61
+ value: n
62
+ }] },
63
+ pagination: {
64
+ limit: 50,
65
+ offset: 0
66
+ }
67
+ })).files ?? []).map(b));
68
+ } catch (e) {
69
+ x(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load documents")), d([]);
70
+ } finally {
71
+ _(!1);
72
+ }
73
+ }, [
74
+ n,
75
+ t,
76
+ S
77
+ ]);
78
+ return p(() => {
79
+ C();
80
+ }, [C]), {
81
+ documents: u,
82
+ isLoading: g,
83
+ error: v,
84
+ refetch: f(() => {
85
+ C();
86
+ }, [C])
87
+ };
88
+ }
89
+ //#endregion
90
+ //#region src/movethewheels/components/DocumentsCard.tsx
91
+ function S(e) {
92
+ if (!Number.isFinite(e) || e <= 0) return "—";
93
+ let t = [
94
+ "B",
95
+ "KB",
96
+ "MB",
97
+ "GB"
98
+ ], n = e, r = 0;
99
+ for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
100
+ return `${n.toFixed(n >= 10 || r === 0 ? 0 : 1)} ${t[r]}`;
101
+ }
102
+ function C({ entityType: e, entityId: s }) {
103
+ let { navigate: f } = a(), { documents: p, isLoading: m } = x(e, s), h = () => f("/files/browse");
104
+ return /* @__PURE__ */ _(t, { children: [/* @__PURE__ */ _(i, {
105
+ className: "flex flex-row items-center justify-between",
106
+ children: [/* @__PURE__ */ _(r, {
107
+ className: "flex items-center gap-2",
108
+ children: [/* @__PURE__ */ g(l, { size: 18 }), " Documents"]
109
+ }), /* @__PURE__ */ _(o, {
110
+ variant: "outline",
111
+ size: "sm",
112
+ onClick: h,
113
+ children: [/* @__PURE__ */ g(u, { size: 14 }), " Add / Manage"]
114
+ })]
115
+ }), /* @__PURE__ */ g(n, { children: m ? /* @__PURE__ */ g("p", {
116
+ className: "text-text-secondary text-center py-4",
117
+ children: "Loading documents…"
118
+ }) : p.length > 0 ? /* @__PURE__ */ g("div", {
119
+ className: "space-y-3",
120
+ children: p.map((e) => /* @__PURE__ */ _("div", {
121
+ className: "flex items-center justify-between gap-3 p-3 border rounded-lg",
122
+ children: [/* @__PURE__ */ _("div", {
123
+ className: "min-w-0",
124
+ children: [/* @__PURE__ */ g("p", {
125
+ className: "font-medium truncate",
126
+ children: e.name
127
+ }), /* @__PURE__ */ _("p", {
128
+ className: "text-sm text-text-secondary",
129
+ children: [
130
+ S(e.size),
131
+ " · ",
132
+ d(e.createdAt, "relative")
133
+ ]
134
+ })]
135
+ }), e.downloadUrl ? /* @__PURE__ */ _("a", {
136
+ href: e.downloadUrl,
137
+ target: "_blank",
138
+ rel: "noopener noreferrer",
139
+ className: "shrink-0 inline-flex items-center gap-1 text-sm text-primary hover:underline",
140
+ children: [/* @__PURE__ */ g(c, { size: 14 }), " Open"]
141
+ }) : /* @__PURE__ */ _(o, {
142
+ variant: "ghost",
143
+ size: "sm",
144
+ onClick: h,
145
+ children: [/* @__PURE__ */ g(v, { size: 14 }), " View"]
146
+ })]
147
+ }, e.id))
148
+ }) : /* @__PURE__ */ _("div", {
149
+ className: "text-center py-6",
150
+ children: [
151
+ /* @__PURE__ */ g(l, {
152
+ size: 32,
153
+ className: "mx-auto mb-2 text-text-secondary opacity-50"
154
+ }),
155
+ /* @__PURE__ */ g("p", {
156
+ className: "text-text-secondary",
157
+ children: "No documents yet"
158
+ }),
159
+ /* @__PURE__ */ g("button", {
160
+ type: "button",
161
+ onClick: h,
162
+ className: "mt-1 text-sm text-primary hover:underline",
163
+ children: "Add them in Files"
164
+ })
165
+ ]
166
+ }) })] });
167
+ }
168
+ //#endregion
169
+ export { x as n, C as t };